Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New stake pool fields, updated goSDK #176

Merged
merged 11 commits into from
Mar 10, 2022
50 changes: 22 additions & 28 deletions cmd/stakepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ func printStakePoolInfo(info *sdk.StakePoolInfo) {
fmt.Println("going to unlock, total:", info.UnstakeTotal)

fmt.Println("capacity:")
fmt.Println(" free: ", info.Free, "(for current write price)")
fmt.Println(" capacity: ", info.Capacity, "(blobber bid)")
fmt.Println(" write_price:", info.WritePrice, "(blobber write price)")
fmt.Println(" offers_total:", info.OffersTotal, "(total stake committed to offers)")

fmt.Println(" capacity: ", info.Capacity, "(blobber bid)")
fmt.Println(" free: ", info.Free, "(for current write price)")
fmt.Println(" write_price: ", info.WritePrice, "(blobber write price)")
fmt.Println(" offers_total: ", info.OffersTotal, "(total stake committed to offers)")
fmt.Println(" unstake_total: ", info.UnstakeTotal, "(total stake not available for further commitments)")
fmt.Println(" unclaimed rewards:", info.Rewards)
if len(info.Delegate) == 0 {
fmt.Println("delegate_pools: no delegate pools")
} else {
Expand All @@ -30,31 +31,20 @@ func printStakePoolInfo(info *sdk.StakePoolInfo) {
fmt.Println("- id: ", dp.ID)
fmt.Println(" balance: ", dp.Balance)
fmt.Println(" delegate_id: ", dp.DelegateID)
fmt.Println(" rewards: ", dp.Rewards)
fmt.Println(" penalty: ", dp.Penalty)
var gtu string
if dp.Unstake {
gtu = "<unstaking>"
} else {
gtu = "<not going>"
}

fmt.Println(" going to unlock at:", gtu)
fmt.Println(" unclaimed reward: ", dp.Rewards)
fmt.Println(" total_reward: ", dp.TotalReward)
fmt.Println(" total_penalty: ", dp.TotalPenalty)
fmt.Println(" status: ", dp.Status)
fmt.Println(" round_created: ", dp.RoundCreated)
fmt.Println(" unstake: ", dp.UnStake)
}
}
fmt.Println("penalty: ", info.Penalty, "(total blobber penalty for all time)")

fmt.Println("rewards:")
fmt.Println(" charge: ", info.Rewards.Charge, "(for all time)")
fmt.Println(" blobber: ", info.Rewards.Blobber, "(for all time)")
fmt.Println(" validator:", info.Rewards.Validator, "(for all time)")

// settings
fmt.Println("settings:")
fmt.Println(" delegate_wallet:", info.Settings.DelegateWallet)
fmt.Println(" min_stake: ", info.Settings.MinStake.String())
fmt.Println(" max_stake: ", info.Settings.MaxStake.String())
fmt.Println(" num_delegates: ", info.Settings.NumDelegates)
fmt.Println(" delegate_wallet: ", info.Settings.DelegateWallet)
fmt.Println(" min_stake: ", info.Settings.MinStake.String())
fmt.Println(" max_stake: ", info.Settings.MaxStake.String())
fmt.Println(" num_delegates: ", info.Settings.NumDelegates)
}

func printStakePoolUserInfo(info *sdk.StakePoolUserInfo) {
Expand All @@ -68,8 +58,12 @@ func printStakePoolUserInfo(info *sdk.StakePoolUserInfo) {
fmt.Println(" - id: ", dp.ID)
fmt.Println(" balance: ", dp.Balance)
fmt.Println(" delegate_id: ", dp.DelegateID)
fmt.Println(" rewards: ", dp.Rewards)
fmt.Println(" penalty: ", dp.Penalty)
fmt.Println(" unclaimed reward: ", dp.Rewards)
fmt.Println(" total rewards: ", dp.TotalReward)
fmt.Println(" total penalty: ", dp.TotalPenalty)
fmt.Println(" status: ", dp.Status)
fmt.Println(" round_created: ", dp.RoundCreated)
fmt.Println(" unstake: ", dp.UnStake)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.17

require (
github.com/0chain/errors v1.0.3
github.com/0chain/gosdk v1.7.3-0.20220308002456-3390ff10619d
github.com/0chain/gosdk v1.7.3-0.20220310100436-899687c15d5a
github.com/icza/bitio v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/cobra v1.1.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ github.com/0chain/errors v1.0.3 h1:QQZPFxTfnMcRdt32DXbzRQIfGWmBsKoEdszKQDb0rRM=
github.com/0chain/errors v1.0.3/go.mod h1:xymD6nVgrbgttWwkpSCfLLEJbFO6iHGQwk/yeSuYkIc=
github.com/0chain/gosdk v1.7.3-0.20220308002456-3390ff10619d h1:zBXe8BLkL1qXuzs591YGXl32nXTtlbWCd93gMqhikQM=
github.com/0chain/gosdk v1.7.3-0.20220308002456-3390ff10619d/go.mod h1:JF2dfUrSfIGK599LuUn7BgqQAj7oJPw+CE5GVSr/qEE=
github.com/0chain/gosdk v1.7.3-0.20220309114437-837c362699e3 h1:A9OkjmxqAb5vgtXYRTt4Z3bby0hBGBHzhKbXdBzxwKU=
github.com/0chain/gosdk v1.7.3-0.20220309114437-837c362699e3/go.mod h1:JF2dfUrSfIGK599LuUn7BgqQAj7oJPw+CE5GVSr/qEE=
github.com/0chain/gosdk v1.7.3-0.20220310100436-899687c15d5a h1:pw6OGtHYoMd/xz1aLWHKPOBFsXqC0tZntpAzQBnZkd4=
github.com/0chain/gosdk v1.7.3-0.20220310100436-899687c15d5a/go.mod h1:JF2dfUrSfIGK599LuUn7BgqQAj7oJPw+CE5GVSr/qEE=
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc=
github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4=
Expand Down