diff --git a/app/ante.go b/app/ante.go index 57d33d8d7..001ad5cc6 100644 --- a/app/ante.go +++ b/app/ante.go @@ -122,15 +122,11 @@ func (min MinCommissionDecorator) AnteHandle( simulate bool, next sdk.AnteHandler, ) (newCtx sdk.Context, err error) { msgs := tx.GetMsgs() - minCommissionRate := sdk.NewDecWithPrec(5, 2) // 5% as a fraction - maxVotingPower := sdk.NewDec(100) // 100% // Fetch parameter from parameter module - params, found := min.pk.GetAnteHandlerParam(ctx) - if found { - minCommissionRate = params.MinCommissionRate - maxVotingPower = params.MaxVotingPower - } + params := min.pk.GetParams(ctx) + minCommissionRate := params.MinCommissionRate + maxVotingPower := params.MaxVotingPower validMsg := func(m sdk.Msg) error { switch msg := m.(type) { diff --git a/app/app.go b/app/app.go index 7fbe4602f..64256f7ce 100644 --- a/app/app.go +++ b/app/app.go @@ -500,6 +500,12 @@ func NewElysApp( ) bApp.SetParamStore(&app.ConsensusParamsKeeper) + app.ParameterKeeper = *parametermodulekeeper.NewKeeper( + appCodec, + keys[parametermoduletypes.StoreKey], + keys[parametermoduletypes.MemStoreKey], + ) + // add capability keeper and ScopeToModule for ibc module app.CapabilityKeeper = capabilitykeeper.NewKeeper( appCodec, @@ -734,6 +740,7 @@ func NewElysApp( tkeys[ammmoduletypes.TStoreKey], app.GetSubspace(ammmoduletypes.ModuleName), authtypes.NewModuleAddress(govtypes.ModuleName).String(), + &app.ParameterKeeper, app.BankKeeper, app.AccountKeeper, app.OracleKeeper, @@ -802,12 +809,6 @@ func NewElysApp( ) burnerModule := burnermodule.NewAppModule(appCodec, app.BurnerKeeper, app.AccountKeeper, app.BankKeeper) - app.ParameterKeeper = *parametermodulekeeper.NewKeeper( - appCodec, - keys[parametermoduletypes.StoreKey], - keys[parametermoduletypes.MemStoreKey], - app.GetSubspace(parametermoduletypes.ModuleName), - ) parameterModule := parametermodule.NewAppModule(appCodec, app.ParameterKeeper, app.AccountKeeper, app.BankKeeper) wasmDir := filepath.Join(homePath, "wasm") @@ -907,8 +908,8 @@ func NewElysApp( AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)). AddRoute(oracletypes.RouterKey, oraclemodule.NewAssetInfoProposalHandler(&app.OracleKeeper)). - AddRoute(incentivemoduletypes.RouterKey, incentivemodule.NewPoolInfoProposalHandler(&app.IncentiveKeeper)). - AddRoute(parametermoduletypes.RouterKey, parametermodule.NewParameterChangeProposalHandler(&app.ParameterKeeper)) + AddRoute(incentivemoduletypes.RouterKey, incentivemodule.NewPoolInfoProposalHandler(&app.IncentiveKeeper)) + // The gov proposal types can be individually enabled if len(enabledProposals) != 0 { govRouter.AddRoute(wasmmodule.RouterKey, wasmmodule.NewWasmProposalHandler(app.WasmKeeper, enabledProposals)) @@ -924,6 +925,7 @@ func NewElysApp( app.BankKeeper, app.OracleKeeper, app.AssetprofileKeeper, + &app.ParameterKeeper, ) app.ClockKeeper = *clockmodulekeeper.NewKeeper( @@ -1165,6 +1167,7 @@ func NewElysApp( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. genesisModuleOrder := []string{ + parametermoduletypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, @@ -1194,7 +1197,6 @@ func NewElysApp( tokenomicsmoduletypes.ModuleName, burnermoduletypes.ModuleName, ammmoduletypes.ModuleName, - parametermoduletypes.ModuleName, marginmoduletypes.ModuleName, wasmmodule.ModuleName, accountedpoolmoduletypes.ModuleName, @@ -1493,7 +1495,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(incentivemoduletypes.ModuleName) paramsKeeper.Subspace(burnermoduletypes.ModuleName) paramsKeeper.Subspace(ammmoduletypes.ModuleName) - paramsKeeper.Subspace(parametermoduletypes.ModuleName) paramsKeeper.Subspace(marginmoduletypes.ModuleName) paramsKeeper.Subspace(accountedpoolmoduletypes.ModuleName) paramsKeeper.Subspace(transferhooktypes.ModuleName) diff --git a/app/setup_handlers.go b/app/setup_handlers.go index af45bf00b..d5f2bbf35 100644 --- a/app/setup_handlers.go +++ b/app/setup_handlers.go @@ -26,7 +26,6 @@ import ( leveragelptypes "github.com/elys-network/elys/x/leveragelp/types" margintypes "github.com/elys-network/elys/x/margin/types" oracletypes "github.com/elys-network/elys/x/oracle/types" - parametertypes "github.com/elys-network/elys/x/parameter/types" stablestaketypes "github.com/elys-network/elys/x/stablestake/types" tokenomicstypes "github.com/elys-network/elys/x/tokenomics/types" transferhooktypes "github.com/elys-network/elys/x/transferhook/types" @@ -77,8 +76,6 @@ func setUpgradeHandler(app *ElysApp) { keyTable = margintypes.ParamKeyTable() //nolint:staticcheck case oracletypes.ModuleName: keyTable = oracletypes.ParamKeyTable() //nolint:staticcheck - case parametertypes.ModuleName: - keyTable = parametertypes.ParamKeyTable() //nolint:staticcheck case tokenomicstypes.ModuleName: keyTable = tokenomicstypes.ParamKeyTable() //nolint:staticcheck case accountedpooltypes.ModuleName: diff --git a/config.yml b/config.yml index f8f3c209b..050c17a29 100644 --- a/config.yml +++ b/config.yml @@ -432,10 +432,11 @@ genesis: denom: "ueden" amount: "1000000" parameter: - anteHandlerParam: - minCommissionRate: "0.05" - maxVotingPower: "0.66" - minSelfDelegation: "1" + params: + min_commission_rate: "0.05" + max_voting_power: "0.66" + min_self_delegation: "1" + broker_address: "" margin: params: leverage_max: "10" diff --git a/dockernet/src/init_chain.sh b/dockernet/src/init_chain.sh index 7774d4f02..e7ee00484 100644 --- a/dockernet/src/init_chain.sh +++ b/dockernet/src/init_chain.sh @@ -24,7 +24,7 @@ set_elys_genesis() { jq '.app_state.staking.params.unbonding_time = $newVal' --arg newVal "$UNBONDING_TIME" $genesis_config > json.tmp && mv json.tmp $genesis_config jq '.app_state.gov.deposit_params.max_deposit_period = $newVal' --arg newVal "$MAX_DEPOSIT_PERIOD" $genesis_config > json.tmp && mv json.tmp $genesis_config jq '.app_state.gov.voting_params.voting_period = $newVal' --arg newVal "$VOTING_PERIOD" $genesis_config > json.tmp && mv json.tmp $genesis_config - jq '.app_state.parameter.anteHandlerParamList[0].maxVotingPower = $newVal' --arg newVal "100.000000000000000000" $genesis_config > json.tmp && mv json.tmp $genesis_config + jq '.app_state.parameter.params.maxVotingPower = $newVal' --arg newVal "100.000000000000000000" $genesis_config > json.tmp && mv json.tmp $genesis_config } set_band_genesis() { diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index e0be855e5..9bd8b104b 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -37851,8 +37851,6 @@ paths: pool_creation_fee: type: string format: uint64 - broker_address: - type: string description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -38324,7 +38322,7 @@ paths: method signatures required by gogoproto. - swapFee: + swap_fee: type: string discount: type: string @@ -38423,7 +38421,7 @@ paths: method signatures required by gogoproto. - swapFee: + swap_fee: type: string discount: type: string @@ -41716,8 +41714,6 @@ paths: type: boolean invariant_check_epoch: type: string - broker_address: - type: string take_profit_borrow_interest_rate_min: type: string funding_fee_base_rate: @@ -43146,131 +43142,6 @@ paths: additionalProperties: {} tags: - Query - /elys-network/elys/parameter/ante_handler_param: - get: - operationId: ElysParameterAnteHandlerParamAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - ante_handler_param: - type: array - items: - type: object - properties: - min_commission_rate: - type: string - max_voting_power: - type: string - min_self_delegation: - type: string - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query /elys-network/elys/parameter/params: get: summary: Parameters queries the parameters of the module. @@ -43284,6 +43155,15 @@ paths: params: description: params holds all the parameters of this module. type: object + properties: + min_commission_rate: + type: string + max_voting_power: + type: string + min_self_delegation: + type: string + broker_address: + type: string description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -83088,8 +82968,6 @@ definitions: pool_creation_fee: type: string format: uint64 - broker_address: - type: string description: Params defines the parameters for the module. elys.amm.Pool: type: object @@ -83464,8 +83342,6 @@ definitions: pool_creation_fee: type: string format: uint64 - broker_address: - type: string description: QueryParamsResponse is response type for the Query/Params RPC method. elys.amm.QuerySlippageTrackAllResponse: type: object @@ -83564,7 +83440,7 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. - swapFee: + swap_fee: type: string discount: type: string @@ -83597,7 +83473,7 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. - swapFee: + swap_fee: type: string discount: type: string @@ -85728,6 +85604,18 @@ definitions: id: type: string format: uint64 + amount: + 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.margin.MsgBrokerOpenResponse: type: object properties: @@ -85740,6 +85628,18 @@ definitions: id: type: string format: uint64 + amount: + 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.margin.MsgDewhitelistResponse: type: object elys.margin.MsgOpenResponse: @@ -85797,8 +85697,6 @@ definitions: type: boolean invariant_check_epoch: type: string - broker_address: - type: string take_profit_borrow_interest_rate_min: type: string funding_fee_base_rate: @@ -85857,8 +85755,6 @@ definitions: type: boolean invariant_check_epoch: type: string - broker_address: - type: string take_profit_borrow_interest_rate_min: type: string funding_fee_base_rate: @@ -87216,7 +87112,13 @@ definitions: type: string format: uint64 description: QueryParamsResponse is response type for the Query/Params RPC method. - elys.parameter.AnteHandlerParam: + elys.parameter.MsgUpdateMaxVotingPowerResponse: + type: object + elys.parameter.MsgUpdateMinCommissionResponse: + type: object + elys.parameter.MsgUpdateMinSelfDelegationResponse: + type: object + elys.parameter.Params: type: object properties: min_commission_rate: @@ -87225,55 +87127,24 @@ definitions: type: string min_self_delegation: type: string - elys.parameter.Params: - type: object + broker_address: + type: string description: Params defines the parameters for the module. - elys.parameter.QueryAllAnteHandlerParamResponse: - type: object - properties: - ante_handler_param: - type: array - items: - type: object - properties: - min_commission_rate: - type: string - max_voting_power: - type: string - min_self_delegation: - type: string - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } elys.parameter.QueryParamsResponse: type: object properties: params: description: params holds all the parameters of this module. type: object + properties: + min_commission_rate: + type: string + max_voting_power: + type: string + min_self_delegation: + type: string + broker_address: + type: string description: QueryParamsResponse is response type for the Query/Params RPC method. elys.stablestake.MsgBondResponse: type: object diff --git a/proto/elys/amm/params.proto b/proto/elys/amm/params.proto index ae24f0088..7922ce03d 100644 --- a/proto/elys/amm/params.proto +++ b/proto/elys/amm/params.proto @@ -10,5 +10,4 @@ message Params { option (gogoproto.goproto_stringer) = false; uint64 pool_creation_fee = 1; - string broker_address = 2; } diff --git a/proto/elys/margin/params.proto b/proto/elys/margin/params.proto index a51303877..e1555ed5c 100644 --- a/proto/elys/margin/params.proto +++ b/proto/elys/margin/params.proto @@ -63,22 +63,21 @@ message Params { bool incremental_borrow_interest_payment_enabled = 17; bool whitelisting_enabled = 18; string invariant_check_epoch = 19; - string broker_address = 20; - string take_profit_borrow_interest_rate_min = 21 [ + string take_profit_borrow_interest_rate_min = 20 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - string funding_fee_base_rate = 22 [ + string funding_fee_base_rate = 21 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - string funding_fee_max_rate = 23 [ + string funding_fee_max_rate = 22 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - string funding_fee_min_rate = 24 [ + string funding_fee_min_rate = 23 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - string funding_fee_collection_address = 25; + string funding_fee_collection_address = 24; } diff --git a/proto/elys/parameter/ante_handler_param.proto b/proto/elys/parameter/ante_handler_param.proto deleted file mode 100644 index 660a2239b..000000000 --- a/proto/elys/parameter/ante_handler_param.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -package elys.parameter; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/elys-network/elys/x/parameter/types"; - -message AnteHandlerParam { - string min_commission_rate = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - string max_voting_power = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - string min_self_delegation = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; -} - diff --git a/proto/elys/parameter/genesis.proto b/proto/elys/parameter/genesis.proto index 373da456c..6b1902c58 100644 --- a/proto/elys/parameter/genesis.proto +++ b/proto/elys/parameter/genesis.proto @@ -4,13 +4,11 @@ package elys.parameter; import "gogoproto/gogo.proto"; import "elys/parameter/params.proto"; -import "elys/parameter/ante_handler_param.proto"; option go_package = "github.com/elys-network/elys/x/parameter/types"; // GenesisState defines the parameter module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - AnteHandlerParam ante_handler_param = 2 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.nullable) = false]; } diff --git a/proto/elys/parameter/params.proto b/proto/elys/parameter/params.proto index 3a3722efb..384d12a68 100644 --- a/proto/elys/parameter/params.proto +++ b/proto/elys/parameter/params.proto @@ -8,5 +8,18 @@ option go_package = "github.com/elys-network/elys/x/parameter/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - + + string min_commission_rate = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string max_voting_power = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string min_self_delegation = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string broker_address = 4; } diff --git a/proto/elys/parameter/proposal.proto b/proto/elys/parameter/proposal.proto deleted file mode 100644 index 540da71ae..000000000 --- a/proto/elys/parameter/proposal.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package elys.parameter; - -option go_package = "github.com/elys-network/elys/x/parameter/types"; - -message ProposalUpdateMinCommission { - string title = 1; - string description = 2; - string min_commission = 3; -} - -message ProposalUpdateMaxVotingPower { - string title = 1; - string description = 2; - string max_voting_power = 3; -} - -message ProposalUpdateMinSelfDelegation { - string title = 1; - string description = 2; - string min_self_delegation = 3; -} diff --git a/proto/elys/parameter/query.proto b/proto/elys/parameter/query.proto index a39b60e67..9c1010fe8 100644 --- a/proto/elys/parameter/query.proto +++ b/proto/elys/parameter/query.proto @@ -4,24 +4,15 @@ package elys.parameter; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; import "elys/parameter/params.proto"; -import "elys/parameter/ante_handler_param.proto"; option go_package = "github.com/elys-network/elys/x/parameter/types"; // Query defines the gRPC querier service. service Query { - // Parameters queries the parameters of the module. rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/elys-network/elys/parameter/params"; - - } - - rpc AnteHandlerParamAll (QueryAllAnteHandlerParamRequest) returns (QueryAllAnteHandlerParamResponse) { - option (google.api.http).get = "/elys-network/elys/parameter/ante_handler_param"; - } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -29,17 +20,6 @@ message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { - // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false]; } - -message QueryAllAnteHandlerParamRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllAnteHandlerParamResponse { - repeated AnteHandlerParam ante_handler_param = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/proto/elys/parameter/tx.proto b/proto/elys/parameter/tx.proto index 03b10bb2e..e503a08f6 100644 --- a/proto/elys/parameter/tx.proto +++ b/proto/elys/parameter/tx.proto @@ -4,4 +4,26 @@ package elys.parameter; option go_package = "github.com/elys-network/elys/x/parameter/types"; // Msg defines the Msg service. -service Msg {} \ No newline at end of file +service Msg { + rpc UpdateMinCommission(MsgUpdateMinCommission) returns (MsgUpdateMinCommissionResponse); + rpc UpdateMaxVotingPower(MsgUpdateMaxVotingPower) returns (MsgUpdateMaxVotingPowerResponse); + rpc UpdateMinSelfDelegation(MsgUpdateMinSelfDelegation) returns (MsgUpdateMinSelfDelegationResponse); +} + +message MsgUpdateMinCommission { + string creator = 1; + string min_commission = 2; +} +message MsgUpdateMinCommissionResponse {} + +message MsgUpdateMaxVotingPower { + string creator = 1; + string max_voting_power = 3; +} +message MsgUpdateMaxVotingPowerResponse {} + +message MsgUpdateMinSelfDelegation { + string creator = 1; + string min_self_delegation = 3; +} +message MsgUpdateMinSelfDelegationResponse {} \ No newline at end of file diff --git a/scripts/examples/transferhook/mars.yml b/scripts/examples/transferhook/mars.yml index 9e80cb8fe..823658694 100644 --- a/scripts/examples/transferhook/mars.yml +++ b/scripts/examples/transferhook/mars.yml @@ -375,10 +375,11 @@ genesis: denom: "ueden" amount: "1000000" parameter: - anteHandlerParam: - minCommissionRate: "0.05" - maxVotingPower: "0.66" - minSelfDelegation: "1" + params: + min_commission_rate: "0.05" + max_voting_power: "0.66" + min_self_delegation: "1" + broker_address: "" margin: params: leverage_max: "10" diff --git a/testutil/keeper/amm.go b/testutil/keeper/amm.go index ae122b35e..e639cdd49 100644 --- a/testutil/keeper/amm.go +++ b/testutil/keeper/amm.go @@ -51,6 +51,7 @@ func AmmKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, *mocks.AccountedPoolK authtypes.NewModuleAddress(govtypes.ModuleName).String(), nil, nil, + nil, oracleKeeper, nil, nil, diff --git a/testutil/keeper/margin.go b/testutil/keeper/margin.go index 9dc45b8a2..d6d095dae 100644 --- a/testutil/keeper/margin.go +++ b/testutil/keeper/margin.go @@ -40,6 +40,7 @@ func MarginKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { nil, nil, nil, + nil, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/testutil/keeper/parameter.go b/testutil/keeper/parameter.go index 796fdcafc..c99a0416e 100644 --- a/testutil/keeper/parameter.go +++ b/testutil/keeper/parameter.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/elys-network/elys/x/parameter/keeper" "github.com/elys-network/elys/x/parameter/types" "github.com/stretchr/testify/require" @@ -30,17 +29,10 @@ func ParameterKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "ParameterParams", - ) k := keeper.NewKeeper( cdc, storeKey, memStoreKey, - paramsSubspace, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/wasmbindings/types/types.go b/wasmbindings/types/types.go index a4aa91aff..15006f2d9 100644 --- a/wasmbindings/types/types.go +++ b/wasmbindings/types/types.go @@ -192,8 +192,7 @@ type ElysQuery struct { OraclePriceFeederAll *oracletypes.QueryAllPriceFeederRequest `json:"oracle_price_feeder_all,omitempty"` // parameter queriers - ParameterParams *parametertypes.QueryParamsRequest `json:"parameter_params,omitempty"` - ParameterAnteHandlerParamAll *parametertypes.QueryAllAnteHandlerParamRequest `json:"parameter_ante_handler_param_all,omitempty"` + ParameterParams *parametertypes.QueryParamsRequest `json:"parameter_params,omitempty"` // stablestake queriers StableStakeParams *stablestaketypes.QueryParamsRequest `json:"stable_stake_params,omitempty"` diff --git a/x/amm/keeper/apply_discount.go b/x/amm/keeper/apply_discount.go index 55ba662b5..1be738853 100644 --- a/x/amm/keeper/apply_discount.go +++ b/x/amm/keeper/apply_discount.go @@ -19,8 +19,9 @@ func (k Keeper) ApplyDiscount(ctx sdk.Context, swapFee sdk.Dec, discount sdk.Dec } // check if discount is positive and signer address is broker address otherwise throw an error - if discount.IsPositive() && sender != k.BrokerAddress(ctx) { - return sdk.ZeroDec(), sdk.ZeroDec(), sdkerrors.Wrapf(types.ErrInvalidDiscount, "discount %s is positive and signer address %s is not broker address %s", discount, sender, k.BrokerAddress(ctx)) + brokerAddress := k.parameterKeeper.GetParams(ctx).BrokerAddress + if discount.IsPositive() && sender != brokerAddress { + return sdk.ZeroDec(), sdk.ZeroDec(), sdkerrors.Wrapf(types.ErrInvalidDiscount, "discount %s is positive and signer address %s is not broker address %s", discount, sender, brokerAddress) } // apply discount percentage to swap fee diff --git a/x/amm/keeper/apply_discount_test.go b/x/amm/keeper/apply_discount_test.go index 0cf251ad9..721b5ea08 100644 --- a/x/amm/keeper/apply_discount_test.go +++ b/x/amm/keeper/apply_discount_test.go @@ -1,16 +1,17 @@ package keeper_test import ( - "testing" - + "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cosmos/cosmos-sdk/types" - keepertest "github.com/elys-network/elys/testutil/keeper" - "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" ) -func TestApplyDiscount(t *testing.T) { - // Mock context and keeper - k, ctx, _, _ := keepertest.AmmKeeper(t) +func (suite *KeeperTestSuite) TestApplyDiscount() { + k, ctx := suite.app.AmmKeeper, suite.ctx + brokerAddress := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()).String() + params := suite.app.ParameterKeeper.GetParams(ctx) + params.BrokerAddress = brokerAddress + suite.app.ParameterKeeper.SetParams(ctx, params) // Define test cases tests := []struct { @@ -32,7 +33,7 @@ func TestApplyDiscount(t *testing.T) { name: "Positive discount with valid broker address", swapFee: types.NewDecWithPrec(100, 2), discount: types.NewDecWithPrec(10, 2), // 0.10 (10%) - sender: k.BrokerAddress(ctx), + sender: brokerAddress, wantFee: types.NewDecWithPrec(90, 2), // 0.90 after discount }, { @@ -46,14 +47,14 @@ func TestApplyDiscount(t *testing.T) { name: "Boundary value for discount", swapFee: types.NewDecWithPrec(100, 2), discount: types.NewDecWithPrec(9999, 4), // 0.9999 (99.99%) - sender: k.BrokerAddress(ctx), + sender: brokerAddress, wantFee: types.NewDecWithPrec(1, 4), // 0.01 after discount }, { name: "Discount greater than swap fee", swapFee: types.NewDecWithPrec(50, 2), // 0.50 discount: types.NewDecWithPrec(75, 2), // 0.75 - sender: k.BrokerAddress(ctx), + sender: brokerAddress, wantFee: types.NewDecWithPrec(125, 3), }, { @@ -67,14 +68,14 @@ func TestApplyDiscount(t *testing.T) { name: "Zero swap fee with valid discount", swapFee: types.ZeroDec(), discount: types.NewDecWithPrec(10, 2), - sender: k.BrokerAddress(ctx), + sender: brokerAddress, wantFee: types.ZeroDec(), }, { name: "Large discount with valid broker address", swapFee: types.NewDecWithPrec(100, 2), discount: types.NewDecWithPrec(9000, 4), // 0.90 (90%) - sender: k.BrokerAddress(ctx), + sender: brokerAddress, wantFee: types.NewDecWithPrec(10, 2), // 0.10 after discount }, { @@ -87,15 +88,15 @@ func TestApplyDiscount(t *testing.T) { } for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { + suite.Run(tc.name, func() { fee, discount, err := k.ApplyDiscount(ctx, tc.swapFee, tc.discount, tc.sender) if tc.wantError { - require.Error(t, err) + suite.Require().Error(err) } else { - require.NoError(t, err) - require.Equal(t, tc.wantFee, fee) - require.Equal(t, tc.discount, discount) + suite.Require().NoError(err) + suite.Require().Equal(tc.wantFee, fee) + suite.Require().Equal(tc.discount, discount) } }) } diff --git a/x/amm/keeper/calc_in_route_spot_price.go b/x/amm/keeper/calc_in_route_spot_price.go index 1ab6a3e03..e19f6f56e 100644 --- a/x/amm/keeper/calc_in_route_spot_price.go +++ b/x/amm/keeper/calc_in_route_spot_price.go @@ -36,7 +36,8 @@ func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes [ swapFee := pool.GetPoolParams().SwapFee // Apply discount to swap fee if applicable - swapFee, _, err := k.ApplyDiscount(ctx, swapFee, discount, k.BrokerAddress(ctx)) + brokerAddress := k.parameterKeeper.GetParams(ctx).BrokerAddress + swapFee, _, err := k.ApplyDiscount(ctx, swapFee, discount, brokerAddress) if err != nil { return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } diff --git a/x/amm/keeper/calc_out_route_spot_price.go b/x/amm/keeper/calc_out_route_spot_price.go index 757688f84..8495f3702 100644 --- a/x/amm/keeper/calc_out_route_spot_price.go +++ b/x/amm/keeper/calc_out_route_spot_price.go @@ -36,7 +36,8 @@ func (k Keeper) CalcOutRouteSpotPrice(ctx sdk.Context, tokenOut sdk.Coin, routes swapFee := pool.GetPoolParams().SwapFee // Apply discount to swap fee if applicable - swapFee, _, err := k.ApplyDiscount(ctx, swapFee, discount, k.BrokerAddress(ctx)) + brokerAddress := k.parameterKeeper.GetParams(ctx).BrokerAddress + swapFee, _, err := k.ApplyDiscount(ctx, swapFee, discount, brokerAddress) if err != nil { return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } diff --git a/x/amm/keeper/keeper.go b/x/amm/keeper/keeper.go index eb0c85dbc..bc82ca6d9 100644 --- a/x/amm/keeper/keeper.go +++ b/x/amm/keeper/keeper.go @@ -11,6 +11,7 @@ import ( "github.com/elys-network/elys/x/amm/types" commitmentkeeper "github.com/elys-network/elys/x/commitment/keeper" + pkeeper "github.com/elys-network/elys/x/parameter/keeper" ) type ( @@ -22,6 +23,7 @@ type ( authority string hooks types.AmmHooks + parameterKeeper *pkeeper.Keeper bankKeeper types.BankKeeper accountKeeper types.AccountKeeper oracleKeeper types.OracleKeeper @@ -38,6 +40,7 @@ func NewKeeper( ps paramtypes.Subspace, authority string, + parameterKeeper *pkeeper.Keeper, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, oracleKeeper types.OracleKeeper, @@ -57,6 +60,7 @@ func NewKeeper( paramstore: ps, authority: authority, + parameterKeeper: parameterKeeper, bankKeeper: bankKeeper, accountKeeper: accountKeeper, oracleKeeper: oracleKeeper, diff --git a/x/amm/keeper/params.go b/x/amm/keeper/params.go index 1c6675d38..99f4b8be6 100644 --- a/x/amm/keeper/params.go +++ b/x/amm/keeper/params.go @@ -9,7 +9,6 @@ import ( func (k Keeper) GetParams(ctx sdk.Context) types.Params { return types.NewParams( k.PoolCreationFee(ctx), - k.BrokerAddress(ctx), ) } @@ -23,9 +22,3 @@ func (k Keeper) PoolCreationFee(ctx sdk.Context) (res uint64) { k.paramstore.Get(ctx, types.KeyPoolCreationFee, &res) return } - -// BrokerAddress returns the BrokerAddress param -func (k Keeper) BrokerAddress(ctx sdk.Context) (res string) { - k.paramstore.Get(ctx, types.KeyBrokerAddress, &res) - return -} diff --git a/x/amm/types/params.go b/x/amm/types/params.go index 4757a17e4..3995b600a 100644 --- a/x/amm/types/params.go +++ b/x/amm/types/params.go @@ -14,7 +14,6 @@ var ( KeyBrokerAddress = []byte("BrokerAddress") // TODO: Determine the default value DefaultPoolCreationFee uint64 = 0 - DefaultBrokerAddress string = "" ) // ParamKeyTable the param key table for launch module @@ -25,11 +24,9 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams( poolCreationFee uint64, - brokerAddress string, ) Params { return Params{ PoolCreationFee: poolCreationFee, - BrokerAddress: brokerAddress, } } @@ -37,7 +34,6 @@ func NewParams( func DefaultParams() Params { return NewParams( DefaultPoolCreationFee, - DefaultBrokerAddress, ) } @@ -45,7 +41,6 @@ func DefaultParams() Params { func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyPoolCreationFee, &p.PoolCreationFee, validatePoolCreationFee), - paramtypes.NewParamSetPair(KeyBrokerAddress, &p.BrokerAddress, validateBrokerAddress), } } @@ -54,9 +49,6 @@ func (p Params) Validate() error { if err := validatePoolCreationFee(p.PoolCreationFee); err != nil { return err } - if err := validateBrokerAddress(p.BrokerAddress); err != nil { - return err - } return nil } @@ -79,16 +71,3 @@ func validatePoolCreationFee(v interface{}) error { return nil } - -// validateBrokerAddress validates the BrokerAddress param -func validateBrokerAddress(v interface{}) error { - brokerAddress, ok := v.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", v) - } - - // TODO implement validation - _ = brokerAddress - - return nil -} diff --git a/x/amm/types/params.pb.go b/x/amm/types/params.pb.go index f75444f0f..99f1539a6 100644 --- a/x/amm/types/params.pb.go +++ b/x/amm/types/params.pb.go @@ -26,7 +26,6 @@ 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"` - BrokerAddress string `protobuf:"bytes,2,opt,name=broker_address,json=brokerAddress,proto3" json:"broker_address,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -68,13 +67,6 @@ func (m *Params) GetPoolCreationFee() uint64 { return 0 } -func (m *Params) GetBrokerAddress() string { - if m != nil { - return m.BrokerAddress - } - return "" -} - func init() { proto.RegisterType((*Params)(nil), "elys.amm.Params") } @@ -82,21 +74,19 @@ func init() { func init() { proto.RegisterFile("elys/amm/params.proto", fileDescriptor_1209ca218537a425) } var fileDescriptor_1209ca218537a425 = []byte{ - // 215 bytes of a gzipped FileDescriptorProto + // 184 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, 0x52, 0x22, 0x17, 0x5b, 0x00, 0x58, 0xbd, 0x90, 0x16, 0x97, + 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, 0x2a, 0xa4, 0xca, 0xc5, 0x97, 0x54, 0x94, 0x9f, 0x9d, 0x5a, 0x14, 0x9f, 0x98, 0x92, 0x52, - 0x94, 0x5a, 0x5c, 0x2c, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x19, 0xc4, 0x0b, 0x11, 0x75, 0x84, 0x08, - 0x5a, 0xb1, 0xcc, 0x58, 0x20, 0xcf, 0xe0, 0xe4, 0x74, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, - 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, - 0x72, 0x0c, 0x51, 0x1a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, - 0x77, 0xea, 0xe6, 0xa5, 0x96, 0x94, 0xe7, 0x17, 0x65, 0x83, 0x39, 0xfa, 0x15, 0x60, 0xdf, 0x94, - 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x5d, 0x6b, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xe7, - 0xdf, 0x05, 0x9b, 0xe6, 0x00, 0x00, 0x00, + 0x9a, 0x6a, 0xc5, 0x32, 0x63, 0x81, 0x3c, 0x83, 0x93, 0xd3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, + 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, + 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, + 0x83, 0x1c, 0xa0, 0x9b, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0x0d, 0xe6, 0xe8, 0x57, 0x80, 0x9d, + 0x59, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0x86, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, + 0x80, 0xf9, 0xf7, 0xd8, 0xbf, 0x00, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -119,13 +109,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.BrokerAddress) > 0 { - i -= len(m.BrokerAddress) - copy(dAtA[i:], m.BrokerAddress) - i = encodeVarintParams(dAtA, i, uint64(len(m.BrokerAddress))) - i-- - dAtA[i] = 0x12 - } if m.PoolCreationFee != 0 { i = encodeVarintParams(dAtA, i, uint64(m.PoolCreationFee)) i-- @@ -154,10 +137,6 @@ func (m *Params) Size() (n int) { if m.PoolCreationFee != 0 { n += 1 + sovParams(uint64(m.PoolCreationFee)) } - l = len(m.BrokerAddress) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } return n } @@ -215,38 +194,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BrokerAddress", wireType) - } - 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 - } - m.BrokerAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/margin/keeper/get_amm_pool_test.go b/x/margin/keeper/get_amm_pool_test.go index d039a66ae..182acf8a9 100644 --- a/x/margin/keeper/get_amm_pool_test.go +++ b/x/margin/keeper/get_amm_pool_test.go @@ -14,7 +14,7 @@ import ( func TestGetAmmPool_PoolNotFound(t *testing.T) { mockAmm := new(mocks.AmmKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", mockAmm, nil, nil, nil) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", mockAmm, nil, nil, nil, nil) ctx := sdk.Context{} // mock or setup a context borrowAsset := "testAsset" @@ -32,7 +32,7 @@ func TestGetAmmPool_PoolNotFound(t *testing.T) { func TestGetAmmPool_PoolFound(t *testing.T) { mockAmm := new(mocks.AmmKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", mockAmm, nil, nil, nil) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", mockAmm, nil, nil, nil, nil) ctx := sdk.Context{} // mock or setup a context borrowAsset := "testAsset" diff --git a/x/margin/keeper/get_first_valid_pool_test.go b/x/margin/keeper/get_first_valid_pool_test.go index 5620987fc..8dc02aec6 100644 --- a/x/margin/keeper/get_first_valid_pool_test.go +++ b/x/margin/keeper/get_first_valid_pool_test.go @@ -13,7 +13,7 @@ import ( func TestGetFirstValidPool_NoPoolID(t *testing.T) { mockAmm := new(mocks.AmmKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", mockAmm, nil, nil, nil) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", mockAmm, nil, nil, nil, nil) ctx := sdk.Context{} // mock or setup a context borrowAsset := "testAsset" @@ -30,7 +30,7 @@ func TestGetFirstValidPool_NoPoolID(t *testing.T) { func TestGetFirstValidPool_ValidPoolID(t *testing.T) { mockAmm := new(mocks.AmmKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", mockAmm, nil, nil, nil) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", mockAmm, nil, nil, nil, nil) ctx := sdk.Context{} // mock or setup a context borrowAsset := "testAsset" diff --git a/x/margin/keeper/keeper.go b/x/margin/keeper/keeper.go index a0a891955..f1c551971 100644 --- a/x/margin/keeper/keeper.go +++ b/x/margin/keeper/keeper.go @@ -19,6 +19,7 @@ import ( ammtypes "github.com/elys-network/elys/x/amm/types" assetprofiletypes "github.com/elys-network/elys/x/assetprofile/types" "github.com/elys-network/elys/x/margin/types" + pkeeper "github.com/elys-network/elys/x/parameter/keeper" ptypes "github.com/elys-network/elys/x/parameter/types" ) @@ -33,14 +34,15 @@ type ( types.CloseLongChecker types.CloseShortChecker - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - authority string - amm types.AmmKeeper - bankKeeper types.BankKeeper - oracleKeeper ammtypes.OracleKeeper - apKeeper types.AssetProfileKeeper + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + authority string + parameterKeeper *pkeeper.Keeper + amm types.AmmKeeper + bankKeeper types.BankKeeper + oracleKeeper ammtypes.OracleKeeper + apKeeper types.AssetProfileKeeper hooks types.MarginHooks } @@ -55,6 +57,7 @@ func NewKeeper( bk types.BankKeeper, oracleKeeper ammtypes.OracleKeeper, apKeeper types.AssetProfileKeeper, + parameterKeeper *pkeeper.Keeper, ) *Keeper { // ensure that authority is a valid AccAddress if _, err := sdk.AccAddressFromBech32(authority); err != nil { @@ -62,14 +65,15 @@ func NewKeeper( } keeper := &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - authority: authority, - amm: amm, - bankKeeper: bk, - oracleKeeper: oracleKeeper, - apKeeper: apKeeper, + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + authority: authority, + amm: amm, + bankKeeper: bk, + oracleKeeper: oracleKeeper, + apKeeper: apKeeper, + parameterKeeper: parameterKeeper, } keeper.AuthorizationChecker = keeper diff --git a/x/margin/keeper/msg_server_broker_close.go b/x/margin/keeper/msg_server_broker_close.go index 8395bd2a4..212913e32 100644 --- a/x/margin/keeper/msg_server_broker_close.go +++ b/x/margin/keeper/msg_server_broker_close.go @@ -13,7 +13,7 @@ func (k msgServer) BrokerClose(goCtx context.Context, msg *types.MsgBrokerClose) ctx := sdk.UnwrapSDKContext(goCtx) // get broker address - brokerAddress := k.GetBrokerAddress(ctx).String() + brokerAddress := k.parameterKeeper.GetParams(ctx).BrokerAddress // check if broker is allowed if brokerAddress != msg.Creator { diff --git a/x/margin/keeper/msg_server_broker_open.go b/x/margin/keeper/msg_server_broker_open.go index 8840eacb4..3db1ef5cf 100644 --- a/x/margin/keeper/msg_server_broker_open.go +++ b/x/margin/keeper/msg_server_broker_open.go @@ -13,7 +13,7 @@ func (k msgServer) BrokerOpen(goCtx context.Context, msg *types.MsgBrokerOpen) ( ctx := sdk.UnwrapSDKContext(goCtx) // get broker address - brokerAddress := k.GetBrokerAddress(ctx).String() + brokerAddress := k.parameterKeeper.GetParams(ctx).BrokerAddress // check if broker is allowed if brokerAddress != msg.Creator { diff --git a/x/margin/keeper/open_test.go b/x/margin/keeper/open_test.go index d2f3e3057..aa7a60455 100644 --- a/x/margin/keeper/open_test.go +++ b/x/margin/keeper/open_test.go @@ -20,7 +20,7 @@ func TestOpen_ErrorCheckUserAuthorization(t *testing.T) { mockChecker := new(mocks.OpenChecker) mockAssetProfile := new(mocks.AssetProfileKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile, nil) k.OpenChecker = mockChecker var ( @@ -48,7 +48,7 @@ func TestOpen_ErrorCheckMaxOpenPositions(t *testing.T) { mockChecker := new(mocks.OpenChecker) mockAssetProfile := new(mocks.AssetProfileKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile, nil) k.OpenChecker = mockChecker var ( @@ -80,7 +80,7 @@ func TestOpen_ErrorPreparePools(t *testing.T) { mockChecker := new(mocks.OpenChecker) mockAssetProfile := new(mocks.AssetProfileKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile, nil) k.OpenChecker = mockChecker var ( @@ -113,7 +113,7 @@ func TestOpen_ErrorCheckPoolHealth(t *testing.T) { mockChecker := new(mocks.OpenChecker) mockAssetProfile := new(mocks.AssetProfileKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile, nil) k.OpenChecker = mockChecker var ( @@ -146,7 +146,7 @@ func TestOpen_ErrorInvalidPosition(t *testing.T) { mockChecker := new(mocks.OpenChecker) mockAssetProfile := new(mocks.AssetProfileKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile, nil) k.OpenChecker = mockChecker var ( @@ -172,7 +172,7 @@ func TestOpen_ErrorOpenLong(t *testing.T) { mockChecker := new(mocks.OpenChecker) mockAssetProfile := new(mocks.AssetProfileKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile, nil) k.OpenChecker = mockChecker var ( @@ -206,7 +206,7 @@ func TestOpen_ErrorOpenShort(t *testing.T) { mockChecker := new(mocks.OpenChecker) mockAssetProfile := new(mocks.AssetProfileKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile, nil) k.OpenChecker = mockChecker var ( @@ -240,7 +240,7 @@ func TestOpen_Successful(t *testing.T) { mockChecker := new(mocks.OpenChecker) mockAssetProfile := new(mocks.AssetProfileKeeper) - k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile) + k := keeper.NewKeeper(nil, nil, nil, "cosmos1ysxv266l8w76lq0vy44ktzajdr9u9yhlxzlvga", nil, nil, nil, mockAssetProfile, nil) k.OpenChecker = mockChecker var ( diff --git a/x/margin/keeper/params.go b/x/margin/keeper/params.go index fc6718d74..e80964437 100644 --- a/x/margin/keeper/params.go +++ b/x/margin/keeper/params.go @@ -143,15 +143,6 @@ func (k Keeper) IsWhitelistingEnabled(ctx sdk.Context) bool { return k.GetParams(ctx).WhitelistingEnabled } -func (k Keeper) GetBrokerAddress(ctx sdk.Context) sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(k.GetParams(ctx).BrokerAddress) - if err != nil { - panic(err) - } - - return addr -} - func (k Keeper) GetTakeProfitBorrowInterestRateMin(ctx sdk.Context) sdk.Dec { return k.GetParams(ctx).TakeProfitBorrowInterestRateMin } diff --git a/x/margin/types/params.go b/x/margin/types/params.go index 55bda3b7a..f03532676 100644 --- a/x/margin/types/params.go +++ b/x/margin/types/params.go @@ -60,7 +60,6 @@ func NewParams() Params { BorrowInterestRateIncrease: sdk.NewDecWithPrec(33, 10), BorrowInterestRateMax: sdk.NewDecWithPrec(27, 7), BorrowInterestRateMin: sdk.NewDecWithPrec(3, 8), - BrokerAddress: ZeroAddress, EpochLength: (int64)(1), ForceCloseFundAddress: ZeroAddress, ForceCloseFundPercentage: sdk.OneDec(), @@ -106,7 +105,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyIncrementalBorrowInterestPaymentEnabled, &p.IncrementalBorrowInterestPaymentEnabled, validateIncrementalBorrowInterestPaymentEnabled), paramtypes.NewParamSetPair(KeyWhitelistingEnabled, &p.WhitelistingEnabled, validateWhitelistingEnabled), paramtypes.NewParamSetPair(KeyInvariantCheckEpoch, &p.InvariantCheckEpoch, validateInvariantCheckEpoch), - paramtypes.NewParamSetPair(KeyBrokerAddress, &p.BrokerAddress, validateBrokerAddress), paramtypes.NewParamSetPair(KeyTakeProfitBorrowInterestRateMin, &p.TakeProfitBorrowInterestRateMin, validateTakeProfitBorrowInterestRateMin), paramtypes.NewParamSetPair(KeyFundingFeeBaseRate, &p.FundingFeeBaseRate, validateBorrowInterestRateMax), paramtypes.NewParamSetPair(KeyFundingFeeMinRate, &p.FundingFeeMinRate, validateBorrowInterestRateMax), @@ -174,9 +172,6 @@ func (p Params) Validate() error { if err := validateInvariantCheckEpoch(p.InvariantCheckEpoch); err != nil { return err } - if err := validateBrokerAddress(p.BrokerAddress); err != nil { - return err - } if err := validateTakeProfitBorrowInterestRateMin(p.TakeProfitBorrowInterestRateMin); err != nil { return err } @@ -463,15 +458,6 @@ func validateInvariantCheckEpoch(i interface{}) error { return nil } -func validateBrokerAddress(i interface{}) error { - _, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - func validateTakeProfitBorrowInterestRateMin(i interface{}) error { v, ok := i.(sdk.Dec) if !ok { diff --git a/x/margin/types/params.pb.go b/x/margin/types/params.pb.go index b1108ee24..ab9bbc71a 100644 --- a/x/margin/types/params.pb.go +++ b/x/margin/types/params.pb.go @@ -45,12 +45,11 @@ type Params struct { IncrementalBorrowInterestPaymentEnabled bool `protobuf:"varint,17,opt,name=incremental_borrow_interest_payment_enabled,json=incrementalBorrowInterestPaymentEnabled,proto3" json:"incremental_borrow_interest_payment_enabled,omitempty"` WhitelistingEnabled bool `protobuf:"varint,18,opt,name=whitelisting_enabled,json=whitelistingEnabled,proto3" json:"whitelisting_enabled,omitempty"` InvariantCheckEpoch string `protobuf:"bytes,19,opt,name=invariant_check_epoch,json=invariantCheckEpoch,proto3" json:"invariant_check_epoch,omitempty"` - BrokerAddress string `protobuf:"bytes,20,opt,name=broker_address,json=brokerAddress,proto3" json:"broker_address,omitempty"` - TakeProfitBorrowInterestRateMin github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,21,opt,name=take_profit_borrow_interest_rate_min,json=takeProfitBorrowInterestRateMin,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"take_profit_borrow_interest_rate_min"` - FundingFeeBaseRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,22,opt,name=funding_fee_base_rate,json=fundingFeeBaseRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_fee_base_rate"` - FundingFeeMaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,23,opt,name=funding_fee_max_rate,json=fundingFeeMaxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_fee_max_rate"` - FundingFeeMinRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,24,opt,name=funding_fee_min_rate,json=fundingFeeMinRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_fee_min_rate"` - FundingFeeCollectionAddress string `protobuf:"bytes,25,opt,name=funding_fee_collection_address,json=fundingFeeCollectionAddress,proto3" json:"funding_fee_collection_address,omitempty"` + TakeProfitBorrowInterestRateMin github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,20,opt,name=take_profit_borrow_interest_rate_min,json=takeProfitBorrowInterestRateMin,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"take_profit_borrow_interest_rate_min"` + FundingFeeBaseRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,21,opt,name=funding_fee_base_rate,json=fundingFeeBaseRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_fee_base_rate"` + FundingFeeMaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,22,opt,name=funding_fee_max_rate,json=fundingFeeMaxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_fee_max_rate"` + FundingFeeMinRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,23,opt,name=funding_fee_min_rate,json=fundingFeeMinRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"funding_fee_min_rate"` + FundingFeeCollectionAddress string `protobuf:"bytes,24,opt,name=funding_fee_collection_address,json=fundingFeeCollectionAddress,proto3" json:"funding_fee_collection_address,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -134,13 +133,6 @@ func (m *Params) GetInvariantCheckEpoch() string { return "" } -func (m *Params) GetBrokerAddress() string { - if m != nil { - return m.BrokerAddress - } - return "" -} - func (m *Params) GetFundingFeeCollectionAddress() string { if m != nil { return m.FundingFeeCollectionAddress @@ -155,57 +147,56 @@ func init() { func init() { proto.RegisterFile("elys/margin/params.proto", fileDescriptor_f427d3667a99d828) } var fileDescriptor_f427d3667a99d828 = []byte{ - // 798 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xc0, 0xbd, 0xb4, 0x84, 0x76, 0xec, 0x94, 0x64, 0x6c, 0xd3, 0xa1, 0x15, 0x76, 0x40, 0xfc, - 0x89, 0x14, 0x6a, 0x03, 0x3d, 0x20, 0x71, 0xc3, 0x6e, 0x82, 0x2a, 0x11, 0xd5, 0x35, 0x9c, 0x50, - 0xc5, 0x68, 0xbc, 0xfb, 0x76, 0x77, 0xe4, 0xdd, 0x99, 0xf5, 0xcc, 0x38, 0xb1, 0x0f, 0x7c, 0x07, - 0x8e, 0x48, 0x5c, 0xf8, 0x18, 0x7c, 0x84, 0x1e, 0x7b, 0x44, 0x1c, 0x2a, 0x94, 0x7c, 0x11, 0x34, - 0xb3, 0xbb, 0xb6, 0xdb, 0xa4, 0x10, 0x6d, 0x7b, 0x4a, 0x3c, 0x6f, 0xe6, 0xf7, 0x7b, 0x6f, 0xde, - 0xec, 0xee, 0x20, 0x02, 0xc9, 0x52, 0xf7, 0x53, 0xa6, 0x22, 0x2e, 0xfa, 0x19, 0x53, 0x2c, 0xd5, - 0xbd, 0x4c, 0x49, 0x23, 0x71, 0xdd, 0x46, 0x7a, 0x79, 0xe4, 0x4e, 0x2b, 0x92, 0x91, 0x74, 0xe3, - 0x7d, 0xfb, 0x5f, 0x3e, 0xe5, 0xa3, 0x3f, 0x77, 0xd1, 0xd6, 0xc8, 0xad, 0xc1, 0x8f, 0x51, 0x23, - 0x81, 0x13, 0x50, 0x2c, 0x02, 0x9a, 0xb2, 0x05, 0xf1, 0xf6, 0xbc, 0xfd, 0x9b, 0x83, 0xde, 0xd3, - 0xe7, 0xdd, 0xda, 0xdf, 0xcf, 0xbb, 0x9f, 0x46, 0xdc, 0xc4, 0xf3, 0x49, 0xcf, 0x97, 0x69, 0xdf, - 0x97, 0x3a, 0x95, 0xba, 0xf8, 0x73, 0x4f, 0x07, 0xd3, 0xbe, 0x59, 0x66, 0xa0, 0x7b, 0x0f, 0xc0, - 0x1f, 0xd7, 0x4b, 0xc6, 0x31, 0x5b, 0xe0, 0x08, 0x91, 0x89, 0x54, 0x4a, 0x9e, 0x52, 0x2e, 0x0c, - 0x28, 0xd0, 0x86, 0x2a, 0x66, 0x72, 0xfc, 0x5b, 0x95, 0xf0, 0xed, 0x9c, 0xf7, 0xb0, 0xc0, 0x8d, - 0x99, 0xf9, 0x6f, 0x11, 0x17, 0xe4, 0xda, 0x1b, 0x13, 0x71, 0x81, 0x67, 0xe8, 0x83, 0x4b, 0x45, - 0x5c, 0xf8, 0x0a, 0x98, 0x06, 0x72, 0xbd, 0x92, 0xed, 0xce, 0x45, 0xdb, 0xc3, 0x82, 0xf8, 0x4a, - 0x65, 0x00, 0x85, 0xf2, 0xed, 0x37, 0xa5, 0x7c, 0x50, 0x10, 0xf1, 0x13, 0x84, 0x63, 0x60, 0x89, - 0x89, 0x69, 0xc4, 0xb8, 0xa0, 0x21, 0xf3, 0x8d, 0x54, 0x64, 0xab, 0x92, 0x67, 0x27, 0x27, 0x7d, - 0xc7, 0xb8, 0x38, 0x72, 0x1c, 0xfc, 0x21, 0x6a, 0x40, 0x26, 0xfd, 0x98, 0x26, 0x20, 0x22, 0x13, - 0x93, 0x77, 0xf6, 0xbc, 0xfd, 0x6b, 0xe3, 0xba, 0x1b, 0xfb, 0xde, 0x0d, 0xe1, 0x10, 0xdd, 0x56, - 0x90, 0xca, 0x13, 0x96, 0xd0, 0xd9, 0x1c, 0xe6, 0x40, 0x4d, 0xac, 0x40, 0xc7, 0x32, 0x09, 0xc8, - 0x8d, 0x6a, 0xed, 0x2c, 0x70, 0x8f, 0x2d, 0xed, 0xc7, 0x12, 0x86, 0x3f, 0x47, 0x38, 0x65, 0x0b, - 0x2a, 0x33, 0x10, 0x34, 0x93, 0x9a, 0x1b, 0x2e, 0x85, 0x26, 0x37, 0x5d, 0x42, 0x3b, 0x29, 0x5b, - 0x3c, 0xca, 0x40, 0x8c, 0xca, 0x71, 0xfc, 0x33, 0x6a, 0x66, 0x52, 0x26, 0xf9, 0xf4, 0x75, 0x46, - 0xa8, 0x52, 0x46, 0xbb, 0x16, 0x65, 0xf9, 0xeb, 0x6c, 0x52, 0x74, 0x37, 0x94, 0xca, 0x07, 0xea, - 0x27, 0x52, 0x03, 0x0d, 0xe7, 0x22, 0xa0, 0x19, 0x28, 0x1f, 0x84, 0x61, 0x11, 0x90, 0x7a, 0x25, - 0x0f, 0x71, 0xc8, 0xa1, 0x25, 0x1e, 0xcd, 0x45, 0x30, 0x5a, 0xf1, 0xf0, 0xd7, 0x88, 0x5c, 0xd0, - 0xb1, 0x20, 0x50, 0xa0, 0x35, 0x69, 0x58, 0xd7, 0xb8, 0xfd, 0xe2, 0xda, 0x6f, 0xf3, 0x20, 0xfe, - 0xdd, 0x43, 0xf7, 0xdd, 0x81, 0x4f, 0x2d, 0x29, 0xa1, 0x2f, 0x1f, 0xcf, 0x8c, 0x2d, 0x6d, 0xe4, - 0x42, 0x01, 0xdb, 0x95, 0x0a, 0xe8, 0x6d, 0xa8, 0x06, 0x2f, 0x9c, 0xd9, 0x51, 0xee, 0x79, 0xa9, - 0x2c, 0x40, 0x5f, 0x5c, 0x39, 0xb9, 0xb2, 0xdc, 0x5b, 0xae, 0xdc, 0x83, 0xab, 0x98, 0xca, 0x4d, - 0x78, 0x84, 0xea, 0x7a, 0x46, 0x53, 0x19, 0xf0, 0x90, 0x83, 0x22, 0xef, 0x56, 0xaa, 0x0d, 0xe9, - 0xd9, 0x71, 0x41, 0xc0, 0x3f, 0xa0, 0x6d, 0xcd, 0x42, 0x30, 0xcb, 0xf2, 0x79, 0xdb, 0xa9, 0x84, - 0x6c, 0xe4, 0x90, 0xe2, 0x59, 0x7b, 0x82, 0x0e, 0xae, 0xb2, 0x19, 0x20, 0xd8, 0x24, 0x81, 0x80, - 0xec, 0xee, 0x79, 0xfb, 0x37, 0xc6, 0x9f, 0xfd, 0xdf, 0x3e, 0x1c, 0xe6, 0xd3, 0xf1, 0x97, 0xa8, - 0x75, 0x1a, 0x73, 0x03, 0x09, 0xd7, 0x86, 0x8b, 0x68, 0x85, 0xc1, 0x0e, 0xd3, 0xdc, 0x8c, 0x95, - 0x4b, 0xbe, 0x42, 0x6d, 0x2e, 0x4e, 0x98, 0xe2, 0x4c, 0x18, 0xea, 0xc7, 0xe0, 0x4f, 0xa9, 0x7b, - 0xf0, 0x49, 0xd3, 0xb5, 0xa0, 0xb9, 0x0a, 0x0e, 0x6d, 0xec, 0xd0, 0x86, 0xf0, 0x27, 0xe8, 0xd6, - 0x44, 0xc9, 0x29, 0xa8, 0x55, 0xbf, 0x5a, 0x6e, 0xf2, 0x76, 0x3e, 0x5a, 0x76, 0xe4, 0x17, 0xf4, - 0xb1, 0x61, 0x53, 0xa0, 0x99, 0x92, 0x21, 0x37, 0xf4, 0x95, 0x1f, 0x84, 0x76, 0xa5, 0x7d, 0xed, - 0x5a, 0xf6, 0xc8, 0xa1, 0x07, 0x97, 0x7e, 0x1a, 0x18, 0x6a, 0xdb, 0x33, 0x65, 0xf7, 0x21, 0x04, - 0xa0, 0x13, 0xa6, 0xc1, 0x39, 0xc9, 0x7b, 0x95, 0x7c, 0xb8, 0x80, 0x1d, 0x01, 0x0c, 0x98, 0x06, - 0x6b, 0xc1, 0x14, 0xb5, 0x36, 0x15, 0xf6, 0xd5, 0xe5, 0x0c, 0xb7, 0xab, 0xbd, 0x81, 0xd6, 0x86, - 0x63, 0xb6, 0xb8, 0x54, 0xc0, 0x45, 0x2e, 0x20, 0xaf, 0x2d, 0xe0, 0xc2, 0x09, 0x86, 0xa8, 0xb3, - 0x29, 0xf0, 0x65, 0x92, 0x80, 0x6f, 0xdf, 0xae, 0xab, 0xd6, 0xbe, 0xef, 0x5a, 0x7b, 0x77, 0xbd, - 0x74, 0xb8, 0x9a, 0x53, 0x34, 0xfa, 0x9b, 0xeb, 0xbf, 0xfd, 0xd1, 0xad, 0x0d, 0x0e, 0x9f, 0x9e, - 0x75, 0xbc, 0x67, 0x67, 0x1d, 0xef, 0x9f, 0xb3, 0x8e, 0xf7, 0xeb, 0x79, 0xa7, 0xf6, 0xec, 0xbc, - 0x53, 0xfb, 0xeb, 0xbc, 0x53, 0xfb, 0xe9, 0x60, 0x23, 0x3f, 0x7b, 0x05, 0xba, 0x27, 0xc0, 0x9c, - 0x4a, 0x35, 0x75, 0x3f, 0xfa, 0x8b, 0xf2, 0xae, 0xe4, 0x12, 0x9d, 0x6c, 0xb9, 0x8b, 0xd0, 0xfd, - 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x55, 0x81, 0xfd, 0x84, 0x47, 0x09, 0x00, 0x00, + // 776 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x8f, 0x1b, 0x35, + 0x14, 0xc0, 0x33, 0xb4, 0x2c, 0xad, 0x93, 0xc2, 0xae, 0x93, 0x50, 0xab, 0x15, 0xc9, 0x82, 0x10, + 0xac, 0xb4, 0x34, 0x01, 0x7a, 0x40, 0xe2, 0x46, 0xd2, 0x5d, 0x54, 0x89, 0x55, 0xd3, 0xc0, 0x09, + 0x55, 0x58, 0xce, 0xcc, 0x9b, 0x19, 0x2b, 0x33, 0xf6, 0xc4, 0x76, 0x76, 0x93, 0x03, 0xdf, 0x01, + 0x6e, 0x48, 0x5c, 0xf8, 0x38, 0x3d, 0xf6, 0x88, 0x38, 0x54, 0x68, 0xf7, 0x8b, 0x20, 0x7b, 0x66, + 0x92, 0x74, 0xff, 0xc0, 0x6a, 0xd8, 0x53, 0x32, 0x7e, 0xf6, 0xef, 0xf7, 0x9e, 0xff, 0xc9, 0x88, + 0x40, 0xb2, 0xd4, 0xfd, 0x94, 0xa9, 0x88, 0x8b, 0x7e, 0xc6, 0x14, 0x4b, 0x75, 0x2f, 0x53, 0xd2, + 0x48, 0x5c, 0xb7, 0x91, 0x5e, 0x1e, 0x79, 0xd0, 0x8a, 0x64, 0x24, 0x5d, 0x7b, 0xdf, 0xfe, 0xcb, + 0xbb, 0x7c, 0xf4, 0xeb, 0x0e, 0xda, 0x1a, 0xb9, 0x31, 0xf8, 0x39, 0x6a, 0x24, 0x70, 0x0c, 0x8a, + 0x45, 0x40, 0x53, 0xb6, 0x20, 0xde, 0xae, 0xb7, 0x77, 0x77, 0xd0, 0x7b, 0xf9, 0xba, 0x5b, 0xfb, + 0xeb, 0x75, 0xf7, 0x93, 0x88, 0x9b, 0x78, 0x3e, 0xe9, 0xf9, 0x32, 0xed, 0xfb, 0x52, 0xa7, 0x52, + 0x17, 0x3f, 0x8f, 0x74, 0x30, 0xed, 0x9b, 0x65, 0x06, 0xba, 0xf7, 0x04, 0xfc, 0x71, 0xbd, 0x64, + 0x1c, 0xb1, 0x05, 0x8e, 0x10, 0x99, 0x48, 0xa5, 0xe4, 0x09, 0xe5, 0xc2, 0x80, 0x02, 0x6d, 0xa8, + 0x62, 0x26, 0xc7, 0xbf, 0x55, 0x09, 0xdf, 0xce, 0x79, 0x4f, 0x0b, 0xdc, 0x98, 0x99, 0x7f, 0x17, + 0x71, 0x41, 0x6e, 0xdd, 0x98, 0x88, 0x0b, 0x3c, 0x43, 0x1f, 0x5c, 0x2a, 0xe2, 0xc2, 0x57, 0xc0, + 0x34, 0x90, 0xdb, 0x95, 0x6c, 0x0f, 0x2e, 0xda, 0x9e, 0x16, 0xc4, 0x2b, 0x95, 0x01, 0x14, 0xca, + 0xb7, 0x6f, 0x4a, 0xf9, 0xa4, 0x20, 0xe2, 0x17, 0x08, 0xc7, 0xc0, 0x12, 0x13, 0xd3, 0x88, 0x71, + 0x41, 0x43, 0xe6, 0x1b, 0xa9, 0xc8, 0x56, 0x25, 0xcf, 0x76, 0x4e, 0xfa, 0x96, 0x71, 0x71, 0xe8, + 0x38, 0xf8, 0x43, 0xd4, 0x80, 0x4c, 0xfa, 0x31, 0x4d, 0x40, 0x44, 0x26, 0x26, 0xef, 0xec, 0x7a, + 0x7b, 0xb7, 0xc6, 0x75, 0xd7, 0xf6, 0x9d, 0x6b, 0xc2, 0x21, 0xba, 0xaf, 0x20, 0x95, 0xc7, 0x2c, + 0xa1, 0xb3, 0x39, 0xcc, 0x81, 0x9a, 0x58, 0x81, 0x8e, 0x65, 0x12, 0x90, 0x3b, 0xd5, 0x96, 0xb3, + 0xc0, 0x3d, 0xb7, 0xb4, 0x1f, 0x4a, 0x18, 0xfe, 0x0c, 0xe1, 0x94, 0x2d, 0xa8, 0xcc, 0x40, 0xd0, + 0x4c, 0x6a, 0x6e, 0xb8, 0x14, 0x9a, 0xdc, 0x75, 0x09, 0x6d, 0xa7, 0x6c, 0xf1, 0x2c, 0x03, 0x31, + 0x2a, 0xdb, 0xf1, 0x4f, 0xa8, 0x99, 0x49, 0x99, 0xe4, 0xdd, 0xd7, 0x19, 0xa1, 0x4a, 0x19, 0xed, + 0x58, 0x94, 0xe5, 0xaf, 0xb3, 0x49, 0xd1, 0xc3, 0x50, 0x2a, 0x1f, 0xa8, 0x9f, 0x48, 0x0d, 0x34, + 0x9c, 0x8b, 0x80, 0x66, 0xa0, 0x7c, 0x10, 0x86, 0x45, 0x40, 0xea, 0x95, 0x3c, 0xc4, 0x21, 0x87, + 0x96, 0x78, 0x38, 0x17, 0xc1, 0x68, 0xc5, 0xc3, 0x5f, 0x21, 0x72, 0x41, 0xc7, 0x82, 0x40, 0x81, + 0xd6, 0xa4, 0x61, 0x5d, 0xe3, 0xf6, 0x9b, 0x63, 0xbf, 0xc9, 0x83, 0xf8, 0x77, 0x0f, 0x3d, 0x76, + 0x1b, 0x3e, 0xb5, 0xa4, 0x84, 0x9e, 0xdf, 0x9e, 0x19, 0x5b, 0xda, 0xc8, 0x85, 0x02, 0xee, 0x55, + 0x2a, 0xa0, 0xb7, 0xa1, 0x1a, 0xbc, 0xb1, 0x67, 0x47, 0xb9, 0xe7, 0x5c, 0x59, 0x80, 0x3e, 0xbf, + 0x76, 0x72, 0x65, 0xb9, 0xef, 0xba, 0x72, 0xf7, 0xaf, 0x63, 0x2a, 0x27, 0xe1, 0x19, 0xaa, 0xeb, + 0x19, 0x4d, 0x65, 0xc0, 0x43, 0x0e, 0x8a, 0xbc, 0x57, 0xa9, 0x36, 0xa4, 0x67, 0x47, 0x05, 0x01, + 0x7f, 0x8f, 0xee, 0x69, 0x16, 0x82, 0x59, 0x96, 0xe7, 0x6d, 0xbb, 0x12, 0xb2, 0x91, 0x43, 0x8a, + 0xb3, 0xf6, 0x02, 0xed, 0x5f, 0x67, 0x32, 0x40, 0xb0, 0x49, 0x02, 0x01, 0xd9, 0xd9, 0xf5, 0xf6, + 0xee, 0x8c, 0x3f, 0xfd, 0xaf, 0x79, 0x38, 0xc8, 0xbb, 0xe3, 0x2f, 0x50, 0xeb, 0x24, 0xe6, 0x06, + 0x12, 0xae, 0x0d, 0x17, 0xd1, 0x0a, 0x83, 0x1d, 0xa6, 0xb9, 0x19, 0x2b, 0x87, 0x7c, 0x89, 0xda, + 0x5c, 0x1c, 0x33, 0xc5, 0x99, 0x30, 0xd4, 0x8f, 0xc1, 0x9f, 0x52, 0x77, 0xf0, 0x49, 0xd3, 0x2d, + 0x41, 0x73, 0x15, 0x1c, 0xda, 0xd8, 0x81, 0x0d, 0xe1, 0x9f, 0xd1, 0xc7, 0x86, 0x4d, 0x81, 0x66, + 0x4a, 0x86, 0xdc, 0xd0, 0x2b, 0x6f, 0xfa, 0x56, 0xa5, 0x09, 0xeb, 0x5a, 0xf6, 0xc8, 0xa1, 0x07, + 0x97, 0xde, 0xf9, 0x0c, 0xb5, 0xed, 0x66, 0xb1, 0x05, 0x86, 0x00, 0x74, 0xc2, 0x34, 0x38, 0x27, + 0x69, 0x57, 0xf2, 0xe1, 0x02, 0x76, 0x08, 0x30, 0x60, 0x1a, 0xac, 0x05, 0x53, 0xd4, 0xda, 0x54, + 0xd8, 0x3b, 0xc9, 0x19, 0xde, 0xaf, 0x76, 0xb5, 0xac, 0x0d, 0x47, 0x6c, 0x71, 0xa9, 0x80, 0x8b, + 0x5c, 0x70, 0xff, 0x7f, 0x0b, 0xb8, 0x70, 0x82, 0x21, 0xea, 0x6c, 0x0a, 0x7c, 0x99, 0x24, 0xe0, + 0xdb, 0x6b, 0x73, 0x75, 0xc6, 0x88, 0x5b, 0xe0, 0x87, 0xeb, 0xa1, 0xc3, 0x55, 0x9f, 0xe2, 0x4c, + 0x7d, 0x7d, 0xfb, 0xb7, 0x3f, 0xba, 0xb5, 0xc1, 0xc1, 0xcb, 0xd3, 0x8e, 0xf7, 0xea, 0xb4, 0xe3, + 0xfd, 0x7d, 0xda, 0xf1, 0x7e, 0x39, 0xeb, 0xd4, 0x5e, 0x9d, 0x75, 0x6a, 0x7f, 0x9e, 0x75, 0x6a, + 0x3f, 0xee, 0x6f, 0xe4, 0x67, 0xdf, 0x36, 0x8f, 0x04, 0x98, 0x13, 0xa9, 0xa6, 0xee, 0xa3, 0xbf, + 0x28, 0x1f, 0x41, 0x2e, 0xd1, 0xc9, 0x96, 0x7b, 0xe1, 0x3c, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, + 0xd0, 0xf4, 0xd8, 0x3d, 0x20, 0x09, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -235,7 +226,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xca + dAtA[i] = 0xc2 } { size := m.FundingFeeMinRate.Size() @@ -248,7 +239,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xc2 + dAtA[i] = 0xba { size := m.FundingFeeMaxRate.Size() i -= size @@ -260,7 +251,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xba + dAtA[i] = 0xb2 { size := m.FundingFeeBaseRate.Size() i -= size @@ -272,7 +263,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xb2 + dAtA[i] = 0xaa { size := m.TakeProfitBorrowInterestRateMin.Size() i -= size @@ -284,16 +275,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xaa - if len(m.BrokerAddress) > 0 { - i -= len(m.BrokerAddress) - copy(dAtA[i:], m.BrokerAddress) - i = encodeVarintParams(dAtA, i, uint64(len(m.BrokerAddress))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa2 - } + dAtA[i] = 0xa2 if len(m.InvariantCheckEpoch) > 0 { i -= len(m.InvariantCheckEpoch) copy(dAtA[i:], m.InvariantCheckEpoch) @@ -541,10 +523,6 @@ func (m *Params) Size() (n int) { if l > 0 { n += 2 + l + sovParams(uint64(l)) } - l = len(m.BrokerAddress) - if l > 0 { - n += 2 + l + sovParams(uint64(l)) - } l = m.TakeProfitBorrowInterestRateMin.Size() n += 2 + l + sovParams(uint64(l)) l = m.FundingFeeBaseRate.Size() @@ -1178,38 +1156,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { m.InvariantCheckEpoch = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 20: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BrokerAddress", wireType) - } - 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 - } - m.BrokerAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 21: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TakeProfitBorrowInterestRateMin", wireType) } @@ -1243,7 +1189,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 22: + case 21: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FundingFeeBaseRate", wireType) } @@ -1277,7 +1223,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 23: + case 22: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FundingFeeMaxRate", wireType) } @@ -1311,7 +1257,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 24: + case 23: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FundingFeeMinRate", wireType) } @@ -1345,7 +1291,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 25: + case 24: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FundingFeeCollectionAddress", wireType) } diff --git a/x/margin/types/query.pb.gw.go b/x/margin/types/query.pb.gw.go index e9b2a447e..4df04ec91 100644 --- a/x/margin/types/query.pb.gw.go +++ b/x/margin/types/query.pb.gw.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -31,7 +30,6 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ParamsRequest @@ -642,14 +640,12 @@ func local_request_Query_MTP_0(ctx context.Context, marshaler runtime.Marshaler, // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -657,7 +653,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -671,8 +666,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GetPositions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -680,7 +673,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GetPositions_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -694,8 +686,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GetPositionsByPool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -703,7 +693,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GetPositionsByPool_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -717,8 +706,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GetStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -726,7 +713,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GetStatus_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -740,8 +726,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GetPositionsForAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -749,7 +733,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GetPositionsForAddress_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -763,8 +746,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GetWhitelist_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -772,7 +753,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GetWhitelist_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -786,8 +766,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_IsWhitelisted_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -795,7 +773,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_IsWhitelisted_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -809,8 +786,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Pool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -818,7 +793,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Pool_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -832,8 +806,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Pools_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -841,7 +813,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Pools_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -855,8 +826,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_MTP_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -864,7 +833,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_MTP_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/parameter/client/cli/query.go b/x/parameter/client/cli/query.go index d76ea6c7b..1e9227646 100644 --- a/x/parameter/client/cli/query.go +++ b/x/parameter/client/cli/query.go @@ -25,7 +25,6 @@ func GetQueryCmd(queryRoute string) *cobra.Command { } cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListAnteHandlerParam()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/parameter/client/cli/query_ante_handler_param.go b/x/parameter/client/cli/query_ante_handler_param.go deleted file mode 100644 index fb8226dde..000000000 --- a/x/parameter/client/cli/query_ante_handler_param.go +++ /dev/null @@ -1,43 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/elys-network/elys/x/parameter/types" - "github.com/spf13/cobra" -) - -func CmdListAnteHandlerParam() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-ante-handler-param", - Short: "list all ante-handler-param", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllAnteHandlerParamRequest{ - Pagination: pageReq, - } - - res, err := queryClient.AnteHandlerParamAll(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/parameter/client/cli/tx.go b/x/parameter/client/cli/tx.go index 29a0b3ffd..01e2593fb 100644 --- a/x/parameter/client/cli/tx.go +++ b/x/parameter/client/cli/tx.go @@ -7,13 +7,9 @@ import ( "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" // "github.com/cosmos/cosmos-sdk/client/flags" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/parameter/types" ) @@ -35,176 +31,8 @@ func GetTxCmd() *cobra.Command { SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } - cmd.AddCommand(CmdSubmitUpdateMinCommissionRateProposal()) - cmd.AddCommand(CmdSubmitUpdateMaxVotingPowerProposal()) - cmd.AddCommand(CmdSubmitUpdateMinSelfDelegationProposal()) // this line is used by starport scaffolding # 1 return cmd } - -func CmdSubmitUpdateMinCommissionRateProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-min-commission-rate-proposal [commission]", - Args: cobra.ExactArgs(1), - Short: "Submit an update comission rate proposal", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - title, err := cmd.Flags().GetString(cli.FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(cli.FlagDescription) - if err != nil { - return err - } - - content := types.NewProposalUpdateMinCommission( - title, - description, - args[0], - ) - - from := clientCtx.GetFromAddress() - - depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := v1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(cli.FlagTitle, "", "title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "description of proposal") - cmd.Flags().String(cli.FlagDeposit, "", "deposit of proposal") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdSubmitUpdateMaxVotingPowerProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-max-voting-power-proposal [max_voting_power]", - Args: cobra.ExactArgs(1), - Short: "Submit an update max voting power proposal", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - title, err := cmd.Flags().GetString(cli.FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(cli.FlagDescription) - if err != nil { - return err - } - - content := types.NewProposalUpdateMaxVotingPower( - title, - description, - args[0], - ) - - from := clientCtx.GetFromAddress() - - depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := v1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(cli.FlagTitle, "", "title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "description of proposal") - cmd.Flags().String(cli.FlagDeposit, "", "deposit of proposal") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdSubmitUpdateMinSelfDelegationProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-min-self-delegation-proposal [min_self_delegation]", - Args: cobra.ExactArgs(1), - Short: "Submit an update min self delegation proposal", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - title, err := cmd.Flags().GetString(cli.FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(cli.FlagDescription) - if err != nil { - return err - } - - content := types.NewProposalUpdateMinSelfDelegation( - title, - description, - args[0], - ) - - from := clientCtx.GetFromAddress() - - depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := v1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(cli.FlagTitle, "", "title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "description of proposal") - cmd.Flags().String(cli.FlagDeposit, "", "deposit of proposal") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/parameter/client/wasm/querier.go b/x/parameter/client/wasm/querier.go index 321b9b9c0..e11d39fcc 100644 --- a/x/parameter/client/wasm/querier.go +++ b/x/parameter/client/wasm/querier.go @@ -21,8 +21,6 @@ func (oq *Querier) HandleQuery(ctx sdk.Context, query wasmbindingstypes.ElysQuer switch { case query.ParameterParams != nil: return oq.queryParams(ctx, query.ParameterParams) - case query.ParameterAnteHandlerParamAll != nil: - return oq.queryAnteHandlerParamAll(ctx, query.ParameterAnteHandlerParamAll) default: // This handler cannot handle the query return nil, wasmbindingstypes.ErrCannotHandleQuery diff --git a/x/parameter/client/wasm/query_ante_handler_param_all.go b/x/parameter/client/wasm/query_ante_handler_param_all.go deleted file mode 100644 index b8a7418c2..000000000 --- a/x/parameter/client/wasm/query_ante_handler_param_all.go +++ /dev/null @@ -1,22 +0,0 @@ -package wasm - -import ( - "encoding/json" - - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/elys-network/elys/x/parameter/types" -) - -func (oq *Querier) queryAnteHandlerParamAll(ctx sdk.Context, query *types.QueryAllAnteHandlerParamRequest) ([]byte, error) { - res, err := oq.keeper.AnteHandlerParamAll(ctx, query) - if err != nil { - return nil, errorsmod.Wrap(err, "failed to get ante handler param all") - } - - responseBytes, err := json.Marshal(res) - if err != nil { - return nil, errorsmod.Wrap(err, "failed to serialize ante handler param all response") - } - return responseBytes, nil -} diff --git a/x/parameter/client/wasm/query_params.go b/x/parameter/client/wasm/query_params.go index 2e4750a52..908811b13 100644 --- a/x/parameter/client/wasm/query_params.go +++ b/x/parameter/client/wasm/query_params.go @@ -9,7 +9,7 @@ import ( ) func (oq *Querier) queryParams(ctx sdk.Context, query *types.QueryParamsRequest) ([]byte, error) { - res, err := oq.keeper.Params(ctx, query) + res, err := oq.keeper.Params(sdk.WrapSDKContext(ctx), query) if err != nil { return nil, errorsmod.Wrap(err, "failed to get params") } diff --git a/x/parameter/genesis.go b/x/parameter/genesis.go index 06719971c..e585f2aa9 100644 --- a/x/parameter/genesis.go +++ b/x/parameter/genesis.go @@ -8,9 +8,6 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set the anteHandlerParam - k.SetAnteHandlerParam(ctx, genState.AnteHandlerParam) - // this line is used by starport scaffolding # genesis/module/init k.SetParams(ctx, genState.Params) } @@ -20,11 +17,6 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - anteParam, bfound := k.GetAnteHandlerParam(ctx) - if bfound { - genesis.AnteHandlerParam = anteParam - } - // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/parameter/keeper/keeper.go b/x/parameter/keeper/keeper.go index f03daf98f..e2de62e7b 100644 --- a/x/parameter/keeper/keeper.go +++ b/x/parameter/keeper/keeper.go @@ -7,18 +7,15 @@ 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/cosmos/cosmos-sdk/store/prefix" "github.com/elys-network/elys/x/parameter/types" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey } ) @@ -26,49 +23,14 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, - ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, + cdc: cdc, + storeKey: storeKey, + memKey: memKey, } } func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } - -// SetAnteHandlerParam set a specific anteHandlerParam in the store from its index -func (k Keeper) SetAnteHandlerParam(ctx sdk.Context, anteHandlerParam types.AnteHandlerParam) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AnteHandlerParamKeyPrefix)) - b := k.cdc.MustMarshal(&anteHandlerParam) - store.Set(types.AnteHandlerParamKey( - types.AnteStoreKey, - ), b) -} - -// GetAnteHandlerParam returns a anteHandlerParam from its index -func (k Keeper) GetAnteHandlerParam( - ctx sdk.Context, - -) (val types.AnteHandlerParam, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AnteHandlerParamKeyPrefix)) - - b := store.Get(types.AnteHandlerParamKey( - types.AnteStoreKey, - )) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} diff --git a/x/parameter/keeper/msg_server.go b/x/parameter/keeper/msg_server.go index d337565e8..39178dc1e 100644 --- a/x/parameter/keeper/msg_server.go +++ b/x/parameter/keeper/msg_server.go @@ -1,6 +1,10 @@ package keeper import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/elys-network/elys/x/parameter/types" ) @@ -15,3 +19,45 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { } var _ types.MsgServer = msgServer{} + +func (k msgServer) UpdateMinCommission(goCtx context.Context, msg *types.MsgUpdateMinCommission) (*types.MsgUpdateMinCommissionResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + minComission, err := sdk.NewDecFromStr(msg.MinCommission) + if err != nil { + return nil, err + } + + params := k.GetParams(ctx) + params.MinCommissionRate = minComission + k.SetParams(ctx, params) + return &types.MsgUpdateMinCommissionResponse{}, nil +} + +func (k msgServer) UpdateMaxVotingPower(goCtx context.Context, msg *types.MsgUpdateMaxVotingPower) (*types.MsgUpdateMaxVotingPowerResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + maxVotingPower, err := sdk.NewDecFromStr(msg.MaxVotingPower) + if err != nil { + return nil, err + } + + params := k.GetParams(ctx) + params.MaxVotingPower = maxVotingPower + k.SetParams(ctx, params) + return &types.MsgUpdateMaxVotingPowerResponse{}, nil +} + +func (k msgServer) UpdateMinSelfDelegation(goCtx context.Context, msg *types.MsgUpdateMinSelfDelegation) (*types.MsgUpdateMinSelfDelegationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + minSelfDelegation, ok := sdk.NewIntFromString(msg.MinSelfDelegation) + if !ok { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer") + } + + params := k.GetParams(ctx) + params.MinSelfDelegation = minSelfDelegation + k.SetParams(ctx, params) + return &types.MsgUpdateMinSelfDelegationResponse{}, nil +} diff --git a/x/parameter/keeper/params.go b/x/parameter/keeper/params.go index 842081bf2..7c81ec2de 100644 --- a/x/parameter/keeper/params.go +++ b/x/parameter/keeper/params.go @@ -6,11 +6,21 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +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) + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(¶ms) + store.Set([]byte(types.ParamsKey), b) } diff --git a/x/parameter/keeper/query_ante_handler_param.go b/x/parameter/keeper/query_ante_handler_param.go deleted file mode 100644 index 3d1d36c2c..000000000 --- a/x/parameter/keeper/query_ante_handler_param.go +++ /dev/null @@ -1,40 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/elys-network/elys/x/parameter/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) AnteHandlerParamAll(goCtx context.Context, req *types.QueryAllAnteHandlerParamRequest) (*types.QueryAllAnteHandlerParamResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var anteHandlerParams []types.AnteHandlerParam - ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - anteHandlerParamStore := prefix.NewStore(store, types.KeyPrefix(types.AnteHandlerParamKeyPrefix)) - - pageRes, err := query.Paginate(anteHandlerParamStore, req.Pagination, func(key []byte, value []byte) error { - var anteHandlerParam types.AnteHandlerParam - if err := k.cdc.Unmarshal(value, &anteHandlerParam); err != nil { - return err - } - - anteHandlerParams = append(anteHandlerParams, anteHandlerParam) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllAnteHandlerParamResponse{AnteHandlerParam: anteHandlerParams, Pagination: pageRes}, nil -} diff --git a/x/parameter/proposal_handler.go b/x/parameter/proposal_handler.go deleted file mode 100644 index 0bfe52f24..000000000 --- a/x/parameter/proposal_handler.go +++ /dev/null @@ -1,76 +0,0 @@ -package parameter - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/elys-network/elys/x/parameter/keeper" - "github.com/elys-network/elys/x/parameter/types" -) - -func NewParameterChangeProposalHandler(k *keeper.Keeper) govtypes.Handler { - return func(ctx sdk.Context, content govtypes.Content) error { - switch c := content.(type) { - case *types.ProposalUpdateMinCommission: - return handleUpdateMinCommission(ctx, k, c) - case *types.ProposalUpdateMaxVotingPower: - return handleUpdateMaxVotingPower(ctx, k, c) - case *types.ProposalUpdateMinSelfDelegation: - return handleUpdateMinSelfDelegation(ctx, k, c) - - default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized software upgrade proposal content type: %T", c) - } - } -} - -// Update min commission -func handleUpdateMinCommission(ctx sdk.Context, k *keeper.Keeper, p *types.ProposalUpdateMinCommission) error { - minComission, err := sdk.NewDecFromStr(p.MinCommission) - if err != nil { - return err - } - - params, bfound := k.GetAnteHandlerParam(ctx) - if !bfound { - return nil - } - params.MinCommissionRate = minComission - k.SetAnteHandlerParam(ctx, params) - - return nil -} - -// Update max voting power -func handleUpdateMaxVotingPower(ctx sdk.Context, k *keeper.Keeper, p *types.ProposalUpdateMaxVotingPower) error { - maxVotingPower, err := sdk.NewDecFromStr(p.MaxVotingPower) - if err != nil { - return err - } - - params, bfound := k.GetAnteHandlerParam(ctx) - if !bfound { - return nil - } - params.MaxVotingPower = maxVotingPower - k.SetAnteHandlerParam(ctx, params) - - return nil -} - -// Update min self delegation -func handleUpdateMinSelfDelegation(ctx sdk.Context, k *keeper.Keeper, p *types.ProposalUpdateMinSelfDelegation) error { - minSelfDelegation, ok := sdk.NewIntFromString(p.MinSelfDelegation) - if !ok { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer") - } - - params, bfound := k.GetAnteHandlerParam(ctx) - if !bfound { - return nil - } - params.MinSelfDelegation = minSelfDelegation - k.SetAnteHandlerParam(ctx, params) - - return nil -} diff --git a/x/parameter/types/ante_handler_param.pb.go b/x/parameter/types/ante_handler_param.pb.go deleted file mode 100644 index 5e3181592..000000000 --- a/x/parameter/types/ante_handler_param.pb.go +++ /dev/null @@ -1,419 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: elys/parameter/ante_handler_param.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" - 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" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type AnteHandlerParam struct { - MinCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=min_commission_rate,json=minCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_commission_rate"` - MaxVotingPower github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=max_voting_power,json=maxVotingPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_voting_power"` - MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation"` -} - -func (m *AnteHandlerParam) Reset() { *m = AnteHandlerParam{} } -func (m *AnteHandlerParam) String() string { return proto.CompactTextString(m) } -func (*AnteHandlerParam) ProtoMessage() {} -func (*AnteHandlerParam) Descriptor() ([]byte, []int) { - return fileDescriptor_61ae17167f40c52b, []int{0} -} -func (m *AnteHandlerParam) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AnteHandlerParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AnteHandlerParam.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 *AnteHandlerParam) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnteHandlerParam.Merge(m, src) -} -func (m *AnteHandlerParam) XXX_Size() int { - return m.Size() -} -func (m *AnteHandlerParam) XXX_DiscardUnknown() { - xxx_messageInfo_AnteHandlerParam.DiscardUnknown(m) -} - -var xxx_messageInfo_AnteHandlerParam proto.InternalMessageInfo - -func init() { - proto.RegisterType((*AnteHandlerParam)(nil), "elys.parameter.AnteHandlerParam") -} - -func init() { - proto.RegisterFile("elys/parameter/ante_handler_param.proto", fileDescriptor_61ae17167f40c52b) -} - -var fileDescriptor_61ae17167f40c52b = []byte{ - // 320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0xbd, 0x4e, 0x3a, 0x41, - 0x14, 0xc5, 0x77, 0xf9, 0x27, 0xff, 0xc4, 0x2d, 0x08, 0xa2, 0x05, 0xa1, 0x58, 0x8c, 0x85, 0xda, - 0xb0, 0x13, 0xe2, 0x13, 0x88, 0x14, 0xd8, 0x11, 0x4c, 0x8c, 0xb1, 0x70, 0x32, 0xbb, 0x5c, 0x96, - 0x09, 0x3b, 0x73, 0x37, 0x33, 0x57, 0x3e, 0xde, 0xc2, 0x07, 0xf1, 0x41, 0x28, 0x29, 0x8d, 0x05, - 0x31, 0xf0, 0x22, 0x66, 0x67, 0x95, 0xd0, 0x6a, 0x35, 0x1f, 0xf7, 0xe4, 0x77, 0x4e, 0xee, 0x09, - 0x2e, 0x21, 0x5b, 0x5a, 0x96, 0x0b, 0x23, 0x14, 0x10, 0x18, 0x26, 0x34, 0x01, 0x9f, 0x08, 0x3d, - 0xca, 0xc0, 0x70, 0xf7, 0x1d, 0xe5, 0x06, 0x09, 0xeb, 0xd5, 0x42, 0x18, 0xed, 0x85, 0xcd, 0xd3, - 0x14, 0x53, 0x74, 0x23, 0x56, 0xdc, 0x4a, 0x55, 0x33, 0x4c, 0xd0, 0x2a, 0xb4, 0x2c, 0x16, 0x16, - 0xd8, 0xac, 0x13, 0x03, 0x89, 0x0e, 0x4b, 0x50, 0xea, 0x72, 0x7e, 0xfe, 0x56, 0x09, 0x6a, 0x37, - 0x9a, 0xa0, 0x5f, 0x3a, 0x0c, 0x0a, 0x5c, 0xfd, 0x39, 0x38, 0x51, 0x52, 0xf3, 0x04, 0x95, 0x92, - 0xd6, 0x4a, 0xd4, 0xdc, 0x08, 0x82, 0x86, 0x7f, 0xe6, 0x5f, 0x1d, 0x75, 0xa3, 0xd5, 0xa6, 0xe5, - 0x7d, 0x6c, 0x5a, 0x17, 0xa9, 0xa4, 0xc9, 0x4b, 0x1c, 0x25, 0xa8, 0xd8, 0xb7, 0x49, 0x79, 0xb4, - 0xed, 0x68, 0xca, 0x68, 0x99, 0x83, 0x8d, 0x7a, 0x90, 0x0c, 0x8f, 0x95, 0xd4, 0xb7, 0x7b, 0xd2, - 0x50, 0x10, 0xd4, 0x1f, 0x83, 0x9a, 0x12, 0x0b, 0x3e, 0x43, 0x92, 0x3a, 0xe5, 0x39, 0xce, 0xc1, - 0x34, 0x2a, 0x7f, 0x82, 0x57, 0x95, 0x58, 0x3c, 0x38, 0xcc, 0xa0, 0xa0, 0xfc, 0x24, 0xb7, 0x90, - 0x8d, 0xf9, 0x08, 0x32, 0x48, 0x05, 0x49, 0xd4, 0x8d, 0x7f, 0xbf, 0x86, 0xdf, 0x69, 0x72, 0xc9, - 0xef, 0x21, 0x1b, 0xf7, 0xf6, 0xa0, 0x6e, 0x7f, 0xb5, 0x0d, 0xfd, 0xf5, 0x36, 0xf4, 0x3f, 0xb7, - 0xa1, 0xff, 0xba, 0x0b, 0xbd, 0xf5, 0x2e, 0xf4, 0xde, 0x77, 0xa1, 0xf7, 0x14, 0x1d, 0x40, 0x8b, - 0x66, 0xda, 0x1a, 0x68, 0x8e, 0x66, 0xea, 0x1e, 0x6c, 0x71, 0xd0, 0xa8, 0x33, 0x88, 0xff, 0xbb, - 0xfd, 0x5f, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x36, 0x82, 0xe2, 0xf0, 0x01, 0x00, 0x00, -} - -func (m *AnteHandlerParam) 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 *AnteHandlerParam) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AnteHandlerParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.MinSelfDelegation.Size() - i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAnteHandlerParam(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.MaxVotingPower.Size() - i -= size - if _, err := m.MaxVotingPower.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAnteHandlerParam(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.MinCommissionRate.Size() - i -= size - if _, err := m.MinCommissionRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAnteHandlerParam(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintAnteHandlerParam(dAtA []byte, offset int, v uint64) int { - offset -= sovAnteHandlerParam(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *AnteHandlerParam) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MinCommissionRate.Size() - n += 1 + l + sovAnteHandlerParam(uint64(l)) - l = m.MaxVotingPower.Size() - n += 1 + l + sovAnteHandlerParam(uint64(l)) - l = m.MinSelfDelegation.Size() - n += 1 + l + sovAnteHandlerParam(uint64(l)) - return n -} - -func sovAnteHandlerParam(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAnteHandlerParam(x uint64) (n int) { - return sovAnteHandlerParam(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *AnteHandlerParam) 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 ErrIntOverflowAnteHandlerParam - } - 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: AnteHandlerParam: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AnteHandlerParam: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinCommissionRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAnteHandlerParam - } - 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 ErrInvalidLengthAnteHandlerParam - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAnteHandlerParam - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxVotingPower", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAnteHandlerParam - } - 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 ErrInvalidLengthAnteHandlerParam - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAnteHandlerParam - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxVotingPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAnteHandlerParam - } - 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 ErrInvalidLengthAnteHandlerParam - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAnteHandlerParam - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAnteHandlerParam(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAnteHandlerParam - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAnteHandlerParam(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAnteHandlerParam - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAnteHandlerParam - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAnteHandlerParam - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAnteHandlerParam - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAnteHandlerParam - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAnteHandlerParam - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAnteHandlerParam = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAnteHandlerParam = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAnteHandlerParam = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/parameter/types/codec.go b/x/parameter/types/codec.go index d0aa4917e..0a1e8247c 100644 --- a/x/parameter/types/codec.go +++ b/x/parameter/types/codec.go @@ -3,23 +3,25 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" // this line is used by starport scaffolding # 1 "github.com/cosmos/cosmos-sdk/types/msgservice" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func RegisterCodec(cdc *codec.LegacyAmino) { // this line is used by starport scaffolding # 2 + cdc.RegisterConcrete(&MsgUpdateMinCommission{}, "parameter/MsgUpdateMinCommission", nil) + cdc.RegisterConcrete(&MsgUpdateMaxVotingPower{}, "amm/MsgUpdateMaxVotingPower", nil) + cdc.RegisterConcrete(&MsgUpdateMinSelfDelegation{}, "amm/MsgUpdateMinSelfDelegation", nil) + // this line is used by starport scaffolding # 2 } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - - registry.RegisterImplementations( - (*govtypes.Content)(nil), - &ProposalUpdateMinCommission{}, - &ProposalUpdateMaxVotingPower{}, - &ProposalUpdateMinSelfDelegation{}, + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateMinCommission{}, + &MsgUpdateMaxVotingPower{}, + &MsgUpdateMinSelfDelegation{}, ) // this line is used by starport scaffolding # 3 diff --git a/x/parameter/types/genesis.go b/x/parameter/types/genesis.go index b646afbe3..f2689b73b 100644 --- a/x/parameter/types/genesis.go +++ b/x/parameter/types/genesis.go @@ -1,21 +1,11 @@ package types -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - // DefaultIndex is the default global index const DefaultIndex uint64 = 1 // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { - anteParam := AnteHandlerParam{ - MinCommissionRate: sdk.NewDecWithPrec(5, 2), - MaxVotingPower: sdk.NewDecWithPrec(66, 1), - MinSelfDelegation: sdk.NewInt(1)} - return &GenesisState{ - AnteHandlerParam: anteParam, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } diff --git a/x/parameter/types/genesis.pb.go b/x/parameter/types/genesis.pb.go index 2482a1cdf..e45d8583b 100644 --- a/x/parameter/types/genesis.pb.go +++ b/x/parameter/types/genesis.pb.go @@ -25,8 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the parameter module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - AnteHandlerParam AnteHandlerParam `protobuf:"bytes,2,opt,name=ante_handler_param,json=anteHandlerParam,proto3" json:"ante_handler_param"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -69,13 +68,6 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetAnteHandlerParam() AnteHandlerParam { - if m != nil { - return m.AnteHandlerParam - } - return AnteHandlerParam{} -} - func init() { proto.RegisterType((*GenesisState)(nil), "elys.parameter.GenesisState") } @@ -83,23 +75,19 @@ func init() { func init() { proto.RegisterFile("elys/parameter/genesis.proto", fileDescriptor_854dcce2a04e2574) } var fileDescriptor_854dcce2a04e2574 = []byte{ - // 241 bytes of a gzipped FileDescriptorProto + // 191 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcd, 0xa9, 0x2c, 0xd6, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x4d, 0x2d, 0x49, 0x2d, 0xd2, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0xc9, 0xea, 0xc1, 0x65, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x34, 0x9a, 0x19, - 0x60, 0x16, 0xd4, 0x08, 0x29, 0x75, 0x34, 0xc9, 0xc4, 0xbc, 0x92, 0xd4, 0xf8, 0x8c, 0xc4, 0xbc, - 0x94, 0x9c, 0xd4, 0xa2, 0x78, 0xb0, 0x30, 0x44, 0xa1, 0xd2, 0x2c, 0x46, 0x2e, 0x1e, 0x77, 0x88, - 0xed, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0x26, 0x5c, 0x6c, 0x10, 0x93, 0x24, 0x18, 0x15, 0x18, - 0x35, 0xb8, 0x8d, 0xc4, 0xf4, 0x50, 0x5d, 0xa3, 0x17, 0x00, 0x96, 0x75, 0x62, 0x39, 0x71, 0x4f, - 0x9e, 0x21, 0x08, 0xaa, 0x56, 0x28, 0x84, 0x4b, 0x08, 0xd3, 0x0a, 0x09, 0x26, 0xb0, 0x09, 0x0a, - 0xe8, 0x26, 0x38, 0xe6, 0x95, 0xa4, 0x7a, 0x40, 0x14, 0x82, 0x0d, 0x83, 0x9a, 0x25, 0x90, 0x88, - 0x2e, 0xee, 0x71, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, - 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x7a, 0xe9, 0x99, - 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0xd3, 0x75, 0xf3, 0x52, 0x4b, 0xca, - 0xf3, 0x8b, 0xb2, 0xc1, 0x1c, 0xfd, 0x0a, 0x24, 0x9f, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, - 0x81, 0x7d, 0x6b, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xc4, 0x48, 0xe3, 0x8b, 0x79, 0x01, 0x00, - 0x00, + 0x60, 0x16, 0xd4, 0x08, 0x25, 0x17, 0x2e, 0x1e, 0x77, 0x88, 0x99, 0xc1, 0x25, 0x89, 0x25, 0xa9, + 0x42, 0x26, 0x5c, 0x6c, 0x10, 0x79, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x31, 0x3d, 0x54, + 0x3b, 0xf4, 0x02, 0xc0, 0xb2, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0xd5, 0x3a, 0x79, + 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, + 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x5e, 0x7a, 0x66, 0x49, 0x46, + 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, 0x24, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, + 0x6c, 0x30, 0x47, 0xbf, 0x02, 0xc9, 0x59, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x67, + 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd9, 0xfc, 0x1e, 0xaa, 0xf9, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -122,16 +110,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.AnteHandlerParam.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -164,8 +142,6 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - l = m.AnteHandlerParam.Size() - n += 1 + l + sovGenesis(uint64(l)) return n } @@ -237,39 +213,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AnteHandlerParam", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.AnteHandlerParam.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/parameter/types/keys.go b/x/parameter/types/keys.go index 6306c15ce..4c398cad3 100644 --- a/x/parameter/types/keys.go +++ b/x/parameter/types/keys.go @@ -15,10 +15,8 @@ const ( // MemStoreKey defines the in-memory store key MemStoreKey = "mem_parameter" - // AnteHandlerParamKeyPrefix is the prefix to retrieve all AnteHandlerParam - AnteHandlerParamKeyPrefix = "AnteHandlerParam/value/" - - AnteStoreKey = "ante-handler-param" + // ParamsKey is the prefix to retrieve all Params + ParamsKey = "Params/value/" ) const ( @@ -58,16 +56,3 @@ var _ binary.ByteOrder func KeyPrefix(p string) []byte { return []byte(p) } - -// AnteHandlerParamKey returns the store key to retrieve a AnteHandlerParam from the index fields -func AnteHandlerParamKey( - index string, -) []byte { - var key []byte - - indexBytes := []byte(index) - key = append(key, indexBytes...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/parameter/types/msgs.go b/x/parameter/types/msgs.go new file mode 100644 index 000000000..c67f16800 --- /dev/null +++ b/x/parameter/types/msgs.go @@ -0,0 +1,81 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ sdk.Msg = &MsgUpdateMinCommission{} + +func NewMsgExitPool(creator string, minCommission string) *MsgUpdateMinCommission { + return &MsgUpdateMinCommission{ + Creator: creator, + MinCommission: minCommission, + } +} + +func (msg *MsgUpdateMinCommission) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgUpdateMinCommission) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + return nil +} + +var _ sdk.Msg = &MsgUpdateMinCommission{} + +func NewMsgUpdateMaxVotingPower(creator string, maxVotingPower string) *MsgUpdateMaxVotingPower { + return &MsgUpdateMaxVotingPower{ + Creator: creator, + MaxVotingPower: maxVotingPower, + } +} + +func (msg *MsgUpdateMaxVotingPower) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgUpdateMaxVotingPower) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + return nil +} + +var _ sdk.Msg = &MsgUpdateMinCommission{} + +func NewMsgUpdateMinSelfDelegation(creator string, minSelfDelegation string) *MsgUpdateMinSelfDelegation { + return &MsgUpdateMinSelfDelegation{ + Creator: creator, + MinSelfDelegation: minSelfDelegation, + } +} + +func (msg *MsgUpdateMinSelfDelegation) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg *MsgUpdateMinSelfDelegation) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + return nil +} diff --git a/x/parameter/types/params.go b/x/parameter/types/params.go index 357196ad6..28fa3788f 100644 --- a/x/parameter/types/params.go +++ b/x/parameter/types/params.go @@ -1,30 +1,26 @@ package types import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + sdk "github.com/cosmos/cosmos-sdk/types" "gopkg.in/yaml.v2" ) -var _ paramtypes.ParamSet = (*Params)(nil) - -// 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() Params { - return Params{} +func NewParams(minCommissionRate sdk.Dec, maxVotingPower sdk.Dec, minSelfDelegation sdk.Int) Params { + return Params{ + MinCommissionRate: minCommissionRate, + MaxVotingPower: maxVotingPower, + MinSelfDelegation: minSelfDelegation, + } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return NewParams( + sdk.NewDecWithPrec(5, 2), + sdk.NewDec(100), + sdk.OneInt(), + ) } // Validate validates the set of params diff --git a/x/parameter/types/params.pb.go b/x/parameter/types/params.pb.go index 99469b4cc..aa540c1dc 100644 --- a/x/parameter/types/params.pb.go +++ b/x/parameter/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,6 +26,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + MinCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=min_commission_rate,json=minCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_commission_rate"` + MaxVotingPower github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=max_voting_power,json=maxVotingPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_voting_power"` + MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation"` + BrokerAddress string `protobuf:"bytes,4,opt,name=broker_address,json=brokerAddress,proto3" json:"broker_address,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -59,6 +64,13 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetBrokerAddress() string { + if m != nil { + return m.BrokerAddress + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "elys.parameter.Params") } @@ -66,17 +78,27 @@ func init() { func init() { proto.RegisterFile("elys/parameter/params.proto", fileDescriptor_b61780a5be327c2b) } var fileDescriptor_b61780a5be327c2b = []byte{ - // 148 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcd, 0xa9, 0x2c, - 0xd6, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x4d, 0x2d, 0x49, 0x2d, 0x82, 0xb0, 0x8a, 0xf5, 0x0a, 0x8a, - 0xf2, 0x4b, 0xf2, 0x85, 0xf8, 0x40, 0x92, 0x7a, 0x70, 0x49, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, - 0xb0, 0x94, 0x3e, 0x88, 0x05, 0x51, 0xa5, 0xc4, 0xc7, 0xc5, 0x16, 0x00, 0xd6, 0x65, 0xc5, 0x32, - 0x63, 0x81, 0x3c, 0x83, 0x93, 0xc7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, - 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, - 0xe9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x83, 0x8c, 0xd6, 0xcd, - 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x06, 0x73, 0xf4, 0x2b, 0x90, 0x9c, 0x51, 0x52, 0x59, 0x90, - 0x5a, 0x9c, 0xc4, 0x06, 0xb6, 0xc0, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xdd, 0xab, 0x8d, - 0xa5, 0x00, 0x00, 0x00, + // 316 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0x31, 0x4b, 0xc3, 0x40, + 0x14, 0xc7, 0x93, 0x5a, 0x0a, 0x06, 0x2c, 0x1a, 0x1d, 0x82, 0x42, 0x2a, 0x82, 0xe2, 0xd2, 0xcb, + 0xe0, 0xe6, 0x66, 0xed, 0xa0, 0x5b, 0xa9, 0x20, 0xe2, 0xe0, 0x71, 0x4d, 0x5e, 0xe3, 0xd1, 0xdc, + 0xbd, 0x70, 0x77, 0xda, 0xf6, 0x5b, 0x38, 0x3a, 0xfa, 0x71, 0xba, 0xd9, 0x51, 0x1c, 0x8a, 0xb4, + 0x5f, 0x44, 0x72, 0xd1, 0xd0, 0x55, 0xa7, 0x7b, 0xf7, 0xfe, 0x77, 0x3f, 0x7e, 0xf0, 0xf7, 0x0e, + 0x20, 0x9b, 0xea, 0x28, 0x67, 0x8a, 0x09, 0x30, 0xa0, 0xca, 0x49, 0x93, 0x5c, 0xa1, 0x41, 0xbf, + 0x59, 0x84, 0xa4, 0x0a, 0xf7, 0xf7, 0x52, 0x4c, 0xd1, 0x46, 0x51, 0x31, 0x95, 0xaf, 0x8e, 0xde, + 0x6b, 0x5e, 0xa3, 0x67, 0xbf, 0xf9, 0x0f, 0xde, 0xae, 0xe0, 0x92, 0xc6, 0x28, 0x04, 0xd7, 0x9a, + 0xa3, 0xa4, 0x8a, 0x19, 0x08, 0xdc, 0x43, 0xf7, 0x74, 0xb3, 0x43, 0x66, 0x8b, 0x96, 0xf3, 0xb9, + 0x68, 0x9d, 0xa4, 0xdc, 0x3c, 0x3e, 0x0d, 0x48, 0x8c, 0x22, 0x8a, 0x51, 0x0b, 0xd4, 0x3f, 0x47, + 0x5b, 0x27, 0xa3, 0xc8, 0x4c, 0x73, 0xd0, 0xa4, 0x0b, 0x71, 0x7f, 0x47, 0x70, 0x79, 0x59, 0x91, + 0xfa, 0xcc, 0x80, 0x7f, 0xe7, 0x6d, 0x0b, 0x36, 0xa1, 0xcf, 0x68, 0xb8, 0x4c, 0x69, 0x8e, 0x63, + 0x50, 0x41, 0xed, 0x5f, 0xf0, 0xa6, 0x60, 0x93, 0x5b, 0x8b, 0xe9, 0x15, 0x94, 0x5f, 0x73, 0x0d, + 0xd9, 0x90, 0x26, 0x90, 0x41, 0xca, 0x0c, 0x47, 0x19, 0x6c, 0xfc, 0x19, 0x7e, 0x2d, 0x8d, 0x35, + 0xbf, 0x81, 0x6c, 0xd8, 0xad, 0x40, 0xfe, 0xb1, 0xd7, 0x1c, 0x28, 0x1c, 0x81, 0xa2, 0x2c, 0x49, + 0x14, 0x68, 0x1d, 0xd4, 0x0b, 0x74, 0x7f, 0xab, 0xdc, 0x5e, 0x94, 0xcb, 0xf3, 0xfa, 0xeb, 0x5b, + 0xcb, 0xe9, 0x5c, 0xcd, 0x96, 0xa1, 0x3b, 0x5f, 0x86, 0xee, 0xd7, 0x32, 0x74, 0x5f, 0x56, 0xa1, + 0x33, 0x5f, 0x85, 0xce, 0xc7, 0x2a, 0x74, 0xee, 0xc9, 0x9a, 0x41, 0x51, 0x4e, 0x5b, 0x82, 0x19, + 0xa3, 0x1a, 0xd9, 0x4b, 0x34, 0x59, 0x2b, 0xd2, 0xda, 0x0c, 0x1a, 0xb6, 0xa2, 0xb3, 0xef, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xe2, 0x79, 0x2a, 0x74, 0xe7, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -99,6 +121,43 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BrokerAddress) > 0 { + i -= len(m.BrokerAddress) + copy(dAtA[i:], m.BrokerAddress) + i = encodeVarintParams(dAtA, i, uint64(len(m.BrokerAddress))) + i-- + dAtA[i] = 0x22 + } + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.MaxVotingPower.Size() + i -= size + if _, err := m.MaxVotingPower.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.MinCommissionRate.Size() + i -= size + if _, err := m.MinCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -119,6 +178,16 @@ func (m *Params) Size() (n int) { } var l int _ = l + l = m.MinCommissionRate.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.MaxVotingPower.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.MinSelfDelegation.Size() + n += 1 + l + sovParams(uint64(l)) + l = len(m.BrokerAddress) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -157,6 +226,140 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCommissionRate", wireType) + } + 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.MinCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxVotingPower", wireType) + } + 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.MaxVotingPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + } + 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.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BrokerAddress", wireType) + } + 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 + } + m.BrokerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/parameter/types/proposal.go b/x/parameter/types/proposal.go deleted file mode 100644 index 0021863ce..000000000 --- a/x/parameter/types/proposal.go +++ /dev/null @@ -1,117 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -const ( - ProposalTypeUpdateMinCommissionRate string = "UpdateMinCommissionRate" - ProposalTypeUpdateMaxVotingPower string = "UpdateMaxVotingPower" - ProposalTypeUpdateMinSelfDelegation string = "UpdateMinSelfDelegation" -) - -func init() { - gov.RegisterProposalType(ProposalTypeUpdateMinCommissionRate) - gov.RegisterProposalType(ProposalTypeUpdateMaxVotingPower) - gov.RegisterProposalType(ProposalTypeUpdateMinSelfDelegation) -} - -// NewProposalUpdateMinCommission creates a new ProposalUpdateMinCommission instance -func NewProposalUpdateMinCommission( - title, description string, - minCommission string, -) gov.Content { - return &ProposalUpdateMinCommission{ - Title: title, - Description: description, - MinCommission: minCommission, - } -} - -// Implements Proposal Interface -var _ gov.Content = &ProposalUpdateMinCommission{} - -// ProposalRoute gets the proposal's router key -func (sup *ProposalUpdateMinCommission) ProposalRoute() string { return RouterKey } - -// ProposalType is "SoftwareUpgrade" -func (sup *ProposalUpdateMinCommission) ProposalType() string { - return ProposalTypeUpdateMinCommissionRate -} - -// ValidateBasic validates the proposal -func (sup *ProposalUpdateMinCommission) ValidateBasic() error { - _, err := sdk.NewDecFromStr(sup.MinCommission) - if err != nil { - return err - } - // sup.MinCommission - return gov.ValidateAbstract(sup) -} - -// NewProposalUpdateMaxVotingPower creates a new ProposalUpdateMaxVotingPower instance -func NewProposalUpdateMaxVotingPower( - title, description string, - maxVotingPower string, -) gov.Content { - return &ProposalUpdateMaxVotingPower{ - Title: title, - Description: description, - MaxVotingPower: maxVotingPower, - } -} - -// Implements Proposal Interface -var _ gov.Content = &ProposalUpdateMaxVotingPower{} - -// ProposalRoute gets the proposal's router key -func (sup *ProposalUpdateMaxVotingPower) ProposalRoute() string { return RouterKey } - -// ProposalType is "SoftwareUpgrade" -func (sup *ProposalUpdateMaxVotingPower) ProposalType() string { - return ProposalTypeUpdateMaxVotingPower -} - -// ValidateBasic validates the proposal -func (sup *ProposalUpdateMaxVotingPower) ValidateBasic() error { - _, err := sdk.NewDecFromStr(sup.MaxVotingPower) - if err != nil { - return err - } - return gov.ValidateAbstract(sup) -} - -// NewProposalUpdateMinSelfDelegation creates a new NewProposalUpdateMinSelfDelegation instance -func NewProposalUpdateMinSelfDelegation( - title, description string, - minSelfDelegation string, -) gov.Content { - return &ProposalUpdateMinSelfDelegation{ - Title: title, - Description: description, - MinSelfDelegation: minSelfDelegation, - } -} - -// Implements Proposal Interface -var _ gov.Content = &ProposalUpdateMinSelfDelegation{} - -// ProposalRoute gets the proposal's router key -func (sup *ProposalUpdateMinSelfDelegation) ProposalRoute() string { return RouterKey } - -// ProposalType is "SoftwareUpgrade" -func (sup *ProposalUpdateMinSelfDelegation) ProposalType() string { - return ProposalTypeUpdateMinSelfDelegation -} - -// ValidateBasic validates the proposal -func (sup *ProposalUpdateMinSelfDelegation) ValidateBasic() error { - _, ok := sdk.NewIntFromString(sup.MinSelfDelegation) - if !ok { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer") - } - - return gov.ValidateAbstract(sup) -} diff --git a/x/parameter/types/proposal.pb.go b/x/parameter/types/proposal.pb.go deleted file mode 100644 index db128853f..000000000 --- a/x/parameter/types/proposal.pb.go +++ /dev/null @@ -1,969 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: elys/parameter/proposal.proto - -package types - -import ( - fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type ProposalUpdateMinCommission struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - MinCommission string `protobuf:"bytes,3,opt,name=min_commission,json=minCommission,proto3" json:"min_commission,omitempty"` -} - -func (m *ProposalUpdateMinCommission) Reset() { *m = ProposalUpdateMinCommission{} } -func (m *ProposalUpdateMinCommission) String() string { return proto.CompactTextString(m) } -func (*ProposalUpdateMinCommission) ProtoMessage() {} -func (*ProposalUpdateMinCommission) Descriptor() ([]byte, []int) { - return fileDescriptor_f9a4532402d67c8f, []int{0} -} -func (m *ProposalUpdateMinCommission) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalUpdateMinCommission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalUpdateMinCommission.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 *ProposalUpdateMinCommission) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalUpdateMinCommission.Merge(m, src) -} -func (m *ProposalUpdateMinCommission) XXX_Size() int { - return m.Size() -} -func (m *ProposalUpdateMinCommission) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalUpdateMinCommission.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalUpdateMinCommission proto.InternalMessageInfo - -func (m *ProposalUpdateMinCommission) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalUpdateMinCommission) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalUpdateMinCommission) GetMinCommission() string { - if m != nil { - return m.MinCommission - } - return "" -} - -type ProposalUpdateMaxVotingPower struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - MaxVotingPower string `protobuf:"bytes,3,opt,name=max_voting_power,json=maxVotingPower,proto3" json:"max_voting_power,omitempty"` -} - -func (m *ProposalUpdateMaxVotingPower) Reset() { *m = ProposalUpdateMaxVotingPower{} } -func (m *ProposalUpdateMaxVotingPower) String() string { return proto.CompactTextString(m) } -func (*ProposalUpdateMaxVotingPower) ProtoMessage() {} -func (*ProposalUpdateMaxVotingPower) Descriptor() ([]byte, []int) { - return fileDescriptor_f9a4532402d67c8f, []int{1} -} -func (m *ProposalUpdateMaxVotingPower) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalUpdateMaxVotingPower) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalUpdateMaxVotingPower.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 *ProposalUpdateMaxVotingPower) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalUpdateMaxVotingPower.Merge(m, src) -} -func (m *ProposalUpdateMaxVotingPower) XXX_Size() int { - return m.Size() -} -func (m *ProposalUpdateMaxVotingPower) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalUpdateMaxVotingPower.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalUpdateMaxVotingPower proto.InternalMessageInfo - -func (m *ProposalUpdateMaxVotingPower) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalUpdateMaxVotingPower) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalUpdateMaxVotingPower) GetMaxVotingPower() string { - if m != nil { - return m.MaxVotingPower - } - return "" -} - -type ProposalUpdateMinSelfDelegation struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - MinSelfDelegation string `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3" json:"min_self_delegation,omitempty"` -} - -func (m *ProposalUpdateMinSelfDelegation) Reset() { *m = ProposalUpdateMinSelfDelegation{} } -func (m *ProposalUpdateMinSelfDelegation) String() string { return proto.CompactTextString(m) } -func (*ProposalUpdateMinSelfDelegation) ProtoMessage() {} -func (*ProposalUpdateMinSelfDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_f9a4532402d67c8f, []int{2} -} -func (m *ProposalUpdateMinSelfDelegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalUpdateMinSelfDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalUpdateMinSelfDelegation.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 *ProposalUpdateMinSelfDelegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalUpdateMinSelfDelegation.Merge(m, src) -} -func (m *ProposalUpdateMinSelfDelegation) XXX_Size() int { - return m.Size() -} -func (m *ProposalUpdateMinSelfDelegation) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalUpdateMinSelfDelegation.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalUpdateMinSelfDelegation proto.InternalMessageInfo - -func (m *ProposalUpdateMinSelfDelegation) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalUpdateMinSelfDelegation) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalUpdateMinSelfDelegation) GetMinSelfDelegation() string { - if m != nil { - return m.MinSelfDelegation - } - return "" -} - -func init() { - proto.RegisterType((*ProposalUpdateMinCommission)(nil), "elys.parameter.ProposalUpdateMinCommission") - proto.RegisterType((*ProposalUpdateMaxVotingPower)(nil), "elys.parameter.ProposalUpdateMaxVotingPower") - proto.RegisterType((*ProposalUpdateMinSelfDelegation)(nil), "elys.parameter.ProposalUpdateMinSelfDelegation") -} - -func init() { proto.RegisterFile("elys/parameter/proposal.proto", fileDescriptor_f9a4532402d67c8f) } - -var fileDescriptor_f9a4532402d67c8f = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x91, 0xbf, 0x4a, 0xf4, 0x40, - 0x14, 0xc5, 0x77, 0xbe, 0x0f, 0x05, 0x47, 0x0c, 0x1a, 0x2d, 0x02, 0xea, 0xb8, 0x04, 0x84, 0x6d, - 0x4c, 0x0a, 0xdf, 0x40, 0x2d, 0x6c, 0x84, 0x45, 0xd1, 0xc2, 0x26, 0xcc, 0x26, 0x77, 0xe3, 0xe0, - 0xfc, 0x63, 0x66, 0x74, 0xb3, 0x60, 0x61, 0x6b, 0xe7, 0x63, 0x59, 0x6e, 0x69, 0x29, 0xc9, 0x8b, - 0x48, 0x62, 0x08, 0x71, 0xed, 0xb4, 0xbc, 0xf7, 0x5c, 0x7e, 0xe7, 0x72, 0x0e, 0xde, 0x07, 0x3e, - 0xb7, 0xb1, 0xa6, 0x86, 0x0a, 0x70, 0x60, 0x62, 0x6d, 0x94, 0x56, 0x96, 0xf2, 0x48, 0x1b, 0xe5, - 0x94, 0xef, 0xd5, 0x72, 0xd4, 0xc9, 0xe1, 0x13, 0xde, 0x1d, 0xb7, 0x17, 0xd7, 0x3a, 0xa3, 0x0e, - 0x2e, 0x98, 0x3c, 0x55, 0x42, 0x30, 0x6b, 0x99, 0x92, 0xfe, 0x0e, 0x5e, 0x71, 0xcc, 0x71, 0x08, - 0xd0, 0x10, 0x8d, 0xd6, 0x2e, 0xbf, 0x06, 0x7f, 0x88, 0xd7, 0x33, 0xb0, 0xa9, 0x61, 0xda, 0x31, - 0x25, 0x83, 0x7f, 0x8d, 0xd6, 0x5f, 0xf9, 0x87, 0xd8, 0x13, 0x4c, 0x26, 0x69, 0x47, 0x0a, 0xfe, - 0x37, 0x47, 0x1b, 0xa2, 0x8f, 0x0f, 0x9f, 0x11, 0xde, 0x5b, 0xb2, 0xa7, 0xc5, 0x8d, 0x72, 0x4c, - 0xe6, 0x63, 0x35, 0x03, 0xf3, 0x6b, 0xff, 0x11, 0xde, 0x14, 0xb4, 0x48, 0x1e, 0x1b, 0x54, 0xa2, - 0x6b, 0x56, 0xfb, 0x81, 0x27, 0xbe, 0x39, 0x84, 0x2f, 0x08, 0x1f, 0xfc, 0x48, 0xe0, 0x0a, 0xf8, - 0xf4, 0x0c, 0x38, 0xe4, 0xd4, 0xfd, 0x25, 0x85, 0x08, 0x6f, 0xd7, 0x29, 0x58, 0xe0, 0xd3, 0x24, - 0xeb, 0x70, 0xed, 0x23, 0x5b, 0x62, 0xd9, 0xe7, 0xe4, 0xfc, 0xad, 0x24, 0x68, 0x51, 0x12, 0xf4, - 0x51, 0x12, 0xf4, 0x5a, 0x91, 0xc1, 0xa2, 0x22, 0x83, 0xf7, 0x8a, 0x0c, 0x6e, 0xa3, 0x9c, 0xb9, - 0xbb, 0x87, 0x49, 0x94, 0x2a, 0x11, 0xd7, 0x0d, 0x1e, 0x49, 0x70, 0x33, 0x65, 0xee, 0x9b, 0x21, - 0x2e, 0x7a, 0x7d, 0xbb, 0xb9, 0x06, 0x3b, 0x59, 0x6d, 0xda, 0x3e, 0xfe, 0x0c, 0x00, 0x00, 0xff, - 0xff, 0xac, 0x87, 0x6d, 0x07, 0x0e, 0x02, 0x00, 0x00, -} - -func (m *ProposalUpdateMinCommission) 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 *ProposalUpdateMinCommission) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalUpdateMinCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MinCommission) > 0 { - i -= len(m.MinCommission) - copy(dAtA[i:], m.MinCommission) - i = encodeVarintProposal(dAtA, i, uint64(len(m.MinCommission))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalUpdateMaxVotingPower) 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 *ProposalUpdateMaxVotingPower) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalUpdateMaxVotingPower) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MaxVotingPower) > 0 { - i -= len(m.MaxVotingPower) - copy(dAtA[i:], m.MaxVotingPower) - i = encodeVarintProposal(dAtA, i, uint64(len(m.MaxVotingPower))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalUpdateMinSelfDelegation) 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 *ProposalUpdateMinSelfDelegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalUpdateMinSelfDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MinSelfDelegation) > 0 { - i -= len(m.MinSelfDelegation) - copy(dAtA[i:], m.MinSelfDelegation) - i = encodeVarintProposal(dAtA, i, uint64(len(m.MinSelfDelegation))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintProposal(dAtA []byte, offset int, v uint64) int { - offset -= sovProposal(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ProposalUpdateMinCommission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.MinCommission) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalUpdateMaxVotingPower) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.MaxVotingPower) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalUpdateMinSelfDelegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.MinSelfDelegation) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func sovProposal(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozProposal(x uint64) (n int) { - return sovProposal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ProposalUpdateMinCommission) 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 ErrIntOverflowProposal - } - 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: ProposalUpdateMinCommission: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalUpdateMinCommission: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinCommission", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinCommission = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalUpdateMaxVotingPower) 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 ErrIntOverflowProposal - } - 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: ProposalUpdateMaxVotingPower: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalUpdateMaxVotingPower: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxVotingPower", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MaxVotingPower = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalUpdateMinSelfDelegation) 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 ErrIntOverflowProposal - } - 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: ProposalUpdateMinSelfDelegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalUpdateMinSelfDelegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinSelfDelegation = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProposal(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthProposal - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupProposal - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthProposal - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthProposal = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProposal = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupProposal = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/parameter/types/query.pb.go b/x/parameter/types/query.pb.go index 5361f5b98..1cfe0187a 100644 --- a/x/parameter/types/query.pb.go +++ b/x/parameter/types/query.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -113,141 +112,32 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -type QueryAllAnteHandlerParamRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllAnteHandlerParamRequest) Reset() { *m = QueryAllAnteHandlerParamRequest{} } -func (m *QueryAllAnteHandlerParamRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllAnteHandlerParamRequest) ProtoMessage() {} -func (*QueryAllAnteHandlerParamRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8d15aa9fdb9a1470, []int{2} -} -func (m *QueryAllAnteHandlerParamRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllAnteHandlerParamRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllAnteHandlerParamRequest.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 *QueryAllAnteHandlerParamRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllAnteHandlerParamRequest.Merge(m, src) -} -func (m *QueryAllAnteHandlerParamRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllAnteHandlerParamRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllAnteHandlerParamRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllAnteHandlerParamRequest proto.InternalMessageInfo - -func (m *QueryAllAnteHandlerParamRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -type QueryAllAnteHandlerParamResponse struct { - AnteHandlerParam []AnteHandlerParam `protobuf:"bytes,1,rep,name=ante_handler_param,json=anteHandlerParam,proto3" json:"ante_handler_param"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllAnteHandlerParamResponse) Reset() { *m = QueryAllAnteHandlerParamResponse{} } -func (m *QueryAllAnteHandlerParamResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllAnteHandlerParamResponse) ProtoMessage() {} -func (*QueryAllAnteHandlerParamResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8d15aa9fdb9a1470, []int{3} -} -func (m *QueryAllAnteHandlerParamResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllAnteHandlerParamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllAnteHandlerParamResponse.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 *QueryAllAnteHandlerParamResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllAnteHandlerParamResponse.Merge(m, src) -} -func (m *QueryAllAnteHandlerParamResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllAnteHandlerParamResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllAnteHandlerParamResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllAnteHandlerParamResponse proto.InternalMessageInfo - -func (m *QueryAllAnteHandlerParamResponse) GetAnteHandlerParam() []AnteHandlerParam { - if m != nil { - return m.AnteHandlerParam - } - return nil -} - -func (m *QueryAllAnteHandlerParamResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - func init() { proto.RegisterType((*QueryParamsRequest)(nil), "elys.parameter.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "elys.parameter.QueryParamsResponse") - proto.RegisterType((*QueryAllAnteHandlerParamRequest)(nil), "elys.parameter.QueryAllAnteHandlerParamRequest") - proto.RegisterType((*QueryAllAnteHandlerParamResponse)(nil), "elys.parameter.QueryAllAnteHandlerParamResponse") } func init() { proto.RegisterFile("elys/parameter/query.proto", fileDescriptor_8d15aa9fdb9a1470) } var fileDescriptor_8d15aa9fdb9a1470 = []byte{ - // 448 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x3d, 0x8f, 0xd3, 0x30, - 0x18, 0x8e, 0x0b, 0x74, 0xf0, 0x49, 0x08, 0xf9, 0x4e, 0xe8, 0x14, 0x50, 0x2e, 0xca, 0x09, 0xae, - 0x02, 0x61, 0xd3, 0x82, 0xc4, 0xdc, 0x0e, 0x50, 0x89, 0xa5, 0x54, 0x4c, 0x2c, 0x95, 0x53, 0x5e, - 0xa5, 0x11, 0xa9, 0x9d, 0xc6, 0x2e, 0xd0, 0x85, 0x81, 0x5f, 0x80, 0xc4, 0x2f, 0x61, 0x66, 0x62, - 0xeb, 0x58, 0x89, 0x85, 0x09, 0xa1, 0x96, 0x1f, 0x82, 0x62, 0x1b, 0x68, 0xd3, 0x0f, 0xd8, 0x2c, - 0xbf, 0xcf, 0xfb, 0x7c, 0x39, 0xc1, 0x3e, 0x64, 0x33, 0xc5, 0x72, 0x5e, 0xf0, 0x31, 0x68, 0x28, - 0xd8, 0x64, 0x0a, 0xc5, 0x8c, 0xe6, 0x85, 0xd4, 0x92, 0x5c, 0x2d, 0x67, 0xf4, 0xcf, 0xcc, 0x3f, - 0x49, 0x64, 0x22, 0xcd, 0x88, 0x95, 0x27, 0x8b, 0xf2, 0x6f, 0x26, 0x52, 0x26, 0x19, 0x30, 0x9e, - 0xa7, 0x8c, 0x0b, 0x21, 0x35, 0xd7, 0xa9, 0x14, 0xca, 0x4d, 0xef, 0x0c, 0xa5, 0x1a, 0x4b, 0xc5, - 0x62, 0xae, 0xc0, 0x92, 0xb3, 0xd7, 0xcd, 0x18, 0x34, 0x6f, 0xb2, 0x9c, 0x27, 0xa9, 0x30, 0x60, - 0x87, 0xbd, 0x51, 0xf1, 0x62, 0x4e, 0xbf, 0x89, 0x2e, 0x2a, 0x43, 0x2e, 0x34, 0x0c, 0x46, 0x5c, - 0xbc, 0xcc, 0xa0, 0x18, 0x98, 0x6b, 0x0b, 0x8c, 0x4e, 0x30, 0x79, 0x56, 0xea, 0xf4, 0xcc, 0x76, - 0x1f, 0x26, 0x53, 0x50, 0x3a, 0x7a, 0x8a, 0x8f, 0x37, 0x6e, 0x55, 0x2e, 0x85, 0x02, 0xf2, 0x10, - 0xd7, 0xad, 0xca, 0x29, 0x0a, 0x51, 0xe3, 0xa8, 0x75, 0x9d, 0x6e, 0x66, 0xa6, 0x16, 0xdf, 0xb9, - 0x3c, 0xff, 0x7e, 0xe6, 0xf5, 0x1d, 0x36, 0x4a, 0xf1, 0x99, 0x21, 0x6b, 0x67, 0x59, 0x5b, 0x68, - 0xe8, 0x5a, 0x17, 0x06, 0xea, 0xf4, 0xc8, 0x63, 0x8c, 0xff, 0xe6, 0x73, 0xe4, 0xb7, 0xa9, 0x2d, - 0x83, 0x96, 0x65, 0x50, 0xdb, 0xb4, 0x2b, 0x83, 0xf6, 0x78, 0x02, 0x6e, 0xb7, 0xbf, 0xb6, 0x19, - 0x7d, 0x41, 0x38, 0xdc, 0xaf, 0xe5, 0x52, 0x3c, 0xc7, 0x64, 0xbb, 0x8e, 0x53, 0x14, 0x5e, 0x6a, - 0x1c, 0xb5, 0xc2, 0x6a, 0xa2, 0x2a, 0x8b, 0xcb, 0x76, 0x8d, 0x57, 0xee, 0xc9, 0x93, 0x8d, 0x08, - 0x35, 0x13, 0xe1, 0xe2, 0x9f, 0x11, 0xac, 0xa5, 0xf5, 0x0c, 0xad, 0xcf, 0x35, 0x7c, 0xc5, 0x64, - 0x20, 0xef, 0x70, 0xdd, 0x16, 0x4a, 0xa2, 0xaa, 0xad, 0xed, 0x37, 0xf3, 0xcf, 0x0f, 0x62, 0xac, - 0x50, 0x74, 0xf7, 0xfd, 0xd7, 0x9f, 0x1f, 0x6b, 0xb7, 0xc8, 0x39, 0x2b, 0xc1, 0xf7, 0x04, 0xe8, - 0x37, 0xb2, 0x78, 0xc5, 0x76, 0x7e, 0x4a, 0xe4, 0x13, 0xc2, 0xc7, 0xd5, 0xfc, 0xed, 0x2c, 0x23, - 0x6c, 0xa7, 0xd2, 0xfe, 0xe7, 0xf5, 0xef, 0xff, 0xff, 0x82, 0xf3, 0xf9, 0xc8, 0xf8, 0x6c, 0x12, - 0x76, 0xd0, 0xe7, 0xf6, 0x33, 0x76, 0xba, 0xf3, 0x65, 0x80, 0x16, 0xcb, 0x00, 0xfd, 0x58, 0x06, - 0xe8, 0xc3, 0x2a, 0xf0, 0x16, 0xab, 0xc0, 0xfb, 0xb6, 0x0a, 0xbc, 0x17, 0x34, 0x49, 0xf5, 0x68, - 0x1a, 0xd3, 0xa1, 0x1c, 0xef, 0x20, 0x7d, 0xbb, 0x46, 0xab, 0x67, 0x39, 0xa8, 0xb8, 0x6e, 0x7e, - 0x90, 0x07, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x17, 0x5b, 0x2e, 0xf4, 0xf4, 0x03, 0x00, 0x00, + // 269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xcd, 0xa9, 0x2c, + 0xd6, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x4d, 0x2d, 0x49, 0x2d, 0xd2, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, + 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0xc9, 0xe9, 0xc1, 0xe5, 0xa4, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x4c, 0x7a, 0x7e, 0x7e, 0x7a, + 0x4e, 0xaa, 0x7e, 0x62, 0x41, 0xa6, 0x7e, 0x62, 0x5e, 0x5e, 0x7e, 0x49, 0x62, 0x49, 0x66, 0x7e, + 0x5e, 0x31, 0x54, 0x56, 0x1a, 0xcd, 0x7c, 0x30, 0x0b, 0x2a, 0xa9, 0x24, 0xc2, 0x25, 0x14, 0x08, + 0xb2, 0x2f, 0x00, 0x2c, 0x18, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0xa2, 0xe4, 0xcd, 0x25, 0x8c, + 0x22, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0x64, 0xc2, 0xc5, 0x06, 0xd1, 0x2c, 0xc1, 0xa8, + 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa6, 0x87, 0xea, 0x3c, 0x3d, 0x88, 0x7a, 0x27, 0x96, 0x13, 0xf7, + 0xe4, 0x19, 0x82, 0xa0, 0x6a, 0x8d, 0xda, 0x19, 0xb9, 0x58, 0xc1, 0xa6, 0x09, 0xd5, 0x71, 0xb1, + 0x41, 0x54, 0x08, 0x29, 0xa1, 0xeb, 0xc4, 0x74, 0x84, 0x94, 0x32, 0x5e, 0x35, 0x10, 0x27, 0x29, + 0x69, 0x37, 0x5d, 0x7e, 0x32, 0x99, 0x49, 0x55, 0x48, 0x59, 0x1f, 0xa4, 0x58, 0x37, 0x2f, 0xb5, + 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0xab, 0x97, 0x9d, 0x3c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, + 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, + 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x2f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x17, + 0x8b, 0x41, 0x15, 0x48, 0x46, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x43, 0xcf, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0x16, 0x0c, 0x21, 0x5c, 0xbc, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -264,7 +154,6 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - AnteHandlerParamAll(ctx context.Context, in *QueryAllAnteHandlerParamRequest, opts ...grpc.CallOption) (*QueryAllAnteHandlerParamResponse, error) } type queryClient struct { @@ -284,20 +173,10 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) AnteHandlerParamAll(ctx context.Context, in *QueryAllAnteHandlerParamRequest, opts ...grpc.CallOption) (*QueryAllAnteHandlerParamResponse, error) { - out := new(QueryAllAnteHandlerParamResponse) - err := c.cc.Invoke(ctx, "/elys.parameter.Query/AnteHandlerParamAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - AnteHandlerParamAll(context.Context, *QueryAllAnteHandlerParamRequest) (*QueryAllAnteHandlerParamResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -307,9 +186,6 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) AnteHandlerParamAll(ctx context.Context, req *QueryAllAnteHandlerParamRequest) (*QueryAllAnteHandlerParamResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AnteHandlerParamAll not implemented") -} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -333,24 +209,6 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_AnteHandlerParamAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllAnteHandlerParamRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AnteHandlerParamAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/elys.parameter.Query/AnteHandlerParamAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AnteHandlerParamAll(ctx, req.(*QueryAllAnteHandlerParamRequest)) - } - return interceptor(ctx, in, info, handler) -} - var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "elys.parameter.Query", HandlerType: (*QueryServer)(nil), @@ -359,10 +217,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, - { - MethodName: "AnteHandlerParamAll", - Handler: _Query_AnteHandlerParamAll_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "elys/parameter/query.proto", @@ -424,90 +278,6 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryAllAnteHandlerParamRequest) 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 *QueryAllAnteHandlerParamRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllAnteHandlerParamRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllAnteHandlerParamResponse) 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 *QueryAllAnteHandlerParamResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllAnteHandlerParamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.AnteHandlerParam) > 0 { - for iNdEx := len(m.AnteHandlerParam) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AnteHandlerParam[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -539,38 +309,6 @@ func (m *QueryParamsResponse) Size() (n int) { return n } -func (m *QueryAllAnteHandlerParamRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllAnteHandlerParamResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.AnteHandlerParam) > 0 { - for _, e := range m.AnteHandlerParam { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -710,212 +448,6 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllAnteHandlerParamRequest) 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 ErrIntOverflowQuery - } - 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: QueryAllAnteHandlerParamRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllAnteHandlerParamRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllAnteHandlerParamResponse) 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 ErrIntOverflowQuery - } - 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: QueryAllAnteHandlerParamResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllAnteHandlerParamResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AnteHandlerParam", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AnteHandlerParam = append(m.AnteHandlerParam, AnteHandlerParam{}) - if err := m.AnteHandlerParam[len(m.AnteHandlerParam)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/parameter/types/query.pb.gw.go b/x/parameter/types/query.pb.gw.go index e185b865c..d8ea85070 100644 --- a/x/parameter/types/query.pb.gw.go +++ b/x/parameter/types/query.pb.gw.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -31,7 +30,6 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -51,53 +49,15 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -var ( - filter_Query_AnteHandlerParamAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_AnteHandlerParamAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllAnteHandlerParamRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AnteHandlerParamAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.AnteHandlerParamAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AnteHandlerParamAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllAnteHandlerParamRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AnteHandlerParamAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.AnteHandlerParamAll(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -105,7 +65,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -116,29 +75,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_AnteHandlerParamAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_AnteHandlerParamAll_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AnteHandlerParamAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -200,37 +136,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_AnteHandlerParamAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_AnteHandlerParamAll_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AnteHandlerParamAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "parameter", "params"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_AnteHandlerParamAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"elys-network", "elys", "parameter", "ante_handler_param"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_AnteHandlerParamAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/parameter/types/tx.pb.go b/x/parameter/types/tx.pb.go index 06e73fdc2..4125c3c05 100644 --- a/x/parameter/types/tx.pb.go +++ b/x/parameter/types/tx.pb.go @@ -9,7 +9,11 @@ import ( grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,18 +27,306 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type MsgUpdateMinCommission struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + MinCommission string `protobuf:"bytes,2,opt,name=min_commission,json=minCommission,proto3" json:"min_commission,omitempty"` +} + +func (m *MsgUpdateMinCommission) Reset() { *m = MsgUpdateMinCommission{} } +func (m *MsgUpdateMinCommission) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMinCommission) ProtoMessage() {} +func (*MsgUpdateMinCommission) Descriptor() ([]byte, []int) { + return fileDescriptor_9d997b2afb1f3cab, []int{0} +} +func (m *MsgUpdateMinCommission) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateMinCommission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateMinCommission.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 *MsgUpdateMinCommission) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMinCommission.Merge(m, src) +} +func (m *MsgUpdateMinCommission) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateMinCommission) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMinCommission.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateMinCommission proto.InternalMessageInfo + +func (m *MsgUpdateMinCommission) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateMinCommission) GetMinCommission() string { + if m != nil { + return m.MinCommission + } + return "" +} + +type MsgUpdateMinCommissionResponse struct { +} + +func (m *MsgUpdateMinCommissionResponse) Reset() { *m = MsgUpdateMinCommissionResponse{} } +func (m *MsgUpdateMinCommissionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMinCommissionResponse) ProtoMessage() {} +func (*MsgUpdateMinCommissionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9d997b2afb1f3cab, []int{1} +} +func (m *MsgUpdateMinCommissionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateMinCommissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateMinCommissionResponse.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 *MsgUpdateMinCommissionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMinCommissionResponse.Merge(m, src) +} +func (m *MsgUpdateMinCommissionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateMinCommissionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMinCommissionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateMinCommissionResponse proto.InternalMessageInfo + +type MsgUpdateMaxVotingPower struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + MaxVotingPower string `protobuf:"bytes,3,opt,name=max_voting_power,json=maxVotingPower,proto3" json:"max_voting_power,omitempty"` +} + +func (m *MsgUpdateMaxVotingPower) Reset() { *m = MsgUpdateMaxVotingPower{} } +func (m *MsgUpdateMaxVotingPower) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMaxVotingPower) ProtoMessage() {} +func (*MsgUpdateMaxVotingPower) Descriptor() ([]byte, []int) { + return fileDescriptor_9d997b2afb1f3cab, []int{2} +} +func (m *MsgUpdateMaxVotingPower) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateMaxVotingPower) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateMaxVotingPower.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 *MsgUpdateMaxVotingPower) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMaxVotingPower.Merge(m, src) +} +func (m *MsgUpdateMaxVotingPower) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateMaxVotingPower) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMaxVotingPower.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateMaxVotingPower proto.InternalMessageInfo + +func (m *MsgUpdateMaxVotingPower) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateMaxVotingPower) GetMaxVotingPower() string { + if m != nil { + return m.MaxVotingPower + } + return "" +} + +type MsgUpdateMaxVotingPowerResponse struct { +} + +func (m *MsgUpdateMaxVotingPowerResponse) Reset() { *m = MsgUpdateMaxVotingPowerResponse{} } +func (m *MsgUpdateMaxVotingPowerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMaxVotingPowerResponse) ProtoMessage() {} +func (*MsgUpdateMaxVotingPowerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9d997b2afb1f3cab, []int{3} +} +func (m *MsgUpdateMaxVotingPowerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateMaxVotingPowerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateMaxVotingPowerResponse.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 *MsgUpdateMaxVotingPowerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMaxVotingPowerResponse.Merge(m, src) +} +func (m *MsgUpdateMaxVotingPowerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateMaxVotingPowerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMaxVotingPowerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateMaxVotingPowerResponse proto.InternalMessageInfo + +type MsgUpdateMinSelfDelegation struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + MinSelfDelegation string `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3" json:"min_self_delegation,omitempty"` +} + +func (m *MsgUpdateMinSelfDelegation) Reset() { *m = MsgUpdateMinSelfDelegation{} } +func (m *MsgUpdateMinSelfDelegation) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMinSelfDelegation) ProtoMessage() {} +func (*MsgUpdateMinSelfDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_9d997b2afb1f3cab, []int{4} +} +func (m *MsgUpdateMinSelfDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateMinSelfDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateMinSelfDelegation.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 *MsgUpdateMinSelfDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMinSelfDelegation.Merge(m, src) +} +func (m *MsgUpdateMinSelfDelegation) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateMinSelfDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMinSelfDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateMinSelfDelegation proto.InternalMessageInfo + +func (m *MsgUpdateMinSelfDelegation) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateMinSelfDelegation) GetMinSelfDelegation() string { + if m != nil { + return m.MinSelfDelegation + } + return "" +} + +type MsgUpdateMinSelfDelegationResponse struct { +} + +func (m *MsgUpdateMinSelfDelegationResponse) Reset() { *m = MsgUpdateMinSelfDelegationResponse{} } +func (m *MsgUpdateMinSelfDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMinSelfDelegationResponse) ProtoMessage() {} +func (*MsgUpdateMinSelfDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9d997b2afb1f3cab, []int{5} +} +func (m *MsgUpdateMinSelfDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateMinSelfDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateMinSelfDelegationResponse.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 *MsgUpdateMinSelfDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMinSelfDelegationResponse.Merge(m, src) +} +func (m *MsgUpdateMinSelfDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateMinSelfDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMinSelfDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateMinSelfDelegationResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateMinCommission)(nil), "elys.parameter.MsgUpdateMinCommission") + proto.RegisterType((*MsgUpdateMinCommissionResponse)(nil), "elys.parameter.MsgUpdateMinCommissionResponse") + proto.RegisterType((*MsgUpdateMaxVotingPower)(nil), "elys.parameter.MsgUpdateMaxVotingPower") + proto.RegisterType((*MsgUpdateMaxVotingPowerResponse)(nil), "elys.parameter.MsgUpdateMaxVotingPowerResponse") + proto.RegisterType((*MsgUpdateMinSelfDelegation)(nil), "elys.parameter.MsgUpdateMinSelfDelegation") + proto.RegisterType((*MsgUpdateMinSelfDelegationResponse)(nil), "elys.parameter.MsgUpdateMinSelfDelegationResponse") +} + func init() { proto.RegisterFile("elys/parameter/tx.proto", fileDescriptor_9d997b2afb1f3cab) } var fileDescriptor_9d997b2afb1f3cab = []byte{ - // 128 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xcd, 0xa9, 0x2c, - 0xd6, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x4d, 0x2d, 0x49, 0x2d, 0xd2, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0x49, 0xe8, 0xc1, 0x25, 0x8c, 0x58, 0xb9, 0x98, 0x7d, 0x8b, - 0xd3, 0x9d, 0x3c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, - 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x2f, 0x3d, - 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xa4, 0x57, 0x37, 0x2f, 0xb5, 0xa4, - 0x3c, 0xbf, 0x28, 0x1b, 0xcc, 0xd1, 0xaf, 0x40, 0xb6, 0xa3, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, - 0x6c, 0x8f, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x9a, 0x90, 0x0f, 0x82, 0x00, 0x00, 0x00, + // 361 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcf, 0x4a, 0xeb, 0x40, + 0x14, 0xc6, 0x9b, 0x16, 0xee, 0xe5, 0x1e, 0xb8, 0xe5, 0xde, 0x54, 0x6c, 0xc8, 0x22, 0xd6, 0xe0, + 0x9f, 0x22, 0x38, 0x81, 0xfa, 0x06, 0xea, 0xc2, 0x4d, 0x41, 0x2a, 0x0a, 0x0a, 0x12, 0xd2, 0xf6, + 0x34, 0x06, 0x33, 0x99, 0x61, 0x66, 0xb4, 0xe9, 0x5b, 0xf8, 0x58, 0x2e, 0xbb, 0x74, 0xa9, 0xed, + 0x8b, 0x48, 0x82, 0x89, 0x8d, 0x24, 0xa5, 0xcb, 0xe1, 0xfc, 0xe6, 0xfb, 0x3e, 0xbe, 0xc3, 0x81, + 0x36, 0x86, 0x33, 0xe9, 0x70, 0x4f, 0x78, 0x14, 0x15, 0x0a, 0x47, 0xc5, 0x84, 0x0b, 0xa6, 0x98, + 0xde, 0x4c, 0x06, 0x24, 0x1f, 0xd8, 0xb7, 0xb0, 0xdd, 0x97, 0xfe, 0x35, 0x1f, 0x7b, 0x0a, 0xfb, + 0x41, 0x74, 0xc6, 0x28, 0x0d, 0xa4, 0x0c, 0x58, 0xa4, 0x1b, 0xf0, 0x7b, 0x24, 0xd0, 0x53, 0x4c, + 0x18, 0x5a, 0x47, 0xeb, 0xfe, 0x19, 0x64, 0x4f, 0x7d, 0x1f, 0x9a, 0x34, 0x88, 0xdc, 0x51, 0xce, + 0x1a, 0xf5, 0x14, 0xf8, 0x4b, 0x57, 0x05, 0xec, 0x0e, 0x58, 0xe5, 0xd2, 0x03, 0x94, 0x9c, 0x45, + 0x12, 0xed, 0x7b, 0x68, 0x7f, 0x13, 0x5e, 0x7c, 0xc3, 0x54, 0x10, 0xf9, 0x97, 0x6c, 0x8a, 0x62, + 0x8d, 0x7b, 0x17, 0xfe, 0x51, 0x2f, 0x76, 0x9f, 0x53, 0xd8, 0xe5, 0x09, 0x6d, 0x34, 0x52, 0xa4, + 0x49, 0x0b, 0x1a, 0xf6, 0x2e, 0xec, 0x54, 0xc8, 0xe7, 0x09, 0x26, 0x60, 0xae, 0x66, 0xbc, 0xc2, + 0x70, 0x72, 0x8e, 0x21, 0xfa, 0x9e, 0x5a, 0x5f, 0x01, 0x81, 0x56, 0x52, 0x81, 0xc4, 0x70, 0xe2, + 0x8e, 0xf3, 0x0f, 0x5f, 0x39, 0xfe, 0xd3, 0x9f, 0x4a, 0xf6, 0x1e, 0xd8, 0xd5, 0x3e, 0x59, 0x9a, + 0xde, 0x47, 0x1d, 0x1a, 0x7d, 0xe9, 0xeb, 0x14, 0x5a, 0x65, 0x1b, 0x39, 0x20, 0xc5, 0xe5, 0x91, + 0xf2, 0x7a, 0x4d, 0xb2, 0x19, 0x97, 0xd9, 0xea, 0x1c, 0xb6, 0x4a, 0x77, 0x70, 0x58, 0xad, 0x53, + 0x00, 0x4d, 0x67, 0x43, 0x30, 0x77, 0x9c, 0x41, 0xbb, 0xaa, 0xf3, 0xa3, 0x75, 0xe1, 0x8b, 0xac, + 0xd9, 0xdb, 0x9c, 0xcd, 0xac, 0x4f, 0x2f, 0x5e, 0x17, 0x96, 0x36, 0x5f, 0x58, 0xda, 0xfb, 0xc2, + 0xd2, 0x5e, 0x96, 0x56, 0x6d, 0xbe, 0xb4, 0x6a, 0x6f, 0x4b, 0xab, 0x76, 0x47, 0xfc, 0x40, 0x3d, + 0x3c, 0x0d, 0xc9, 0x88, 0x51, 0x27, 0xd1, 0x3d, 0x8e, 0x50, 0x4d, 0x99, 0x78, 0x4c, 0x1f, 0x4e, + 0xbc, 0x7a, 0x4d, 0x33, 0x8e, 0x72, 0xf8, 0x2b, 0xbd, 0xa8, 0x93, 0xcf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xee, 0x5b, 0xd7, 0xcc, 0x6c, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -49,6 +341,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + UpdateMinCommission(ctx context.Context, in *MsgUpdateMinCommission, opts ...grpc.CallOption) (*MsgUpdateMinCommissionResponse, error) + UpdateMaxVotingPower(ctx context.Context, in *MsgUpdateMaxVotingPower, opts ...grpc.CallOption) (*MsgUpdateMaxVotingPowerResponse, error) + UpdateMinSelfDelegation(ctx context.Context, in *MsgUpdateMinSelfDelegation, opts ...grpc.CallOption) (*MsgUpdateMinSelfDelegationResponse, error) } type msgClient struct { @@ -59,22 +354,981 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) UpdateMinCommission(ctx context.Context, in *MsgUpdateMinCommission, opts ...grpc.CallOption) (*MsgUpdateMinCommissionResponse, error) { + out := new(MsgUpdateMinCommissionResponse) + err := c.cc.Invoke(ctx, "/elys.parameter.Msg/UpdateMinCommission", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateMaxVotingPower(ctx context.Context, in *MsgUpdateMaxVotingPower, opts ...grpc.CallOption) (*MsgUpdateMaxVotingPowerResponse, error) { + out := new(MsgUpdateMaxVotingPowerResponse) + err := c.cc.Invoke(ctx, "/elys.parameter.Msg/UpdateMaxVotingPower", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateMinSelfDelegation(ctx context.Context, in *MsgUpdateMinSelfDelegation, opts ...grpc.CallOption) (*MsgUpdateMinSelfDelegationResponse, error) { + out := new(MsgUpdateMinSelfDelegationResponse) + err := c.cc.Invoke(ctx, "/elys.parameter.Msg/UpdateMinSelfDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + UpdateMinCommission(context.Context, *MsgUpdateMinCommission) (*MsgUpdateMinCommissionResponse, error) + UpdateMaxVotingPower(context.Context, *MsgUpdateMaxVotingPower) (*MsgUpdateMaxVotingPowerResponse, error) + UpdateMinSelfDelegation(context.Context, *MsgUpdateMinSelfDelegation) (*MsgUpdateMinSelfDelegationResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) UpdateMinCommission(ctx context.Context, req *MsgUpdateMinCommission) (*MsgUpdateMinCommissionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateMinCommission not implemented") +} +func (*UnimplementedMsgServer) UpdateMaxVotingPower(ctx context.Context, req *MsgUpdateMaxVotingPower) (*MsgUpdateMaxVotingPowerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateMaxVotingPower not implemented") +} +func (*UnimplementedMsgServer) UpdateMinSelfDelegation(ctx context.Context, req *MsgUpdateMinSelfDelegation) (*MsgUpdateMinSelfDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateMinSelfDelegation not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_UpdateMinCommission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateMinCommission) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateMinCommission(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.parameter.Msg/UpdateMinCommission", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateMinCommission(ctx, req.(*MsgUpdateMinCommission)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateMaxVotingPower_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateMaxVotingPower) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateMaxVotingPower(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.parameter.Msg/UpdateMaxVotingPower", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateMaxVotingPower(ctx, req.(*MsgUpdateMaxVotingPower)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateMinSelfDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateMinSelfDelegation) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateMinSelfDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.parameter.Msg/UpdateMinSelfDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateMinSelfDelegation(ctx, req.(*MsgUpdateMinSelfDelegation)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "elys.parameter.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "elys/parameter/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateMinCommission", + Handler: _Msg_UpdateMinCommission_Handler, + }, + { + MethodName: "UpdateMaxVotingPower", + Handler: _Msg_UpdateMaxVotingPower_Handler, + }, + { + MethodName: "UpdateMinSelfDelegation", + Handler: _Msg_UpdateMinSelfDelegation_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "elys/parameter/tx.proto", +} + +func (m *MsgUpdateMinCommission) 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 *MsgUpdateMinCommission) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateMinCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MinCommission) > 0 { + i -= len(m.MinCommission) + copy(dAtA[i:], m.MinCommission) + i = encodeVarintTx(dAtA, i, uint64(len(m.MinCommission))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateMinCommissionResponse) 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 *MsgUpdateMinCommissionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateMinCommissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateMaxVotingPower) 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 *MsgUpdateMaxVotingPower) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateMaxVotingPower) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MaxVotingPower) > 0 { + i -= len(m.MaxVotingPower) + copy(dAtA[i:], m.MaxVotingPower) + i = encodeVarintTx(dAtA, i, uint64(len(m.MaxVotingPower))) + i-- + dAtA[i] = 0x1a + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateMaxVotingPowerResponse) 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 *MsgUpdateMaxVotingPowerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateMaxVotingPowerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateMinSelfDelegation) 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 *MsgUpdateMinSelfDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } + +func (m *MsgUpdateMinSelfDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MinSelfDelegation) > 0 { + i -= len(m.MinSelfDelegation) + copy(dAtA[i:], m.MinSelfDelegation) + i = encodeVarintTx(dAtA, i, uint64(len(m.MinSelfDelegation))) + i-- + dAtA[i] = 0x1a + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateMinSelfDelegationResponse) 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 *MsgUpdateMinSelfDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateMinSelfDelegationResponse) 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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateMinCommission) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.MinCommission) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateMinCommissionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateMaxVotingPower) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.MaxVotingPower) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateMaxVotingPowerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateMinSelfDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.MinSelfDelegation) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateMinSelfDelegationResponse) 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 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateMinCommission) 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: MsgUpdateMinCommission: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateMinCommission: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCommission", 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.MinCommission = string(dAtA[iNdEx:postIndex]) + 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 *MsgUpdateMinCommissionResponse) 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: MsgUpdateMinCommissionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateMinCommissionResponse: 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 (m *MsgUpdateMaxVotingPower) 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: MsgUpdateMaxVotingPower: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateMaxVotingPower: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxVotingPower", 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.MaxVotingPower = string(dAtA[iNdEx:postIndex]) + 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 *MsgUpdateMaxVotingPowerResponse) 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: MsgUpdateMaxVotingPowerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateMaxVotingPowerResponse: 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 (m *MsgUpdateMinSelfDelegation) 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: MsgUpdateMinSelfDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateMinSelfDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", 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.MinSelfDelegation = string(dAtA[iNdEx:postIndex]) + 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 *MsgUpdateMinSelfDelegationResponse) 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: MsgUpdateMinSelfDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateMinSelfDelegationResponse: 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)