-
Notifications
You must be signed in to change notification settings - Fork 112
/
status.go
48 lines (40 loc) · 1.35 KB
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package auction
import (
"fmt"
"github.com/rocket-pool/rocketpool-go/utils/eth"
"github.com/urfave/cli"
"github.com/rocket-pool/smartnode/shared/services/rocketpool"
"github.com/rocket-pool/smartnode/shared/utils/math"
)
func getStatus(c *cli.Context) error {
// Get RP client
rp, err := rocketpool.NewClientFromCtx(c).WithReady()
if err != nil {
return err
}
defer rp.Close()
// Get auction status
status, err := rp.AuctionStatus()
if err != nil {
return err
}
// Print & return
fmt.Printf(
"A total of %.6f RPL is up for auction, with %.6f RPL currently allotted and %.6f RPL remaining.\n",
math.RoundDown(eth.WeiToEth(status.TotalRPLBalance), 6),
math.RoundDown(eth.WeiToEth(status.AllottedRPLBalance), 6),
math.RoundDown(eth.WeiToEth(status.RemainingRPLBalance), 6))
if status.LotCounts.ClaimAvailable > 0 {
fmt.Printf("%d lot(s) you have bid on have RPL available to claim!\n", status.LotCounts.ClaimAvailable)
}
if status.LotCounts.BiddingAvailable > 0 {
fmt.Printf("%d lot(s) are open for bidding!\n", status.LotCounts.BiddingAvailable)
}
if status.LotCounts.RPLRecoveryAvailable > 0 {
fmt.Printf("%d cleared lot(s) have unclaimed RPL ready to recover!\n", status.LotCounts.RPLRecoveryAvailable)
}
if status.CanCreateLot {
fmt.Println("A new lot can be created with remaining RPL in the auction contract.")
}
return nil
}