refactor(math)!: remove aliases in math (#16040)

Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
Marko
2023-05-07 17:25:59 +00:00
committed by GitHub
co-authored by Julien Robert
parent 06c1a2f3c7
commit 044fe13789
25 changed files with 102 additions and 121 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"testing"
"cosmossdk.io/math"
"github.com/stretchr/testify/require"
clienttx "github.com/cosmos/cosmos-sdk/client/tx"
@@ -25,7 +26,7 @@ var (
msg = testdata.NewTestMsg(tipperAddr, aux2Addr)
memo = "test-memo"
tip = &txtypes.Tip{Tipper: tipperAddr.String(), Amount: sdk.NewCoins(sdk.NewCoin("tip-denom", sdk.NewIntFromUint64(123)))}
tip = &txtypes.Tip{Tipper: tipperAddr.String(), Amount: sdk.NewCoins(sdk.NewCoin("tip-denom", math.NewIntFromUint64(123)))}
chainID = "test-chain"
gas = testdata.NewTestGasLimit()
fee = testdata.NewTestFeeAmount()
+3 -3
View File
@@ -68,7 +68,7 @@ func (bva *BaseVestingAccount) TrackDelegation(balance, vestingCoins, amount sdk
// compute x and y per the specification, where:
// X := min(max(V - DV, 0), D)
// Y := D - X
x := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), math.ZeroInt()), coin.Amount)
x := math.MinInt(math.MaxInt(vestingAmt.Sub(delVestingAmt), math.ZeroInt()), coin.Amount)
y := coin.Amount.Sub(x)
if !x.IsZero() {
@@ -105,8 +105,8 @@ func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins) {
// compute x and y per the specification, where:
// X := min(DF, D)
// Y := min(DV, D - X)
x := sdk.MinInt(delegatedFree, coin.Amount)
y := sdk.MinInt(delegatedVesting, coin.Amount.Sub(x))
x := math.MinInt(delegatedFree, coin.Amount)
y := math.MinInt(delegatedVesting, coin.Amount.Sub(x))
if !x.IsZero() {
xCoin := sdk.NewCoin(coin.Denom, x)