-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from ComposableFi/rustninja/ibctransfer-stora…
…ge-module-added Rustninja/ibctransfer custom ibc transfer module added to store params for eth fees
- Loading branch information
Showing
23 changed files
with
3,758 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
proto/composable/ibctransfermiddleware/v1beta1/genesis.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ]; | ||
} |
81 changes: 81 additions & 0 deletions
81
proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
proto/composable/ibctransfermiddleware/v1beta1/query.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(MsgUpdateCustomIbcParams) returns (MsgUpdateParamsCustomIbcResponse); | ||
} | ||
|
||
// MsgUpdateParams is the Msg/UpdateParams request type. | ||
// | ||
// Since: cosmos-sdk 0.47 | ||
message MsgUpdateCustomIbcParams { | ||
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 MsgUpdateParamsCustomIbcResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
Oops, something went wrong.