Skip to content

Commit

Permalink
PR5430 - cosmos/cosmos-sdk#5430 - Coins -> ...Coin
Browse files Browse the repository at this point in the history
  • Loading branch information
Codegnosis committed Jan 27, 2020
1 parent fcfe634 commit 8a489d9
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/undcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func GetAccountWithLockedCmd(cdc *codec.Codec) *cobra.Command {
entUnd := undtypes.NewEnterpriseUnd()

entUnd.Locked = lockedUnd.Amount
entUnd.Available = acc.GetCoins().Add(sdk.NewCoins(lockedUnd.Amount))
entUnd.Available = acc.GetCoins().Add(lockedUnd.Amount)

accountWithLocked.Account = acc
accountWithLocked.Enterprise = entUnd
Expand Down
2 changes: 1 addition & 1 deletion simapp/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (app *UndSimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []
// donate any unwithdrawn outstanding reward fraction tokens to the community pool
scraps := app.DistrKeeper.GetValidatorOutstandingRewards(ctx, val.GetOperator())
feePool := app.DistrKeeper.GetFeePool(ctx)
feePool.CommunityPool = feePool.CommunityPool.Add(scraps)
feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
app.DistrKeeper.SetFeePool(ctx, feePool)

app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
Expand Down
2 changes: 1 addition & 1 deletion simapp/genesis_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestSimGenesisAccountValidate(t *testing.T) {
"valid basic account with invalid original vesting coins",
simapp.SimGenesisAccount{
BaseAccount: baseAcc,
OriginalVesting: coins.Add(coins),
OriginalVesting: coins.Add(coins...),
StartTime: vestingStart.Unix(),
EndTime: vestingStart.Add(1 * time.Hour).Unix(),
},
Expand Down
4 changes: 2 additions & 2 deletions simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func SetupUnitTestApp(isCheckTx bool, genAccs int, amt int64, testDenom string)
initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt))
totalSupply := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt.MulRaw(int64(len(testAccs)))))
prevSupply := app.SupplyKeeper.GetSupply(ctx)
app.SupplyKeeper.SetSupply(ctx, supply.NewSupply(prevSupply.GetTotal().Add(totalSupply)))
app.SupplyKeeper.SetSupply(ctx, supply.NewSupply(prevSupply.GetTotal().Add(totalSupply...)))

app.BeaconKeeper.SetHighestBeaconID(ctx, 1)
beaconParams := app.BeaconKeeper.GetParams(ctx)
Expand Down Expand Up @@ -153,7 +153,7 @@ func AddTestAddrs(app *UndSimApp, ctx sdk.Context, accNum int, accAmt sdk.Int) [
initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt))
totalSupply := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt.MulRaw(int64(len(testAddrs)))))
prevSupply := app.SupplyKeeper.GetSupply(ctx)
app.SupplyKeeper.SetSupply(ctx, supply.NewSupply(prevSupply.GetTotal().Add(totalSupply)))
app.SupplyKeeper.SetSupply(ctx, supply.NewSupply(prevSupply.GetTotal().Add(totalSupply...)))

// fill all the addresses with some coins, set the loose pool tokens simultaneously
for _, addr := range testAddrs {
Expand Down
4 changes: 2 additions & 2 deletions x/beacon/internal/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func checkFeePayerHasFunds(ctx sdk.Context, ak auth.AccountKeeper, ek types.Ente
lockedUndCoins := sdk.NewCoins(lockedUnd)
// include any locked UND in potential coins. We need to do this because if these checks pass,
// the locked UND will be unlocked in the next decorator
potentialCoins = potentialCoins.Add(lockedUndCoins)
potentialCoins = potentialCoins.Add(lockedUndCoins...)

// verify the account has enough funds to pay for fees, including any locked enterprise UND
_, hasNeg := potentialCoins.SafeSub(fees)
Expand All @@ -161,7 +161,7 @@ func checkFeePayerHasFunds(ctx sdk.Context, ak auth.AccountKeeper, ek types.Ente

// include any locked UND in potential coins. We need to do this because if these checks pass,
// the locked UND will be unlocked in the next decorator
potentialSpendableCoins = potentialSpendableCoins.Add(lockedUndCoins)
potentialSpendableCoins = potentialSpendableCoins.Add(lockedUndCoins...)

if _, hasNeg := potentialSpendableCoins.SafeSub(fees); hasNeg {
err := sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds,
Expand Down
2 changes: 1 addition & 1 deletion x/beacon/internal/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func TestCorrectBeaconFeeDecoratorCorrectFeeInsufficientFundsWithLocked(t *testi
}
_ = app.EnterpriseKeeper.SetLockedUndForAccount(ctx, lockedUnd)

withLocked := initCoins.Add(sdk.NewCoins(lockedUnd.Amount))
withLocked := initCoins.Add(lockedUnd.Amount)

feeInt := int64(actualRegFeeAmt)
feeDenom := actualFeeDenom
Expand Down
2 changes: 1 addition & 1 deletion x/enterprise/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func EnterpriseAuthAccountOverride(cliCtx context.CLIContext) http.HandlerFunc {
entUnd := undtypes.NewEnterpriseUnd()

entUnd.Locked = lockedUnd.Amount
entUnd.Available = account.GetCoins().Add(sdk.NewCoins(lockedUnd.Amount))
entUnd.Available = account.GetCoins().Add(lockedUnd.Amount)

accountWithLocked.Account = account
accountWithLocked.Enterprise = entUnd
Expand Down
2 changes: 1 addition & 1 deletion x/enterprise/internal/keeper/locked.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (k Keeper) UnlockCoinsForFees(ctx sdk.Context, feePayer sdk.AccAddress, fee
spendableCoins := feePayerAcc.SpendableCoins(blockTime)

// calculate how much would be available if UND were unlocked
potentiallyAvailable := spendableCoins.Add(lockedUndCoins)
potentiallyAvailable := spendableCoins.Add(lockedUndCoins...)

// is this enough to pay for the fees
_, hasNeg := potentiallyAvailable.SafeSub(feesToPay)
Expand Down
4 changes: 2 additions & 2 deletions x/wrkchain/internal/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func checkFeePayerHasFunds(ctx sdk.Context, ak auth.AccountKeeper, ek types.Ente
lockedUndCoins := sdk.NewCoins(lockedUnd)
// include any locked UND in potential coins. We need to do this because if these checks pass,
// the locked UND will be unlocked in the next decorator
potentialCoins = potentialCoins.Add(lockedUndCoins)
potentialCoins = potentialCoins.Add(lockedUndCoins...)

// verify the account has enough funds to pay for fees, including any locked enterprise UND
_, hasNeg := potentialCoins.SafeSub(fees)
Expand All @@ -161,7 +161,7 @@ func checkFeePayerHasFunds(ctx sdk.Context, ak auth.AccountKeeper, ek types.Ente

// include any locked UND in potential coins. We need to do this because if these checks pass,
// the locked UND will be unlocked in the next decorator
potentialSpendableCoins = potentialSpendableCoins.Add(lockedUndCoins)
potentialSpendableCoins = potentialSpendableCoins.Add(lockedUndCoins...)

if _, hasNeg := potentialSpendableCoins.SafeSub(fees); hasNeg {
err := sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds,
Expand Down
2 changes: 1 addition & 1 deletion x/wrkchain/internal/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func TestCorrectWrkChainFeeDecoratorCorrectFeeInsufficientFundsWithLocked(t *tes
}
_ = app.EnterpriseKeeper.SetLockedUndForAccount(ctx, lockedUnd)

withLocked := initCoins.Add(sdk.NewCoins(lockedUnd.Amount))
withLocked := initCoins.Add(lockedUnd.Amount)

feeInt := int64(actualRegFeeAmt)
feeDenom := actualFeeDenom
Expand Down

0 comments on commit 8a489d9

Please sign in to comment.