From 2aa30b19b307456ae37cd3526cff853a3811e112 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Thu, 25 Apr 2024 22:05:43 +0800 Subject: [PATCH] convert neuron token to a0gi --- x/council/v1/client/cli/tx.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x/council/v1/client/cli/tx.go b/x/council/v1/client/cli/tx.go index 627e12a7..31f12d0e 100644 --- a/x/council/v1/client/cli/tx.go +++ b/x/council/v1/client/cli/tx.go @@ -166,13 +166,15 @@ func NewVoteCmd() *cobra.Command { var tokens sdkmath.Int for _, val := range rsp.Hist.Valset { thisValAddr := val.GetOperator() + if thisValAddr.Equals(valAddr) { 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 - 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) for i := range ballots { ballotID := uint64(i)