-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description PR for the IBC logic of GMP Ref: ojo-network/ojo-evm#3 --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
- Loading branch information
1 parent
69bcdb6
commit 5e82697
Showing
42 changed files
with
4,258 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package ibctransfer | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" | ||
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" | ||
types "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" | ||
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" | ||
"github.com/cosmos/ibc-go/v7/modules/core/exported" | ||
) | ||
|
||
type Keeper struct { | ||
ibctransferkeeper.Keeper | ||
|
||
storeKey storetypes.StoreKey | ||
cdc codec.BinaryCodec | ||
paramSpace paramtypes.Subspace | ||
|
||
ics4Wrapper porttypes.ICS4Wrapper | ||
channelKeeper types.ChannelKeeper | ||
portKeeper types.PortKeeper | ||
authKeeper types.AccountKeeper | ||
bankKeeper types.BankKeeper | ||
scopedKeeper exported.ScopedKeeper | ||
} | ||
|
||
func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { | ||
// TODO: Custom IBC validation logic | ||
return k.Keeper.Transfer(goCtx, msg) | ||
} | ||
|
||
// NewKeeper creates a new IBC transfer Keeper instance | ||
func NewKeeper( | ||
cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, | ||
ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, | ||
authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, scopedKeeper exported.ScopedKeeper, | ||
) Keeper { | ||
// ensure ibc transfer module account is set | ||
if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { | ||
panic("the IBC transfer module account has not been set") | ||
} | ||
|
||
// set KeyTable if it has not already been set | ||
if !paramSpace.HasKeyTable() { | ||
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) | ||
} | ||
|
||
return Keeper{ | ||
cdc: cdc, | ||
storeKey: key, | ||
paramSpace: paramSpace, | ||
ics4Wrapper: ics4Wrapper, | ||
channelKeeper: channelKeeper, | ||
portKeeper: portKeeper, | ||
authKeeper: authKeeper, | ||
bankKeeper: bankKeeper, | ||
scopedKeeper: scopedKeeper, | ||
} | ||
} |
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
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,12 @@ | ||
syntax = "proto3"; | ||
package ojo.gmp.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "ojo/gmp/v1/gmp.proto"; | ||
|
||
option go_package = "github.com/ojo-network/ojo/x/gmp/types"; | ||
|
||
// GenesisState represents the genesis state of the gmp module. | ||
message GenesisState { | ||
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,38 @@ | ||
syntax = "proto3"; | ||
package ojo.gmp.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/ojo-network/ojo/x/gmp/types"; | ||
|
||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
// Params defines the parameters for the gmp module. | ||
message Params { | ||
// The axelar address that we'll send IBC transactions to. | ||
string gmp_address = 1; | ||
|
||
// The channel over which we communicate with axelar. | ||
string gmp_channel = 2; | ||
|
||
// The amount of time we'll wait for a response from axelar before timing out. | ||
int64 gmp_timeout = 3; | ||
} | ||
|
||
// GmpMessage defines the GMP message that we encode in the | ||
// IBC memo field and send to Axelar. | ||
// | ||
// Ref: https://github.com/axelarnetwork/evm-cosmos-gmp-sample | ||
message GmpMessage { | ||
// destination_chain is the destination chain of the message | ||
string destination_chain = 1; | ||
|
||
// destination_address is the destination address of the message | ||
string destination_address = 2; | ||
|
||
// payload is the encoded payload of the message (exchange rates) | ||
bytes payload = 3; | ||
|
||
// type is an enum that specifies the type of message | ||
int64 type = 4; | ||
} |
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 ojo.gmp.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "ojo/gmp/v1/gmp.proto"; | ||
|
||
option go_package = "github.com/ojo-network/ojo/x/gmp/types"; | ||
|
||
// Query defines the gRPC querier service for the gmp module | ||
service Query { | ||
// Params queries all parameters. | ||
rpc Params(ParamsRequest) returns (ParamsResponse) { | ||
option (google.api.http).get = "/ojo/gmp/v1/params"; | ||
} | ||
} | ||
|
||
// ParamsRequest is the request type for the Query/Params RPC method. | ||
message ParamsRequest {} | ||
|
||
// ParamsResponse is the response type for the Query/Params RPC method. | ||
message ParamsResponse { | ||
// params defines the parameters of the module. | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
} |
Oops, something went wrong.