mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 15:55:18 +00:00
convert neuron token to a0gi
This commit is contained in:
parent
71cfc353cf
commit
2aa30b19b3
@ -166,13 +166,15 @@ func NewVoteCmd() *cobra.Command {
|
|||||||
var tokens sdkmath.Int
|
var tokens sdkmath.Int
|
||||||
for _, val := range rsp.Hist.Valset {
|
for _, val := range rsp.Hist.Valset {
|
||||||
thisValAddr := val.GetOperator()
|
thisValAddr := val.GetOperator()
|
||||||
|
|
||||||
if thisValAddr.Equals(valAddr) {
|
if thisValAddr.Equals(valAddr) {
|
||||||
tokens = val.GetTokens()
|
tokens = val.GetTokens()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// the denom of token is neuron, need to convert to A0GI
|
||||||
|
a0gi := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000))
|
||||||
// 1_000 0AGI token / vote
|
// 1_000 0AGI token / vote
|
||||||
numBallots := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(sdk.NewInt(1_000)).Uint64()
|
numBallots := a0gi.Quo(sdk.NewInt(1_000)).Uint64()
|
||||||
ballots := make([]*types.Ballot, numBallots)
|
ballots := make([]*types.Ballot, numBallots)
|
||||||
for i := range ballots {
|
for i := range ballots {
|
||||||
ballotID := uint64(i)
|
ballotID := uint64(i)
|
||||||
|
Loading…
Reference in New Issue
Block a user