recv both cosmos denom and evm denom from bank keeper

This commit is contained in:
Solovyov1796 2024-05-05 14:17:37 +08:00 committed by 0g-wh
parent 6609ea5293
commit a4486a680e

View File

@ -52,9 +52,17 @@ func (k EvmBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom st
}
spendableCoins := k.bk.SpendableCoins(ctx, addr)
ua0gi := spendableCoins.AmountOf(CosmosDenom)
neuron := k.neuronKeeper.GetBalance(ctx, addr)
total := ua0gi.Mul(ConversionMultiplier).Add(neuron)
cosmosDenomFromBank := spendableCoins.AmountOf(CosmosDenom)
evmDenomFromBank := spendableCoins.AmountOf(EvmDenom)
evmDenomFromEvmBank := k.neuronKeeper.GetBalance(ctx, addr)
var total sdkmath.Int
if cosmosDenomFromBank.IsPositive() {
total = cosmosDenomFromBank.Mul(ConversionMultiplier).Add(evmDenomFromBank).Add(evmDenomFromEvmBank)
} else {
total = evmDenomFromBank.Add(evmDenomFromEvmBank)
}
return sdk.NewCoin(EvmDenom, total)
}