mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
3375484f79
* Use cosmossdk.io/errors for deprecated error methods * Update error registration with cosmossdk.io/errors * Use cosmossdk.io/math for deprecated sdk.Int alias * Fix modified proto file * Update sdk.Int usage in swap hooks * Update e2e test deprecated method usage
42 lines
1.5 KiB
Go
42 lines
1.5 KiB
Go
package keeper_test
|
|
|
|
import (
|
|
sdkmath "cosmossdk.io/math"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/kava-labs/kava/x/kavadist/keeper"
|
|
"github.com/kava-labs/kava/x/kavadist/types"
|
|
)
|
|
|
|
func (suite *keeperTestSuite) TestHandleCommunityPoolMultiSpendProposal() {
|
|
addr, distrKeeper, ctx := suite.Addrs[0], suite.App.GetDistrKeeper(), suite.Ctx
|
|
initBalances := suite.BankKeeper.GetAllBalances(ctx, addr)
|
|
|
|
// add coins to the module account and fund fee pool
|
|
macc := distrKeeper.GetDistributionAccount(ctx)
|
|
fundAmount := sdk.NewCoins(sdk.NewInt64Coin("ukava", 1000000))
|
|
suite.Require().NoError(suite.App.FundModuleAccount(ctx, macc.GetName(), fundAmount))
|
|
feePool := distrKeeper.GetFeePool(ctx)
|
|
feePool.CommunityPool = sdk.NewDecCoinsFromCoins(fundAmount...)
|
|
distrKeeper.SetFeePool(ctx, feePool)
|
|
|
|
proposalAmount1 := int64(1100)
|
|
proposalAmount2 := int64(1200)
|
|
proposal := types.NewCommunityPoolMultiSpendProposal("test title", "description", []types.MultiSpendRecipient{
|
|
{
|
|
Address: addr.String(),
|
|
Amount: sdk.NewCoins(sdk.NewInt64Coin("ukava", proposalAmount1)),
|
|
},
|
|
{
|
|
Address: addr.String(),
|
|
Amount: sdk.NewCoins(sdk.NewInt64Coin("ukava", proposalAmount2)),
|
|
},
|
|
})
|
|
err := keeper.HandleCommunityPoolMultiSpendProposal(ctx, suite.Keeper, proposal)
|
|
suite.Require().Nil(err)
|
|
|
|
balances := suite.BankKeeper.GetAllBalances(ctx, addr)
|
|
expected := initBalances.AmountOf("ukava").Add(sdkmath.NewInt(proposalAmount1 + proposalAmount2))
|
|
suite.Require().Equal(expected, balances.AmountOf("ukava"))
|
|
}
|