From 8f2563ed7711d116e8b286d3726bf1d02663d207 Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 16:11:53 +0000 Subject: [PATCH 1/2] added ibc transfer module that is going to store all params for eth fees --- app/app.go | 7 + app/keepers/keepers.go | 20 +- app/keepers/keys.go | 4 +- .../v1beta1/genesis.proto | 14 + .../v1beta1/ibctransfermiddleware.proto | 81 + .../ibctransfermiddleware/v1beta1/query.proto | 25 + .../ibctransfermiddleware/v1beta1/tx.proto | 41 + x/ibctransfermiddleware/client/cli/query.go | 55 + x/ibctransfermiddleware/client/cli/tx.go | 22 + x/ibctransfermiddleware/keeper/genesis.go | 19 + x/ibctransfermiddleware/keeper/grpc_query.go | 19 + x/ibctransfermiddleware/keeper/keeper.go | 76 + x/ibctransfermiddleware/keeper/msg_server.go | 38 + x/ibctransfermiddleware/module.go | 156 ++ x/ibctransfermiddleware/types/codec.go | 45 + x/ibctransfermiddleware/types/genesis.go | 21 + x/ibctransfermiddleware/types/genesis.pb.go | 325 ++++ .../types/ibctransfermiddleware.pb.go | 1462 +++++++++++++++++ x/ibctransfermiddleware/types/keys.go | 15 + x/ibctransfermiddleware/types/msgs.go | 28 + x/ibctransfermiddleware/types/query.pb.go | 537 ++++++ x/ibctransfermiddleware/types/query.pb.gw.go | 153 ++ x/ibctransfermiddleware/types/tx.pb.go | 602 +++++++ 23 files changed, 3757 insertions(+), 8 deletions(-) create mode 100644 proto/composable/ibctransfermiddleware/v1beta1/genesis.proto create mode 100644 proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto create mode 100644 proto/composable/ibctransfermiddleware/v1beta1/query.proto create mode 100644 proto/composable/ibctransfermiddleware/v1beta1/tx.proto create mode 100644 x/ibctransfermiddleware/client/cli/query.go create mode 100644 x/ibctransfermiddleware/client/cli/tx.go create mode 100644 x/ibctransfermiddleware/keeper/genesis.go create mode 100644 x/ibctransfermiddleware/keeper/grpc_query.go create mode 100644 x/ibctransfermiddleware/keeper/keeper.go create mode 100644 x/ibctransfermiddleware/keeper/msg_server.go create mode 100644 x/ibctransfermiddleware/module.go create mode 100644 x/ibctransfermiddleware/types/codec.go create mode 100644 x/ibctransfermiddleware/types/genesis.go create mode 100644 x/ibctransfermiddleware/types/genesis.pb.go create mode 100644 x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go create mode 100644 x/ibctransfermiddleware/types/keys.go create mode 100644 x/ibctransfermiddleware/types/msgs.go create mode 100644 x/ibctransfermiddleware/types/query.pb.go create mode 100644 x/ibctransfermiddleware/types/query.pb.gw.go create mode 100644 x/ibctransfermiddleware/types/tx.pb.go diff --git a/app/app.go b/app/app.go index bfd837a43..9fa1ef474 100644 --- a/app/app.go +++ b/app/app.go @@ -102,6 +102,7 @@ import ( custombankmodule "github.com/notional-labs/composable/v6/custom/bank" "github.com/notional-labs/composable/v6/app/ante" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware" "github.com/notional-labs/composable/v6/x/stakingmiddleware" transfermiddleware "github.com/notional-labs/composable/v6/x/transfermiddleware" transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types" @@ -127,6 +128,7 @@ import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" upgrades "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" stakingmiddlewaretypes "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" ) @@ -227,6 +229,7 @@ var ( consensus.AppModuleBasic{}, alliancemodule.AppModuleBasic{}, stakingmiddleware.AppModuleBasic{}, + ibctransfermiddleware.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic ) @@ -371,6 +374,7 @@ func NewComposableApp( distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), customstaking.NewAppModule(appCodec, *app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), stakingmiddleware.NewAppModule(appCodec, app.StakingMiddlewareKeeper), + ibctransfermiddleware.NewAppModule(appCodec, app.IbcTransferMiddlewareKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), @@ -427,6 +431,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers ) @@ -462,6 +467,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -501,6 +507,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis ) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index bf8dbe441..ed29f8753 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -110,6 +110,9 @@ import ( ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" stakingmiddlewaretypes "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" + + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/keeper" + ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) const ( @@ -156,12 +159,13 @@ type AppKeepers struct { ScopedRateLimitKeeper capabilitykeeper.ScopedKeeper ConsensusParamsKeeper consensusparamkeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration - TransferMiddlewareKeeper transfermiddlewarekeeper.Keeper - TxBoundaryKeepper txBoundaryKeeper.Keeper - RouterKeeper *routerkeeper.Keeper - RatelimitKeeper ratelimitmodulekeeper.Keeper - AllianceKeeper alliancemodulekeeper.Keeper - StakingMiddlewareKeeper stakingmiddleware.Keeper + TransferMiddlewareKeeper transfermiddlewarekeeper.Keeper + TxBoundaryKeepper txBoundaryKeeper.Keeper + RouterKeeper *routerkeeper.Keeper + RatelimitKeeper ratelimitmodulekeeper.Keeper + AllianceKeeper alliancemodulekeeper.Keeper + StakingMiddlewareKeeper stakingmiddleware.Keeper + IbcTransferMiddlewareKeeper ibctransfermiddleware.Keeper } // InitNormalKeepers initializes all 'normal' keepers. @@ -194,6 +198,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ) appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + appKeepers.IbcTransferMiddlewareKeeper = ibctransfermiddleware.NewKeeper(appCodec, appKeepers.keys[ibctransfermiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) appKeepers.StakingKeeper = customstaking.NewKeeper( appCodec, appKeepers.keys[stakingtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), &appKeepers.StakingMiddlewareKeeper, @@ -394,7 +399,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.IBCKeeper.ChannelKeeper, &appKeepers.IBCKeeper.PortKeeper, appKeepers.ScopedWasmKeeper, - appKeepers.TransferKeeper, + appKeepers.TransferKeeper.Keeper, bApp.MsgServiceRouter(), bApp.GRPCQueryRouter(), wasmDir, @@ -492,6 +497,7 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper.Subspace(wasm.ModuleName) paramsKeeper.Subspace(transfermiddlewaretypes.ModuleName) paramsKeeper.Subspace(stakingmiddlewaretypes.ModuleName) + paramsKeeper.Subspace(ibctransfermiddlewaretypes.ModuleName) return paramsKeeper } diff --git a/app/keepers/keys.go b/app/keepers/keys.go index a0dc2e358..606b8f21d 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -45,6 +45,8 @@ import ( // customstakingtypes "github.com/notional-labs/composable/v6/custom/staking/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" + + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) // GenerateKeys generates new keys (KV Store, Transient store, and memory store). @@ -55,7 +57,7 @@ func (appKeepers *AppKeepers) GenerateKeys() { authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icqtypes.StoreKey, capabilitytypes.StoreKey, consensusparamtypes.StoreKey, wasm08types.StoreKey, - authzkeeper.StoreKey, stakingmiddleware.StoreKey, + authzkeeper.StoreKey, stakingmiddleware.StoreKey, ibctransfermiddleware.StoreKey, crisistypes.StoreKey, routertypes.StoreKey, transfermiddlewaretypes.StoreKey, group.StoreKey, minttypes.StoreKey, alliancemoduletypes.StoreKey, wasm.StoreKey, ibchookstypes.StoreKey, icahosttypes.StoreKey, ratelimitmoduletypes.StoreKey, txBoundaryTypes.StoreKey, ) diff --git a/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto b/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto new file mode 100644 index 000000000..20f491b2c --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "gogoproto/gogo.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; +import "amino/amino.proto"; + + +option go_package = "x/ibctransfermiddleware/types"; + +// GenesisState defines the ibctransfermiddleware module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto new file mode 100644 index 000000000..d8621e42d --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +option go_package = "x/ibctransfermiddleware/types"; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; + + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +message Delegation { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgDelegate"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// BeginRedelegate defines a SDK message for performing a begin redelegation of coins +// from a delegator to a validator. +message BeginRedelegate{ + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgBeginRedelegate"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +message Undelegate { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgUndelegate"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +message CancelUnbondingDelegation { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgCancelUnbondingDelegation"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + int64 creation_height = 4; +} + + + +// Params holds parameters for the ibctransfermiddleware module. +message Params { + // expected blocks per year + uint64 blocks_per_epoch = 1; + // max block allowed before validator set update + uint64 allow_unbond_after_epoch_progress_block_number = 2; +} + diff --git a/proto/composable/ibctransfermiddleware/v1beta1/query.proto b/proto/composable/ibctransfermiddleware/v1beta1/query.proto new file mode 100644 index 000000000..7f0f5c45c --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/query.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; + +option go_package = "x/ibctransfermiddleware/types"; + +// Query provides defines the gRPC querier service. +service Query { + // Params returns the total set of minting parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/composable/ibctransfermiddleware/params"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto new file mode 100644 index 000000000..781979b09 --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; + +option go_package = "x/ibctransfermiddleware/types"; + +// Msg defines the x/ibctransfermiddleware Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + rpc UpdateEpochParams(MsgUpdateEpochParams) returns (MsgUpdateParamsEpochResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateEpochParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "composable/x/ibctransfermiddleware/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/ibctransfermiddleware parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParamsEpochResponse {} diff --git a/x/ibctransfermiddleware/client/cli/query.go b/x/ibctransfermiddleware/client/cli/query.go new file mode 100644 index 000000000..119694e64 --- /dev/null +++ b/x/ibctransfermiddleware/client/cli/query.go @@ -0,0 +1,55 @@ +package cli + +import ( + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +// GetQueryCmd returns the cli query commands for the staking middleware module. +func GetQueryCmd() *cobra.Command { + ibctransfermiddlewareParamsQueryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the staking middleware module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + ibctransfermiddlewareParamsQueryCmd.AddCommand( + GetCmdQueryParams(), + ) + + return ibctransfermiddlewareParamsQueryCmd +} + +// GetCmdQueryParams implements a command to return the current staking middleware's params +// parameters. +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query the current staking middleware parameters", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryParamsRequest{} + res, err := queryClient.Params(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(&res.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ibctransfermiddleware/client/cli/tx.go b/x/ibctransfermiddleware/client/cli/tx.go new file mode 100644 index 000000000..95ab3dd0e --- /dev/null +++ b/x/ibctransfermiddleware/client/cli/tx.go @@ -0,0 +1,22 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" + "github.com/spf13/cobra" +) + +// GetTxCmd returns the tx commands for staking middleware module. +func GetTxCmd() *cobra.Command { + txCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Exp transaction subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + txCmd.AddCommand() + + return txCmd +} diff --git a/x/ibctransfermiddleware/keeper/genesis.go b/x/ibctransfermiddleware/keeper/genesis.go new file mode 100644 index 000000000..82b22a6f9 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/genesis.go @@ -0,0 +1,19 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +// InitGenesis new stake middleware genesis +func (keeper Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { + if err := keeper.SetParams(ctx, data.Params); err != nil { + panic(err) + } +} + +// ExportGenesis returns a GenesisState for a given context and keeper. +func (keeper Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + params := keeper.GetParams(ctx) + return types.NewGenesisState(params) +} diff --git a/x/ibctransfermiddleware/keeper/grpc_query.go b/x/ibctransfermiddleware/keeper/grpc_query.go new file mode 100644 index 000000000..b95c1d2f6 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/grpc_query.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var _ types.QueryServer = Keeper{} + +// Params returns params of the staking middleware module. +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/ibctransfermiddleware/keeper/keeper.go b/x/ibctransfermiddleware/keeper/keeper.go new file mode 100644 index 000000000..0dafdacee --- /dev/null +++ b/x/ibctransfermiddleware/keeper/keeper.go @@ -0,0 +1,76 @@ +package keeper + +import ( + "fmt" + + "github.com/cometbft/cometbft/libs/log" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Keeper of the staking middleware store +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string +} + +// NewKeeper creates a new middleware Keeper instance +func NewKeeper( + cdc codec.BinaryCodec, + key storetypes.StoreKey, + authority string, +) Keeper { + return Keeper{ + cdc: cdc, + storeKey: key, + authority: authority, + } +} + +// GetAuthority returns the x/ibctransfermiddleware module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", "x/"+types.ModuleName) +} + +// SetParams sets the x/ibctransfermiddleware module parameters. +func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { + if p.BlocksPerEpoch < 5 { + return fmt.Errorf( + "BlocksPerEpoch must be greater than or equal to 5", + ) + } + if p.AllowUnbondAfterEpochProgressBlockNumber > p.BlocksPerEpoch { + return fmt.Errorf( + "AllowUnbondAfterEpochProgressBlockNumber must be less than or equal to BlocksPerEpoch", + ) + } + + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&p) + store.Set(types.ParamsKey, bz) + + return nil +} + +// GetParams returns the current x/ibctransfermiddleware module parameters. +func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return p + } + + k.cdc.MustUnmarshal(bz, &p) + return p +} diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go new file mode 100644 index 000000000..e9d5a6e77 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -0,0 +1,38 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var _ types.MsgServer = msgServer{} + +// msgServer is a wrapper of Keeper. +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the x/ibctransfermiddleware MsgServer interface. +func NewMsgServerImpl(k Keeper) types.MsgServer { + return &msgServer{ + Keeper: k, + } +} + +// UpdateParams updates the params. +func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdateEpochParams) (*types.MsgUpdateParamsEpochResponse, error) { + if ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := ms.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsEpochResponse{}, nil +} diff --git a/x/ibctransfermiddleware/module.go b/x/ibctransfermiddleware/module.go new file mode 100644 index 000000000..1f46d6364 --- /dev/null +++ b/x/ibctransfermiddleware/module.go @@ -0,0 +1,156 @@ +package ibctransfermiddleware + +import ( + "context" + "encoding/json" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/client/cli" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/keeper" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleSimulation = AppModule{} +) + +// AppModuleBasic defines the basic application module used by the staking middleware module. +type AppModuleBasic struct { + cdc codec.Codec +} + +var _ module.AppModuleBasic = AppModuleBasic{} + +// Name returns the staking middleware module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the staking middleware module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module interface +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns default genesis state as raw bytes for the staking middleware +// module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis performs genesis state validation for the staking middleware module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var data types.GenesisState + if err := cdc.UnmarshalJSON(bz, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return types.ValidateGenesis(data) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking middleware module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns no root tx command for the staking middleware module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the staking middleware module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// AppModule implements an application module for the staking middleware module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule object. If the InflationCalculationFn +// argument is nil, then the SDK's default inflation function will be used. +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: keeper, + } +} + +// Name returns the staking middleware module's name. +func (AppModule) Name() string { + return types.ModuleName +} + +// RegisterInvariants registers the staking middleware module invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// RegisterServices registers a gRPC query service to respond to the +// module-specific gRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) +} + +// InitGenesis performs genesis initialization for the staking middleware module. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + + am.keeper.InitGenesis(ctx, &genesisState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the exported genesis state as raw bytes for the staking middleware +// module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(gs) +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock returns the begin blocker for the staking middleware module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + // BeginBlocker(ctx, am.keeper) ??? +} + +// AppModuleSimulation functions +// GenerateGenesisState creates a randomized GenState of the staking middleware module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { + return nil +} + +// RegisterStoreDecoder registers a decoder for staking middleware module's types. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// WeightedOperations doesn't return any staking middleware module operation. +func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { + return nil +} diff --git a/x/ibctransfermiddleware/types/codec.go b/x/ibctransfermiddleware/types/codec.go new file mode 100644 index 000000000..c8986807f --- /dev/null +++ b/x/ibctransfermiddleware/types/codec.go @@ -0,0 +1,45 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/types/msgservice" + authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" + govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" + groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// RegisterLegacyAminoCodec registers the account interfaces and concrete types on the +// provided LegacyAmino codec. These types are used for Amino JSON serialization +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgUpdateEpochParams{}, "composable/MsgUpdateEpochParams") +} + +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateEpochParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + sdk.RegisterLegacyAminoCodec(amino) + + // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be + // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances + RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(govcodec.Amino) + RegisterLegacyAminoCodec(groupcodec.Amino) +} diff --git a/x/ibctransfermiddleware/types/genesis.go b/x/ibctransfermiddleware/types/genesis.go new file mode 100644 index 000000000..d9cf35fad --- /dev/null +++ b/x/ibctransfermiddleware/types/genesis.go @@ -0,0 +1,21 @@ +package types + +// NewGenesisState creates a new GenesisState object +func NewGenesisState(params Params) *GenesisState { + return &GenesisState{ + Params: params, + } +} + +// DefaultGenesisState creates a default GenesisState object +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: Params{BlocksPerEpoch: 360, AllowUnbondAfterEpochProgressBlockNumber: 0}, + } +} + +// ValidateGenesis validates the provided genesis state to ensure the +// expected invariants holds. +func ValidateGenesis(data GenesisState) error { + return nil +} diff --git a/x/ibctransfermiddleware/types/genesis.pb.go b/x/ibctransfermiddleware/types/genesis.pb.go new file mode 100644 index 000000000..d75c5c1bd --- /dev/null +++ b/x/ibctransfermiddleware/types/genesis.pb.go @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "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 + +// GenesisState defines the ibctransfermiddleware module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_ab9a6edd8a683ba6, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "composable.ibctransfermiddleware.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/genesis.proto", fileDescriptor_ab9a6edd8a683ba6) +} + +var fileDescriptor_ab9a6edd8a683ba6 = []byte{ + // 213 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4b, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, + 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xd2, 0x40, 0xe8, 0xd3, 0xc3, 0xaa, 0x4f, 0x0f, 0xaa, 0x4f, 0x4a, 0x24, 0x3d, + 0x3f, 0x3d, 0x1f, 0xac, 0x49, 0x1f, 0xc4, 0x82, 0xe8, 0x97, 0x72, 0x21, 0xda, 0x5e, 0xec, 0xa6, + 0x43, 0x4c, 0x11, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x21, 0xa5, 0x38, 0x2e, + 0x1e, 0x77, 0x88, 0x4b, 0x83, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0xfc, 0xb8, 0xd8, 0x0a, 0x12, 0x8b, + 0x12, 0x73, 0x8b, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x0c, 0xf4, 0x88, 0x75, 0xb9, 0x5e, + 0x00, 0x58, 0x9f, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0x53, 0x9c, 0xcc, 0x4f, 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, 0xb6, 0x02, 0x87, 0x4f, 0x4a, 0x2a, 0x0b, + 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xee, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x64, 0x36, + 0x5f, 0x72, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go new file mode 100644 index 000000000..8061d3d76 --- /dev/null +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -0,0 +1,1462 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "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 + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +type Delegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *Delegation) Reset() { *m = Delegation{} } +func (m *Delegation) String() string { return proto.CompactTextString(m) } +func (*Delegation) ProtoMessage() {} +func (*Delegation) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{0} +} +func (m *Delegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Delegation.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 *Delegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Delegation.Merge(m, src) +} +func (m *Delegation) XXX_Size() int { + return m.Size() +} +func (m *Delegation) XXX_DiscardUnknown() { + xxx_messageInfo_Delegation.DiscardUnknown(m) +} + +var xxx_messageInfo_Delegation proto.InternalMessageInfo + +// BeginRedelegate defines a SDK message for performing a begin redelegation of coins +// from a delegator to a validator. +type BeginRedelegate struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"` + Amount types.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` +} + +func (m *BeginRedelegate) Reset() { *m = BeginRedelegate{} } +func (m *BeginRedelegate) String() string { return proto.CompactTextString(m) } +func (*BeginRedelegate) ProtoMessage() {} +func (*BeginRedelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{1} +} +func (m *BeginRedelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BeginRedelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BeginRedelegate.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 *BeginRedelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_BeginRedelegate.Merge(m, src) +} +func (m *BeginRedelegate) XXX_Size() int { + return m.Size() +} +func (m *BeginRedelegate) XXX_DiscardUnknown() { + xxx_messageInfo_BeginRedelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_BeginRedelegate proto.InternalMessageInfo + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +type Undelegate struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *Undelegate) Reset() { *m = Undelegate{} } +func (m *Undelegate) String() string { return proto.CompactTextString(m) } +func (*Undelegate) ProtoMessage() {} +func (*Undelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{2} +} +func (m *Undelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Undelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Undelegate.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 *Undelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_Undelegate.Merge(m, src) +} +func (m *Undelegate) XXX_Size() int { + return m.Size() +} +func (m *Undelegate) XXX_DiscardUnknown() { + xxx_messageInfo_Undelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_Undelegate proto.InternalMessageInfo + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +type CancelUnbondingDelegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + CreationHeight int64 `protobuf:"varint,4,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` +} + +func (m *CancelUnbondingDelegation) Reset() { *m = CancelUnbondingDelegation{} } +func (m *CancelUnbondingDelegation) String() string { return proto.CompactTextString(m) } +func (*CancelUnbondingDelegation) ProtoMessage() {} +func (*CancelUnbondingDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{3} +} +func (m *CancelUnbondingDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CancelUnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CancelUnbondingDelegation.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 *CancelUnbondingDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_CancelUnbondingDelegation.Merge(m, src) +} +func (m *CancelUnbondingDelegation) XXX_Size() int { + return m.Size() +} +func (m *CancelUnbondingDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_CancelUnbondingDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_CancelUnbondingDelegation proto.InternalMessageInfo + +// Params holds parameters for the ibctransfermiddleware module. +type Params struct { + // expected blocks per year + BlocksPerEpoch uint64 `protobuf:"varint,1,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` + // max block allowed before validator set update + AllowUnbondAfterEpochProgressBlockNumber uint64 `protobuf:"varint,2,opt,name=allow_unbond_after_epoch_progress_block_number,json=allowUnbondAfterEpochProgressBlockNumber,proto3" json:"allow_unbond_after_epoch_progress_block_number,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{4} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetBlocksPerEpoch() uint64 { + if m != nil { + return m.BlocksPerEpoch + } + return 0 +} + +func (m *Params) GetAllowUnbondAfterEpochProgressBlockNumber() uint64 { + if m != nil { + return m.AllowUnbondAfterEpochProgressBlockNumber + } + return 0 +} + +func init() { + proto.RegisterType((*Delegation)(nil), "composable.ibctransfermiddleware.v1beta1.Delegation") + proto.RegisterType((*BeginRedelegate)(nil), "composable.ibctransfermiddleware.v1beta1.BeginRedelegate") + proto.RegisterType((*Undelegate)(nil), "composable.ibctransfermiddleware.v1beta1.Undelegate") + proto.RegisterType((*CancelUnbondingDelegation)(nil), "composable.ibctransfermiddleware.v1beta1.CancelUnbondingDelegation") + proto.RegisterType((*Params)(nil), "composable.ibctransfermiddleware.v1beta1.Params") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto", fileDescriptor_1193893bc248bc1b) +} + +var fileDescriptor_1193893bc248bc1b = []byte{ + // 584 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x95, 0x4f, 0x6b, 0x13, 0x41, + 0x18, 0x87, 0x77, 0x93, 0x10, 0xe8, 0x08, 0xfd, 0x13, 0xab, 0x26, 0x85, 0x6e, 0x4a, 0x2e, 0x0d, + 0x81, 0x66, 0x89, 0x1e, 0xc4, 0xea, 0xc1, 0xa6, 0x29, 0x88, 0xa8, 0x84, 0x2d, 0xbd, 0x78, 0x59, + 0x67, 0x77, 0xa7, 0x9b, 0xa1, 0xbb, 0x33, 0x61, 0x66, 0x92, 0xea, 0xd5, 0x93, 0x78, 0x12, 0xd4, + 0x7b, 0x8f, 0x1e, 0x73, 0xf0, 0x43, 0xf4, 0x58, 0x3c, 0x79, 0x10, 0x91, 0xe4, 0x10, 0x3f, 0x80, + 0x1f, 0x40, 0x76, 0x66, 0x92, 0x10, 0x9b, 0x92, 0x22, 0x3d, 0x88, 0x97, 0x24, 0xf3, 0xbe, 0xfb, + 0xfc, 0x78, 0xe7, 0x61, 0x32, 0x0b, 0x1a, 0x3e, 0x8d, 0xdb, 0x94, 0x43, 0x2f, 0x42, 0x36, 0xf6, + 0x7c, 0xc1, 0x20, 0xe1, 0x87, 0x88, 0xc5, 0x38, 0x08, 0x22, 0x74, 0x0c, 0x19, 0xb2, 0xbb, 0x35, + 0x0f, 0x09, 0x58, 0x9b, 0xdd, 0xad, 0xb6, 0x19, 0x15, 0x34, 0x57, 0x9e, 0xa4, 0x54, 0x67, 0x3f, + 0xa7, 0x53, 0xd6, 0x56, 0x43, 0x1a, 0x52, 0x09, 0xd9, 0xc9, 0x2f, 0xc5, 0xaf, 0x15, 0x7c, 0xca, + 0x63, 0xca, 0x5d, 0xd5, 0x50, 0x0b, 0xdd, 0xb2, 0xd4, 0xca, 0xf6, 0x20, 0x9f, 0xcc, 0xe2, 0x53, + 0x4c, 0x74, 0x7f, 0x05, 0xc6, 0x98, 0x50, 0x5b, 0x7e, 0xea, 0xd2, 0x2d, 0x8d, 0xc4, 0x3c, 0xb4, + 0xbb, 0xb5, 0xe4, 0x4b, 0x35, 0x4a, 0xef, 0x53, 0x00, 0x34, 0x50, 0x84, 0x42, 0x28, 0x30, 0x25, + 0xb9, 0x3d, 0xb0, 0x12, 0xa8, 0x15, 0x65, 0x2e, 0x0c, 0x02, 0x86, 0x38, 0xcf, 0x9b, 0x1b, 0x66, + 0x79, 0xa1, 0x9e, 0xff, 0xf2, 0x79, 0x6b, 0x55, 0xcf, 0xb1, 0xa3, 0x3a, 0xfb, 0x82, 0x61, 0x12, + 0x3a, 0xcb, 0x63, 0x44, 0xd7, 0x93, 0x98, 0x2e, 0x8c, 0x70, 0x30, 0x15, 0x93, 0x9a, 0x17, 0x33, + 0x46, 0x46, 0x31, 0x0f, 0x40, 0x16, 0xc6, 0xb4, 0x43, 0x44, 0x3e, 0xbd, 0x61, 0x96, 0xaf, 0xdd, + 0x2e, 0x54, 0x35, 0x98, 0xec, 0x7c, 0xe4, 0xaf, 0xba, 0x4b, 0x31, 0xa9, 0x2f, 0x9c, 0x7e, 0x2f, + 0x1a, 0x9f, 0x86, 0xbd, 0x8a, 0xe9, 0x68, 0x66, 0xfb, 0xde, 0x9b, 0x93, 0xa2, 0xf1, 0xf3, 0xa4, + 0x68, 0xbc, 0x1e, 0xf6, 0x2a, 0xe7, 0xb7, 0xf5, 0x76, 0xd8, 0xab, 0xdc, 0x54, 0x79, 0x5b, 0x3c, + 0x38, 0xb2, 0x9f, 0xf2, 0x50, 0x8b, 0x40, 0xa5, 0x5f, 0x29, 0xb0, 0x54, 0x47, 0x21, 0x26, 0x0e, + 0xd2, 0x1c, 0xba, 0x2a, 0x35, 0x4f, 0xc0, 0x8d, 0x89, 0x1a, 0xce, 0xfc, 0x4b, 0xeb, 0xb9, 0x3e, + 0xc6, 0xf6, 0x99, 0x3f, 0x33, 0x2d, 0xe0, 0x62, 0x9c, 0x96, 0xbe, 0x74, 0x5a, 0x83, 0x8b, 0xf3, + 0xbe, 0x33, 0x7f, 0xe1, 0xfb, 0xe1, 0x7c, 0xdf, 0xeb, 0xd3, 0xbe, 0xff, 0x50, 0x5c, 0xfa, 0x98, + 0x02, 0xe0, 0x80, 0x5c, 0xb5, 0xf1, 0x7f, 0xe2, 0x30, 0xde, 0x9f, 0x2f, 0x27, 0x3f, 0x2d, 0x67, + 0x22, 0xa2, 0xf4, 0x2d, 0x05, 0x0a, 0xbb, 0x90, 0xf8, 0x28, 0x3a, 0x20, 0x1e, 0x25, 0x01, 0x26, + 0xe1, 0xff, 0xf9, 0x9f, 0xcd, 0x6d, 0x82, 0x25, 0x9f, 0x21, 0xb9, 0x2f, 0xb7, 0x85, 0x70, 0xd8, + 0x52, 0x47, 0x31, 0xed, 0x2c, 0x8e, 0xca, 0x8f, 0x64, 0x75, 0xfb, 0xf1, 0x7c, 0x9f, 0x9b, 0xd3, + 0x3e, 0x2f, 0x14, 0x58, 0xfa, 0x60, 0x82, 0x6c, 0x13, 0x32, 0x18, 0xf3, 0x5c, 0x19, 0x2c, 0x7b, + 0x11, 0xf5, 0x8f, 0xb8, 0xdb, 0x46, 0xcc, 0x45, 0x6d, 0xea, 0xb7, 0xa4, 0xca, 0x8c, 0xb3, 0xa8, + 0xea, 0x4d, 0xc4, 0xf6, 0x92, 0x6a, 0xee, 0x05, 0xa8, 0xc2, 0x28, 0xa2, 0xc7, 0x6e, 0x47, 0x26, + 0xba, 0xf0, 0x50, 0x8c, 0x88, 0xe4, 0xce, 0x0e, 0x93, 0x29, 0x5c, 0xc9, 0xb8, 0xa4, 0x13, 0x7b, + 0x88, 0x49, 0x97, 0x19, 0xa7, 0x2c, 0x29, 0x35, 0xc6, 0x4e, 0xc2, 0xc8, 0xb8, 0xa6, 0x26, 0xea, + 0x09, 0xf0, 0x4c, 0x3e, 0x5f, 0xbf, 0x7b, 0xda, 0xb7, 0xcc, 0xb3, 0xbe, 0x65, 0xfe, 0xe8, 0x5b, + 0xe6, 0xbb, 0x81, 0x65, 0x9c, 0x0d, 0x2c, 0xe3, 0xeb, 0xc0, 0x32, 0x9e, 0xaf, 0xbf, 0xbc, 0xe0, + 0xc5, 0x24, 0x5e, 0xb5, 0x11, 0xf7, 0xb2, 0xf2, 0x6a, 0xbf, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, + 0x6b, 0xd0, 0x58, 0xce, 0xc9, 0x06, 0x00, 0x00, +} + +func (m *Delegation) 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 *Delegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BeginRedelegate) 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 *BeginRedelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorDstAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorSrcAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Undelegate) 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 *Undelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Undelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CancelUnbondingDelegation) 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 *CancelUnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CancelUnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationHeight != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AllowUnbondAfterEpochProgressBlockNumber != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.AllowUnbondAfterEpochProgressBlockNumber)) + i-- + dAtA[i] = 0x10 + } + if m.BlocksPerEpoch != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.BlocksPerEpoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintIbctransfermiddleware(dAtA []byte, offset int, v uint64) int { + offset -= sovIbctransfermiddleware(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Delegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + return n +} + +func (m *BeginRedelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + return n +} + +func (m *Undelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + return n +} + +func (m *CancelUnbondingDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + if m.CreationHeight != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.CreationHeight)) + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlocksPerEpoch != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.BlocksPerEpoch)) + } + if m.AllowUnbondAfterEpochProgressBlockNumber != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.AllowUnbondAfterEpochProgressBlockNumber)) + } + return n +} + +func sovIbctransfermiddleware(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozIbctransfermiddleware(x uint64) (n int) { + return sovIbctransfermiddleware(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Delegation) 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 ErrIntOverflowIbctransfermiddleware + } + 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: Delegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Delegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BeginRedelegate) 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 ErrIntOverflowIbctransfermiddleware + } + 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: BeginRedelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BeginRedelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Undelegate) 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 ErrIntOverflowIbctransfermiddleware + } + 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: Undelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Undelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CancelUnbondingDelegation) 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 ErrIntOverflowIbctransfermiddleware + } + 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: CancelUnbondingDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CancelUnbondingDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + 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 ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) 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 ErrIntOverflowIbctransfermiddleware + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerEpoch", wireType) + } + m.BlocksPerEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlocksPerEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowUnbondAfterEpochProgressBlockNumber", wireType) + } + m.AllowUnbondAfterEpochProgressBlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AllowUnbondAfterEpochProgressBlockNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipIbctransfermiddleware(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, ErrIntOverflowIbctransfermiddleware + } + 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, ErrIntOverflowIbctransfermiddleware + } + 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, ErrIntOverflowIbctransfermiddleware + } + 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, ErrInvalidLengthIbctransfermiddleware + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIbctransfermiddleware + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthIbctransfermiddleware + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthIbctransfermiddleware = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIbctransfermiddleware = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIbctransfermiddleware = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/keys.go b/x/ibctransfermiddleware/types/keys.go new file mode 100644 index 000000000..e349116db --- /dev/null +++ b/x/ibctransfermiddleware/types/keys.go @@ -0,0 +1,15 @@ +package types + +// ParamsKey is the key to use for the keeper store. +var ( + ParamsKey = []byte{0x01} // key for global staking middleware params in the keeper store +) + +const ( + // module name + ModuleName = "ibctransfermiddleware" + + // StoreKey is the default store key for ibctransfermiddleware module that store params when apply validator set changes and when allow to unbond/redelegate + + StoreKey = "customibctransferparams" // not using the module name because of collisions with key "staking" +) diff --git a/x/ibctransfermiddleware/types/msgs.go b/x/ibctransfermiddleware/types/msgs.go new file mode 100644 index 000000000..4418aa784 --- /dev/null +++ b/x/ibctransfermiddleware/types/msgs.go @@ -0,0 +1,28 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateEpochParams{} + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgUpdateEpochParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *MsgUpdateEpochParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateEpochParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrapf(err, "invalid authority address") + } + + return nil +} diff --git a/x/ibctransfermiddleware/types/query.pb.go b/x/ibctransfermiddleware/types/query.pb.go new file mode 100644 index 000000000..3781ce2b7 --- /dev/null +++ b/x/ibctransfermiddleware/types/query.pb.go @@ -0,0 +1,537 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + 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. +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 + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_488b65e78926913a, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_488b65e78926913a, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "composable.ibctransfermiddleware.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "composable.ibctransfermiddleware.v1beta1.QueryParamsResponse") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/query.proto", fileDescriptor_488b65e78926913a) +} + +var fileDescriptor_488b65e78926913a = []byte{ + // 286 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x49, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, + 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0xd2, 0x40, 0xe8, 0xd2, 0xc3, 0xaa, 0x4b, 0x0f, 0xaa, 0x4b, 0x4a, 0x24, 0x3d, 0x3f, 0x3d, + 0x1f, 0xac, 0x49, 0x1f, 0xc4, 0x82, 0xe8, 0x97, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, + 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, + 0xca, 0xba, 0x10, 0xed, 0x26, 0xec, 0x76, 0x83, 0x4d, 0x51, 0x12, 0xe1, 0x12, 0x0a, 0x04, 0x39, + 0x39, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x38, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x29, 0x95, + 0x4b, 0x18, 0x45, 0xb4, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, 0x8f, 0x8b, 0xad, 0x00, 0x2c, + 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x64, 0xa0, 0x47, 0xac, 0x0f, 0xf5, 0x20, 0x26, 0x39, + 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x35, 0xc5, 0xe8, 0x20, 0x23, 0x17, 0x2b, 0xd8, 0x1e, + 0xa1, 0xed, 0x8c, 0x5c, 0x6c, 0x10, 0x25, 0x42, 0x36, 0xc4, 0x1b, 0x8a, 0xe9, 0x72, 0x29, 0x5b, + 0x32, 0x75, 0x43, 0x7c, 0xa8, 0x64, 0xd0, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x2d, 0x21, 0x0d, 0x7d, + 0x82, 0xa1, 0x0b, 0xf1, 0x83, 0x93, 0xf9, 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, 0xc9, 0x56, 0xe0, 0xd0, 0x59, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x00, 0x63, + 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68, 0x06, 0x43, 0xc4, 0x5c, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Params returns the total set of minting parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params returns the total set of minting parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "composable.ibctransfermiddleware.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "composable/ibctransfermiddleware/v1beta1/query.proto", +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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 err := m.Params.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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/query.pb.gw.go b/x/ibctransfermiddleware/types/query.pb.gw.go new file mode 100644 index 000000000..fcde2bfcb --- /dev/null +++ b/x/ibctransfermiddleware/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +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 + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(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. +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 { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + 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) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) 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() + 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_Params_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_Params_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}, []string{"composable", "ibctransfermiddleware", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/ibctransfermiddleware/types/tx.pb.go b/x/ibctransfermiddleware/types/tx.pb.go new file mode 100644 index 000000000..ae3aab62a --- /dev/null +++ b/x/ibctransfermiddleware/types/tx.pb.go @@ -0,0 +1,602 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + 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. +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 + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateEpochParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/ibctransfermiddleware parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateEpochParams) Reset() { *m = MsgUpdateEpochParams{} } +func (m *MsgUpdateEpochParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateEpochParams) ProtoMessage() {} +func (*MsgUpdateEpochParams) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{0} +} +func (m *MsgUpdateEpochParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateEpochParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateEpochParams.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 *MsgUpdateEpochParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateEpochParams.Merge(m, src) +} +func (m *MsgUpdateEpochParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateEpochParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateEpochParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateEpochParams proto.InternalMessageInfo + +func (m *MsgUpdateEpochParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateEpochParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsEpochResponse struct { +} + +func (m *MsgUpdateParamsEpochResponse) Reset() { *m = MsgUpdateParamsEpochResponse{} } +func (m *MsgUpdateParamsEpochResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsEpochResponse) ProtoMessage() {} +func (*MsgUpdateParamsEpochResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{1} +} +func (m *MsgUpdateParamsEpochResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsEpochResponse.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 *MsgUpdateParamsEpochResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsEpochResponse.Merge(m, src) +} +func (m *MsgUpdateParamsEpochResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsEpochResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsEpochResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsEpochResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateEpochParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateEpochParams") + proto.RegisterType((*MsgUpdateParamsEpochResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsEpochResponse") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/tx.proto", fileDescriptor_bf5c053de6965bca) +} + +var fileDescriptor_bf5c053de6965bca = []byte{ + // 367 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, + 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xd2, 0x40, + 0x68, 0xd1, 0xc3, 0xaa, 0x45, 0x0f, 0xaa, 0x45, 0x4a, 0x3c, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, + 0x3f, 0xb7, 0x38, 0x5d, 0xbf, 0xcc, 0x10, 0x44, 0x41, 0x8c, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, + 0xcb, 0xd7, 0x07, 0x93, 0x50, 0x21, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82, + 0x8a, 0x4a, 0x42, 0x4c, 0x88, 0x87, 0x48, 0x40, 0x38, 0x50, 0x29, 0x17, 0xa2, 0x5d, 0x8e, 0xdd, + 0x91, 0x60, 0x53, 0x94, 0x5e, 0x31, 0x72, 0x89, 0xf8, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, + 0xa4, 0xba, 0x16, 0xe4, 0x27, 0x67, 0x04, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x0b, 0x99, 0x71, 0x71, + 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, + 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x83, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, + 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x50, 0x30, 0x17, 0x5b, 0x01, 0xd8, 0x04, 0x09, + 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x03, 0x3d, 0x62, 0x83, 0x4b, 0x0f, 0x62, 0xb3, 0x13, 0xe7, + 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x1a, 0x65, 0xe5, 0xda, 0xf4, + 0x7c, 0x83, 0x16, 0xc2, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x8c, 0x90, 0xbc, 0x5f, 0x81, 0x23, 0x00, + 0xe0, 0x1e, 0x83, 0x98, 0xac, 0x24, 0xc7, 0x25, 0x83, 0x26, 0x04, 0xf6, 0x71, 0x50, 0x6a, 0x71, + 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd1, 0x2a, 0x46, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0xd9, 0x8c, + 0x5c, 0x82, 0x98, 0x21, 0x62, 0x47, 0xbc, 0x4f, 0xb0, 0x85, 0xa8, 0x94, 0x1b, 0x19, 0xfa, 0xb1, + 0xb8, 0x52, 0x8a, 0xb5, 0x01, 0x14, 0x36, 0x4e, 0xe6, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, + 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, + 0x2c, 0xc7, 0x10, 0x25, 0x8b, 0x2b, 0x3c, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x31, + 0x6f, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x35, 0x13, 0xa7, 0xfb, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// 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 { + UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) { + out := new(MsgUpdateParamsEpochResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + UpdateEpochParams(context.Context, *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateEpochParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateEpochParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateEpochParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateEpochParams(ctx, req.(*MsgUpdateEpochParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "composable.ibctransfermiddleware.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateEpochParams", + Handler: _Msg_UpdateEpochParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "composable/ibctransfermiddleware/v1beta1/tx.proto", +} + +func (m *MsgUpdateEpochParams) 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 *MsgUpdateEpochParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateEpochParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsEpochResponse) 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 *MsgUpdateParamsEpochResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsEpochResponse) 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 *MsgUpdateEpochParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsEpochResponse) 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 *MsgUpdateEpochParams) 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: MsgUpdateEpochParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateEpochParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsEpochResponse) 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: MsgUpdateParamsEpochResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsEpochResponse: 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") +) From abf68326fee6abcc52df924251ac1fe9736c14ba Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 16:20:24 +0000 Subject: [PATCH 2/2] resolve conflict with a same name for MsgUpdateEpochParams from staking. --- .../ibctransfermiddleware/v1beta1/tx.proto | 6 +- x/ibctransfermiddleware/keeper/msg_server.go | 4 +- x/ibctransfermiddleware/types/codec.go | 4 +- x/ibctransfermiddleware/types/msgs.go | 8 +- x/ibctransfermiddleware/types/tx.pb.go | 139 +++++++++--------- 5 files changed, 81 insertions(+), 80 deletions(-) diff --git a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto index 781979b09..c695e2daf 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto @@ -13,13 +13,13 @@ option go_package = "x/ibctransfermiddleware/types"; service Msg { option (cosmos.msg.v1.service) = true; - rpc UpdateEpochParams(MsgUpdateEpochParams) returns (MsgUpdateParamsEpochResponse); + rpc UpdateEpochParams(MsgUpdateCustomIbcParams) returns (MsgUpdateParamsCustomIbcResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. // // Since: cosmos-sdk 0.47 -message MsgUpdateEpochParams { +message MsgUpdateCustomIbcParams { option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "composable/x/ibctransfermiddleware/MsgUpdateParams"; @@ -38,4 +38,4 @@ message MsgUpdateEpochParams { // MsgUpdateParams message. // // Since: cosmos-sdk 0.47 -message MsgUpdateParamsEpochResponse {} +message MsgUpdateParamsCustomIbcResponse {} diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go index e9d5a6e77..806ecde36 100644 --- a/x/ibctransfermiddleware/keeper/msg_server.go +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -24,7 +24,7 @@ func NewMsgServerImpl(k Keeper) types.MsgServer { } // UpdateParams updates the params. -func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdateEpochParams) (*types.MsgUpdateParamsEpochResponse, error) { +func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdateCustomIbcParams) (*types.MsgUpdateParamsCustomIbcResponse, error) { if ms.authority != req.Authority { return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) } @@ -34,5 +34,5 @@ func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdat return nil, err } - return &types.MsgUpdateParamsEpochResponse{}, nil + return &types.MsgUpdateParamsCustomIbcResponse{}, nil } diff --git a/x/ibctransfermiddleware/types/codec.go b/x/ibctransfermiddleware/types/codec.go index c8986807f..e22a34195 100644 --- a/x/ibctransfermiddleware/types/codec.go +++ b/x/ibctransfermiddleware/types/codec.go @@ -16,13 +16,13 @@ import ( // RegisterLegacyAminoCodec registers the account interfaces and concrete types on the // provided LegacyAmino codec. These types are used for Amino JSON serialization func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - legacy.RegisterAminoMsg(cdc, &MsgUpdateEpochParams{}, "composable/MsgUpdateEpochParams") + legacy.RegisterAminoMsg(cdc, &MsgUpdateCustomIbcParams{}, "composable/MsgUpdateCustomIbcParams") } func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), - &MsgUpdateEpochParams{}, + &MsgUpdateCustomIbcParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/ibctransfermiddleware/types/msgs.go b/x/ibctransfermiddleware/types/msgs.go index 4418aa784..c4ceec79a 100644 --- a/x/ibctransfermiddleware/types/msgs.go +++ b/x/ibctransfermiddleware/types/msgs.go @@ -5,21 +5,21 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgUpdateEpochParams{} +var _ sdk.Msg = &MsgUpdateCustomIbcParams{} // GetSignBytes implements the LegacyMsg interface. -func (m MsgUpdateEpochParams) GetSignBytes() []byte { +func (m MsgUpdateCustomIbcParams) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } // GetSigners returns the expected signers for a MsgUpdateParams message. -func (m *MsgUpdateEpochParams) GetSigners() []sdk.AccAddress { +func (m *MsgUpdateCustomIbcParams) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.Authority) return []sdk.AccAddress{addr} } // ValidateBasic does a sanity check on the provided data. -func (m *MsgUpdateEpochParams) ValidateBasic() error { +func (m *MsgUpdateCustomIbcParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { return errorsmod.Wrapf(err, "invalid authority address") } diff --git a/x/ibctransfermiddleware/types/tx.pb.go b/x/ibctransfermiddleware/types/tx.pb.go index ae3aab62a..7235fb024 100644 --- a/x/ibctransfermiddleware/types/tx.pb.go +++ b/x/ibctransfermiddleware/types/tx.pb.go @@ -34,7 +34,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgUpdateParams is the Msg/UpdateParams request type. // // Since: cosmos-sdk 0.47 -type MsgUpdateEpochParams struct { +type MsgUpdateCustomIbcParams struct { // authority is the address that controls the module (defaults to x/gov unless // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` @@ -44,18 +44,18 @@ type MsgUpdateEpochParams struct { Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } -func (m *MsgUpdateEpochParams) Reset() { *m = MsgUpdateEpochParams{} } -func (m *MsgUpdateEpochParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateEpochParams) ProtoMessage() {} -func (*MsgUpdateEpochParams) Descriptor() ([]byte, []int) { +func (m *MsgUpdateCustomIbcParams) Reset() { *m = MsgUpdateCustomIbcParams{} } +func (m *MsgUpdateCustomIbcParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCustomIbcParams) ProtoMessage() {} +func (*MsgUpdateCustomIbcParams) Descriptor() ([]byte, []int) { return fileDescriptor_bf5c053de6965bca, []int{0} } -func (m *MsgUpdateEpochParams) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateCustomIbcParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateEpochParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateCustomIbcParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateEpochParams.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateCustomIbcParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -65,26 +65,26 @@ func (m *MsgUpdateEpochParams) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *MsgUpdateEpochParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateEpochParams.Merge(m, src) +func (m *MsgUpdateCustomIbcParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCustomIbcParams.Merge(m, src) } -func (m *MsgUpdateEpochParams) XXX_Size() int { +func (m *MsgUpdateCustomIbcParams) XXX_Size() int { return m.Size() } -func (m *MsgUpdateEpochParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateEpochParams.DiscardUnknown(m) +func (m *MsgUpdateCustomIbcParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCustomIbcParams.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateEpochParams proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateCustomIbcParams proto.InternalMessageInfo -func (m *MsgUpdateEpochParams) GetAuthority() string { +func (m *MsgUpdateCustomIbcParams) GetAuthority() string { if m != nil { return m.Authority } return "" } -func (m *MsgUpdateEpochParams) GetParams() Params { +func (m *MsgUpdateCustomIbcParams) GetParams() Params { if m != nil { return m.Params } @@ -95,21 +95,21 @@ func (m *MsgUpdateEpochParams) GetParams() Params { // MsgUpdateParams message. // // Since: cosmos-sdk 0.47 -type MsgUpdateParamsEpochResponse struct { +type MsgUpdateParamsCustomIbcResponse struct { } -func (m *MsgUpdateParamsEpochResponse) Reset() { *m = MsgUpdateParamsEpochResponse{} } -func (m *MsgUpdateParamsEpochResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsEpochResponse) ProtoMessage() {} -func (*MsgUpdateParamsEpochResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateParamsCustomIbcResponse) Reset() { *m = MsgUpdateParamsCustomIbcResponse{} } +func (m *MsgUpdateParamsCustomIbcResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsCustomIbcResponse) ProtoMessage() {} +func (*MsgUpdateParamsCustomIbcResponse) Descriptor() ([]byte, []int) { return fileDescriptor_bf5c053de6965bca, []int{1} } -func (m *MsgUpdateParamsEpochResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateParamsEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateParamsEpochResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -119,21 +119,21 @@ func (m *MsgUpdateParamsEpochResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgUpdateParamsEpochResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsEpochResponse.Merge(m, src) +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.Merge(m, src) } -func (m *MsgUpdateParamsEpochResponse) XXX_Size() int { +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateParamsEpochResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsEpochResponse.DiscardUnknown(m) +func (m *MsgUpdateParamsCustomIbcResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateParamsEpochResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateParamsCustomIbcResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgUpdateEpochParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateEpochParams") - proto.RegisterType((*MsgUpdateParamsEpochResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsEpochResponse") + proto.RegisterType((*MsgUpdateCustomIbcParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateCustomIbcParams") + proto.RegisterType((*MsgUpdateParamsCustomIbcResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsCustomIbcResponse") } func init() { @@ -141,7 +141,7 @@ func init() { } var fileDescriptor_bf5c053de6965bca = []byte{ - // 367 bytes of a gzipped FileDescriptorProto + // 378 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0xcf, 0x2d, 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, @@ -150,21 +150,22 @@ var fileDescriptor_bf5c053de6965bca = []byte{ 0x3f, 0xb7, 0x38, 0x5d, 0xbf, 0xcc, 0x10, 0x44, 0x41, 0x8c, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x50, 0x21, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82, 0x8a, 0x4a, 0x42, 0x4c, 0x88, 0x87, 0x48, 0x40, 0x38, 0x50, 0x29, 0x17, 0xa2, 0x5d, 0x8e, 0xdd, - 0x91, 0x60, 0x53, 0x94, 0x5e, 0x31, 0x72, 0x89, 0xf8, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, - 0xa4, 0xba, 0x16, 0xe4, 0x27, 0x67, 0x04, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x0b, 0x99, 0x71, 0x71, - 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, - 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x83, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, - 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x50, 0x30, 0x17, 0x5b, 0x01, 0xd8, 0x04, 0x09, - 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x03, 0x3d, 0x62, 0x83, 0x4b, 0x0f, 0x62, 0xb3, 0x13, 0xe7, - 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x1a, 0x65, 0xe5, 0xda, 0xf4, - 0x7c, 0x83, 0x16, 0xc2, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x8c, 0x90, 0xbc, 0x5f, 0x81, 0x23, 0x00, - 0xe0, 0x1e, 0x83, 0x98, 0xac, 0x24, 0xc7, 0x25, 0x83, 0x26, 0x04, 0xf6, 0x71, 0x50, 0x6a, 0x71, - 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd1, 0x2a, 0x46, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0xd9, 0x8c, - 0x5c, 0x82, 0x98, 0x21, 0x62, 0x47, 0xbc, 0x4f, 0xb0, 0x85, 0xa8, 0x94, 0x1b, 0x19, 0xfa, 0xb1, - 0xb8, 0x52, 0x8a, 0xb5, 0x01, 0x14, 0x36, 0x4e, 0xe6, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, - 0x2c, 0xc7, 0x10, 0x25, 0x8b, 0x2b, 0x3c, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x31, - 0x6f, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x35, 0x13, 0xa7, 0xfb, 0x02, 0x00, 0x00, + 0x91, 0x60, 0x53, 0x94, 0xde, 0x31, 0x72, 0x49, 0xf8, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, + 0xa4, 0x3a, 0x97, 0x16, 0x97, 0xe4, 0xe7, 0x7a, 0x26, 0x25, 0x07, 0x24, 0x16, 0x25, 0xe6, 0x16, + 0x0b, 0x99, 0x71, 0x71, 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, + 0x30, 0x6a, 0x70, 0x3a, 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x87, 0x63, 0x4a, 0x4a, 0x51, + 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x50, 0x30, 0x17, 0x5b, + 0x01, 0xd8, 0x04, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x03, 0x3d, 0x62, 0x83, 0x4c, 0x0f, + 0x62, 0xb3, 0x13, 0xe7, 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x1a, + 0x65, 0xe5, 0xda, 0xf4, 0x7c, 0x83, 0x16, 0xc2, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x8c, 0x90, 0x82, + 0xa0, 0x02, 0x47, 0x20, 0xc0, 0x3d, 0x07, 0x31, 0x59, 0x49, 0x89, 0x4b, 0x01, 0x4d, 0x08, 0xee, + 0xeb, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x4d, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, + 0xe9, 0x42, 0x8b, 0x19, 0xb9, 0x04, 0x21, 0x2a, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0xa0, 0xa1, 0xe2, + 0x44, 0xbc, 0x6f, 0x70, 0x85, 0xac, 0x94, 0x17, 0x19, 0x66, 0xe0, 0x70, 0xad, 0x14, 0x6b, 0x03, + 0x28, 0x9c, 0x9c, 0xcc, 0x4f, 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, 0x16, + 0x57, 0xd8, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x53, 0x82, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0x6a, 0x14, 0xf9, 0x95, 0x0b, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -179,7 +180,7 @@ 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 { - UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) + UpdateEpochParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) } type msgClient struct { @@ -190,8 +191,8 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) { - out := new(MsgUpdateParamsEpochResponse) +func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) { + out := new(MsgUpdateParamsCustomIbcResponse) err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", in, out, opts...) if err != nil { return nil, err @@ -201,14 +202,14 @@ func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochPar // MsgServer is the server API for Msg service. type MsgServer interface { - UpdateEpochParams(context.Context, *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) + UpdateEpochParams(context.Context, *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) { +func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateEpochParams not implemented") } @@ -217,7 +218,7 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { } func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateEpochParams) + in := new(MsgUpdateCustomIbcParams) if err := dec(in); err != nil { return nil, err } @@ -229,7 +230,7 @@ func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec fu FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateEpochParams(ctx, req.(*MsgUpdateEpochParams)) + return srv.(MsgServer).UpdateEpochParams(ctx, req.(*MsgUpdateCustomIbcParams)) } return interceptor(ctx, in, info, handler) } @@ -247,7 +248,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "composable/ibctransfermiddleware/v1beta1/tx.proto", } -func (m *MsgUpdateEpochParams) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateCustomIbcParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -257,12 +258,12 @@ func (m *MsgUpdateEpochParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateEpochParams) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateCustomIbcParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateEpochParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateCustomIbcParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -287,7 +288,7 @@ func (m *MsgUpdateEpochParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateParamsEpochResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParamsCustomIbcResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -297,12 +298,12 @@ func (m *MsgUpdateParamsEpochResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateParamsEpochResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsCustomIbcResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParamsEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsCustomIbcResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -321,7 +322,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgUpdateEpochParams) Size() (n int) { +func (m *MsgUpdateCustomIbcParams) Size() (n int) { if m == nil { return 0 } @@ -336,7 +337,7 @@ func (m *MsgUpdateEpochParams) Size() (n int) { return n } -func (m *MsgUpdateParamsEpochResponse) Size() (n int) { +func (m *MsgUpdateParamsCustomIbcResponse) Size() (n int) { if m == nil { return 0 } @@ -351,7 +352,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgUpdateEpochParams) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -374,10 +375,10 @@ func (m *MsgUpdateEpochParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateEpochParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateCustomIbcParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateEpochParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateCustomIbcParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -466,7 +467,7 @@ func (m *MsgUpdateEpochParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsEpochResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsCustomIbcResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -489,10 +490,10 @@ func (m *MsgUpdateParamsEpochResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsEpochResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: