diff --git a/x/coinswap/simulation/operation.go b/x/coinswap/simulation/operation.go index eae7be98..40f86efa 100644 --- a/x/coinswap/simulation/operation.go +++ b/x/coinswap/simulation/operation.go @@ -114,6 +114,14 @@ func SimulateMsgAddLiquidity(k keeper.Keeper, ak types.AccountKeeper, bk types.B "standardAmount should be positive", ), nil, nil } + params := k.GetParams(ctx) + if exactStandardAmt.GTE(params.MaxStandardCoinPerPool) { + return simtypes.NoOpMsg( + types.ModuleName, + TypeMsgAddLiquidity, + "standardAmount should be less than MaxStandardCoinPerPool", + ), nil, nil + } maxToken, err = randToken(r, spendable) if err != nil { @@ -148,6 +156,25 @@ func SimulateMsgAddLiquidity(k keeper.Keeper, ak types.AccountKeeper, bk types.B ), nil, err } + // check maxToken is registered in MaxSwapAmount + found := func(denom string) bool { + MaxSwapAmount := params.MaxSwapAmount + for _, coin := range MaxSwapAmount { + if coin.Denom == denom { + return true + } + } + return false + }(maxToken.Denom) + + if !found { + return simtypes.NoOpMsg( + types.ModuleName, + TypeMsgAddLiquidity, + "maxToken is not registered in MaxSwapAmount", + ), nil, err + } + poolID := types.GetPoolId(maxToken.Denom) pool, has := k.GetPool(ctx, poolID) if !has {