mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
recv both cosmos denom and evm denom from bank keeper
This commit is contained in:
parent
adb09a7c82
commit
521f558f5d
@ -52,9 +52,17 @@ func (k EvmBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom st
|
|||||||
}
|
}
|
||||||
|
|
||||||
spendableCoins := k.bk.SpendableCoins(ctx, addr)
|
spendableCoins := k.bk.SpendableCoins(ctx, addr)
|
||||||
ua0gi := spendableCoins.AmountOf(CosmosDenom)
|
cosmosDenomFromBank := spendableCoins.AmountOf(CosmosDenom)
|
||||||
neuron := k.neuronKeeper.GetBalance(ctx, addr)
|
evmDenomFromBank := spendableCoins.AmountOf(EvmDenom)
|
||||||
total := ua0gi.Mul(ConversionMultiplier).Add(neuron)
|
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)
|
return sdk.NewCoin(EvmDenom, total)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user