Skip to content

Commit

Permalink
Merge pull request #1 from oasysgames/feat/show-slash
Browse files Browse the repository at this point in the history
infoコマンドでslashも確認できるよにした
  • Loading branch information
tak1827 authored Jul 24, 2023
2 parents a6d418b + 4be0f8e commit f5ba5cf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.vscode
.env*
.go-version
.go-version
oaspos
6 changes: 6 additions & 0 deletions cmd/validator/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ func doInfo(ec *ethclient.Client, validator common.Address) {
utils.Fatal(err)
}

slashes, err := stakemanager.GetBlockAndSlashes(callOpts, validator, currentEpoch)
if err != nil {
utils.Fatal(err)
}

status := "active"
if !currentInfo.Active {
status = "inactive"
Expand All @@ -97,6 +102,7 @@ func doInfo(ec *ethclient.Client, validator common.Address) {
fmt.Printf("%s : %s\n", rightPad("Commissions"), utils.FormatWei(commissions))
fmt.Printf("%s : %s\n", rightPad("Current Epoch Staking"), utils.FormatWei(currentInfo.Stakes))
fmt.Printf("%s : %s\n", rightPad("Next Epoch Staking"), utils.FormatWei(nextInfo.Stakes))
fmt.Printf("%s : %s\n", rightPad("Slash"), slashes.Slashes.String())
}

func rightPad(s string) string {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.17

require (
github.com/ethereum/go-ethereum v1.10.17
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/cobra v1.4.0
)

Expand All @@ -18,7 +19,6 @@ require (
github.com/gorilla/websocket v1.4.2 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
go get && go build -o oaspos

0 comments on commit f5ba5cf

Please sign in to comment.