From d54acc4a4d246d2c785d989f4c57952c69dc31d6 Mon Sep 17 00:00:00 2001 From: jelysn <129082781+jelysn@users.noreply.github.com> Date: Sat, 6 Apr 2024 07:03:06 +0800 Subject: [PATCH] Halborn fixes (#447) * HAL-02 pool creation fee * add migration script for amm module params * HAL-19 - add SlippageTrackDuration on amm params * update error handling * resolve incentive unit test --------- Co-authored-by: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> --- app/app.go | 2 - docs/static/openapi.yml | 11 + proto/elys/amm/params.proto | 6 +- proto/elys/amm/tx.proto | 9 +- testutil/keeper/amm.go | 9 - x/amm/keeper/abci.go | 3 +- x/amm/keeper/abci_test.go | 1 - x/amm/keeper/keeper.go | 8 - x/amm/keeper/msg_server_create_pool.go | 12 + x/amm/keeper/msg_server_create_pool_test.go | 6 +- x/amm/keeper/msg_server_exit_pool_test.go | 8 +- ...server_feed_multiple_external_liquidity.go | 5 +- x/amm/keeper/msg_server_update_params.go | 21 + x/amm/keeper/msg_server_update_pool_params.go | 9 +- .../msg_server_update_pool_params_test.go | 9 +- x/amm/keeper/params.go | 25 +- x/amm/keeper/params_test.go | 1 - x/amm/migrations/v4_migration.go | 11 + x/amm/module.go | 4 +- x/amm/simulation/update_pool_params.go | 2 +- x/amm/types/codec.go | 3 +- x/amm/types/keys.go | 3 + x/amm/types/message_update_params.go | 48 ++ x/amm/types/message_update_pool_params.go | 10 +- .../types/message_update_pool_params_test.go | 4 +- x/amm/types/params.go | 52 +- x/amm/types/params.pb.go | 95 ++- x/amm/types/tx.pb.go | 570 +++++++++++++++--- x/incentive/keeper/keeper_lps_test.go | 9 +- x/incentive/keeper/params_test.go | 9 +- x/incentive/keeper/pool_apr_test.go | 9 +- x/leveragelp/keeper/begin_blocker.go | 1 - 32 files changed, 741 insertions(+), 234 deletions(-) create mode 100644 x/amm/keeper/msg_server_update_params.go create mode 100644 x/amm/migrations/v4_migration.go create mode 100644 x/amm/types/message_update_params.go diff --git a/app/app.go b/app/app.go index 3b2d6fc8c..2090fabf4 100644 --- a/app/app.go +++ b/app/app.go @@ -745,7 +745,6 @@ func NewElysApp( appCodec, keys[ammmoduletypes.StoreKey], tkeys[ammmoduletypes.TStoreKey], - app.GetSubspace(ammmoduletypes.ModuleName), authtypes.NewModuleAddress(govtypes.ModuleName).String(), &app.ParameterKeeper, app.BankKeeper, @@ -1499,7 +1498,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(commitmentmoduletypes.ModuleName) paramsKeeper.Subspace(tokenomicsmoduletypes.ModuleName) paramsKeeper.Subspace(burnermoduletypes.ModuleName) - paramsKeeper.Subspace(ammmoduletypes.ModuleName) paramsKeeper.Subspace(perpetualmoduletypes.ModuleName) paramsKeeper.Subspace(transferhooktypes.ModuleName) paramsKeeper.Subspace(clockmoduletypes.ModuleName) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 8a6ba7543..699e088ac 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -37947,7 +37947,10 @@ paths: properties: pool_creation_fee: type: string + slippage_track_duration: + type: string format: uint64 + title: 'default 1 week: 604,800' description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -82967,6 +82970,8 @@ definitions: type: string recipient: type: string + elys.amm.MsgUpdateParamsResponse: + type: object elys.amm.MsgUpdatePoolParamsResponse: type: object properties: @@ -83023,7 +83028,10 @@ definitions: properties: pool_creation_fee: type: string + slippage_track_duration: + type: string format: uint64 + title: 'default 1 week: 604,800' description: Params defines the parameters for the module. elys.amm.Pool: type: object @@ -83462,7 +83470,10 @@ definitions: properties: pool_creation_fee: type: string + slippage_track_duration: + type: string format: uint64 + title: 'default 1 week: 604,800' description: QueryParamsResponse is response type for the Query/Params RPC method. elys.amm.QuerySlippageTrackAllResponse: type: object diff --git a/proto/elys/amm/params.proto b/proto/elys/amm/params.proto index 7922ce03d..dc2a8d19f 100644 --- a/proto/elys/amm/params.proto +++ b/proto/elys/amm/params.proto @@ -9,5 +9,9 @@ option go_package = "github.com/elys-network/elys/x/amm/types"; message Params { option (gogoproto.goproto_stringer) = false; - uint64 pool_creation_fee = 1; + string pool_creation_fee = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + uint64 slippage_track_duration = 2; // default 1 week: 604,800 } diff --git a/proto/elys/amm/tx.proto b/proto/elys/amm/tx.proto index f453ad57d..d7b756d56 100644 --- a/proto/elys/amm/tx.proto +++ b/proto/elys/amm/tx.proto @@ -21,6 +21,7 @@ service Msg { rpc SwapByDenom (MsgSwapByDenom ) returns (MsgSwapByDenomResponse ); rpc FeedMultipleExternalLiquidity (MsgFeedMultipleExternalLiquidity) returns (MsgFeedMultipleExternalLiquidityResponse); rpc UpdatePoolParams (MsgUpdatePoolParams ) returns (MsgUpdatePoolParamsResponse ); + rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); } message MsgCreatePool { string sender = 1; @@ -129,7 +130,7 @@ message MsgSwapByDenomResponse { } message MsgUpdatePoolParams { - string sender = 1; + string authority = 1; uint64 pool_id = 2; PoolParams pool_params = 3; } @@ -139,3 +140,9 @@ message MsgUpdatePoolParamsResponse { PoolParams pool_params = 2; } +message MsgUpdateParams { + string authority = 1; + Params params = 2; +} + +message MsgUpdateParamsResponse {} diff --git a/testutil/keeper/amm.go b/testutil/keeper/amm.go index e639cdd49..36a97b211 100644 --- a/testutil/keeper/amm.go +++ b/testutil/keeper/amm.go @@ -13,7 +13,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/elys-network/elys/x/amm/keeper" "github.com/elys-network/elys/x/amm/types" "github.com/elys-network/elys/x/amm/types/mocks" @@ -33,13 +32,6 @@ func AmmKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, *mocks.AccountedPoolK registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - transientStoreKey, - "AmmParams", - ) - accountedPoolKeeper := mocks.NewAccountedPoolKeeper(t) oracleKeeper := mocks.NewOracleKeeper(t) @@ -47,7 +39,6 @@ func AmmKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, *mocks.AccountedPoolK cdc, storeKey, transientStoreKey, - paramsSubspace, authtypes.NewModuleAddress(govtypes.ModuleName).String(), nil, nil, diff --git a/x/amm/keeper/abci.go b/x/amm/keeper/abci.go index b2d3c4f42..513a711b5 100644 --- a/x/amm/keeper/abci.go +++ b/x/amm/keeper/abci.go @@ -172,9 +172,10 @@ func (k Keeper) ExecuteSwapRequests(ctx sdk.Context) []sdk.Msg { } func (k Keeper) ClearOutdatedSlippageTrack(ctx sdk.Context) { + params := k.GetParams(ctx) tracks := k.AllSlippageTracks(ctx) for _, track := range tracks { - if track.Timestamp+86400*7 < uint64(ctx.BlockTime().Unix()) { + if track.Timestamp+params.SlippageTrackDuration < uint64(ctx.BlockTime().Unix()) { k.DeleteSlippageTrack(ctx, track) } } diff --git a/x/amm/keeper/abci_test.go b/x/amm/keeper/abci_test.go index 2e766ddf5..4af00a9f9 100644 --- a/x/amm/keeper/abci_test.go +++ b/x/amm/keeper/abci_test.go @@ -314,7 +314,6 @@ func (suite *KeeperTestSuite) TestExecuteSwapRequests() { } } -// TODO: test ClearOutdatedSlippageTrack func (suite *KeeperTestSuite) TestClearOutdatedSlippageTrack() { now := time.Now() tracks := []types.OraclePoolSlippageTrack{ diff --git a/x/amm/keeper/keeper.go b/x/amm/keeper/keeper.go index 4e45899cb..f9b6d86e0 100644 --- a/x/amm/keeper/keeper.go +++ b/x/amm/keeper/keeper.go @@ -7,7 +7,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/elys-network/elys/x/amm/types" commitmentkeeper "github.com/elys-network/elys/x/commitment/keeper" @@ -19,7 +18,6 @@ type ( cdc codec.BinaryCodec storeKey storetypes.StoreKey transientStoreKey storetypes.StoreKey - paramstore paramtypes.Subspace authority string hooks types.AmmHooks @@ -37,7 +35,6 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, transientStoreKey storetypes.StoreKey, - ps paramtypes.Subspace, authority string, parameterKeeper *pkeeper.Keeper, @@ -48,16 +45,11 @@ func NewKeeper( assetProfileKeeper types.AssetProfileKeeper, accountedPoolKeeper types.AccountedPoolKeeper, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } return &Keeper{ cdc: cdc, storeKey: storeKey, transientStoreKey: transientStoreKey, - paramstore: ps, authority: authority, parameterKeeper: parameterKeeper, diff --git a/x/amm/keeper/msg_server_create_pool.go b/x/amm/keeper/msg_server_create_pool.go index e7bcc5a44..94261dd54 100644 --- a/x/amm/keeper/msg_server_create_pool.go +++ b/x/amm/keeper/msg_server_create_pool.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/elys-network/elys/x/amm/types" + ptypes "github.com/elys-network/elys/x/parameter/types" ) // CreatePool attempts to create a pool returning the newly created pool ID or an error upon failure. @@ -14,6 +15,17 @@ import ( func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (*types.MsgCreatePoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + // Pay pool creation fee + sender := sdk.MustAccAddressFromBech32(msg.Sender) + params := k.GetParams(ctx) + + if !params.PoolCreationFee.IsNil() && params.PoolCreationFee.IsPositive() { + feeCoins := sdk.Coins{sdk.NewCoin(ptypes.Elys, params.PoolCreationFee)} + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, feeCoins); err != nil { + return nil, err + } + } + poolId, err := k.Keeper.CreatePool(ctx, msg) if err != nil { return &types.MsgCreatePoolResponse{}, err diff --git a/x/amm/keeper/msg_server_create_pool_test.go b/x/amm/keeper/msg_server_create_pool_test.go index 496815998..a3c47e0b8 100644 --- a/x/amm/keeper/msg_server_create_pool_test.go +++ b/x/amm/keeper/msg_server_create_pool_test.go @@ -22,7 +22,7 @@ func (suite *KeeperTestSuite) TestMsgServerCreatePool() { }{ { desc: "zero tvl pool creation", - senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 1000000)}, + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 11000000)}, poolParams: types.PoolParams{ SwapFee: sdk.ZeroDec(), ExitFee: sdk.ZeroDec(), @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestMsgServerCreatePool() { }, { desc: "positive tvl pool creation", - senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, poolParams: types.PoolParams{ SwapFee: sdk.ZeroDec(), ExitFee: sdk.ZeroDec(), @@ -78,7 +78,7 @@ func (suite *KeeperTestSuite) TestMsgServerCreatePool() { }, { desc: "not enough balance to create pool", - senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000)}, + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10000000)}, poolParams: types.PoolParams{ SwapFee: sdk.ZeroDec(), ExitFee: sdk.ZeroDec(), diff --git a/x/amm/keeper/msg_server_exit_pool_test.go b/x/amm/keeper/msg_server_exit_pool_test.go index 8cb3732f9..7f9d617af 100644 --- a/x/amm/keeper/msg_server_exit_pool_test.go +++ b/x/amm/keeper/msg_server_exit_pool_test.go @@ -113,11 +113,13 @@ func (suite *KeeperTestSuite) TestMsgServerExitPool() { // bootstrap accounts sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - + params := suite.app.AmmKeeper.GetParams(suite.ctx) // bootstrap balances - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, tc.poolInitBalance) + poolCreationFee := sdk.NewCoin(ptypes.Elys, params.PoolCreationFee) + coins := tc.poolInitBalance.Add(poolCreationFee) + err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) suite.Require().NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, sender, tc.poolInitBalance) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, sender, coins) suite.Require().NoError(err) // execute function diff --git a/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go b/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go index 84730adaf..14c98e652 100644 --- a/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go +++ b/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go @@ -89,7 +89,10 @@ func (k msgServer) FeedMultipleExternalLiquidity(goCtx context.Context, msg *typ } pool.PoolParams.ExternalLiquidityRatio = elRatio - k.SetPool(ctx, pool) + err = k.SetPool(ctx, pool) + if err != nil { + return nil, err + } } return &types.MsgFeedMultipleExternalLiquidityResponse{}, nil diff --git a/x/amm/keeper/msg_server_update_params.go b/x/amm/keeper/msg_server_update_params.go new file mode 100644 index 000000000..ecf99bd4b --- /dev/null +++ b/x/amm/keeper/msg_server_update_params.go @@ -0,0 +1,21 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/elys-network/elys/x/amm/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.authority != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + k.Keeper.SetParams(ctx, *msg.Params) + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/amm/keeper/msg_server_update_pool_params.go b/x/amm/keeper/msg_server_update_pool_params.go index 553633656..419cc99aa 100644 --- a/x/amm/keeper/msg_server_update_pool_params.go +++ b/x/amm/keeper/msg_server_update_pool_params.go @@ -30,7 +30,10 @@ func (k Keeper) UpdatePoolParams(ctx sdk.Context, poolId uint64, poolParams type } pool.PoolParams = poolParams - k.SetPool(ctx, pool) + err := k.SetPool(ctx, pool) + if err != nil { + return 0, types.PoolParams{}, err + } return pool.PoolId, pool.PoolParams, nil } @@ -38,8 +41,8 @@ func (k Keeper) UpdatePoolParams(ctx sdk.Context, poolId uint64, poolParams type func (k msgServer) UpdatePoolParams(goCtx context.Context, msg *types.MsgUpdatePoolParams) (*types.MsgUpdatePoolParamsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if k.authority != msg.Sender { - return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Sender) + if k.authority != msg.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } poolId, poolParams, err := k.Keeper.UpdatePoolParams(ctx, msg.PoolId, *msg.PoolParams) diff --git a/x/amm/keeper/msg_server_update_pool_params_test.go b/x/amm/keeper/msg_server_update_pool_params_test.go index f56a01533..acc11098e 100644 --- a/x/amm/keeper/msg_server_update_pool_params_test.go +++ b/x/amm/keeper/msg_server_update_pool_params_test.go @@ -139,9 +139,12 @@ func (suite *KeeperTestSuite) TestMsgServerUpdatePoolParams() { sender := authtypes.NewModuleAddress(govtypes.ModuleName) // bootstrap balances - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, tc.senderInitBalance) + params := suite.app.AmmKeeper.GetParams(suite.ctx) + poolCreationFee := sdk.NewCoin(ptypes.Elys, params.PoolCreationFee) + coins := tc.senderInitBalance.Add(poolCreationFee) + err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) suite.Require().NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, sender, tc.senderInitBalance) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, sender, coins) suite.Require().NoError(err) // execute function @@ -184,7 +187,7 @@ func (suite *KeeperTestSuite) TestMsgServerUpdatePoolParams() { resp2, err := msgServer.UpdatePoolParams( sdk.WrapSDKContext(suite.ctx), &types.MsgUpdatePoolParams{ - Sender: sender.String(), + Authority: sender.String(), PoolId: pools[0].PoolId, PoolParams: &tc.updatedPoolParams, }) diff --git a/x/amm/keeper/params.go b/x/amm/keeper/params.go index 99f4b8be6..b163f87fb 100644 --- a/x/amm/keeper/params.go +++ b/x/amm/keeper/params.go @@ -5,20 +5,21 @@ import ( "github.com/elys-network/elys/x/amm/types" ) -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams( - k.PoolCreationFee(ctx), - ) +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + + b := store.Get([]byte(types.ParamsKey)) + if b == nil { + return + } + + k.cdc.MustUnmarshal(b, ¶ms) + return } // SetParams set the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} - -// PoolCreationFee returns the PoolCreationFee param -func (k Keeper) PoolCreationFee(ctx sdk.Context) (res uint64) { - k.paramstore.Get(ctx, types.KeyPoolCreationFee, &res) - return + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(¶ms) + store.Set([]byte(types.ParamsKey), b) } diff --git a/x/amm/keeper/params_test.go b/x/amm/keeper/params_test.go index e2e30ceac..0a7d2541d 100644 --- a/x/amm/keeper/params_test.go +++ b/x/amm/keeper/params_test.go @@ -15,5 +15,4 @@ func TestGetParams(t *testing.T) { k.SetParams(ctx, params) require.EqualValues(t, params, k.GetParams(ctx)) - require.EqualValues(t, params.PoolCreationFee, k.PoolCreationFee(ctx)) } diff --git a/x/amm/migrations/v4_migration.go b/x/amm/migrations/v4_migration.go new file mode 100644 index 000000000..d371dfc20 --- /dev/null +++ b/x/amm/migrations/v4_migration.go @@ -0,0 +1,11 @@ +package migrations + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/amm/types" +) + +func (m Migrator) V4Migration(ctx sdk.Context) error { + m.keeper.SetParams(ctx, types.DefaultParams()) + return nil +} diff --git a/x/amm/module.go b/x/amm/module.go index 4d0438a21..034813b03 100644 --- a/x/amm/module.go +++ b/x/amm/module.go @@ -117,7 +117,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) m := migrations.NewMigrator(am.keeper) - err := cfg.RegisterMigration(types.ModuleName, 2, m.V3Migration) + err := cfg.RegisterMigration(types.ModuleName, 3, m.V4Migration) if err != nil { panic(err) } @@ -144,7 +144,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 3 } +func (AppModule) ConsensusVersion() uint64 { return 4 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/amm/simulation/update_pool_params.go b/x/amm/simulation/update_pool_params.go index 52bc295e0..df39c27b4 100644 --- a/x/amm/simulation/update_pool_params.go +++ b/x/amm/simulation/update_pool_params.go @@ -19,7 +19,7 @@ func SimulateMsgUpdatePoolParams( ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgUpdatePoolParams{ - Sender: simAccount.Address.String(), + Authority: simAccount.Address.String(), } // TODO: Handling the UpdatePoolParams simulation diff --git a/x/amm/types/codec.go b/x/amm/types/codec.go index 98d1368f5..8bec8e622 100644 --- a/x/amm/types/codec.go +++ b/x/amm/types/codec.go @@ -16,6 +16,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgSwapByDenom{}, "amm/SwapByDenom", nil) cdc.RegisterConcrete(&MsgFeedMultipleExternalLiquidity{}, "amm/FeedMultipleExternalLiquidity", nil) cdc.RegisterConcrete(&MsgUpdatePoolParams{}, "amm/UpdatePoolParams", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "amm/UpdateParams", nil) // this line is used by starport scaffolding # 2 } @@ -28,7 +29,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgSwapExactAmountOut{}, &MsgSwapByDenom{}, &MsgFeedMultipleExternalLiquidity{}, - &MsgUpdatePoolParams{}, + &MsgUpdateParams{}, ) // this line is used by starport scaffolding # 3 diff --git a/x/amm/types/keys.go b/x/amm/types/keys.go index 8e0663652..a27e9cd5c 100644 --- a/x/amm/types/keys.go +++ b/x/amm/types/keys.go @@ -32,6 +32,9 @@ const ( TLastSwapRequestIndex = "last-swap-request-index" TSwapExactAmountInKey = "batch/swap-exact-amount-in" TSwapExactAmountOutKey = "batch/swap-exact-amount-out" + + // ParamsKey is the prefix to retrieve all Params + ParamsKey = "Params/value/" ) func KeyPrefix(p string) []byte { diff --git a/x/amm/types/message_update_params.go b/x/amm/types/message_update_params.go new file mode 100644 index 000000000..1aa478880 --- /dev/null +++ b/x/amm/types/message_update_params.go @@ -0,0 +1,48 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgUpdateParams = "update_params" + +var _ sdk.Msg = &MsgUpdateParams{} + +func NewMsgUpdateParams(authority string, params *Params) *MsgUpdateParams { + return &MsgUpdateParams{ + Authority: authority, + Params: params, + } +} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return TypeMsgUpdateParams +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + panic(err) + } + return []sdk.AccAddress{authority} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + + return nil +} diff --git a/x/amm/types/message_update_pool_params.go b/x/amm/types/message_update_pool_params.go index 1d9b37b23..ff65ee344 100644 --- a/x/amm/types/message_update_pool_params.go +++ b/x/amm/types/message_update_pool_params.go @@ -10,9 +10,9 @@ const TypeMsgUpdatePoolParams = "update_pool_params" var _ sdk.Msg = &MsgUpdatePoolParams{} -func NewMsgUpdatePoolParams(sender string, poolId uint64, poolParams *PoolParams) *MsgUpdatePoolParams { +func NewMsgUpdatePoolParams(authority string, poolId uint64, poolParams *PoolParams) *MsgUpdatePoolParams { return &MsgUpdatePoolParams{ - Sender: sender, + Authority: authority, PoolId: poolId, PoolParams: poolParams, } @@ -27,11 +27,11 @@ func (msg *MsgUpdatePoolParams) Type() string { } func (msg *MsgUpdatePoolParams) GetSigners() []sdk.AccAddress { - sender, err := sdk.AccAddressFromBech32(msg.Sender) + authority, err := sdk.AccAddressFromBech32(msg.Authority) if err != nil { panic(err) } - return []sdk.AccAddress{sender} + return []sdk.AccAddress{authority} } func (msg *MsgUpdatePoolParams) GetSignBytes() []byte { @@ -40,7 +40,7 @@ func (msg *MsgUpdatePoolParams) GetSignBytes() []byte { } func (msg *MsgUpdatePoolParams) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Sender) + _, err := sdk.AccAddressFromBech32(msg.Authority) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } diff --git a/x/amm/types/message_update_pool_params_test.go b/x/amm/types/message_update_pool_params_test.go index 94d91a605..253233c98 100644 --- a/x/amm/types/message_update_pool_params_test.go +++ b/x/amm/types/message_update_pool_params_test.go @@ -20,7 +20,7 @@ func TestMsgUpdatePoolParams_ValidateBasic(t *testing.T) { { name: "invalid address", msg: types.MsgUpdatePoolParams{ - Sender: "invalid_address", + Authority: "invalid_address", PoolParams: &types.PoolParams{ SwapFee: sdk.ZeroDec(), ExitFee: sdk.ZeroDec(), @@ -37,7 +37,7 @@ func TestMsgUpdatePoolParams_ValidateBasic(t *testing.T) { }, { name: "valid address", msg: types.MsgUpdatePoolParams{ - Sender: sample.AccAddress(), + Authority: sample.AccAddress(), PoolParams: &types.PoolParams{ SwapFee: sdk.ZeroDec(), ExitFee: sdk.ZeroDec(), diff --git a/x/amm/types/params.go b/x/amm/types/params.go index 3995b600a..ce262928c 100644 --- a/x/amm/types/params.go +++ b/x/amm/types/params.go @@ -1,55 +1,28 @@ package types import ( - "fmt" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "cosmossdk.io/math" "gopkg.in/yaml.v2" ) -var _ paramtypes.ParamSet = (*Params)(nil) - -var ( - KeyPoolCreationFee = []byte("PoolCreationFee") - KeyBrokerAddress = []byte("BrokerAddress") - // TODO: Determine the default value - DefaultPoolCreationFee uint64 = 0 -) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // NewParams creates a new Params instance -func NewParams( - poolCreationFee uint64, -) Params { +func NewParams(poolCreationFee math.Int, slippageTrackDuration uint64) Params { return Params{ - PoolCreationFee: poolCreationFee, + PoolCreationFee: poolCreationFee, + SlippageTrackDuration: slippageTrackDuration, } } // DefaultParams returns a default set of parameters func DefaultParams() Params { return NewParams( - DefaultPoolCreationFee, + math.NewInt(10_000_000), // 10 ELYS + 86400*7, ) } -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyPoolCreationFee, &p.PoolCreationFee, validatePoolCreationFee), - } -} - // Validate validates the set of params func (p Params) Validate() error { - if err := validatePoolCreationFee(p.PoolCreationFee); err != nil { - return err - } - return nil } @@ -58,16 +31,3 @@ func (p Params) String() string { out, _ := yaml.Marshal(p) return string(out) } - -// validatePoolCreationFee validates the PoolCreationFee param -func validatePoolCreationFee(v interface{}) error { - poolCreationFee, ok := v.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", v) - } - - // TODO implement validation - _ = poolCreationFee - - return nil -} diff --git a/x/amm/types/params.pb.go b/x/amm/types/params.pb.go index 99f1539a6..3e1f1357f 100644 --- a/x/amm/types/params.pb.go +++ b/x/amm/types/params.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -25,7 +26,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - PoolCreationFee uint64 `protobuf:"varint,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3" json:"pool_creation_fee,omitempty"` + PoolCreationFee github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"pool_creation_fee"` + SlippageTrackDuration uint64 `protobuf:"varint,2,opt,name=slippage_track_duration,json=slippageTrackDuration,proto3" json:"slippage_track_duration,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -60,9 +62,9 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetPoolCreationFee() uint64 { +func (m *Params) GetSlippageTrackDuration() uint64 { if m != nil { - return m.PoolCreationFee + return m.SlippageTrackDuration } return 0 } @@ -74,19 +76,24 @@ func init() { func init() { proto.RegisterFile("elys/amm/params.proto", fileDescriptor_1209ca218537a425) } var fileDescriptor_1209ca218537a425 = []byte{ - // 184 bytes of a gzipped FileDescriptorProto + // 257 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xcd, 0xa9, 0x2c, 0xd6, 0x4f, 0xcc, 0xcd, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x09, 0xeb, 0x25, 0xe6, 0xe6, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, - 0x05, 0xf5, 0x41, 0x2c, 0x88, 0xbc, 0x92, 0x15, 0x17, 0x5b, 0x00, 0x58, 0xbd, 0x90, 0x16, 0x97, - 0x60, 0x41, 0x7e, 0x7e, 0x4e, 0x7c, 0x72, 0x51, 0x6a, 0x62, 0x49, 0x66, 0x7e, 0x5e, 0x7c, 0x5a, - 0x6a, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4b, 0x10, 0x3f, 0x48, 0xc2, 0x19, 0x2a, 0xee, 0x96, - 0x9a, 0x6a, 0xc5, 0x32, 0x63, 0x81, 0x3c, 0x83, 0x93, 0xd3, 0x89, 0x47, 0x72, 0x8c, 0x17,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0x26, 0x67, + 0xc7, 0xa7, 0x94, 0x16, 0x81, 0x65, 0x25, 0x98, 0x14, 0x18, 0x35, 0x58, 0x82, 0x44, 0x61, 0xd2, + 0x21, 0x20, 0x59, 0x17, 0xa8, 0xa4, 0x15, 0xcb, 0x8c, 0x05, 0xf2, 0x0c, 0x4e, 0x4e, 0x27, 0x1e, + 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, + 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x81, 0xe4, 0x20, 0x90, 0x4f, 0x75, 0xf3, + 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xc1, 0x1c, 0xfd, 0x0a, 0x70, 0x78, 0x80, 0x9d, 0x95, 0xc4, + 0x06, 0xf6, 0xaf, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x28, 0x08, 0x94, 0x5a, 0x28, 0x01, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -109,11 +116,21 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PoolCreationFee != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.PoolCreationFee)) + if m.SlippageTrackDuration != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.SlippageTrackDuration)) i-- - dAtA[i] = 0x8 + dAtA[i] = 0x10 } + { + size := m.PoolCreationFee.Size() + i -= size + if _, err := m.PoolCreationFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -134,8 +151,10 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.PoolCreationFee != 0 { - n += 1 + sovParams(uint64(m.PoolCreationFee)) + l = m.PoolCreationFee.Size() + n += 1 + l + sovParams(uint64(l)) + if m.SlippageTrackDuration != 0 { + n += 1 + sovParams(uint64(m.SlippageTrackDuration)) } return n } @@ -176,10 +195,44 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PoolCreationFee", wireType) } - m.PoolCreationFee = 0 + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PoolCreationFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SlippageTrackDuration", wireType) + } + m.SlippageTrackDuration = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -189,7 +242,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PoolCreationFee |= uint64(b&0x7F) << shift + m.SlippageTrackDuration |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/amm/types/tx.pb.go b/x/amm/types/tx.pb.go index c0da94118..4211be391 100644 --- a/x/amm/types/tx.pb.go +++ b/x/amm/types/tx.pb.go @@ -941,7 +941,7 @@ func (m *MsgSwapByDenomResponse) GetRecipient() string { } type MsgUpdatePoolParams struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` PoolParams *PoolParams `protobuf:"bytes,3,opt,name=pool_params,json=poolParams,proto3" json:"pool_params,omitempty"` } @@ -979,9 +979,9 @@ func (m *MsgUpdatePoolParams) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdatePoolParams proto.InternalMessageInfo -func (m *MsgUpdatePoolParams) GetSender() string { +func (m *MsgUpdatePoolParams) GetAuthority() string { if m != nil { - return m.Sender + return m.Authority } return "" } @@ -1052,6 +1052,94 @@ func (m *MsgUpdatePoolParamsResponse) GetPoolParams() *PoolParams { return nil } +type MsgUpdateParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7ddafd861f6b7f, []int{18} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7ddafd861f6b7f, []int{19} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreatePool)(nil), "elys.amm.MsgCreatePool") proto.RegisterType((*MsgCreatePoolResponse)(nil), "elys.amm.MsgCreatePoolResponse") @@ -1071,92 +1159,97 @@ func init() { proto.RegisterType((*MsgSwapByDenomResponse)(nil), "elys.amm.MsgSwapByDenomResponse") proto.RegisterType((*MsgUpdatePoolParams)(nil), "elys.amm.MsgUpdatePoolParams") proto.RegisterType((*MsgUpdatePoolParamsResponse)(nil), "elys.amm.MsgUpdatePoolParamsResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "elys.amm.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "elys.amm.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("elys/amm/tx.proto", fileDescriptor_ed7ddafd861f6b7f) } var fileDescriptor_ed7ddafd861f6b7f = []byte{ - // 1267 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x5f, 0x4f, 0x23, 0x55, - 0x14, 0x67, 0x5a, 0xfa, 0xef, 0x20, 0xcb, 0x32, 0xc0, 0x52, 0x0a, 0x14, 0x32, 0x46, 0x24, 0x9b, - 0x6c, 0x9b, 0xc5, 0xa8, 0x59, 0xb2, 0x51, 0xb7, 0x0b, 0x98, 0x6e, 0xb6, 0x81, 0x74, 0xe3, 0xc6, - 0x68, 0xb4, 0x19, 0xda, 0x4b, 0x99, 0xd0, 0xb9, 0x77, 0xec, 0xbd, 0x95, 0xa2, 0x31, 0x3e, 0xf8, - 0xe0, 0xab, 0xcf, 0x7e, 0x05, 0xf5, 0xcd, 0xf8, 0x19, 0x78, 0xdc, 0x47, 0xe3, 0x03, 0x1a, 0xf8, - 0x02, 0xc6, 0x4f, 0x60, 0xee, 0x9d, 0x3b, 0x77, 0x66, 0xfa, 0x8f, 0xa1, 0x21, 0x26, 0x3e, 0xd1, - 0xb9, 0xe7, 0x9e, 0xdf, 0xbd, 0xe7, 0x77, 0xfe, 0xdd, 0x03, 0xcc, 0xa2, 0xd6, 0x19, 0x2d, 0x9a, - 0xb6, 0x5d, 0x64, 0xdd, 0x82, 0xd3, 0x26, 0x8c, 0xe8, 0x69, 0xbe, 0x54, 0x30, 0x6d, 0x3b, 0x37, - 0xdf, 0x24, 0x4d, 0x22, 0x16, 0x8b, 0xfc, 0x97, 0x2b, 0xcf, 0xe5, 0xeb, 0x84, 0xda, 0x84, 0x16, - 0x0f, 0x4d, 0x8a, 0x8a, 0x5f, 0x3e, 0x3c, 0x44, 0xcc, 0x7c, 0x58, 0xac, 0x13, 0x0b, 0x4b, 0xf9, - 0x82, 0x82, 0x74, 0xcc, 0xb6, 0x69, 0x53, 0xb9, 0xbc, 0xa4, 0x96, 0xe9, 0xa9, 0x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x12, 0x00, 0x00, + // 1323 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcb, 0x4e, 0x23, 0x47, + 0x17, 0xa6, 0x6d, 0xf0, 0xe5, 0x30, 0xdc, 0x1a, 0x18, 0x8c, 0x01, 0xc3, 0xdf, 0xbf, 0x42, 0xac, + 0x91, 0xc6, 0xd6, 0x10, 0x25, 0xd1, 0xa0, 0x51, 0x92, 0xf1, 0x00, 0x91, 0x47, 0x58, 0x20, 0x8f, + 0x32, 0xca, 0x45, 0x89, 0xd5, 0xd8, 0x85, 0x69, 0xe1, 0xee, 0xea, 0xb8, 0xaa, 0x83, 0x49, 0x16, + 0x91, 0x32, 0x8b, 0x6c, 0xb3, 0xce, 0x2b, 0x24, 0xd9, 0xe6, 0x19, 0x58, 0xce, 0x32, 0xca, 0x82, + 0x44, 0xf0, 0x02, 0x51, 0x9e, 0x20, 0xaa, 0xea, 0xea, 0xea, 0x6e, 0xdf, 0x68, 0x2c, 0x14, 0x29, + 0x2b, 0xdc, 0xe7, 0xd4, 0xf9, 0xaa, 0xce, 0x77, 0x2e, 0x55, 0x07, 0x98, 0x43, 0xad, 0x73, 0x52, + 0xd4, 0x4d, 0xb3, 0x48, 0x3b, 0x05, 0xbb, 0x8d, 0x29, 0x56, 0x53, 0x4c, 0x54, 0xd0, 0x4d, 0x33, + 0xbb, 0xd0, 0xc4, 0x4d, 0xcc, 0x85, 0x45, 0xf6, 0xcb, 0xd5, 0x67, 0x73, 0x75, 0x4c, 0x4c, 0x4c, + 0x8a, 0x47, 0x3a, 0x41, 0xc5, 0xaf, 0x1e, 0x1d, 0x21, 0xaa, 0x3f, 0x2a, 0xd6, 0xb1, 0x61, 0x09, + 0xfd, 0xa2, 0x84, 0xb4, 0xf5, 0xb6, 0x6e, 0x12, 0x21, 0x5e, 0x96, 0x62, 0x72, 0xa6, 0xdb, 0xb5, + 0x36, 0x76, 0x28, 0x12, 0xaa, 0xac, 0x6f, 0x81, 0x71, 0xab, 0x36, 0xc0, 0x8c, 0xeb, 0x74, 0x42, + 0x10, 0x75, 0x55, 0xda, 0x8f, 0x0a, 0x4c, 0x55, 0x48, 0xf3, 0x59, 0x1b, 0xe9, 0x14, 0x1d, 0x62, + 0xdc, 0x52, 0xef, 0x43, 0x82, 0x20, 0xab, 0x81, 0xda, 0x19, 0x65, 0x43, 0xc9, 0xa7, 0xab, 0xe2, + 0x4b, 0x7d, 0x1b, 0x26, 0x03, 0xc8, 0x99, 0xd8, 0x86, 0x92, 0x9f, 0xdc, 0x5a, 0x28, 0x78, 0x8e, + 0x16, 0x98, 0xf1, 0x21, 0xd7, 0x55, 0xc1, 0x96, 0xbf, 0xd5, 0x6d, 0x61, 0xc6, 0x37, 0x25, 0x99, + 0xf8, 0x46, 0x3c, 0x3f, 0xb9, 0x35, 0x1f, 0x36, 0x7b, 0xca, 0x74, 0xa5, 0xf1, 0x8b, 0xcb, 0xf5, + 0x31, 0xd7, 0x96, 0x0b, 0x88, 0xf6, 0x04, 0x16, 0x43, 0x67, 0xab, 0x22, 0x62, 0x63, 0x8b, 0x20, + 0xf5, 0xff, 0x90, 0xe4, 0xa0, 0x46, 0x83, 0x1f, 0x72, 0xbc, 0x04, 0x57, 0x97, 0xeb, 0x09, 0xb6, + 0xa4, 0xbc, 0x53, 0x4d, 0x30, 0x55, 0xb9, 0xa1, 0xfd, 0xa1, 0xc0, 0x64, 0x85, 0x34, 0x9f, 0x63, + 0xc3, 0x1a, 0xea, 0xd8, 0x92, 0x0f, 0xc6, 0x9c, 0x1a, 0xf7, 0x00, 0xd4, 0x5d, 0x98, 0x36, 0xf5, + 0x4e, 0x4d, 0x37, 0xb1, 0x63, 0x51, 0x52, 0x33, 0x2c, 0x71, 0xfa, 0xe5, 0x82, 0x1b, 0xbd, 0x02, + 0x8b, 0x5e, 0x41, 0x44, 0xaf, 0xf0, 0x0c, 0x1b, 0x96, 0xf0, 0x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xeb, 0xeb, 0xdc, 0xd8, 0x6f, 0xd7, 0xb9, + 0xb1, 0x4f, 0xf3, 0x81, 0xce, 0xc6, 0x60, 0x1e, 0x5a, 0x88, 0x9e, 0xe1, 0xf6, 0x29, 0xff, 0x28, + 0x76, 0xdc, 0xff, 0xcf, 0xb1, 0xfe, 0x76, 0x94, 0xe0, 0xff, 0xfa, 0x7a, 0xeb, 0x9f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x96, 0x45, 0xf1, 0xcd, 0xb8, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1179,6 +1272,7 @@ type MsgClient interface { SwapByDenom(ctx context.Context, in *MsgSwapByDenom, opts ...grpc.CallOption) (*MsgSwapByDenomResponse, error) FeedMultipleExternalLiquidity(ctx context.Context, in *MsgFeedMultipleExternalLiquidity, opts ...grpc.CallOption) (*MsgFeedMultipleExternalLiquidityResponse, error) UpdatePoolParams(ctx context.Context, in *MsgUpdatePoolParams, opts ...grpc.CallOption) (*MsgUpdatePoolParamsResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -1261,6 +1355,15 @@ func (c *msgClient) UpdatePoolParams(ctx context.Context, in *MsgUpdatePoolParam return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/elys.amm.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { CreatePool(context.Context, *MsgCreatePool) (*MsgCreatePoolResponse, error) @@ -1271,6 +1374,7 @@ type MsgServer interface { SwapByDenom(context.Context, *MsgSwapByDenom) (*MsgSwapByDenomResponse, error) FeedMultipleExternalLiquidity(context.Context, *MsgFeedMultipleExternalLiquidity) (*MsgFeedMultipleExternalLiquidityResponse, error) UpdatePoolParams(context.Context, *MsgUpdatePoolParams) (*MsgUpdatePoolParamsResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1301,6 +1405,9 @@ func (*UnimplementedMsgServer) FeedMultipleExternalLiquidity(ctx context.Context func (*UnimplementedMsgServer) UpdatePoolParams(ctx context.Context, req *MsgUpdatePoolParams) (*MsgUpdatePoolParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdatePoolParams not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1450,6 +1557,24 @@ func _Msg_UpdatePoolParams_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.amm.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "elys.amm.Msg", HandlerType: (*MsgServer)(nil), @@ -1486,6 +1611,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdatePoolParams", Handler: _Msg_UpdatePoolParams_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "elys/amm/tx.proto", @@ -2451,10 +2580,10 @@ func (m *MsgUpdatePoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) i-- dAtA[i] = 0xa } @@ -2501,6 +2630,71 @@ func (m *MsgUpdatePoolParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -2862,7 +3056,7 @@ func (m *MsgUpdatePoolParams) Size() (n int) { } var l int _ = l - l = len(m.Sender) + l = len(m.Authority) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2892,6 +3086,32 @@ func (m *MsgUpdatePoolParamsResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -5603,7 +5823,7 @@ func (m *MsgUpdatePoolParams) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5631,7 +5851,7 @@ func (m *MsgUpdatePoolParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -5814,6 +6034,174 @@ func (m *MsgUpdatePoolParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/incentive/keeper/keeper_lps_test.go b/x/incentive/keeper/keeper_lps_test.go index cedc31d5f..617c537cc 100644 --- a/x/incentive/keeper/keeper_lps_test.go +++ b/x/incentive/keeper/keeper_lps_test.go @@ -108,12 +108,11 @@ func TestCalcRewardsForLPs(t *testing.T) { simapp.AddTestCommitment(app, ctx, addr[0], committed, unclaimed) // Create a pool - // Mint 100000USDC - usdcToken := sdk.NewCoins(sdk.NewCoin(ptypes.BaseCurrency, sdk.NewInt(100000))) - - err = app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, usdcToken) + // Mint 100000USDC + 10 ELYS (pool creation fee) + coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) + err = app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, coins) require.NoError(t, err) - err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], usdcToken) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], coins) require.NoError(t, err) var poolAssets []ammtypes.PoolAsset diff --git a/x/incentive/keeper/params_test.go b/x/incentive/keeper/params_test.go index 5355ea239..5f5296199 100644 --- a/x/incentive/keeper/params_test.go +++ b/x/incentive/keeper/params_test.go @@ -38,12 +38,11 @@ func TestUpdatePoolMultiplierInfo(t *testing.T) { addr := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(100010)) // Create a pool - // Mint 100000USDC - usdcToken := sdk.NewCoins(sdk.NewCoin(ptypes.BaseCurrency, sdk.NewInt(100000))) - - err := app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, usdcToken) + // Mint 100000USDC + 10 ELYS (pool creation fee) + coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) + err := app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, coins) require.NoError(t, err) - err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], usdcToken) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], coins) require.NoError(t, err) var poolAssets []ammtypes.PoolAsset diff --git a/x/incentive/keeper/pool_apr_test.go b/x/incentive/keeper/pool_apr_test.go index 875ad1c27..5ace582a6 100644 --- a/x/incentive/keeper/pool_apr_test.go +++ b/x/incentive/keeper/pool_apr_test.go @@ -25,12 +25,11 @@ func TestCalculatePoolAprs(t *testing.T) { addr := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(100010)) // Create a pool - // Mint 100000USDC - usdcToken := sdk.NewCoins(sdk.NewCoin(ptypes.BaseCurrency, sdk.NewInt(100000))) - - err := app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, usdcToken) + // Mint 100000USDC + 10 ELYS (pool creation fee) + coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) + err := app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, coins) require.NoError(t, err) - err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], usdcToken) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], coins) require.NoError(t, err) var poolAssets []ammtypes.PoolAsset diff --git a/x/leveragelp/keeper/begin_blocker.go b/x/leveragelp/keeper/begin_blocker.go index b4b72a32e..ea2ef424d 100644 --- a/x/leveragelp/keeper/begin_blocker.go +++ b/x/leveragelp/keeper/begin_blocker.go @@ -30,7 +30,6 @@ func (k Keeper) BeginBlocker(ctx sdk.Context) { k.LiquidatePositionIfUnhealthy(ctx, position, pool, ammPool) } } - k.SetPool(ctx, pool) } } }