From 154c0fe7884f7c0adaacb4c70fc1f0998afc2065 Mon Sep 17 00:00:00 2001 From: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:15:32 +0100 Subject: [PATCH] feat: add amm update pool params msg --- app/app.go | 1 + config.yml | 3 +- docs/static/openapi.yml | 120 ++++ proto/elys/amm/tx.proto | 38 +- wasmbindings/types/types.go | 1 + x/amm/client/cli/tx.go | 1 + x/amm/client/cli/tx_update_pool_params.go | 123 ++++ x/amm/client/wasm/messenger.go | 2 + x/amm/client/wasm/msg_update_pool_params.go | 44 ++ x/amm/keeper/keeper.go | 3 + x/amm/keeper/keeper_create_pool.go | 14 + x/amm/keeper/keeper_update_pool_params.go | 34 + x/amm/keeper/msg_server_create_pool.go | 6 + x/amm/keeper/msg_server_update_pool_params.go | 28 + .../msg_server_update_pool_params_test.go | 224 ++++++ x/amm/module_simulation.go | 15 + x/amm/simulation/update_pool_params.go | 29 + x/amm/types/codec.go | 2 + x/amm/types/message_update_pool_params.go | 47 ++ .../types/message_update_pool_params_test.go | 40 ++ x/amm/types/tx.pb.go | 676 ++++++++++++++++-- 21 files changed, 1358 insertions(+), 93 deletions(-) create mode 100644 x/amm/client/cli/tx_update_pool_params.go create mode 100644 x/amm/client/wasm/msg_update_pool_params.go create mode 100644 x/amm/keeper/keeper_update_pool_params.go create mode 100644 x/amm/keeper/msg_server_update_pool_params.go create mode 100644 x/amm/keeper/msg_server_update_pool_params_test.go create mode 100644 x/amm/simulation/update_pool_params.go create mode 100644 x/amm/types/message_update_pool_params.go create mode 100644 x/amm/types/message_update_pool_params_test.go diff --git a/app/app.go b/app/app.go index 6fbecba00..7fbe4602f 100644 --- a/app/app.go +++ b/app/app.go @@ -733,6 +733,7 @@ func NewElysApp( keys[ammmoduletypes.StoreKey], tkeys[ammmoduletypes.TStoreKey], app.GetSubspace(ammmoduletypes.ModuleName), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.BankKeeper, app.AccountKeeper, app.OracleKeeper, diff --git a/config.yml b/config.yml index ec76dc02b..f8f3c209b 100644 --- a/config.yml +++ b/config.yml @@ -302,7 +302,8 @@ genesis: num_blocks: "0" amount: "0" amount_collected_by_other_tracker: "0" - max_eden_reward_apr: "0.30" + max_eden_reward_apr_stakers: "0.30" + max_eden_reward_apr_lps: "0.30" fee_pool: community_pool: - amount: "0" diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 788c628cf..e0be855e5 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -38320,6 +38320,25 @@ paths: Coin defines a token with a denomination and an amount. + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + swapFee: + type: string + discount: + type: string + available_liquidity: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method @@ -38351,6 +38370,10 @@ paths: in: query required: false type: string + - name: discount + in: query + required: false + type: string tags: - Query /elys-network/elys/amm/swap_estimation_by_denom: @@ -38396,6 +38419,25 @@ paths: Coin defines a token with a denomination and an amount. + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + swapFee: + type: string + discount: + type: string + available_liquidity: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method @@ -38435,6 +38477,10 @@ paths: in: query required: false type: string + - name: discount + in: query + required: false + type: string tags: - Query /elys-network/elys/assetprofile/entry: @@ -82955,22 +83001,64 @@ definitions: type: string spot_price: type: string + swap_fee: + type: string discount: type: string + recipient: + type: string elys.amm.MsgSwapExactAmountInResponse: type: object properties: token_out_amount: type: string + swap_fee: + type: string discount: type: string + recipient: + type: string elys.amm.MsgSwapExactAmountOutResponse: type: object properties: token_in_amount: type: string + swap_fee: + type: string discount: type: string + recipient: + type: string + elys.amm.MsgUpdatePoolParamsResponse: + type: object + properties: + pool_id: + type: string + format: uint64 + pool_params: + type: object + properties: + swap_fee: + type: string + exit_fee: + type: string + use_oracle: + type: boolean + weight_breaking_fee_multiplier: + type: string + external_liquidity_ratio: + type: string + lp_fee_portion: + type: string + staking_fee_portion: + type: string + weight_recovery_fee_portion: + type: string + threshold_weight_difference: + type: string + fee_denom: + type: string + title: denom for fee collection elys.amm.OraclePoolSlippageTrack: type: object properties: @@ -83476,6 +83564,22 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. + swapFee: + type: string + discount: + type: string + available_liquidity: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. elys.amm.QuerySwapEstimationResponse: type: object properties: @@ -83493,6 +83597,22 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. + swapFee: + type: string + discount: + type: string + available_liquidity: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. elys.amm.SwapAmountInRoute: type: object properties: diff --git a/proto/elys/amm/tx.proto b/proto/elys/amm/tx.proto index e95b35db0..051789de4 100644 --- a/proto/elys/amm/tx.proto +++ b/proto/elys/amm/tx.proto @@ -20,8 +20,8 @@ service Msg { rpc SwapExactAmountOut (MsgSwapExactAmountOut ) returns (MsgSwapExactAmountOutResponse ); rpc SwapByDenom (MsgSwapByDenom ) returns (MsgSwapByDenomResponse ); rpc FeedMultipleExternalLiquidity (MsgFeedMultipleExternalLiquidity) returns (MsgFeedMultipleExternalLiquidityResponse); + rpc UpdatePoolParams (MsgUpdatePoolParams ) returns (MsgUpdatePoolParamsResponse ); } - message MsgCreatePool { string sender = 1; PoolParams pool_params = 2; @@ -62,15 +62,15 @@ message MsgSwapExactAmountIn { repeated SwapAmountInRoute routes = 2 [(gogoproto.nullable) = false ] ; cosmos.base.v1beta1.Coin token_in = 3 [(gogoproto.nullable) = false ] ; string token_out_min_amount = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string discount = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string recipient = 6; + string discount = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string recipient = 6; } message MsgSwapExactAmountInResponse { string token_out_amount = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string swap_fee = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string discount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string recipient = 4; + string swap_fee = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string discount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string recipient = 4; } message MsgSwapExactAmountOut { @@ -78,15 +78,15 @@ message MsgSwapExactAmountOut { repeated SwapAmountOutRoute routes = 2 [(gogoproto.nullable) = false ] ; cosmos.base.v1beta1.Coin token_out = 3 [(gogoproto.nullable) = false ] ; string token_in_max_amount = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string discount = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string recipient = 6; + string discount = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string recipient = 6; } message MsgSwapExactAmountOutResponse { string token_in_amount = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string swap_fee = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string discount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string recipient = 4; + string swap_fee = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string discount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string recipient = 4; } message MsgFeedMultipleExternalLiquidity { @@ -116,7 +116,7 @@ message MsgSwapByDenom { string denom_in = 5; string denom_out = 6; string discount = 7 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string recipient = 8; + string recipient = 8; } message MsgSwapByDenomResponse { @@ -126,5 +126,17 @@ message MsgSwapByDenomResponse { string spot_price = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; string swap_fee = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; string discount = 6 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string recipient = 7; + string recipient = 7; +} + +message MsgUpdatePoolParams { + string sender = 1; + uint64 pool_id = 2; + PoolParams pool_params = 3; } + +message MsgUpdatePoolParamsResponse { + uint64 pool_id = 1; + PoolParams pool_params = 2; +} + diff --git a/wasmbindings/types/types.go b/wasmbindings/types/types.go index ad4600e02..a4aa91aff 100644 --- a/wasmbindings/types/types.go +++ b/wasmbindings/types/types.go @@ -245,6 +245,7 @@ type ElysMsg struct { AmmSwapExactAmountOut *ammtypes.MsgSwapExactAmountOut `json:"amm_swap_exact_amount_out,omitempty"` AmmSwapByDenom *ammtypes.MsgSwapByDenom `json:"amm_swap_by_denom,omitempty"` AmmFeedMultipleExternalLiquidity *ammtypes.MsgFeedMultipleExternalLiquidity `json:"amm_feed_multiple_external_liquidity,omitempty"` + AmmUpdatePoolParams *ammtypes.MsgUpdatePoolParams `json:"amm_update_pool_params,omitempty"` // assetprofile messages AssetProfileCreateEntry *assetprofiletypes.MsgCreateEntry `json:"asset_profile_create_entry,omitempty"` diff --git a/x/amm/client/cli/tx.go b/x/amm/client/cli/tx.go index e7256a93b..fc4e400d8 100644 --- a/x/amm/client/cli/tx.go +++ b/x/amm/client/cli/tx.go @@ -38,6 +38,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdSwapExactAmountIn()) cmd.AddCommand(CmdSwapExactAmountOut()) cmd.AddCommand(CmdSwapByDenom()) + cmd.AddCommand(CmdUpdatePoolParams()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/amm/client/cli/tx_update_pool_params.go b/x/amm/client/cli/tx_update_pool_params.go new file mode 100644 index 000000000..730a8bf28 --- /dev/null +++ b/x/amm/client/cli/tx_update_pool_params.go @@ -0,0 +1,123 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/amm/types" + "github.com/spf13/cast" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdUpdatePoolParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-pool-params [pool-id] [flags]", + Short: "Update pool params", + Example: "elysd tx amm update-pool-params 1 --swap-fee=0.00 --exit-fee=0.00 --use-oracle=false --from=jack --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argPoolId, err := cast.ToUint64E(args[0]) + if err != nil { + return err + } + + swapFeeStr, err := cmd.Flags().GetString(FlagSwapFee) + if err != nil { + return err + } + + exitFeeStr, err := cmd.Flags().GetString(FlagExitFee) + if err != nil { + return err + } + + useOracle, err := cmd.Flags().GetBool(FlagUseOracle) + if err != nil { + return err + } + + weightBreakingFeeMultiplierStr, err := cmd.Flags().GetString(FlagWeightBreakingFeeMultiplier) + if err != nil { + return err + } + + externalLiquidityRatioStr, err := cmd.Flags().GetString(FlagExternalLiquidityRatio) + if err != nil { + return err + } + + lpFeePortionStr, err := cmd.Flags().GetString(FlagLpFeePortion) + if err != nil { + return err + } + + stakingFeePortionStr, err := cmd.Flags().GetString(FlagStakingFeePortion) + if err != nil { + return err + } + + weightRecoveryFeePortionStr, err := cmd.Flags().GetString(FlagWeightRecoveryFeePortion) + if err != nil { + return err + } + + thresholdWeightDifferenceStr, err := cmd.Flags().GetString(FlagThresholdWeightDifference) + if err != nil { + return err + } + + feeDenom, err := cmd.Flags().GetString(FlagFeeDenom) + if err != nil { + return err + } + + poolParams := &types.PoolParams{ + SwapFee: sdk.MustNewDecFromStr(swapFeeStr), + ExitFee: sdk.MustNewDecFromStr(exitFeeStr), + UseOracle: useOracle, + WeightBreakingFeeMultiplier: sdk.MustNewDecFromStr(weightBreakingFeeMultiplierStr), + ExternalLiquidityRatio: sdk.MustNewDecFromStr(externalLiquidityRatioStr), + LpFeePortion: sdk.MustNewDecFromStr(lpFeePortionStr), + StakingFeePortion: sdk.MustNewDecFromStr(stakingFeePortionStr), + WeightRecoveryFeePortion: sdk.MustNewDecFromStr(weightRecoveryFeePortionStr), + ThresholdWeightDifference: sdk.MustNewDecFromStr(thresholdWeightDifferenceStr), + FeeDenom: feeDenom, + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUpdatePoolParams( + clientCtx.GetFromAddress().String(), + argPoolId, + poolParams, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + cmd.Flags().String(FlagSwapFee, "0.00", "swap fee") + cmd.Flags().String(FlagExitFee, "0.00", "exit fee") + cmd.Flags().Bool(FlagUseOracle, false, "flag to be an oracle pool or non-oracle pool") + cmd.Flags().String(FlagWeightBreakingFeeMultiplier, "0.00", "weight breaking fee multiplier") + cmd.Flags().String(FlagExternalLiquidityRatio, "0.00", "external liquidity ratio - valid for oracle pools") + cmd.Flags().String(FlagLpFeePortion, "0.00", "lp fee portion") + cmd.Flags().String(FlagStakingFeePortion, "0.00", "staking fee portion") + cmd.Flags().String(FlagWeightRecoveryFeePortion, "0.00", "weight recovery fee portion") + cmd.Flags().String(FlagThresholdWeightDifference, "0.00", "threshold weight difference - valid for oracle pool") + cmd.Flags().String(FlagFeeDenom, "", "fee denom") + + return cmd +} diff --git a/x/amm/client/wasm/messenger.go b/x/amm/client/wasm/messenger.go index f6198bb39..3824c2164 100644 --- a/x/amm/client/wasm/messenger.go +++ b/x/amm/client/wasm/messenger.go @@ -31,6 +31,8 @@ func (m *Messenger) HandleMsg(ctx sdk.Context, contractAddr sdk.AccAddress, cont return m.msgSwapByDenom(ctx, contractAddr, msg.AmmSwapByDenom) case msg.AmmFeedMultipleExternalLiquidity != nil: return m.msgFeedMultipleExternalLiquidity(ctx, contractAddr, msg.AmmFeedMultipleExternalLiquidity) + case msg.AmmUpdatePoolParams != nil: + return m.msgUpdatePoolParams(ctx, contractAddr, msg.AmmUpdatePoolParams) default: // This handler cannot handle the message return nil, nil, wasmbindingstypes.ErrCannotHandleMsg diff --git a/x/amm/client/wasm/msg_update_pool_params.go b/x/amm/client/wasm/msg_update_pool_params.go new file mode 100644 index 000000000..0a9f8e9c4 --- /dev/null +++ b/x/amm/client/wasm/msg_update_pool_params.go @@ -0,0 +1,44 @@ +package wasm + +import ( + "encoding/json" + + errorsmod "cosmossdk.io/errors" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + ammkeeper "github.com/elys-network/elys/x/amm/keeper" + ammtypes "github.com/elys-network/elys/x/amm/types" +) + +func (m *Messenger) msgUpdatePoolParams(ctx sdk.Context, contractAddr sdk.AccAddress, msg *ammtypes.MsgUpdatePoolParams) ([]sdk.Event, [][]byte, error) { + if msg == nil { + return nil, nil, wasmvmtypes.InvalidRequest{Err: "update pool params null msg"} + } + + if msg.Sender != contractAddr.String() { + return nil, nil, wasmvmtypes.InvalidRequest{Err: "update pool params wrong sender"} + } + + msgServer := ammkeeper.NewMsgServerImpl(*m.keeper) + + if err := msg.ValidateBasic(); err != nil { + return nil, nil, errorsmod.Wrap(err, "failed validating msg") + } + + res, err := msgServer.UpdatePoolParams( + sdk.WrapSDKContext(ctx), + msg, + ) + if err != nil { + return nil, nil, errorsmod.Wrap(err, "update pool params msg") + } + + responseBytes, err := json.Marshal(*res) + if err != nil { + return nil, nil, errorsmod.Wrap(err, "failed to serialize update pool params response") + } + + resp := [][]byte{responseBytes} + + return nil, resp, nil +} diff --git a/x/amm/keeper/keeper.go b/x/amm/keeper/keeper.go index 599f4c3b4..eb0c85dbc 100644 --- a/x/amm/keeper/keeper.go +++ b/x/amm/keeper/keeper.go @@ -19,6 +19,7 @@ type ( storeKey storetypes.StoreKey transientStoreKey storetypes.StoreKey paramstore paramtypes.Subspace + authority string hooks types.AmmHooks bankKeeper types.BankKeeper @@ -35,6 +36,7 @@ func NewKeeper( storeKey, transientStoreKey storetypes.StoreKey, ps paramtypes.Subspace, + authority string, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, @@ -53,6 +55,7 @@ func NewKeeper( storeKey: storeKey, transientStoreKey: transientStoreKey, paramstore: ps, + authority: authority, bankKeeper: bankKeeper, accountKeeper: accountKeeper, diff --git a/x/amm/keeper/keeper_create_pool.go b/x/amm/keeper/keeper_create_pool.go index e44cc9028..55de60be4 100644 --- a/x/amm/keeper/keeper_create_pool.go +++ b/x/amm/keeper/keeper_create_pool.go @@ -4,8 +4,11 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/elys-network/elys/x/amm/types" "github.com/elys-network/elys/x/amm/utils" + assetprofiletypes "github.com/elys-network/elys/x/assetprofile/types" + ptypes "github.com/elys-network/elys/x/parameter/types" ) // CreatePool attempts to create a pool returning the newly created pool ID or @@ -26,6 +29,17 @@ func (k Keeper) CreatePool(ctx sdk.Context, msg *types.MsgCreatePool) (uint64, e // return 0, err // } + entry, found := k.apKeeper.GetEntry(ctx, ptypes.BaseCurrency) + if !found { + return 0, sdkerrors.Wrapf(assetprofiletypes.ErrAssetProfileNotFound, "asset %s not found", ptypes.BaseCurrency) + } + baseCurrency := entry.Denom + + // If the fee denom is empty, set it to the base currency + if msg.PoolParams.FeeDenom == "" { + msg.PoolParams.FeeDenom = baseCurrency + } + // Get the next pool ID and increment the pool ID counter // Create the pool with the given pool ID poolId := k.GetNextPoolId(ctx) diff --git a/x/amm/keeper/keeper_update_pool_params.go b/x/amm/keeper/keeper_update_pool_params.go new file mode 100644 index 000000000..ace97ee57 --- /dev/null +++ b/x/amm/keeper/keeper_update_pool_params.go @@ -0,0 +1,34 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/elys-network/elys/x/amm/types" + assetprofiletypes "github.com/elys-network/elys/x/assetprofile/types" + ptypes "github.com/elys-network/elys/x/parameter/types" +) + +// UpdatePoolParams updates the pool params +func (k Keeper) UpdatePoolParams(ctx sdk.Context, poolId uint64, poolParams types.PoolParams) (uint64, types.PoolParams, error) { + pool, found := k.GetPool(ctx, poolId) + if !found { + return 0, types.PoolParams{}, types.ErrPoolNotFound + } + + entry, found := k.apKeeper.GetEntry(ctx, ptypes.BaseCurrency) + if !found { + return 0, types.PoolParams{}, sdkerrors.Wrapf(assetprofiletypes.ErrAssetProfileNotFound, "asset %s not found", ptypes.BaseCurrency) + } + baseCurrency := entry.Denom + + // If the fee denom is empty, set it to the base currency + if poolParams.FeeDenom == "" { + poolParams.FeeDenom = baseCurrency + } + + pool.PoolParams = poolParams + k.SetPool(ctx, pool) + + return pool.PoolId, pool.PoolParams, nil + +} diff --git a/x/amm/keeper/msg_server_create_pool.go b/x/amm/keeper/msg_server_create_pool.go index e7bcc5a44..cab1ab4a8 100644 --- a/x/amm/keeper/msg_server_create_pool.go +++ b/x/amm/keeper/msg_server_create_pool.go @@ -5,6 +5,8 @@ import ( "strconv" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/elys-network/elys/x/amm/types" ) @@ -14,6 +16,10 @@ import ( func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (*types.MsgCreatePoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + if k.authority != msg.Sender { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Sender) + } + poolId, err := k.Keeper.CreatePool(ctx, msg) if err != nil { return &types.MsgCreatePoolResponse{}, err diff --git a/x/amm/keeper/msg_server_update_pool_params.go b/x/amm/keeper/msg_server_update_pool_params.go new file mode 100644 index 000000000..4a866dc36 --- /dev/null +++ b/x/amm/keeper/msg_server_update_pool_params.go @@ -0,0 +1,28 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/elys-network/elys/x/amm/types" +) + +func (k msgServer) UpdatePoolParams(goCtx context.Context, msg *types.MsgUpdatePoolParams) (*types.MsgUpdatePoolParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.authority != msg.Sender { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Sender) + } + + poolId, poolParams, err := k.Keeper.UpdatePoolParams(ctx, msg.PoolId, *msg.PoolParams) + if err != nil { + return nil, err + } + + return &types.MsgUpdatePoolParamsResponse{ + PoolId: poolId, + PoolParams: &poolParams, + }, nil +} diff --git a/x/amm/keeper/msg_server_update_pool_params_test.go b/x/amm/keeper/msg_server_update_pool_params_test.go new file mode 100644 index 000000000..e6103656c --- /dev/null +++ b/x/amm/keeper/msg_server_update_pool_params_test.go @@ -0,0 +1,224 @@ +package keeper_test + +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" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/elys-network/elys/x/amm/keeper" + "github.com/elys-network/elys/x/amm/types" + ptypes "github.com/elys-network/elys/x/parameter/types" +) + +func (suite *KeeperTestSuite) TestMsgServerUpdatePoolParams() { + for _, tc := range []struct { + desc string + senderInitBalance sdk.Coins + initialPoolParams types.PoolParams + updatedPoolParams types.PoolParams + poolAssets []types.PoolAsset + expSenderBalance sdk.Coins + expTotalLiquidity sdk.Coins + expLpCommitment sdk.Coin + expPass bool + }{ + { + desc: "zero tvl pool creation", + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 1000000)}, + initialPoolParams: types.PoolParams{ + SwapFee: sdk.ZeroDec(), + ExitFee: sdk.ZeroDec(), + UseOracle: false, + WeightBreakingFeeMultiplier: sdk.ZeroDec(), + ExternalLiquidityRatio: sdk.NewDec(1), + LpFeePortion: sdk.ZeroDec(), + StakingFeePortion: sdk.ZeroDec(), + WeightRecoveryFeePortion: sdk.ZeroDec(), + ThresholdWeightDifference: sdk.ZeroDec(), + FeeDenom: ptypes.BaseCurrency, + }, + updatedPoolParams: types.PoolParams{ + SwapFee: sdk.MustNewDecFromStr("0.01"), + ExitFee: sdk.MustNewDecFromStr("0.02"), + UseOracle: false, + WeightBreakingFeeMultiplier: sdk.ZeroDec(), + ExternalLiquidityRatio: sdk.NewDec(1), + LpFeePortion: sdk.ZeroDec(), + StakingFeePortion: sdk.ZeroDec(), + WeightRecoveryFeePortion: sdk.ZeroDec(), + ThresholdWeightDifference: sdk.ZeroDec(), + FeeDenom: "feedenom", + }, + poolAssets: []types.PoolAsset{ + { + Token: sdk.NewInt64Coin(ptypes.Eden, 1000000), + Weight: sdk.OneInt(), + }, + { + Token: sdk.NewInt64Coin(ptypes.Elys, 1000000), + Weight: sdk.OneInt(), + }, + }, + expSenderBalance: sdk.Coins{}, + expLpCommitment: sdk.NewCoin("amm/pool/1", sdk.NewInt(100).Mul(types.OneShare)), + expPass: true, + }, + { + desc: "positive tvl pool creation", + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, + initialPoolParams: types.PoolParams{ + SwapFee: sdk.ZeroDec(), + ExitFee: sdk.ZeroDec(), + UseOracle: false, + WeightBreakingFeeMultiplier: sdk.ZeroDec(), + ExternalLiquidityRatio: sdk.NewDec(1), + LpFeePortion: sdk.ZeroDec(), + StakingFeePortion: sdk.ZeroDec(), + WeightRecoveryFeePortion: sdk.ZeroDec(), + ThresholdWeightDifference: sdk.ZeroDec(), + FeeDenom: ptypes.BaseCurrency, + }, + updatedPoolParams: types.PoolParams{ + SwapFee: sdk.ZeroDec(), + ExitFee: sdk.ZeroDec(), + UseOracle: false, + WeightBreakingFeeMultiplier: sdk.ZeroDec(), + ExternalLiquidityRatio: sdk.NewDec(1), + LpFeePortion: sdk.ZeroDec(), + StakingFeePortion: sdk.ZeroDec(), + WeightRecoveryFeePortion: sdk.ZeroDec(), + ThresholdWeightDifference: sdk.ZeroDec(), + FeeDenom: ptypes.BaseCurrency, + }, + poolAssets: []types.PoolAsset{ + { + Token: sdk.NewInt64Coin(ptypes.Eden, 1000000), + Weight: sdk.OneInt(), + }, + { + Token: sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), + Weight: sdk.OneInt(), + }, + }, + expSenderBalance: sdk.Coins{}, + expLpCommitment: sdk.NewCoin("amm/pool/1", sdk.NewInt(2).Mul(types.OneShare)), + expPass: true, + }, + { + desc: "not enough balance to create pool", + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000)}, + initialPoolParams: types.PoolParams{ + SwapFee: sdk.ZeroDec(), + ExitFee: sdk.ZeroDec(), + UseOracle: false, + WeightBreakingFeeMultiplier: sdk.ZeroDec(), + ExternalLiquidityRatio: sdk.NewDec(1), + LpFeePortion: sdk.ZeroDec(), + StakingFeePortion: sdk.ZeroDec(), + WeightRecoveryFeePortion: sdk.ZeroDec(), + ThresholdWeightDifference: sdk.ZeroDec(), + FeeDenom: ptypes.BaseCurrency, + }, + poolAssets: []types.PoolAsset{ + { + Token: sdk.NewInt64Coin(ptypes.Eden, 1000000), + Weight: sdk.OneInt(), + }, + { + Token: sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), + Weight: sdk.OneInt(), + }, + }, + expSenderBalance: sdk.Coins{}, + expLpCommitment: sdk.Coin{}, + expPass: false, + }, + } { + suite.Run(tc.desc, func() { + suite.SetupTest() + suite.SetupStableCoinPrices() + + // bootstrap accounts + // sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + // use gov address as sender + sender := authtypes.NewModuleAddress(govtypes.ModuleName) + + // bootstrap balances + err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, tc.senderInitBalance) + suite.Require().NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, sender, tc.senderInitBalance) + suite.Require().NoError(err) + + // execute function + msgServer := keeper.NewMsgServerImpl(suite.app.AmmKeeper) + resp, err := msgServer.CreatePool( + sdk.WrapSDKContext(suite.ctx), + &types.MsgCreatePool{ + Sender: sender.String(), + PoolParams: &tc.initialPoolParams, + PoolAssets: tc.poolAssets, + }) + if !tc.expPass { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(resp.PoolID, uint64(1)) + + pools := suite.app.AmmKeeper.GetAllPool(suite.ctx) + suite.Require().Len(pools, 1) + suite.Require().Equal(pools[0].PoolId, uint64(1)) + suite.Require().Equal(pools[0].PoolParams, tc.initialPoolParams) + suite.Require().Equal(pools[0].TotalShares.Amount.String(), tc.expLpCommitment.Amount.String()) + + totalWeight := sdk.ZeroInt() + for _, poolAsset := range tc.poolAssets { + totalWeight = totalWeight.Add(poolAsset.Weight) + } + suite.Require().Equal(pools[0].TotalWeight.String(), totalWeight.MulRaw(types.GuaranteedWeightPrecision).String()) + + // check balance change on sender + balances := suite.app.BankKeeper.GetAllBalances(suite.ctx, sender) + suite.Require().Equal(balances.String(), tc.expSenderBalance.String()) + + // check lp token commitment + commitments := suite.app.CommitmentKeeper.GetCommitments(suite.ctx, sender.String()) + suite.Require().Len(commitments.CommittedTokens, 1) + suite.Require().Equal(commitments.CommittedTokens[0].Denom, tc.expLpCommitment.Denom) + suite.Require().Equal(commitments.CommittedTokens[0].Amount.String(), tc.expLpCommitment.Amount.String()) + + resp2, err := msgServer.UpdatePoolParams( + sdk.WrapSDKContext(suite.ctx), + &types.MsgUpdatePoolParams{ + Sender: sender.String(), + PoolId: pools[0].PoolId, + PoolParams: &tc.updatedPoolParams, + }) + + suite.Require().NoError(err) + suite.Require().Equal(resp2.PoolId, uint64(1)) + + pools = suite.app.AmmKeeper.GetAllPool(suite.ctx) + suite.Require().Len(pools, 1) + suite.Require().Equal(pools[0].PoolId, uint64(1)) + suite.Require().Equal(pools[0].PoolParams, tc.updatedPoolParams) + suite.Require().Equal(pools[0].TotalShares.Amount.String(), tc.expLpCommitment.Amount.String()) + + totalWeight = sdk.ZeroInt() + for _, poolAsset := range tc.poolAssets { + totalWeight = totalWeight.Add(poolAsset.Weight) + } + suite.Require().Equal(pools[0].TotalWeight.String(), totalWeight.MulRaw(types.GuaranteedWeightPrecision).String()) + + // check balance change on sender + balances = suite.app.BankKeeper.GetAllBalances(suite.ctx, sender) + suite.Require().Equal(balances.String(), tc.expSenderBalance.String()) + + // check lp token commitment + commitments = suite.app.CommitmentKeeper.GetCommitments(suite.ctx, sender.String()) + suite.Require().Len(commitments.CommittedTokens, 1) + suite.Require().Equal(commitments.CommittedTokens[0].Denom, tc.expLpCommitment.Denom) + suite.Require().Equal(commitments.CommittedTokens[0].Amount.String(), tc.expLpCommitment.Amount.String()) + } + }) + } +} diff --git a/x/amm/module_simulation.go b/x/amm/module_simulation.go index b0fd6e97b..c1650e495 100644 --- a/x/amm/module_simulation.go +++ b/x/amm/module_simulation.go @@ -46,6 +46,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgSwapByDenom int = 100 + opWeightMsgUpdatePoolParams = "op_weight_msg_update_pool_params" + // TODO: Determine the simulation weight value + defaultWeightMsgUpdatePoolParams int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -140,6 +144,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp ammsimulation.SimulateMsgSwapByDenom(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgUpdatePoolParams int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUpdatePoolParams, &weightMsgUpdatePoolParams, nil, + func(_ *rand.Rand) { + weightMsgUpdatePoolParams = defaultWeightMsgUpdatePoolParams + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUpdatePoolParams, + ammsimulation.SimulateMsgUpdatePoolParams(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations diff --git a/x/amm/simulation/update_pool_params.go b/x/amm/simulation/update_pool_params.go new file mode 100644 index 000000000..52bc295e0 --- /dev/null +++ b/x/amm/simulation/update_pool_params.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/elys-network/elys/x/amm/keeper" + "github.com/elys-network/elys/x/amm/types" +) + +func SimulateMsgUpdatePoolParams( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgUpdatePoolParams{ + Sender: simAccount.Address.String(), + } + + // TODO: Handling the UpdatePoolParams simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UpdatePoolParams simulation not implemented"), nil, nil + } +} diff --git a/x/amm/types/codec.go b/x/amm/types/codec.go index 241be977f..98d1368f5 100644 --- a/x/amm/types/codec.go +++ b/x/amm/types/codec.go @@ -15,6 +15,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgSwapExactAmountOut{}, "amm/SwapExactAmountOut", nil) cdc.RegisterConcrete(&MsgSwapByDenom{}, "amm/SwapByDenom", nil) cdc.RegisterConcrete(&MsgFeedMultipleExternalLiquidity{}, "amm/FeedMultipleExternalLiquidity", nil) + cdc.RegisterConcrete(&MsgUpdatePoolParams{}, "amm/UpdatePoolParams", nil) // this line is used by starport scaffolding # 2 } @@ -27,6 +28,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgSwapExactAmountOut{}, &MsgSwapByDenom{}, &MsgFeedMultipleExternalLiquidity{}, + &MsgUpdatePoolParams{}, ) // this line is used by starport scaffolding # 3 diff --git a/x/amm/types/message_update_pool_params.go b/x/amm/types/message_update_pool_params.go new file mode 100644 index 000000000..e1ee5062c --- /dev/null +++ b/x/amm/types/message_update_pool_params.go @@ -0,0 +1,47 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgUpdatePoolParams = "update_pool_params" + +var _ sdk.Msg = &MsgUpdatePoolParams{} + +func NewMsgUpdatePoolParams(sender string, poolId uint64, poolParams *PoolParams) *MsgUpdatePoolParams { + return &MsgUpdatePoolParams{ + Sender: sender, + PoolId: poolId, + PoolParams: poolParams, + } +} + +func (msg *MsgUpdatePoolParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdatePoolParams) Type() string { + return TypeMsgUpdatePoolParams +} + +func (msg *MsgUpdatePoolParams) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgUpdatePoolParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdatePoolParams) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + return nil +} diff --git a/x/amm/types/message_update_pool_params_test.go b/x/amm/types/message_update_pool_params_test.go new file mode 100644 index 000000000..192479e7e --- /dev/null +++ b/x/amm/types/message_update_pool_params_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/elys-network/elys/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgUpdatePoolParams_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUpdatePoolParams + err error + }{ + { + name: "invalid address", + msg: MsgUpdatePoolParams{ + Sender: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgUpdatePoolParams{ + Sender: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/amm/types/tx.pb.go b/x/amm/types/tx.pb.go index dea312070..33b5a26f4 100644 --- a/x/amm/types/tx.pb.go +++ b/x/amm/types/tx.pb.go @@ -948,6 +948,118 @@ func (m *MsgSwapByDenomResponse) GetRecipient() string { return "" } +type MsgUpdatePoolParams struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,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"` +} + +func (m *MsgUpdatePoolParams) Reset() { *m = MsgUpdatePoolParams{} } +func (m *MsgUpdatePoolParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdatePoolParams) ProtoMessage() {} +func (*MsgUpdatePoolParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7ddafd861f6b7f, []int{16} +} +func (m *MsgUpdatePoolParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdatePoolParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdatePoolParams.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 *MsgUpdatePoolParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdatePoolParams.Merge(m, src) +} +func (m *MsgUpdatePoolParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdatePoolParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdatePoolParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdatePoolParams proto.InternalMessageInfo + +func (m *MsgUpdatePoolParams) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgUpdatePoolParams) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *MsgUpdatePoolParams) GetPoolParams() *PoolParams { + if m != nil { + return m.PoolParams + } + return nil +} + +type MsgUpdatePoolParamsResponse struct { + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + PoolParams *PoolParams `protobuf:"bytes,2,opt,name=pool_params,json=poolParams,proto3" json:"pool_params,omitempty"` +} + +func (m *MsgUpdatePoolParamsResponse) Reset() { *m = MsgUpdatePoolParamsResponse{} } +func (m *MsgUpdatePoolParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdatePoolParamsResponse) ProtoMessage() {} +func (*MsgUpdatePoolParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ed7ddafd861f6b7f, []int{17} +} +func (m *MsgUpdatePoolParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdatePoolParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdatePoolParamsResponse.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 *MsgUpdatePoolParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdatePoolParamsResponse.Merge(m, src) +} +func (m *MsgUpdatePoolParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdatePoolParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdatePoolParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdatePoolParamsResponse proto.InternalMessageInfo + +func (m *MsgUpdatePoolParamsResponse) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *MsgUpdatePoolParamsResponse) GetPoolParams() *PoolParams { + if m != nil { + return m.PoolParams + } + return nil +} + func init() { proto.RegisterType((*MsgCreatePool)(nil), "elys.amm.MsgCreatePool") proto.RegisterType((*MsgCreatePoolResponse)(nil), "elys.amm.MsgCreatePoolResponse") @@ -965,90 +1077,95 @@ func init() { proto.RegisterType((*ExternalLiquidity)(nil), "elys.amm.ExternalLiquidity") proto.RegisterType((*MsgSwapByDenom)(nil), "elys.amm.MsgSwapByDenom") proto.RegisterType((*MsgSwapByDenomResponse)(nil), "elys.amm.MsgSwapByDenomResponse") + proto.RegisterType((*MsgUpdatePoolParams)(nil), "elys.amm.MsgUpdatePoolParams") + proto.RegisterType((*MsgUpdatePoolParamsResponse)(nil), "elys.amm.MsgUpdatePoolParamsResponse") } func init() { proto.RegisterFile("elys/amm/tx.proto", fileDescriptor_ed7ddafd861f6b7f) } var fileDescriptor_ed7ddafd861f6b7f = []byte{ - // 1242 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcb, 0x6e, 0x23, 0x45, - 0x17, 0x4e, 0xdb, 0x8e, 0x2f, 0xc7, 0x93, 0x5b, 0x27, 0x99, 0x38, 0x9e, 0xc4, 0xf1, 0xdf, 0xbf, - 0x14, 0xac, 0x91, 0xc6, 0xd6, 0x04, 0x01, 0x9a, 0x68, 0x04, 0x8c, 0x27, 0x09, 0xf2, 0x68, 0xac, - 0x44, 0x3d, 0xd2, 0x08, 0x81, 0xc0, 0xea, 0xd8, 0x15, 0xa7, 0x14, 0x77, 0x55, 0xe3, 0x2a, 0x13, - 0x07, 0x16, 0x48, 0xb0, 0x60, 0xcb, 0x9a, 0x57, 0x00, 0xb6, 0x3c, 0x43, 0x96, 0xb3, 0x44, 0xb3, - 0x88, 0x50, 0xf2, 0x02, 0x88, 0x27, 0x40, 0x55, 0x5d, 0xdd, 0xed, 0xf6, 0x25, 0x71, 0xac, 0x08, - 0x89, 0x95, 0xbb, 0xcf, 0xa9, 0x73, 0xba, 0xce, 0xf7, 0x9d, 0x4b, 0x95, 0x61, 0x01, 0xb5, 0xce, - 0x58, 0xc9, 0xb2, 0xed, 0x12, 0xef, 0x16, 0x9d, 0x36, 0xe5, 0x54, 0x4f, 0x0a, 0x51, 0xd1, 0xb2, - 0xed, 0xec, 0x52, 0x93, 0x36, 0xa9, 0x14, 0x96, 0xc4, 0x93, 0xab, 0xcf, 0xe6, 0xea, 0x94, 0xd9, - 0x94, 0x95, 0x0e, 0x2d, 0x86, 0x4a, 0x5f, 0x3f, 0x3e, 0x44, 0xdc, 0x7a, 0x5c, 0xaa, 0x53, 0x4c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a, - 0x80, 0x60, 0xe8, 0x8e, 0x97, 0xdd, 0x18, 0xa1, 0xf0, 0xf9, 0xff, 0x18, 0x92, 0xfe, 0x9d, 0x6e, - 0x39, 0xb4, 0xd8, 0x13, 0x67, 0xd7, 0x87, 0x8a, 0x7b, 0x3d, 0xf8, 0x57, 0x8c, 0xb0, 0x07, 0x4f, - 0xdc, 0xe7, 0x61, 0xe0, 0x1c, 0xfe, 0x39, 0x2c, 0x0c, 0x9e, 0xa2, 0x73, 0x21, 0x9b, 0x01, 0x7d, - 0x76, 0xf3, 0x7a, 0xbd, 0xef, 0xfc, 0x4b, 0xd0, 0x87, 0x9c, 0x7f, 0x36, 0xae, 0xb3, 0xde, 0xef, - 0xf0, 0xec, 0x3b, 0x37, 0x2c, 0xf0, 0xfd, 0x57, 0x20, 0xdd, 0xdb, 0xdd, 0x32, 0x03, 0x76, 0x4a, - 0x93, 0xcd, 0x8f, 0xd2, 0xf8, 0xae, 0xbe, 0x83, 0xf5, 0xeb, 0xe7, 0xe0, 0xc3, 0x90, 0x8b, 0x6b, - 0xd7, 0x66, 0xb7, 0xc6, 0x5f, 0xeb, 0x6d, 0xa0, 0x5c, 0x3e, 0xbf, 0xcc, 0x69, 0x6f, 0x2e, 0x73, - 0xda, 0x9f, 0x97, 0x39, 0xed, 0xa7, 0xab, 0xdc, 0xd4, 0x9b, 0xab, 0xdc, 0xd4, 0x1f, 0x57, 0xb9, - 0xa9, 0xcf, 0x0a, 0x3d, 0x69, 0x2c, 0xfc, 0x3e, 0x22, 0x88, 0x9f, 0xd2, 0xf6, 0x89, 0x7c, 0x29, - 0x75, 0xdd, 0xff, 0x6b, 0x44, 0x32, 0x1f, 0xc6, 0xe5, 0x5f, 0x21, 0xef, 0xfe, 0x13, 0x00, 0x00, - 0xff, 0xff, 0xd6, 0x71, 0x06, 0x82, 0xc8, 0x11, 0x00, 0x00, + // 1291 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x5f, 0x6f, 0x1b, 0x45, + 0x10, 0xcf, 0xd9, 0xf1, 0xbf, 0x71, 0xd3, 0x34, 0xd7, 0xb4, 0x75, 0x9c, 0xc4, 0x31, 0x87, 0x08, + 0x56, 0xa5, 0xda, 0x6a, 0x10, 0xa0, 0x46, 0x15, 0x50, 0x37, 0x09, 0x72, 0x55, 0x2b, 0xd1, 0x55, + 0x54, 0x08, 0x04, 0xd6, 0xc5, 0xde, 0x38, 0xab, 0xf8, 0x76, 0x0f, 0xef, 0x9a, 0x38, 0x20, 0x84, + 0x04, 0x0f, 0xbc, 0xf2, 0xcc, 0x57, 0x00, 0xde, 0x10, 0x9f, 0x21, 0x8f, 0x7d, 0x44, 0x3c, 0x44, + 0x28, 0xf9, 0x02, 0x88, 0x4f, 0x80, 0x76, 0x6f, 0xef, 0xce, 0xe7, 0x7f, 0x71, 0xac, 0x08, 0x89, + 0x27, 0xdf, 0xcd, 0xec, 0xcc, 0xed, 0xfc, 0x7e, 0x33, 0xb3, 0x3b, 0x86, 0x05, 0xd4, 0x3a, 0x61, + 0x25, 0xcb, 0xb6, 0x4b, 0xbc, 0x5b, 0x74, 0xda, 0x94, 0x53, 0x3d, 0x29, 0x44, 0x45, 0xcb, 0xb6, + 0xb3, 0x8b, 0x4d, 0xda, 0xa4, 0x52, 0x58, 0x12, 0x4f, 0xae, 0x3e, 0x9b, 0xab, 0x53, 0x66, 0x53, + 0x56, 0xda, 0xb7, 0x18, 0x2a, 0x7d, 0xf9, 0x70, 0x1f, 0x71, 0xeb, 0x61, 0xa9, 0x4e, 0x31, 0x51, + 0xfa, 0x3b, 0xbe, 0x4b, 0xc7, 0x6a, 0x5b, 0x36, 0x53, 0xe2, 0x25, 0x5f, 0xcc, 0x8e, 0x2d, 0xa7, + 0xd6, 0xa6, 0x1d, 0x8e, 0x94, 0x2a, 0x1b, 0x58, 0x50, 0xda, 0xaa, 0x8d, 0x30, 0x93, 0x3a, 0x8b, + 0x31, 0xc4, 0x5d, 0x95, 0xf1, 0x93, 0x06, 0x73, 0x55, 0xd6, 0x7c, 0xda, 0x46, 0x16, 0x47, 0x7b, + 0x94, 0xb6, 0xf4, 0xbb, 0x10, 0x67, 0x88, 0x34, 0x50, 0x3b, 0xa3, 0xe5, 0xb5, 0x42, 0xca, 0x54, + 0x6f, 0xfa, 0xdb, 0x90, 0xee, 0xf1, 0x9c, 0x89, 0xe4, 0xb5, 0x42, 0x7a, 0x63, 0xb1, 0xe8, 0x05, + 0x5a, 0x14, 0xc6, 0x7b, 0x52, 0x67, 0x82, 0xe3, 0x3f, 0xeb, 0x9b, 0xca, 0x4c, 0x7e, 0x94, 0x65, + 0xa2, 0xf9, 0x68, 0x21, 0xbd, 0x71, 0x3b, 0x6c, 0xf6, 0x44, 0xe8, 0xca, 0xb3, 0xa7, 0x67, 0x6b, + 0x33, 0xae, 0xad, 0x14, 0x30, 0xe3, 0x31, 0xdc, 0x09, 0xed, 0xcd, 0x44, 0xcc, 0xa1, 0x84, 0x21, + 0xfd, 0x75, 0x48, 0x48, 0xa7, 0xb8, 0x21, 0x37, 0x39, 0x5b, 0x86, 0xf3, 0xb3, 0xb5, 0xb8, 0x58, + 0x52, 0xd9, 0x32, 0xe3, 0x42, 0x55, 0x69, 0x18, 0xdf, 0x45, 0x20, 0x5d, 0x65, 0xcd, 0x67, 0x14, + 0x93, 0xb1, 0x81, 0xdd, 0x0b, 0x9c, 0x89, 0xa0, 0x66, 0x3d, 0x07, 0xfa, 0x36, 0xdc, 0xb4, 0xad, + 0x6e, 0xcd, 0xb2, 0x69, 0x87, 0x70, 0x56, 0xc3, 0x44, 0xed, 0x7e, 0xa9, 0xe8, 0xb2, 0x57, 0x14, + 0xec, 0x15, 0x15, 0x7b, 0xc5, 0xa7, 0x14, 0x13, 0x15, 0xc3, 0x0d, 0xdb, 0xea, 0x3e, 0x71, 0xad, + 0x2a, 0x44, 0xff, 0x18, 0x6e, 0xb1, 0x43, 0xab, 0x8d, 0x94, 0xa3, 0x1a, 0xed, 0xf0, 0xcc, 0xac, + 0xd8, 0x41, 0xb9, 0x28, 0x56, 0xff, 0x79, 0xb6, 0xb6, 0xde, 0xc4, 0xfc, 0xb0, 0xb3, 0x5f, 0xac, + 0x53, 0xbb, 0xa4, 0x12, 0xc3, 0xfd, 0x79, 0xc0, 0x1a, 0x47, 0x25, 0x7e, 0xe2, 0x20, 0x56, 0xac, + 0x10, 0x6e, 0xde, 0x94, 0x7e, 0x5c, 0xcf, 0xbb, 0x1d, 0xae, 0xbf, 0x06, 0x37, 0x08, 0xad, 0xb5, + 0x91, 0x6d, 0x61, 0x82, 0x49, 0x33, 0x13, 0xcb, 0x6b, 0x85, 0xa4, 0x99, 0x26, 0xd4, 0xf4, 0x44, + 0xc6, 0xcf, 0x1a, 0xdc, 0xee, 0x01, 0xc1, 0x47, 0x70, 0xd8, 0xa6, 0xb4, 0x6b, 0xd9, 0xd4, 0x26, + 0x24, 0x39, 0x3d, 0x42, 0x44, 0xe0, 0x15, 0x99, 0x0c, 0xaf, 0x84, 0x34, 0xa8, 0x10, 0xe3, 0x07, + 0x97, 0xb2, 0xed, 0x2e, 0xe6, 0xd3, 0x51, 0xf6, 0x21, 0xcc, 0xdb, 0x98, 0xf8, 0x94, 0x89, 0xa8, + 0x26, 0xe4, 0x6c, 0xce, 0xc6, 0x44, 0x71, 0x26, 0xa2, 0x78, 0x09, 0xf3, 0x21, 0x7c, 0x30, 0x99, + 0x92, 0xb3, 0xb9, 0x1e, 0x78, 0x2a, 0x44, 0x5f, 0x87, 0x79, 0x17, 0x1d, 0xda, 0xe1, 0xb5, 0x06, + 0x22, 0xd4, 0x96, 0xac, 0xa5, 0xcc, 0x39, 0x29, 0xde, 0xed, 0xf0, 0x2d, 0x21, 0x34, 0x5e, 0x48, + 0xda, 0x3c, 0x20, 0x7c, 0xda, 0x1e, 0x43, 0xca, 0x37, 0x9f, 0x14, 0xdd, 0xa4, 0xe7, 0xd9, 0xf8, +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c, 0xeb, 0x10, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1070,6 +1187,7 @@ type MsgClient interface { SwapExactAmountOut(ctx context.Context, in *MsgSwapExactAmountOut, opts ...grpc.CallOption) (*MsgSwapExactAmountOutResponse, error) 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) } type msgClient struct { @@ -1143,6 +1261,15 @@ func (c *msgClient) FeedMultipleExternalLiquidity(ctx context.Context, in *MsgFe return out, nil } +func (c *msgClient) UpdatePoolParams(ctx context.Context, in *MsgUpdatePoolParams, opts ...grpc.CallOption) (*MsgUpdatePoolParamsResponse, error) { + out := new(MsgUpdatePoolParamsResponse) + err := c.cc.Invoke(ctx, "/elys.amm.Msg/UpdatePoolParams", 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) @@ -1152,6 +1279,7 @@ type MsgServer interface { SwapExactAmountOut(context.Context, *MsgSwapExactAmountOut) (*MsgSwapExactAmountOutResponse, error) SwapByDenom(context.Context, *MsgSwapByDenom) (*MsgSwapByDenomResponse, error) FeedMultipleExternalLiquidity(context.Context, *MsgFeedMultipleExternalLiquidity) (*MsgFeedMultipleExternalLiquidityResponse, error) + UpdatePoolParams(context.Context, *MsgUpdatePoolParams) (*MsgUpdatePoolParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1179,6 +1307,9 @@ func (*UnimplementedMsgServer) SwapByDenom(ctx context.Context, req *MsgSwapByDe func (*UnimplementedMsgServer) FeedMultipleExternalLiquidity(ctx context.Context, req *MsgFeedMultipleExternalLiquidity) (*MsgFeedMultipleExternalLiquidityResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FeedMultipleExternalLiquidity not implemented") } +func (*UnimplementedMsgServer) UpdatePoolParams(ctx context.Context, req *MsgUpdatePoolParams) (*MsgUpdatePoolParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatePoolParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1310,6 +1441,24 @@ func _Msg_FeedMultipleExternalLiquidity_Handler(srv interface{}, ctx context.Con return interceptor(ctx, in, info, handler) } +func _Msg_UpdatePoolParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdatePoolParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdatePoolParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.amm.Msg/UpdatePoolParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdatePoolParams(ctx, req.(*MsgUpdatePoolParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "elys.amm.Msg", HandlerType: (*MsgServer)(nil), @@ -1342,6 +1491,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "FeedMultipleExternalLiquidity", Handler: _Msg_FeedMultipleExternalLiquidity_Handler, }, + { + MethodName: "UpdatePoolParams", + Handler: _Msg_UpdatePoolParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "elys/amm/tx.proto", @@ -2280,6 +2433,93 @@ func (m *MsgSwapByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgUpdatePoolParams) 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 *MsgUpdatePoolParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdatePoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PoolParams != nil { + { + size, err := m.PoolParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.PoolId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.PoolId)) + 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))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdatePoolParamsResponse) 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 *MsgUpdatePoolParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdatePoolParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PoolParams != nil { + { + size, err := m.PoolParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -2638,6 +2878,42 @@ func (m *MsgSwapByDenomResponse) Size() (n int) { return n } +func (m *MsgUpdatePoolParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovTx(uint64(m.PoolId)) + } + if m.PoolParams != nil { + l = m.PoolParams.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdatePoolParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovTx(uint64(m.PoolId)) + } + if m.PoolParams != nil { + l = m.PoolParams.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -5338,6 +5614,248 @@ func (m *MsgSwapByDenomResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdatePoolParams) 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: MsgUpdatePoolParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdatePoolParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolParams", 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.PoolParams == nil { + m.PoolParams = &PoolParams{} + } + if err := m.PoolParams.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 *MsgUpdatePoolParamsResponse) 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: MsgUpdatePoolParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdatePoolParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolParams", 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.PoolParams == nil { + m.PoolParams = &PoolParams{} + } + if err := m.PoolParams.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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0