From eeb35aa16a6dc8051d00bfb3a3bdba820a0cf905 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:42:00 -0700 Subject: [PATCH 01/13] feat: custom ibc logic --- app/app.go | 9 +++---- app/ibctransfer.go | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 app/ibctransfer.go diff --git a/app/app.go b/app/app.go index 8cec1e40..5459a5ae 100644 --- a/app/app.go +++ b/app/app.go @@ -88,7 +88,6 @@ import ( upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v7/modules/core" ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" @@ -223,7 +222,7 @@ type App struct { ParamsKeeper paramskeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly EvidenceKeeper evidencekeeper.Keeper - TransferKeeper ibctransferkeeper.Keeper + TransferKeeper IBCTransferKeeper FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper OracleKeeper oraclekeeper.Keeper @@ -456,7 +455,7 @@ func New( ) // Create Transfer Keepers - app.TransferKeeper = ibctransferkeeper.NewKeeper( + app.TransferKeeper = NewIBCTransferKeeper( appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), @@ -467,8 +466,8 @@ func New( app.BankKeeper, scopedTransferKeeper, ) - transferModule := transfer.NewAppModule(app.TransferKeeper) - transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) + transferModule := transfer.NewAppModule(app.TransferKeeper.Keeper) + transferIBCModule := transfer.NewIBCModule(app.TransferKeeper.Keeper) // Create evidence Keeper for to register the IBC light client misbehavior evidence route evidenceKeeper := evidencekeeper.NewKeeper( diff --git a/app/ibctransfer.go b/app/ibctransfer.go new file mode 100644 index 00000000..3bb09512 --- /dev/null +++ b/app/ibctransfer.go @@ -0,0 +1,62 @@ +package app + +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 IBCTransferKeeper 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 IBCTransferKeeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { + // TODO: Custom IBC Transfer logic + return k.Keeper.Transfer(goCtx, msg) +} + +// NewIBCTransferKeeper creates a new IBC transfer Keeper instance +func NewIBCTransferKeeper( + 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, +) IBCTransferKeeper { + // 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 IBCTransferKeeper{ + cdc: cdc, + storeKey: key, + paramSpace: paramSpace, + ics4Wrapper: ics4Wrapper, + channelKeeper: channelKeeper, + portKeeper: portKeeper, + authKeeper: authKeeper, + bankKeeper: bankKeeper, + scopedKeeper: scopedKeeper, + } +} From 27add54694eebc5eeec36c4d6752e80d477cd113 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Fri, 3 Nov 2023 20:04:55 -0700 Subject: [PATCH 02/13] add custom modules for the custom keeper --- app/app.go | 4 ++-- app/modules.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index 5459a5ae..a8a88d73 100644 --- a/app/app.go +++ b/app/app.go @@ -466,8 +466,8 @@ func New( app.BankKeeper, scopedTransferKeeper, ) - transferModule := transfer.NewAppModule(app.TransferKeeper.Keeper) - transferIBCModule := transfer.NewIBCModule(app.TransferKeeper.Keeper) + transferModule := NewIBCTransferModule(app.TransferKeeper) + transferIBCModule := NewIBCAppModule(app.TransferKeeper) // Create evidence Keeper for to register the IBC light client misbehavior evidence route evidenceKeeper := evidencekeeper.NewKeeper( diff --git a/app/modules.go b/app/modules.go index f9e0aa04..8dfa7ed4 100644 --- a/app/modules.go +++ b/app/modules.go @@ -18,6 +18,7 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer" appparams "github.com/ojo-network/ojo/app/params" ) @@ -130,3 +131,31 @@ func (SlashingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(genState) } + +// SlashingModule defines a custom wrapper around the x/slashing module's +// AppModuleBasic implementation to provide custom default genesis state. +type IBCTransferModule struct { + transfer.AppModuleBasic + keeper IBCTransferKeeper +} + +// NewAppModule creates a new 20-transfer module +func NewIBCTransferModule(k IBCTransferKeeper) IBCTransferModule { + return IBCTransferModule{ + keeper: k, + } +} + +// SlashingModule defines a custom wrapper around the x/slashing module's +// AppModuleBasic implementation to provide custom default genesis state. +type IBCAppModule struct { + transfer.IBCModule + keeper IBCTransferKeeper +} + +// NewIBCModule creates a new IBCModule given the keeper +func NewIBCAppModule(k IBCTransferKeeper) IBCAppModule { + return IBCAppModule{ + keeper: k, + } +} From e8ecafa6db9e86bd540bf239b94f7a3d57959d37 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Fri, 3 Nov 2023 20:10:10 -0700 Subject: [PATCH 03/13] comment fixes --- app/modules.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/modules.go b/app/modules.go index 8dfa7ed4..70c397fd 100644 --- a/app/modules.go +++ b/app/modules.go @@ -132,28 +132,28 @@ func (SlashingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(genState) } -// SlashingModule defines a custom wrapper around the x/slashing module's -// AppModuleBasic implementation to provide custom default genesis state. +// IBCTransferModule defines a custom wrapper around the IBC Transfer AppModuleBasic +// so that we can use a custom Keeper. type IBCTransferModule struct { transfer.AppModuleBasic keeper IBCTransferKeeper } -// NewAppModule creates a new 20-transfer module +// NewIBCTransferModule creates a new 20-transfer module func NewIBCTransferModule(k IBCTransferKeeper) IBCTransferModule { return IBCTransferModule{ keeper: k, } } -// SlashingModule defines a custom wrapper around the x/slashing module's -// AppModuleBasic implementation to provide custom default genesis state. +// IBCAppModule is a custom wrapper around IBCModule, which +// implements the ICS26 interface for transfer given the transfer keeper. type IBCAppModule struct { transfer.IBCModule keeper IBCTransferKeeper } -// NewIBCModule creates a new IBCModule given the keeper +// NewIBCAppModule creates a new IBCModule given the keeper func NewIBCAppModule(k IBCTransferKeeper) IBCAppModule { return IBCAppModule{ keeper: k, From a1cfa94f922491428b6528b8f14c74f1ad0eb0b1 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:33:24 -0800 Subject: [PATCH 04/13] feat: gmp module --- app/app.go | 29 +- app/{ => ibctransfer}/ibctransfer.go | 16 +- app/modules.go | 9 +- go.mod | 38 +- go.sum | 78 +- proto/ojo/gmp/v1/genesis.proto | 12 + proto/ojo/gmp/v1/gmp.proto | 54 ++ proto/ojo/gmp/v1/query.proto | 25 + proto/ojo/gmp/v1/tx.proto | 61 ++ tools/tools.go | 10 +- x/gmp/abci.go | 12 + x/gmp/client/cli/query.go | 50 ++ x/gmp/client/cli/tx.go | 77 ++ x/gmp/client/tests/cli_test.go | 23 + x/gmp/client/tests/suite.go | 84 ++ x/gmp/genesis.go | 21 + x/gmp/genesis_test.go | 57 ++ x/gmp/keeper/grpc_query.go | 32 + x/gmp/keeper/helper_test.go | 17 + x/gmp/keeper/keeper.go | 35 + x/gmp/keeper/keeper_suite_test.go | 37 + x/gmp/keeper/msg_server.go | 116 +++ x/gmp/keeper/msg_server_test.go | 38 + x/gmp/keeper/params.go | 20 + x/gmp/keeper/params_test.go | 21 + x/gmp/module.go | 178 +++++ x/gmp/types/codec.go | 44 + x/gmp/types/errors.go | 5 + x/gmp/types/expected_keeper.go | 11 + x/gmp/types/genesis.go | 15 + x/gmp/types/genesis.pb.go | 321 ++++++++ x/gmp/types/gmp.pb.go | 932 ++++++++++++++++++++++ x/gmp/types/gmp_message_types.go | 12 + x/gmp/types/keys.go | 20 + x/gmp/types/msgs.go | 74 ++ x/gmp/types/params.go | 32 + x/gmp/types/query.pb.go | 534 +++++++++++++ x/gmp/types/query.pb.gw.go | 153 ++++ x/gmp/types/tx.pb.go | 1103 ++++++++++++++++++++++++++ x/oracle/keeper/params.go | 13 + 40 files changed, 4346 insertions(+), 73 deletions(-) rename app/{ => ibctransfer}/ibctransfer.go (83%) create mode 100644 proto/ojo/gmp/v1/genesis.proto create mode 100644 proto/ojo/gmp/v1/gmp.proto create mode 100644 proto/ojo/gmp/v1/query.proto create mode 100644 proto/ojo/gmp/v1/tx.proto create mode 100644 x/gmp/abci.go create mode 100644 x/gmp/client/cli/query.go create mode 100644 x/gmp/client/cli/tx.go create mode 100644 x/gmp/client/tests/cli_test.go create mode 100644 x/gmp/client/tests/suite.go create mode 100644 x/gmp/genesis.go create mode 100644 x/gmp/genesis_test.go create mode 100644 x/gmp/keeper/grpc_query.go create mode 100644 x/gmp/keeper/helper_test.go create mode 100644 x/gmp/keeper/keeper.go create mode 100644 x/gmp/keeper/keeper_suite_test.go create mode 100644 x/gmp/keeper/msg_server.go create mode 100644 x/gmp/keeper/msg_server_test.go create mode 100644 x/gmp/keeper/params.go create mode 100644 x/gmp/keeper/params_test.go create mode 100644 x/gmp/module.go create mode 100644 x/gmp/types/codec.go create mode 100644 x/gmp/types/errors.go create mode 100644 x/gmp/types/expected_keeper.go create mode 100644 x/gmp/types/genesis.go create mode 100644 x/gmp/types/genesis.pb.go create mode 100644 x/gmp/types/gmp.pb.go create mode 100644 x/gmp/types/gmp_message_types.go create mode 100644 x/gmp/types/keys.go create mode 100644 x/gmp/types/msgs.go create mode 100644 x/gmp/types/params.go create mode 100644 x/gmp/types/query.pb.go create mode 100644 x/gmp/types/query.pb.gw.go create mode 100644 x/gmp/types/tx.pb.go diff --git a/app/app.go b/app/app.go index a8a88d73..467eb8e7 100644 --- a/app/app.go +++ b/app/app.go @@ -97,11 +97,17 @@ import ( ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/spf13/cast" + ibctransfer "github.com/ojo-network/ojo/app/ibctransfer" + "github.com/ojo-network/ojo/util/genmap" "github.com/ojo-network/ojo/x/oracle" oraclekeeper "github.com/ojo-network/ojo/x/oracle/keeper" oracletypes "github.com/ojo-network/ojo/x/oracle/types" + "github.com/ojo-network/ojo/x/gmp" + gmpkeeper "github.com/ojo-network/ojo/x/gmp/keeper" + gmptypes "github.com/ojo-network/ojo/x/gmp/types" + "github.com/ojo-network/ojo/x/airdrop" airdropkeeper "github.com/ojo-network/ojo/x/airdrop/keeper" airdroptypes "github.com/ojo-network/ojo/x/airdrop/types" @@ -156,6 +162,7 @@ var ( transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, oracle.AppModuleBasic{}, + gmp.AppModuleBasic{}, airdrop.AppModuleBasic{}, consensus.AppModuleBasic{}, ibctm.AppModuleBasic{}, @@ -171,6 +178,7 @@ var ( govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, oracletypes.ModuleName: {authtypes.Minter}, + gmptypes.ModuleName: {authtypes.Minter}, airdroptypes.ModuleName: {authtypes.Minter}, } ) @@ -222,10 +230,11 @@ type App struct { ParamsKeeper paramskeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly EvidenceKeeper evidencekeeper.Keeper - TransferKeeper IBCTransferKeeper + TransferKeeper ibctransfer.Keeper FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper OracleKeeper oraclekeeper.Keeper + GmpKeeper gmpkeeper.Keeper AirdropKeeper airdropkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper @@ -275,7 +284,8 @@ func New( crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, - consensusparamtypes.StoreKey, group.StoreKey, oracletypes.StoreKey, airdroptypes.StoreKey, + consensusparamtypes.StoreKey, group.StoreKey, oracletypes.StoreKey, gmptypes.StoreKey, + airdroptypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -422,6 +432,14 @@ func New( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.GmpKeeper = gmpkeeper.NewKeeper( + appCodec, + keys[gmptypes.ModuleName], + app.OracleKeeper, + app.TransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + app.AirdropKeeper = airdropkeeper.NewKeeper( appCodec, keys[airdroptypes.ModuleName], @@ -455,7 +473,7 @@ func New( ) // Create Transfer Keepers - app.TransferKeeper = NewIBCTransferKeeper( + app.TransferKeeper = ibctransfer.NewKeeper( appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), @@ -545,6 +563,7 @@ func New( params.NewAppModule(app.ParamsKeeper), transferModule, oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), + gmp.NewAppModule(appCodec, app.GmpKeeper, app.OracleKeeper), airdrop.NewAppModule(appCodec, app.AirdropKeeper, app.AccountKeeper, app.BankKeeper), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), ) @@ -575,6 +594,7 @@ func New( paramstypes.ModuleName, vestingtypes.ModuleName, oracletypes.ModuleName, + gmptypes.ModuleName, airdroptypes.ModuleName, consensusparamtypes.ModuleName, ) @@ -600,6 +620,7 @@ func New( upgradetypes.ModuleName, vestingtypes.ModuleName, oracletypes.ModuleName, + gmptypes.ModuleName, airdroptypes.ModuleName, consensusparamtypes.ModuleName, ) @@ -615,7 +636,7 @@ func New( minttypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, ibctransfertypes.ModuleName, ibcexported.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, - oracletypes.ModuleName, airdroptypes.ModuleName, consensusparamtypes.ModuleName, + oracletypes.ModuleName, gmptypes.ModuleName, airdroptypes.ModuleName, consensusparamtypes.ModuleName, } app.mm.SetOrderInitGenesis(genesisModuleOrder...) app.mm.SetOrderExportGenesis(genesisModuleOrder...) diff --git a/app/ibctransfer.go b/app/ibctransfer/ibctransfer.go similarity index 83% rename from app/ibctransfer.go rename to app/ibctransfer/ibctransfer.go index 3bb09512..e8e4e283 100644 --- a/app/ibctransfer.go +++ b/app/ibctransfer/ibctransfer.go @@ -1,4 +1,4 @@ -package app +package ibctransfer import ( "context" @@ -12,7 +12,7 @@ import ( "github.com/cosmos/ibc-go/v7/modules/core/exported" ) -type IBCTransferKeeper struct { +type Keeper struct { ibctransferkeeper.Keeper storeKey storetypes.StoreKey @@ -27,17 +27,17 @@ type IBCTransferKeeper struct { scopedKeeper exported.ScopedKeeper } -func (k IBCTransferKeeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { - // TODO: Custom IBC Transfer logic +func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { + // TODO: Custom IBC validation logic return k.Keeper.Transfer(goCtx, msg) } -// NewIBCTransferKeeper creates a new IBC transfer Keeper instance -func NewIBCTransferKeeper( +// 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, -) IBCTransferKeeper { +) 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") @@ -48,7 +48,7 @@ func NewIBCTransferKeeper( paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) } - return IBCTransferKeeper{ + return Keeper{ cdc: cdc, storeKey: key, paramSpace: paramSpace, diff --git a/app/modules.go b/app/modules.go index 70c397fd..9362737e 100644 --- a/app/modules.go +++ b/app/modules.go @@ -20,6 +20,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + "github.com/ojo-network/ojo/app/ibctransfer" appparams "github.com/ojo-network/ojo/app/params" ) @@ -136,11 +137,11 @@ func (SlashingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { // so that we can use a custom Keeper. type IBCTransferModule struct { transfer.AppModuleBasic - keeper IBCTransferKeeper + keeper ibctransfer.Keeper } // NewIBCTransferModule creates a new 20-transfer module -func NewIBCTransferModule(k IBCTransferKeeper) IBCTransferModule { +func NewIBCTransferModule(k ibctransfer.Keeper) IBCTransferModule { return IBCTransferModule{ keeper: k, } @@ -150,11 +151,11 @@ func NewIBCTransferModule(k IBCTransferKeeper) IBCTransferModule { // implements the ICS26 interface for transfer given the transfer keeper. type IBCAppModule struct { transfer.IBCModule - keeper IBCTransferKeeper + keeper ibctransfer.Keeper } // NewIBCAppModule creates a new IBCModule given the keeper -func NewIBCAppModule(k IBCTransferKeeper) IBCAppModule { +func NewIBCAppModule(k ibctransfer.Keeper) IBCAppModule { return IBCAppModule{ keeper: k, } diff --git a/go.mod b/go.mod index 97972d91..fa7175c7 100644 --- a/go.mod +++ b/go.mod @@ -15,11 +15,13 @@ require ( github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.2.1 + github.com/ethereum/go-ethereum v1.13.4 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.3 github.com/golangci/golangci-lint v1.55.0 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 github.com/mgechev/revive v1.3.4 github.com/ory/dockertest/v3 v3.10.0 github.com/rs/zerolog v1.30.0 @@ -27,7 +29,7 @@ require ( github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.8.4 - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d + google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 google.golang.org/grpc v1.59.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools/v3 v3.5.1 @@ -37,10 +39,10 @@ require ( require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - cloud.google.com/go v0.110.7 // indirect - cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go v0.110.9 // indirect + cloud.google.com/go/compute v1.23.2 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.1 // indirect + cloud.google.com/go/iam v1.1.4 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/core v0.6.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect @@ -59,7 +61,7 @@ require ( github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect - github.com/Microsoft/go-winio v0.6.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect github.com/alecthomas/go-check-sumtype v0.1.3 // indirect @@ -113,7 +115,7 @@ require ( github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/docker/cli v23.0.1+incompatible // indirect - github.com/docker/docker v23.0.3+incompatible // indirect + github.com/docker/docker v24.0.5+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -127,6 +129,7 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/getsentry/sentry-go v0.23.0 // indirect + github.com/ghodss/yaml v1.0.0 // indirect github.com/ghostiam/protogetter v0.2.3 // indirect github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-kit/kit v0.12.0 // indirect @@ -147,7 +150,7 @@ require ( github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/snappy v0.0.4 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect @@ -158,13 +161,13 @@ require ( github.com/golangci/revgrep v0.5.0 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.3.1 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.11.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect @@ -187,6 +190,7 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect + github.com/holiman/uint256 v1.2.3 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect @@ -221,7 +225,7 @@ require ( github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.10 // indirect + github.com/mattn/go-runewidth v0.0.13 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 // indirect @@ -313,21 +317,21 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.11.0 // indirect + golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.126.0 // indirect + google.golang.org/api v0.128.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index e47c8661..db24f050 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= -cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.110.9 h1:e7ITSqGFFk4rbz/JFIqZh3G4VEHguhAL4BQcFlWtU68= +cloud.google.com/go v0.110.9/go.mod h1:rpxevX/0Lqvlbc88b7Sc1SPNdyK1riNBTUU6JXhYNpM= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -77,8 +77,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.2 h1:nWEMDhgbBkBJjfpVySqU4jgWdc22PLR0o4vEexZHers= +cloud.google.com/go/compute v1.23.2/go.mod h1:JJ0atRC0J/oWYiiVBmsSsrRnh92DhZPG4hFDcR04Rns= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -118,8 +118,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.4 h1:K6n/GZHFTtEoKT5aUG3l9diPi0VduZNQ1PfdnpkkIFk= +cloud.google.com/go/iam v1.1.4/go.mod h1:l/rg8l1AaA+VFMho/HYx2Vv6xinPSLMF8qfhRPIZ0L8= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -250,8 +250,8 @@ github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0/go.mod h1:rZLTje5A9kFBe0 github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= -github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -526,8 +526,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/cli v23.0.1+incompatible h1:LRyWITpGzl2C9e9uGxzisptnxAn1zfZKXy13Ul2Q5oM= github.com/docker/cli v23.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v23.0.3+incompatible h1:9GhVsShNWz1hO//9BNg/dpMnZW25KydO4wtVxWAIbho= -github.com/docker/docker v23.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= +github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -560,6 +560,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= +github.com/ethereum/go-ethereum v1.13.4 h1:25HJnaWVg3q1O7Z62LaaI6S9wVq8QCw3K88g8wEzrcM= +github.com/ethereum/go-ethereum v1.13.4/go.mod h1:I0U5VewuuTzvBtVzKo7b3hJzDhXOUtn9mJW7SsIPB0Q= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -591,6 +593,7 @@ github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghostiam/protogetter v0.2.3 h1:qdv2pzo3BpLqezwqfGDLZ+nHEYmc5bUpIdsMbBVwMjw= github.com/ghostiam/protogetter v0.2.3/go.mod h1:KmNLOsy1v04hKbvZs8EfGI1fk39AgTdRDxWNYPfXVc4= @@ -664,7 +667,7 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -720,8 +723,9 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= @@ -762,8 +766,9 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -790,8 +795,8 @@ github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= @@ -807,8 +812,8 @@ github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= +github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -818,8 +823,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -857,6 +862,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -913,6 +920,8 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= +github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= @@ -1082,8 +1091,8 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= -github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -1292,7 +1301,6 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqn github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= @@ -1585,8 +1593,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= @@ -1722,8 +1730,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1886,8 +1894,8 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2041,8 +2049,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= +google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2163,12 +2171,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 h1:I6WNifs6pF9tNdSob2W24JtyxIYjzFB9qDlpUC76q+U= +google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= +google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= +google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= diff --git a/proto/ojo/gmp/v1/genesis.proto b/proto/ojo/gmp/v1/genesis.proto new file mode 100644 index 00000000..1c69243f --- /dev/null +++ b/proto/ojo/gmp/v1/genesis.proto @@ -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 ]; +} diff --git a/proto/ojo/gmp/v1/gmp.proto b/proto/ojo/gmp/v1/gmp.proto new file mode 100644 index 00000000..0cb8aaf5 --- /dev/null +++ b/proto/ojo/gmp/v1/gmp.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; +package ojo.gmp.v1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.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; +} + +// ExchangeRates defines the ExchangeRates to relay +message ExchangeRate { + // symbol_denom is the symbol of the exchange rate (e.x. "BTC") + string symbol_denom = 1; + + // exponent is the exponent of the asset + uint32 exponent = 2; + + // rate is the conversion rate of the asset + string rate = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// 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; +} diff --git a/proto/ojo/gmp/v1/query.proto b/proto/ojo/gmp/v1/query.proto new file mode 100644 index 00000000..a6c878c6 --- /dev/null +++ b/proto/ojo/gmp/v1/query.proto @@ -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]; +} diff --git a/proto/ojo/gmp/v1/tx.proto b/proto/ojo/gmp/v1/tx.proto new file mode 100644 index 00000000..58785bcb --- /dev/null +++ b/proto/ojo/gmp/v1/tx.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package ojo.gmp.v1; + +import "gogoproto/gogo.proto"; +import "ojo/gmp/v1/gmp.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/ojo-network/ojo/x/gmp/types"; + +// Msg defines the airdrop Msg service. +service Msg { + // SetParams sets the parameters for the airdrop module. + rpc SetParams(MsgSetParams) returns (MsgSetParamsResponse); + + // Relay relays Ojo data via GMP. + rpc Relay(MsgRelay) returns (MsgRelayResponse); +} + +// MsgSetParams defines the SetParams message type. +message MsgSetParams { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "authority"; + + // 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 airdrop parameters to update. + Params params = 2; +} + +// MsgSetParamsResponse defines the SetParams response type. +message MsgSetParamsResponse {} + +message MsgRelay { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "relayer"; + + // authority is the address that signs the message. + string relayer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // destination_chain defines the chain which this will be relayed to. + string destination_chain = 2; + + // destination_address defines the destination contract address to call. + string destination_address = 3; + + // denoms defines the denoms that the user wants to relay via GMP. + repeated string denoms = 4; + + // token determines the IBC token that the user wants to relay via GMP. + cosmos.base.v1beta1.Coin token = 5 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +message MsgRelayResponse {} diff --git a/tools/tools.go b/tools/tools.go index ed7e85ad..d07d4264 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,14 +1,14 @@ //go:build tools -// +build tools -// This file uses the recommended method for tracking developer tools in a Go -// module. -// -// REF: https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module package tools import ( + _ "github.com/cosmos/gogoproto/protoc-gen-gocosmos" + _ "github.com/golang/protobuf/protoc-gen-go" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" + _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" + _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" _ "github.com/mgechev/revive" _ "mvdan.cc/gofumpt" ) diff --git a/x/gmp/abci.go b/x/gmp/abci.go new file mode 100644 index 00000000..da33993b --- /dev/null +++ b/x/gmp/abci.go @@ -0,0 +1,12 @@ +package gmp + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ojo-network/ojo/x/gmp/keeper" +) + +// EndBlocker is called at the end of every block +func EndBlocker(_ sdk.Context, _ keeper.Keeper) error { + return nil +} diff --git a/x/gmp/client/cli/query.go b/x/gmp/client/cli/query.go new file mode 100644 index 00000000..46e4b46e --- /dev/null +++ b/x/gmp/client/cli/query.go @@ -0,0 +1,50 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/ojo-network/ojo/util/cli" + "github.com/ojo-network/ojo/x/gmp/types" + "github.com/spf13/cobra" +) + +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + GetCmdQueryParams(), + ) + + return cmd +} + +// GetCmdQueryParams implements the query params command. +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Args: cobra.NoArgs, + Short: "Query the current GMP params", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.ParamsRequest{}) + return cli.PrintOrErr(res, err, clientCtx) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/gmp/client/cli/tx.go b/x/gmp/client/cli/tx.go new file mode 100644 index 00000000..ceff7d3a --- /dev/null +++ b/x/gmp/client/cli/tx.go @@ -0,0 +1,77 @@ +package cli + +import ( + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + "github.com/ojo-network/ojo/x/gmp/types" + "github.com/spf13/cobra" +) + +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Transaction commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + GetCmdRelay(), + ) + + return cmd +} + +func GetCmdRelay() *cobra.Command { + cmd := &cobra.Command{ + Use: "relay [destination-chain] [destination-address] [amount] [comma-separated list of tokens]", + Args: cobra.ExactArgs(4), + Short: "Relay via axelar GMP to an address", + RunE: func(cmd *cobra.Command, args []string) error { + if err := cmd.Flags().Set(flags.FlagFrom, args[0]); err != nil { + return err + } + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + if args[0] == "" { + return fmt.Errorf("destination-chain cannot be empty") + } + if args[1] == "" { + return fmt.Errorf("destination-address cannot be empty") + } + if args[3] == "" { + return fmt.Errorf("denoms cannot be empty") + } + + // Normalize the coin denom + coin, err := sdk.ParseCoinNormalized(args[2]) + if err != nil { + return err + } + if !strings.HasPrefix(coin.Denom, "ibc/") { + denomTrace := ibctransfertypes.ParseDenomTrace(coin.Denom) + coin.Denom = denomTrace.IBCDenom() + } + + denoms := strings.Split(args[3], ",") + + msg := types.NewMsgRelay(clientCtx.GetFromAddress().String(), args[0], args[1], coin, denoms) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gmp/client/tests/cli_test.go b/x/gmp/client/tests/cli_test.go new file mode 100644 index 00000000..99b50942 --- /dev/null +++ b/x/gmp/client/tests/cli_test.go @@ -0,0 +1,23 @@ +//go:build norace +// +build norace + +package tests + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + app "github.com/ojo-network/ojo/app" +) + +func TestIntegrationTestSuite(t *testing.T) { + cfg := app.IntegrationTestNetworkConfig() + cfg.NumValidators = 2 + cfg.Mnemonics = []string{ + "empower ridge mystery shrimp predict alarm swear brick across funny vendor essay antique vote place lava proof gaze crush head east arch twin lady", + "clean target advice dirt onion correct original vibrant actor upon waste eternal color barely shrimp aspect fall material wait repeat bench demise length seven", + } + + suite.Run(t, NewIntegrationTestSuite(cfg)) +} diff --git a/x/gmp/client/tests/suite.go b/x/gmp/client/tests/suite.go new file mode 100644 index 00000000..c002b4ef --- /dev/null +++ b/x/gmp/client/tests/suite.go @@ -0,0 +1,84 @@ +package tests + +import ( + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/suite" + + "github.com/ojo-network/ojo/x/gmp/client/cli" +) + +type IntegrationTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { + return &IntegrationTestSuite{cfg: cfg} +} + +func (s *IntegrationTestSuite) SetupSuite() { + t := s.T() + t.Log("setting up integration test suite") + + var err error + s.network, err = network.New(t, t.TempDir(), s.cfg) + s.Require().NoError(err) + + _, err = s.network.WaitForHeight(1) + s.Require().NoError(err) +} + +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + + s.network.Cleanup() +} + +// TODO: Fix tx raw log not having "no gmp account found" message in it +func (s *IntegrationTestSuite) TestRelayGmp() { + s.T().Skip() + + val := s.network.Validators[0] + + testCases := []struct { + name string + args []string + expectErr bool + expectedCode uint32 + respType proto.Message + }{ + { + name: "invalid from address", + args: []string{ + "foo", + s.network.Validators[1].Address.String(), + }, + expectErr: true, + respType: &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdRelay(), tc.args) + if tc.expectErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + + txResp := tc.respType.(*sdk.TxResponse) + s.Require().Contains(txResp.RawLog, "unable to relay to gmp") + } + }) + } +} diff --git a/x/gmp/genesis.go b/x/gmp/genesis.go new file mode 100644 index 00000000..ca9753f0 --- /dev/null +++ b/x/gmp/genesis.go @@ -0,0 +1,21 @@ +package gmp + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ojo-network/ojo/x/gmp/keeper" + "github.com/ojo-network/ojo/x/gmp/types" +) + +// InitGenesis initializes the x/gmp module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, genState types.GenesisState) { + keeper.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the x/gmp module's exported genesis. +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { + genesisState := types.DefaultGenesisState() + genesisState.Params = keeper.GetParams(ctx) + return genesisState +} diff --git a/x/gmp/genesis_test.go b/x/gmp/genesis_test.go new file mode 100644 index 00000000..3e78f4f0 --- /dev/null +++ b/x/gmp/genesis_test.go @@ -0,0 +1,57 @@ +package gmp_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "gotest.tools/v3/assert" + + "github.com/stretchr/testify/suite" + + ojoapp "github.com/ojo-network/ojo/app" + "github.com/ojo-network/ojo/tests/integration" + "github.com/ojo-network/ojo/x/gmp" + "github.com/ojo-network/ojo/x/gmp/types" +) + +type IntegrationTestSuite struct { + suite.Suite + + ctx sdk.Context + app *ojoapp.App + keys []integration.TestValidatorKey +} + +func TestIntegrationTestSuite(t *testing.T) { + suite.Run(t, new(IntegrationTestSuite)) +} + +func (s *IntegrationTestSuite) SetupTest() { + s.app, s.ctx, s.keys = integration.SetupAppWithContext(s.T()) +} + +func (s *IntegrationTestSuite) TestGenesis_InitGenesis() { + keeper, ctx := s.app.GmpKeeper, s.ctx + + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + } + + s.Assertions.NotPanics(func() { gmp.InitGenesis(ctx, keeper, genesisState) }) +} + +func (s *IntegrationTestSuite) TestGenesis_ExportGenesis() { + keeper, ctx := s.app.GmpKeeper, s.ctx + + params := types.DefaultParams() + + genesisState := types.GenesisState{ + Params: params, + } + + gmp.InitGenesis(ctx, keeper, genesisState) + + result := gmp.ExportGenesis(ctx, keeper) + + assert.DeepEqual(s.T(), params, result.Params) +} diff --git a/x/gmp/keeper/grpc_query.go b/x/gmp/keeper/grpc_query.go new file mode 100644 index 00000000..cd64d7db --- /dev/null +++ b/x/gmp/keeper/grpc_query.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ojo-network/ojo/x/gmp/types" +) + +var _ types.QueryServer = querier{} + +// Querier implements a QueryServer for the x/gmp module. +type querier struct { + Keeper +} + +// NewQuerier returns an implementation of the gmp QueryServer interface +// for the provided Keeper. +func NewQuerier(keeper Keeper) types.QueryServer { + return &querier{Keeper: keeper} +} + +// Params queries params of x/gmp module. +func (q querier) Params( + goCtx context.Context, + _ *types.ParamsRequest, +) (*types.ParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + params := q.GetParams(ctx) + return &types.ParamsResponse{Params: params}, nil +} diff --git a/x/gmp/keeper/helper_test.go b/x/gmp/keeper/helper_test.go new file mode 100644 index 00000000..9c862196 --- /dev/null +++ b/x/gmp/keeper/helper_test.go @@ -0,0 +1,17 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ojo-network/ojo/client/tx" +) + +// CreateAccount creates a new account with a random mnemonic and returns the address +func CreateAccount(s *IntegrationTestSuite) sdk.AccAddress { + mnemonic, err := tx.CreateMnemonic() + s.Require().NoError(err) + account, _, err := tx.CreateAccountFromMnemonic("test", mnemonic) + s.Require().NoError(err) + address, err := account.GetAddress() + s.Require().NoError(err) + return address +} diff --git a/x/gmp/keeper/keeper.go b/x/gmp/keeper/keeper.go new file mode 100644 index 00000000..e761a500 --- /dev/null +++ b/x/gmp/keeper/keeper.go @@ -0,0 +1,35 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/ojo-network/ojo/app/ibctransfer" + "github.com/ojo-network/ojo/x/gmp/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + oracleKeeper types.OracleKeeper + ibcKeeper ibctransfer.Keeper + // the address capable of executing a MsgSetParams message. Typically, this + // should be the x/gov module account. + authority string +} + +// NewKeeper constructs a new keeper for gmp module. +func NewKeeper( + cdc codec.BinaryCodec, + storeKey storetypes.StoreKey, + oracleKeeper types.OracleKeeper, + ibcKeeper ibctransfer.Keeper, + authority string, +) Keeper { + return Keeper{ + cdc: cdc, + storeKey: storeKey, + authority: authority, + oracleKeeper: oracleKeeper, + ibcKeeper: ibcKeeper, + } +} diff --git a/x/gmp/keeper/keeper_suite_test.go b/x/gmp/keeper/keeper_suite_test.go new file mode 100644 index 00000000..1c0bc288 --- /dev/null +++ b/x/gmp/keeper/keeper_suite_test.go @@ -0,0 +1,37 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + + ojoapp "github.com/ojo-network/ojo/app" + appparams "github.com/ojo-network/ojo/app/params" + "github.com/ojo-network/ojo/tests/integration" + "github.com/ojo-network/ojo/x/gmp/keeper" + "github.com/ojo-network/ojo/x/gmp/types" +) + +const ( + displayDenom string = appparams.DisplayDenom + bondDenom string = appparams.BondDenom +) + +type IntegrationTestSuite struct { + suite.Suite + + ctx sdk.Context + app *ojoapp.App + keys []integration.TestValidatorKey + msgServer types.MsgServer +} + +func TestIntegrationTestSuite(t *testing.T) { + suite.Run(t, new(IntegrationTestSuite)) +} + +func (s *IntegrationTestSuite) SetupSuite() { + s.app, s.ctx, s.keys = integration.SetupAppWithContext(s.T()) + s.msgServer = keeper.NewMsgServerImpl(s.app.GmpKeeper) +} diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go new file mode 100644 index 00000000..494cc255 --- /dev/null +++ b/x/gmp/keeper/msg_server.go @@ -0,0 +1,116 @@ +package keeper + +import ( + "context" + "time" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/accounts/abi" + + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + "github.com/ojo-network/ojo/x/gmp/types" +) + +type msgServer struct { + keeper Keeper +} + +// NewMsgServerImpl returns an implementation of the gmp MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{keeper: keeper} +} + +// SetParams implements MsgServer.SetParams method. +// It defines a method to update the x/gmp module parameters. +func (ms msgServer) SetParams(goCtx context.Context, msg *types.MsgSetParams) (*types.MsgSetParamsResponse, error) { + if ms.keeper.authority != msg.Authority { + err := errors.Wrapf( + govtypes.ErrInvalidSigner, + "invalid authority; expected %s, got %s", + ms.keeper.authority, + msg.Authority, + ) + return nil, err + } + + if err := msg.Params.Validate(); err != nil { + return nil, err + } + + ctx := sdk.UnwrapSDKContext(goCtx) + ms.keeper.SetParams(ctx, *msg.Params) + + return &types.MsgSetParamsResponse{}, nil +} + +// Relay implements MsgServer.Relay method. +// It defines a method to relay over GMP to recipient chains. +func (ms msgServer) Relay( + goCtx context.Context, + msg *types.MsgRelay, +) (*types.MsgRelayResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + params := ms.keeper.GetParams(ctx) + + // encode oracle data + rates := []types.ExchangeRate{} + for _, denom := range msg.Denoms { + rate, err := ms.keeper.oracleKeeper.GetExchangeRate(ctx, denom) + if err != nil { + return &types.MsgRelayResponse{}, err + } + exponent, err := ms.keeper.oracleKeeper.GetExponent(ctx, denom) + if err != nil { + return &types.MsgRelayResponse{}, err + } + + rates = append(rates, types.ExchangeRate{ + SymbolDenom: denom, + Exponent: exponent, + Rate: rate, + }) + } + exchangeRateType, err := abi.NewType("exchangeRate[]", "exchangeRate[]", nil) + if err != nil { + return nil, err + } + _, err = abi.Arguments{{Type: exchangeRateType}}.Pack(rates) + if err != nil { + return nil, err + } + + // package GMP + message := types.GmpMessage{ + DestinationChain: msg.DestinationChain, + DestinationAddress: msg.DestinationAddress, + Payload: "f", + Type: types.TypeGeneralMessage, + } + bz, err := message.Marshal() + if err != nil { + return nil, err + } + + // submit IBC transfer + transferMsg := ibctransfertypes.NewMsgTransfer( + ibctransfertypes.PortID, + params.GmpChannel, + msg.Token, + msg.Relayer, + params.GmpAddress, + clienttypes.ZeroHeight(), + uint64(ctx.BlockTime().Add(time.Duration(params.GmpTimeout)*time.Hour).UnixNano()), + string(bz), + ) + + _, err = ms.keeper.ibcKeeper.Transfer(ctx, transferMsg) + if err != nil { + return &types.MsgRelayResponse{}, err + } + + return &types.MsgRelayResponse{}, nil +} diff --git a/x/gmp/keeper/msg_server_test.go b/x/gmp/keeper/msg_server_test.go new file mode 100644 index 00000000..e6f955c0 --- /dev/null +++ b/x/gmp/keeper/msg_server_test.go @@ -0,0 +1,38 @@ +package keeper_test + +import ( + "github.com/ojo-network/ojo/x/gmp/types" +) + +func (s *IntegrationTestSuite) TestMsgServer_SetParams() { + gmpChannel := "channel-1" + gmpAddress := "axelar1dv4u5k73pzqrxlzujxg3qp8kvc3pje7jtdvu72npnt5zhq05ejcsn5qme5" + timeout := int64(1) + SetParams(s, gmpChannel, gmpAddress, timeout) + + params := types.DefaultParams() + + s.Require().Equal(params, s.app.GmpKeeper.GetParams(s.ctx)) +} + +// SetParams sets the gmp module params +func SetParams( + s *IntegrationTestSuite, + gmpAddress string, + gmpChannel string, + gmpTimeout int64, +) { + params := types.DefaultParams() + params.GmpAddress = gmpAddress + authority := s.app.GovKeeper.GetGovernanceAccount(s.ctx).GetAddress().String() + + msg := types.NewMsgSetParams( + params.GmpAddress, + params.GmpChannel, + params.GmpTimeout, + authority, + ) + + _, err := s.msgServer.SetParams(s.ctx, msg) + s.Require().NoError(err) +} diff --git a/x/gmp/keeper/params.go b/x/gmp/keeper/params.go new file mode 100644 index 00000000..a63d6dd4 --- /dev/null +++ b/x/gmp/keeper/params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ojo-network/ojo/x/gmp/types" +) + +// SetParams sets the gmp module's parameters. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + store := ctx.KVStore(k.storeKey) + store.Set(types.ParamsKey, k.cdc.MustMarshal(¶ms)) +} + +// GetParams gets the gmp module's parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + k.cdc.MustUnmarshal(bz, ¶ms) + return +} diff --git a/x/gmp/keeper/params_test.go b/x/gmp/keeper/params_test.go new file mode 100644 index 00000000..5fe327b9 --- /dev/null +++ b/x/gmp/keeper/params_test.go @@ -0,0 +1,21 @@ +package keeper_test + +import "github.com/ojo-network/ojo/x/gmp/types" + +func (s *IntegrationTestSuite) TestSetAndGetParams() { + app, ctx := s.app, s.ctx + + params := types.Params{ + GmpChannel: "channel-101", + GmpAddress: "gmpaddress", + GmpTimeout: int64(101), + } + + app.GmpKeeper.SetParams(ctx, params) + + params2 := app.GmpKeeper.GetParams(ctx) + + s.Require().Equal(params2.GmpAddress, params.GmpAddress) + s.Require().Equal(params2.GmpChannel, params.GmpChannel) + s.Require().Equal(params2.GmpTimeout, params.GmpTimeout) +} diff --git a/x/gmp/module.go b/x/gmp/module.go new file mode 100644 index 00000000..d6794741 --- /dev/null +++ b/x/gmp/module.go @@ -0,0 +1,178 @@ +package gmp + +import ( + "context" + "encoding/json" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + "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" + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/ojo-network/ojo/x/gmp/client/cli" + "github.com/ojo-network/ojo/x/gmp/keeper" + "github.com/ojo-network/ojo/x/gmp/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleSimulation = AppModule{} +) + +// AppModuleBasic implements the AppModuleBasic interface for the x/gmp module. +type AppModuleBasic struct { + cdc codec.Codec +} + +// RegisterLegacyAminoCodec registers the x/gmp module's types with a legacy +// Amino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the x/gmp module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) ConsensusVersion() uint64 { + return 1 +} + +// RegisterInterfaces registers the x/gmp module's interface types. +func (AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the x/gmp module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis performs genesis state validation for the x/gmp module. +func (AppModuleBasic) ValidateGenesis( + cdc codec.JSONCodec, + _ client.TxEncodingConfig, + bz json.RawMessage, +) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return nil +} + +// Deprecated: RegisterRESTRoutes performs a no-op. Querying is delegated to the +// gRPC service. +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the x/gmp +// 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 the x/gmp module's root tx command. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the x/gmp module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// AppModule implements the AppModule interface for the x/gmp module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + oracleKeeper types.OracleKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + oracleKeeper types.OracleKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + oracleKeeper: oracleKeeper, + } +} + +// Name returns the x/gmp module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// QuerierRoute returns the x/gmp module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// RegisterServices registers gRPC services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper)) +} + +// RegisterInvariants registers the x/gmp module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the x/gmp module's genesis initialization. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + + cdc.MustUnmarshalJSON(gs, &genState) + InitGenesis(ctx, am.keeper, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the x/gmp module's exported genesis state as raw +// JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// BeginBlock executes all ABCI BeginBlock logic respective to the x/gmp module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock is a no-op for the GMP module. +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} + +// GenerateGenesisState currently is a no-op. +func (AppModule) GenerateGenesisState(_ *module.SimulationState) {} + +// WeightedOperations currently is a no-op. +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { + return []simtypes.WeightedOperation{} +} + +// ProposalContents returns all the gmp content functions used to +// simulate governance proposals. +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{} +} + +// RegisterStoreDecoder currently is a no-op. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} diff --git a/x/gmp/types/codec.go b/x/gmp/types/codec.go new file mode 100644 index 00000000..49ed01cc --- /dev/null +++ b/x/gmp/types/codec.go @@ -0,0 +1,44 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +var ( + amino = codec.NewLegacyAmino() + + // ModuleCdc references the global x/gmp module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/staking and + // defined at the application level. + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +// RegisterLegacyAminoCodec registers the necessary x/gmp interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgRelay{}, "ojo/gmp/MsgRelay", nil) + cdc.RegisterConcrete(&MsgSetParams{}, "ojo/gmp/MsgSetParams", nil) +} + +// RegisterInterfaces registers the x/gmp interfaces types with the interface registry +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgRelay{}, + &MsgSetParams{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/gmp/types/errors.go b/x/gmp/types/errors.go new file mode 100644 index 00000000..0da30edf --- /dev/null +++ b/x/gmp/types/errors.go @@ -0,0 +1,5 @@ +package types + +import "cosmossdk.io/errors" + +var ErrNoPriceFound = errors.Register(ModuleName, 1, "no oracle price found") diff --git a/x/gmp/types/expected_keeper.go b/x/gmp/types/expected_keeper.go new file mode 100644 index 00000000..b87f80d2 --- /dev/null +++ b/x/gmp/types/expected_keeper.go @@ -0,0 +1,11 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// OracleKeeper defines the expected Oracle interface that is needed by the gmp module. +type OracleKeeper interface { + GetExchangeRate(ctx sdk.Context, symbol string) (sdk.Dec, error) + GetExponent(ctx sdk.Context, denom string) (uint32, error) +} diff --git a/x/gmp/types/genesis.go b/x/gmp/types/genesis.go new file mode 100644 index 00000000..ba181c25 --- /dev/null +++ b/x/gmp/types/genesis.go @@ -0,0 +1,15 @@ +package types + +func NewGenesisState( + params Params, +) *GenesisState { + return &GenesisState{ + Params: params, + } +} + +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} diff --git a/x/gmp/types/genesis.pb.go b/x/gmp/types/genesis.pb.go new file mode 100644 index 00000000..f945e703 --- /dev/null +++ b/x/gmp/types/genesis.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ojo/gmp/v1/genesis.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/gogoproto" + 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 represents the genesis state of the gmp module. +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_54f1650752d0661e, []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), "ojo.gmp.v1.GenesisState") +} + +func init() { proto.RegisterFile("ojo/gmp/v1/genesis.proto", fileDescriptor_54f1650752d0661e) } + +var fileDescriptor_54f1650752d0661e = []byte{ + // 197 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc8, 0xcf, 0xca, 0xd7, + 0x4f, 0xcf, 0x2d, 0xd0, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, + 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xca, 0xcf, 0xca, 0xd7, 0x4b, 0xcf, 0x2d, 0xd0, 0x2b, 0x33, + 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x0b, 0xeb, 0x83, 0x58, 0x10, 0x15, 0x52, 0x22, 0xc8, + 0x7a, 0x73, 0x0b, 0x20, 0xa2, 0x4a, 0x0e, 0x5c, 0x3c, 0xee, 0x10, 0x83, 0x82, 0x4b, 0x12, 0x4b, + 0x52, 0x85, 0x0c, 0xb8, 0xd8, 0x0a, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x25, 0x18, 0x15, 0x18, 0x35, + 0xb8, 0x8d, 0x84, 0xf4, 0x10, 0x06, 0xeb, 0x05, 0x80, 0x65, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, + 0x08, 0x82, 0xaa, 0x73, 0x72, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, + 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, + 0xb5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xfc, 0xac, 0x7c, 0xdd, + 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x10, 0x5b, 0xbf, 0x02, 0xec, 0x94, 0x92, 0xca, 0x82, + 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x53, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x40, 0x9f, 0x55, + 0x93, 0xde, 0x00, 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/gmp/types/gmp.pb.go b/x/gmp/types/gmp.pb.go new file mode 100644 index 00000000..e2f74ec6 --- /dev/null +++ b/x/gmp/types/gmp.pb.go @@ -0,0 +1,932 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ojo/gmp/v1/gmp.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/gogoproto" + 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 + +// Params defines the parameters for the gmp module. +type Params struct { + // The axelar address that we'll send IBC transactions to. + GmpAddress string `protobuf:"bytes,1,opt,name=gmp_address,json=gmpAddress,proto3" json:"gmp_address,omitempty"` + // The channel over which we communicate with axelar. + GmpChannel string `protobuf:"bytes,2,opt,name=gmp_channel,json=gmpChannel,proto3" json:"gmp_channel,omitempty"` + // The amount of time we'll wait for a response from axelar before timing out. + GmpTimeout int64 `protobuf:"varint,3,opt,name=gmp_timeout,json=gmpTimeout,proto3" json:"gmp_timeout,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_199820a7e9d7929f, []int{0} +} +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 + +// ExchangeRates defines the ExchangeRates to relay +type ExchangeRate struct { + // symbol_denom is the symbol of the exchange rate (e.x. "BTC") + SymbolDenom string `protobuf:"bytes,1,opt,name=symbol_denom,json=symbolDenom,proto3" json:"symbol_denom,omitempty"` + // exponent is the exponent of the asset + Exponent uint32 `protobuf:"varint,2,opt,name=exponent,proto3" json:"exponent,omitempty"` + // rate is the conversion rate of the asset + Rate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate"` +} + +func (m *ExchangeRate) Reset() { *m = ExchangeRate{} } +func (m *ExchangeRate) String() string { return proto.CompactTextString(m) } +func (*ExchangeRate) ProtoMessage() {} +func (*ExchangeRate) Descriptor() ([]byte, []int) { + return fileDescriptor_199820a7e9d7929f, []int{1} +} +func (m *ExchangeRate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExchangeRate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExchangeRate.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 *ExchangeRate) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExchangeRate.Merge(m, src) +} +func (m *ExchangeRate) XXX_Size() int { + return m.Size() +} +func (m *ExchangeRate) XXX_DiscardUnknown() { + xxx_messageInfo_ExchangeRate.DiscardUnknown(m) +} + +var xxx_messageInfo_ExchangeRate proto.InternalMessageInfo + +// 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 +type GmpMessage struct { + // destination_chain is the destination chain of the message + DestinationChain string `protobuf:"bytes,1,opt,name=destination_chain,json=destinationChain,proto3" json:"destination_chain,omitempty"` + // destination_address is the destination address of the message + DestinationAddress string `protobuf:"bytes,2,opt,name=destination_address,json=destinationAddress,proto3" json:"destination_address,omitempty"` + // payload is the encoded payload of the message (exchange rates) + Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` + // type is an enum that specifies the type of message + Type int64 `protobuf:"varint,4,opt,name=type,proto3" json:"type,omitempty"` +} + +func (m *GmpMessage) Reset() { *m = GmpMessage{} } +func (m *GmpMessage) String() string { return proto.CompactTextString(m) } +func (*GmpMessage) ProtoMessage() {} +func (*GmpMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_199820a7e9d7929f, []int{2} +} +func (m *GmpMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GmpMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GmpMessage.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 *GmpMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_GmpMessage.Merge(m, src) +} +func (m *GmpMessage) XXX_Size() int { + return m.Size() +} +func (m *GmpMessage) XXX_DiscardUnknown() { + xxx_messageInfo_GmpMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_GmpMessage proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "ojo.gmp.v1.Params") + proto.RegisterType((*ExchangeRate)(nil), "ojo.gmp.v1.ExchangeRate") + proto.RegisterType((*GmpMessage)(nil), "ojo.gmp.v1.GmpMessage") +} + +func init() { proto.RegisterFile("ojo/gmp/v1/gmp.proto", fileDescriptor_199820a7e9d7929f) } + +var fileDescriptor_199820a7e9d7929f = []byte{ + // 388 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x52, 0xc1, 0xae, 0xd2, 0x40, + 0x14, 0xed, 0xf8, 0xc8, 0xd3, 0x37, 0x0f, 0x13, 0x1d, 0x59, 0x54, 0x16, 0x05, 0x59, 0x18, 0x12, + 0x43, 0x1b, 0xe2, 0x17, 0x08, 0x18, 0x57, 0x26, 0xa6, 0x71, 0xe5, 0x86, 0x0c, 0xed, 0x64, 0x28, + 0x30, 0x73, 0x27, 0x9d, 0x01, 0xe1, 0x2f, 0x74, 0xe7, 0x27, 0xb1, 0x64, 0x69, 0x5c, 0x10, 0x85, + 0x1f, 0x31, 0x33, 0xd3, 0x92, 0xae, 0xee, 0xbd, 0xe7, 0x9c, 0xf6, 0xde, 0x73, 0x5a, 0xdc, 0x81, + 0x15, 0x24, 0x5c, 0xa8, 0x64, 0x37, 0xb6, 0x25, 0x56, 0x25, 0x18, 0x20, 0x18, 0x56, 0x10, 0xdb, + 0x71, 0x37, 0xee, 0x76, 0x38, 0x70, 0x70, 0x70, 0x62, 0x3b, 0xaf, 0xe8, 0xbe, 0xce, 0x40, 0x0b, + 0xd0, 0x73, 0x4f, 0xf8, 0xc1, 0x53, 0x83, 0x35, 0xbe, 0xff, 0x42, 0x4b, 0x2a, 0x34, 0xe9, 0xe1, + 0x47, 0x2e, 0xd4, 0x9c, 0xe6, 0x79, 0xc9, 0xb4, 0x0e, 0x51, 0x1f, 0x0d, 0x1f, 0x52, 0xcc, 0x85, + 0xfa, 0xe0, 0x91, 0x5a, 0x90, 0x2d, 0xa9, 0x94, 0x6c, 0x13, 0x3e, 0xb9, 0x09, 0xa6, 0x1e, 0xa9, + 0x05, 0xa6, 0x10, 0x0c, 0xb6, 0x26, 0xbc, 0xeb, 0xa3, 0xe1, 0x9d, 0x13, 0x7c, 0xf5, 0xc8, 0xe0, + 0x27, 0xc2, 0xed, 0x8f, 0x7b, 0xfb, 0x02, 0xce, 0x52, 0x6a, 0x18, 0x79, 0x83, 0xdb, 0xfa, 0x20, + 0x16, 0xb0, 0x99, 0xe7, 0x4c, 0x82, 0xa8, 0x96, 0x3e, 0x7a, 0x6c, 0x66, 0x21, 0xd2, 0xc5, 0xcf, + 0xd8, 0x5e, 0x81, 0x64, 0xd2, 0xb8, 0x95, 0xcf, 0xd3, 0xdb, 0x4c, 0x26, 0xb8, 0x55, 0x52, 0xc3, + 0xdc, 0xa6, 0x87, 0x49, 0x7c, 0x3c, 0xf7, 0x82, 0x3f, 0xe7, 0xde, 0x5b, 0x5e, 0x98, 0xe5, 0x76, + 0x11, 0x67, 0x20, 0x2a, 0xaf, 0x55, 0x19, 0xe9, 0x7c, 0x9d, 0x98, 0x83, 0x62, 0x3a, 0x9e, 0xb1, + 0x2c, 0x75, 0xcf, 0x0e, 0x7e, 0x21, 0x8c, 0x3f, 0x09, 0xf5, 0x99, 0x69, 0x4d, 0x39, 0x23, 0xef, + 0xf0, 0xcb, 0x9c, 0x69, 0x53, 0x48, 0x6a, 0x0a, 0x90, 0xd6, 0x6c, 0x21, 0xab, 0xb3, 0x5e, 0x34, + 0x88, 0xa9, 0xc5, 0x49, 0x82, 0x5f, 0x35, 0xc5, 0x75, 0x74, 0x3e, 0x19, 0xd2, 0xa0, 0xea, 0x08, + 0x43, 0xfc, 0x54, 0xd1, 0xc3, 0x06, 0x68, 0xee, 0x6e, 0x6e, 0xa7, 0xf5, 0x48, 0x08, 0x6e, 0xd9, + 0xcb, 0xc2, 0x96, 0x0b, 0xcd, 0xf5, 0x93, 0xd9, 0xf1, 0x5f, 0x14, 0x1c, 0x2f, 0x11, 0x3a, 0x5d, + 0x22, 0xf4, 0xf7, 0x12, 0xa1, 0x1f, 0xd7, 0x28, 0x38, 0x5d, 0xa3, 0xe0, 0xf7, 0x35, 0x0a, 0xbe, + 0x35, 0x6d, 0xc2, 0x0a, 0x46, 0x92, 0x99, 0xef, 0x50, 0xae, 0x6d, 0x9f, 0xec, 0xdd, 0x5f, 0xe2, + 0xac, 0x2e, 0xee, 0xdd, 0x87, 0x7e, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xcc, 0x18, 0xac, + 0x3d, 0x02, 0x00, 0x00, +} + +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.GmpTimeout != 0 { + i = encodeVarintGmp(dAtA, i, uint64(m.GmpTimeout)) + i-- + dAtA[i] = 0x18 + } + if len(m.GmpChannel) > 0 { + i -= len(m.GmpChannel) + copy(dAtA[i:], m.GmpChannel) + i = encodeVarintGmp(dAtA, i, uint64(len(m.GmpChannel))) + i-- + dAtA[i] = 0x12 + } + if len(m.GmpAddress) > 0 { + i -= len(m.GmpAddress) + copy(dAtA[i:], m.GmpAddress) + i = encodeVarintGmp(dAtA, i, uint64(len(m.GmpAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ExchangeRate) 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 *ExchangeRate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExchangeRate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Rate.Size() + i -= size + if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGmp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.Exponent != 0 { + i = encodeVarintGmp(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x10 + } + if len(m.SymbolDenom) > 0 { + i -= len(m.SymbolDenom) + copy(dAtA[i:], m.SymbolDenom) + i = encodeVarintGmp(dAtA, i, uint64(len(m.SymbolDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GmpMessage) 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 *GmpMessage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GmpMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Type != 0 { + i = encodeVarintGmp(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x20 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintGmp(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x1a + } + if len(m.DestinationAddress) > 0 { + i -= len(m.DestinationAddress) + copy(dAtA[i:], m.DestinationAddress) + i = encodeVarintGmp(dAtA, i, uint64(len(m.DestinationAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DestinationChain) > 0 { + i -= len(m.DestinationChain) + copy(dAtA[i:], m.DestinationChain) + i = encodeVarintGmp(dAtA, i, uint64(len(m.DestinationChain))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGmp(dAtA []byte, offset int, v uint64) int { + offset -= sovGmp(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GmpAddress) + if l > 0 { + n += 1 + l + sovGmp(uint64(l)) + } + l = len(m.GmpChannel) + if l > 0 { + n += 1 + l + sovGmp(uint64(l)) + } + if m.GmpTimeout != 0 { + n += 1 + sovGmp(uint64(m.GmpTimeout)) + } + return n +} + +func (m *ExchangeRate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SymbolDenom) + if l > 0 { + n += 1 + l + sovGmp(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovGmp(uint64(m.Exponent)) + } + l = m.Rate.Size() + n += 1 + l + sovGmp(uint64(l)) + return n +} + +func (m *GmpMessage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DestinationChain) + if l > 0 { + n += 1 + l + sovGmp(uint64(l)) + } + l = len(m.DestinationAddress) + if l > 0 { + n += 1 + l + sovGmp(uint64(l)) + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovGmp(uint64(l)) + } + if m.Type != 0 { + n += 1 + sovGmp(uint64(m.Type)) + } + return n +} + +func sovGmp(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGmp(x uint64) (n int) { + return sovGmp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +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 ErrIntOverflowGmp + } + 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GmpAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + 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 ErrInvalidLengthGmp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGmp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GmpAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GmpChannel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + 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 ErrInvalidLengthGmp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGmp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GmpChannel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GmpTimeout", wireType) + } + m.GmpTimeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GmpTimeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGmp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGmp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ExchangeRate) 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 ErrIntOverflowGmp + } + 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: ExchangeRate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExchangeRate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SymbolDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + 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 ErrInvalidLengthGmp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGmp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SymbolDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + } + m.Exponent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exponent |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + 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 ErrInvalidLengthGmp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGmp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGmp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGmp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GmpMessage) 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 ErrIntOverflowGmp + } + 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: GmpMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GmpMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationChain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + 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 ErrInvalidLengthGmp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGmp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationChain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + 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 ErrInvalidLengthGmp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGmp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGmp + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGmp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGmp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGmp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGmp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGmp(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, ErrIntOverflowGmp + } + 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, ErrIntOverflowGmp + } + 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, ErrIntOverflowGmp + } + 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, ErrInvalidLengthGmp + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGmp + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGmp + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGmp = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGmp = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGmp = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gmp/types/gmp_message_types.go b/x/gmp/types/gmp_message_types.go new file mode 100644 index 00000000..cb61bc11 --- /dev/null +++ b/x/gmp/types/gmp_message_types.go @@ -0,0 +1,12 @@ +package types + +const ( + // TypeUnrecognized means coin type is unrecognized + TypeUnrecognized = iota + // TypeGeneralMessage is a pure message + TypeGeneralMessage + // TypeGeneralMessageWithToken is a general message with token + TypeGeneralMessageWithToken + // TypeSendToken is a direct token transfer + TypeSendToken +) diff --git a/x/gmp/types/keys.go b/x/gmp/types/keys.go new file mode 100644 index 00000000..9758809c --- /dev/null +++ b/x/gmp/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName is the name of the gmp module + ModuleName = "gmp" + + // StoreKey is the string store representation + StoreKey = ModuleName + + // RouterKey is the message route + RouterKey = ModuleName + + // QuerierRoute is the query router key for the gmp module + QuerierRoute = ModuleName +) + +// KVStore key prefixes +var ( + ParamsKey = []byte{0x01} +) diff --git a/x/gmp/types/msgs.go b/x/gmp/types/msgs.go new file mode 100644 index 00000000..72d8bd4a --- /dev/null +++ b/x/gmp/types/msgs.go @@ -0,0 +1,74 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ojo-network/ojo/util/checkers" +) + +var _ sdk.Msg = &MsgSetParams{} + +func NewMsgSetParams( + gmpAddress string, + gmpChannel string, + gmpTimeout int64, + govAddress string, +) *MsgSetParams { + params := &Params{ + GmpAddress: gmpAddress, + GmpChannel: gmpChannel, + GmpTimeout: gmpTimeout, + } + return &MsgSetParams{ + Params: params, + Authority: govAddress, + } +} + +// Type implements LegacyMsg interface +func (msg MsgSetParams) Type() string { return sdk.MsgTypeURL(&msg) } + +// GetSignBytes implements sdk.Msg +func (msg MsgSetParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners implements sdk.Msg +func (msg MsgSetParams) GetSigners() []sdk.AccAddress { + return checkers.Signers(msg.Authority) +} + +// ValidateBasic Implements sdk.Msg +func (msg MsgSetParams) ValidateBasic() error { + // TODO validate params + return nil +} + +func NewMsgRelay(relayer string, destinationChain string, destinationAddress string, token sdk.Coin, denoms []string) *MsgRelay { + return &MsgRelay{ + Relayer: relayer, + DestinationChain: destinationChain, + DestinationAddress: destinationAddress, + Token: token, + Denoms: denoms, + } +} + +// Type implements LegacyMsg interface +func (msg MsgRelay) Type() string { return sdk.MsgTypeURL(&msg) } + +// GetSignBytes implements sdk.Msg +func (msg MsgRelay) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners implements sdk.Msg +func (msg MsgRelay) GetSigners() []sdk.AccAddress { + return checkers.Signers(msg.Relayer) +} + +// ValidateBasic Implements sdk.Msg +func (msg MsgRelay) ValidateBasic() error { + // TODO validate relay msg + return nil +} diff --git a/x/gmp/types/params.go b/x/gmp/types/params.go new file mode 100644 index 00000000..9ec33f47 --- /dev/null +++ b/x/gmp/types/params.go @@ -0,0 +1,32 @@ +package types + +import ( + "fmt" +) + +var ( + DefaultGMPAddress = "axelar1dv4u5k73pzqrxlzujxg3qp8kvc3pje7jtdvu72npnt5zhq05ejcsn5qme5" + DefaultChannel = "channel-1" + DefaultTimeout = int64(1) +) + +func DefaultParams() Params { + return Params{ + GmpAddress: DefaultGMPAddress, + GmpChannel: DefaultChannel, + GmpTimeout: DefaultTimeout, + } +} + +func (p Params) Validate() error { + if p.GmpTimeout < 1 { + return fmt.Errorf("timeout can not be less than 1") + } + if p.GmpChannel == "" { + return fmt.Errorf("channel can not be empty") + } + if p.GmpAddress == "" { + return fmt.Errorf("address can not be empty") + } + return nil +} diff --git a/x/gmp/types/query.pb.go b/x/gmp/types/query.pb.go new file mode 100644 index 00000000..ee88ce0a --- /dev/null +++ b/x/gmp/types/query.pb.go @@ -0,0 +1,534 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ojo/gmp/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/gogoproto" + _ "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 + +// ParamsRequest is the request type for the Query/Params RPC method. +type ParamsRequest struct { +} + +func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } +func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } +func (*ParamsRequest) ProtoMessage() {} +func (*ParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c1c8ee4b8acdb1c3, []int{0} +} +func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParamsRequest.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 *ParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamsRequest.Merge(m, src) +} +func (m *ParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *ParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo + +// ParamsResponse is the response type for the Query/Params RPC method. +type ParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } +func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } +func (*ParamsResponse) ProtoMessage() {} +func (*ParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c1c8ee4b8acdb1c3, []int{1} +} +func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParamsResponse.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 *ParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamsResponse.Merge(m, src) +} +func (m *ParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *ParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo + +func (m *ParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*ParamsRequest)(nil), "ojo.gmp.v1.ParamsRequest") + proto.RegisterType((*ParamsResponse)(nil), "ojo.gmp.v1.ParamsResponse") +} + +func init() { proto.RegisterFile("ojo/gmp/v1/query.proto", fileDescriptor_c1c8ee4b8acdb1c3) } + +var fileDescriptor_c1c8ee4b8acdb1c3 = []byte{ + // 272 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcb, 0xcf, 0xca, 0xd7, + 0x4f, 0xcf, 0x2d, 0xd0, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xe2, 0xca, 0xcf, 0xca, 0xd7, 0x4b, 0xcf, 0x2d, 0xd0, 0x2b, 0x33, 0x94, 0x12, + 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x0b, 0xeb, 0x83, 0x58, 0x10, 0x15, 0x52, 0x32, 0xe9, 0xf9, 0xf9, + 0xe9, 0x39, 0xa9, 0xfa, 0x89, 0x05, 0x99, 0xfa, 0x89, 0x79, 0x79, 0xf9, 0x25, 0x89, 0x25, 0x99, + 0xf9, 0x79, 0xc5, 0x50, 0x59, 0x11, 0x24, 0x73, 0x41, 0xc6, 0x80, 0x45, 0x95, 0xf8, 0xb9, 0x78, + 0x03, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x9c, 0xb8, + 0xf8, 0x60, 0x02, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x42, 0x06, 0x5c, 0x6c, 0x05, 0x60, 0x11, + 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x21, 0x3d, 0x84, 0x4b, 0xf4, 0x20, 0x6a, 0x9d, 0x58, + 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xaa, 0x33, 0x4a, 0xe1, 0x62, 0x0d, 0x04, 0xb9, 0x5c, 0x28, + 0x9a, 0x8b, 0x0d, 0xa2, 0x40, 0x48, 0x12, 0x53, 0x13, 0xd4, 0x46, 0x29, 0x29, 0x6c, 0x52, 0x10, + 0xbb, 0x95, 0xa4, 0x9a, 0x2e, 0x3f, 0x99, 0xcc, 0x24, 0x22, 0x24, 0xa4, 0x8f, 0xe4, 0x7a, 0x88, + 0x2d, 0x4e, 0x0e, 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, 0xa5, 0x96, 0x9e, + 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0x0b, 0xd2, 0xa7, 0x9b, 0x97, 0x5a, 0x52, 0x9e, + 0x5f, 0x94, 0x0d, 0x36, 0xa3, 0x02, 0x6c, 0x4a, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, + 0x0c, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00, 0x59, 0x4c, 0x29, 0x73, 0x01, 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 queries all parameters. + Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { + out := new(ParamsResponse) + err := c.cc.Invoke(ctx, "/ojo.gmp.v1.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 queries all parameters. + Params(context.Context, *ParamsRequest) (*ParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, 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(ParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ojo.gmp.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ojo.gmp.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ojo/gmp/v1/query.proto", +} + +func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsResponse) 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 *ParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ParamsResponse) 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 *ParamsRequest) 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: ParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsRequest: 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 *ParamsResponse) 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: ParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsResponse: 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/gmp/types/query.pb.gw.go b/x/gmp/types/query.pb.gw.go new file mode 100644 index 00000000..bae570ba --- /dev/null +++ b/x/gmp/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: ojo/gmp/v1/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 ParamsRequest + 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 ParamsRequest + 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, 2, 3}, []string{"ojo", "gmp", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/gmp/types/tx.pb.go b/x/gmp/types/tx.pb.go new file mode 100644 index 00000000..f79186f3 --- /dev/null +++ b/x/gmp/types/tx.pb.go @@ -0,0 +1,1103 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ojo/gmp/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/gogoproto" + 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 + +// MsgSetParams defines the SetParams message type. +type MsgSetParams 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 airdrop parameters to update. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *MsgSetParams) Reset() { *m = MsgSetParams{} } +func (m *MsgSetParams) String() string { return proto.CompactTextString(m) } +func (*MsgSetParams) ProtoMessage() {} +func (*MsgSetParams) Descriptor() ([]byte, []int) { + return fileDescriptor_5f28b599a8e3f91d, []int{0} +} +func (m *MsgSetParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetParams.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 *MsgSetParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetParams.Merge(m, src) +} +func (m *MsgSetParams) XXX_Size() int { + return m.Size() +} +func (m *MsgSetParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetParams proto.InternalMessageInfo + +// MsgSetParamsResponse defines the SetParams response type. +type MsgSetParamsResponse struct { +} + +func (m *MsgSetParamsResponse) Reset() { *m = MsgSetParamsResponse{} } +func (m *MsgSetParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetParamsResponse) ProtoMessage() {} +func (*MsgSetParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5f28b599a8e3f91d, []int{1} +} +func (m *MsgSetParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetParamsResponse.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 *MsgSetParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetParamsResponse.Merge(m, src) +} +func (m *MsgSetParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetParamsResponse proto.InternalMessageInfo + +type MsgRelay struct { + // authority is the address that signs the message. + Relayer string `protobuf:"bytes,1,opt,name=relayer,proto3" json:"relayer,omitempty"` + // destination_chain defines the chain which this will be relayed to. + DestinationChain string `protobuf:"bytes,2,opt,name=destination_chain,json=destinationChain,proto3" json:"destination_chain,omitempty"` + // destination_address defines the destination contract address to call. + DestinationAddress string `protobuf:"bytes,3,opt,name=destination_address,json=destinationAddress,proto3" json:"destination_address,omitempty"` + // denoms defines the denoms that the user wants to relay via GMP. + Denoms []string `protobuf:"bytes,4,rep,name=denoms,proto3" json:"denoms,omitempty"` + // token determines the IBC token that the user wants to relay via GMP. + Token types.Coin `protobuf:"bytes,5,opt,name=token,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"token"` +} + +func (m *MsgRelay) Reset() { *m = MsgRelay{} } +func (m *MsgRelay) String() string { return proto.CompactTextString(m) } +func (*MsgRelay) ProtoMessage() {} +func (*MsgRelay) Descriptor() ([]byte, []int) { + return fileDescriptor_5f28b599a8e3f91d, []int{2} +} +func (m *MsgRelay) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRelay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRelay.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 *MsgRelay) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRelay.Merge(m, src) +} +func (m *MsgRelay) XXX_Size() int { + return m.Size() +} +func (m *MsgRelay) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRelay.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRelay proto.InternalMessageInfo + +type MsgRelayResponse struct { +} + +func (m *MsgRelayResponse) Reset() { *m = MsgRelayResponse{} } +func (m *MsgRelayResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRelayResponse) ProtoMessage() {} +func (*MsgRelayResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5f28b599a8e3f91d, []int{3} +} +func (m *MsgRelayResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRelayResponse.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 *MsgRelayResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRelayResponse.Merge(m, src) +} +func (m *MsgRelayResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRelayResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRelayResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRelayResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSetParams)(nil), "ojo.gmp.v1.MsgSetParams") + proto.RegisterType((*MsgSetParamsResponse)(nil), "ojo.gmp.v1.MsgSetParamsResponse") + proto.RegisterType((*MsgRelay)(nil), "ojo.gmp.v1.MsgRelay") + proto.RegisterType((*MsgRelayResponse)(nil), "ojo.gmp.v1.MsgRelayResponse") +} + +func init() { proto.RegisterFile("ojo/gmp/v1/tx.proto", fileDescriptor_5f28b599a8e3f91d) } + +var fileDescriptor_5f28b599a8e3f91d = []byte{ + // 503 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xb6, 0x5b, 0x12, 0xc8, 0xc1, 0x50, 0xae, 0x56, 0x70, 0x23, 0xe4, 0x44, 0x19, 0x50, 0x54, + 0x14, 0x1f, 0x09, 0x12, 0x43, 0x59, 0x20, 0x1d, 0x98, 0x22, 0x21, 0x77, 0x63, 0xa9, 0x2e, 0xf1, + 0xe9, 0xe2, 0x04, 0xdf, 0xb3, 0x7c, 0xd7, 0xd0, 0xac, 0x4c, 0x08, 0x16, 0x7e, 0x42, 0x67, 0x24, + 0x24, 0x06, 0x7e, 0x44, 0xc7, 0x8a, 0x89, 0x09, 0x50, 0x32, 0xc0, 0xcf, 0x40, 0xbe, 0x3b, 0x2b, + 0x16, 0x02, 0x31, 0xe5, 0xde, 0xfb, 0xbe, 0xf7, 0xdd, 0xbb, 0xef, 0x8b, 0xd1, 0x3e, 0xcc, 0x81, + 0xf0, 0x34, 0x23, 0xcb, 0x01, 0x51, 0xe7, 0x61, 0x96, 0x83, 0x02, 0x8c, 0x60, 0x0e, 0x21, 0x4f, + 0xb3, 0x70, 0x39, 0x68, 0x79, 0x1c, 0x38, 0xe8, 0x36, 0x29, 0x4e, 0x86, 0xd1, 0xf2, 0x2a, 0x63, + 0x05, 0xd1, 0x74, 0x0f, 0xa6, 0x20, 0x53, 0x90, 0xa7, 0x86, 0x6e, 0x0a, 0x0b, 0xdd, 0x31, 0x15, + 0x49, 0x25, 0x2f, 0x66, 0x52, 0xc9, 0x2d, 0x10, 0x58, 0x60, 0x42, 0x25, 0x23, 0xcb, 0xc1, 0x84, + 0x29, 0x3a, 0x20, 0x53, 0x48, 0x84, 0xc1, 0xbb, 0x6f, 0x5d, 0x74, 0x6b, 0x2c, 0xf9, 0x09, 0x53, + 0xcf, 0x69, 0x4e, 0x53, 0x89, 0x1f, 0xa1, 0x06, 0x3d, 0x53, 0x33, 0xc8, 0x13, 0xb5, 0xf2, 0xdd, + 0x8e, 0xdb, 0x6b, 0x8c, 0xfc, 0x2f, 0x9f, 0xfb, 0x9e, 0xbd, 0xee, 0x69, 0x1c, 0xe7, 0x4c, 0xca, + 0x13, 0x95, 0x27, 0x82, 0x47, 0x5b, 0x2a, 0x3e, 0x44, 0xf5, 0x4c, 0x2b, 0xf8, 0x3b, 0x1d, 0xb7, + 0x77, 0x73, 0x88, 0xc3, 0xed, 0x2b, 0x43, 0xa3, 0x1d, 0x59, 0xc6, 0x51, 0xf3, 0xcd, 0x45, 0xdb, + 0xf9, 0x75, 0xd1, 0x76, 0x5e, 0xff, 0xfc, 0x74, 0xb8, 0xd5, 0xe8, 0x36, 0x91, 0x57, 0xdd, 0x25, + 0x62, 0x32, 0x03, 0x21, 0x59, 0xf7, 0xe3, 0x0e, 0xba, 0x31, 0x96, 0x3c, 0x62, 0x2f, 0xe9, 0x0a, + 0x0f, 0xd1, 0xf5, 0xbc, 0x38, 0xb0, 0xfc, 0xbf, 0xeb, 0x95, 0x44, 0x7c, 0x1f, 0xdd, 0x8e, 0x99, + 0x54, 0x89, 0xa0, 0x2a, 0x01, 0x71, 0x3a, 0x9d, 0xd1, 0x44, 0xe8, 0x3d, 0x1b, 0xd1, 0x5e, 0x05, + 0x38, 0x2e, 0xfa, 0x98, 0xa0, 0xfd, 0x2a, 0x99, 0x1a, 0x49, 0x7f, 0x57, 0xd3, 0x71, 0x05, 0xb2, + 0x97, 0xe1, 0x26, 0xaa, 0xc7, 0x4c, 0x40, 0x2a, 0xfd, 0x6b, 0x9d, 0xdd, 0x5e, 0x23, 0xb2, 0x15, + 0xa6, 0xa8, 0xa6, 0x60, 0xc1, 0x84, 0x5f, 0xd3, 0x8e, 0x1c, 0x84, 0x76, 0xc9, 0x22, 0x8b, 0xd0, + 0x66, 0x11, 0x1e, 0x43, 0x22, 0x46, 0x0f, 0x2e, 0xbf, 0xb5, 0x9d, 0x0f, 0xdf, 0xdb, 0x3d, 0x9e, + 0xa8, 0xd9, 0xd9, 0x24, 0x9c, 0x42, 0x6a, 0xf3, 0xb5, 0x3f, 0x7d, 0x19, 0x2f, 0x88, 0x5a, 0x65, + 0x4c, 0xea, 0x01, 0x19, 0x19, 0xe5, 0x23, 0xaf, 0xea, 0x64, 0xf9, 0xdc, 0x2e, 0x46, 0x7b, 0xa5, + 0x5d, 0xa5, 0x87, 0xc3, 0x77, 0x2e, 0xda, 0x1d, 0x4b, 0x8e, 0x9f, 0xa1, 0xc6, 0x36, 0x6c, 0xbf, + 0x1a, 0x52, 0xd5, 0xfa, 0x56, 0xe7, 0x5f, 0x48, 0x29, 0x88, 0x1f, 0xa3, 0x9a, 0x09, 0xc4, 0xfb, + 0x83, 0xaa, 0xbb, 0xad, 0xbb, 0x7f, 0xeb, 0x96, 0xc3, 0xa3, 0x27, 0x97, 0xeb, 0xc0, 0xbd, 0x5a, + 0x07, 0xee, 0x8f, 0x75, 0xe0, 0xbe, 0xdf, 0x04, 0xce, 0xd5, 0x26, 0x70, 0xbe, 0x6e, 0x02, 0xe7, + 0xc5, 0xbd, 0x8a, 0x05, 0x30, 0x87, 0xbe, 0x60, 0xea, 0x15, 0xe4, 0x8b, 0xe2, 0x4c, 0xce, 0xf5, + 0x37, 0xa1, 0x6d, 0x98, 0xd4, 0xf5, 0xff, 0xf7, 0xe1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, + 0x1a, 0xa2, 0xfd, 0x62, 0x03, 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 { + // SetParams sets the parameters for the airdrop module. + SetParams(ctx context.Context, in *MsgSetParams, opts ...grpc.CallOption) (*MsgSetParamsResponse, error) + // Relay relays Ojo data via GMP. + Relay(ctx context.Context, in *MsgRelay, opts ...grpc.CallOption) (*MsgRelayResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SetParams(ctx context.Context, in *MsgSetParams, opts ...grpc.CallOption) (*MsgSetParamsResponse, error) { + out := new(MsgSetParamsResponse) + err := c.cc.Invoke(ctx, "/ojo.gmp.v1.Msg/SetParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Relay(ctx context.Context, in *MsgRelay, opts ...grpc.CallOption) (*MsgRelayResponse, error) { + out := new(MsgRelayResponse) + err := c.cc.Invoke(ctx, "/ojo.gmp.v1.Msg/Relay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // SetParams sets the parameters for the airdrop module. + SetParams(context.Context, *MsgSetParams) (*MsgSetParamsResponse, error) + // Relay relays Ojo data via GMP. + Relay(context.Context, *MsgRelay) (*MsgRelayResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SetParams(ctx context.Context, req *MsgSetParams) (*MsgSetParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetParams not implemented") +} +func (*UnimplementedMsgServer) Relay(ctx context.Context, req *MsgRelay) (*MsgRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Relay not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SetParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ojo.gmp.v1.Msg/SetParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetParams(ctx, req.(*MsgSetParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Relay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRelay) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Relay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ojo.gmp.v1.Msg/Relay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Relay(ctx, req.(*MsgRelay)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ojo.gmp.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SetParams", + Handler: _Msg_SetParams_Handler, + }, + { + MethodName: "Relay", + Handler: _Msg_Relay_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ojo/gmp/v1/tx.proto", +} + +func (m *MsgSetParams) 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 *MsgSetParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + 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 *MsgSetParamsResponse) 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 *MsgSetParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRelay) 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 *MsgRelay) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRelay) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Denoms) > 0 { + for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denoms[iNdEx]) + copy(dAtA[i:], m.Denoms[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denoms[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(m.DestinationAddress) > 0 { + i -= len(m.DestinationAddress) + copy(dAtA[i:], m.DestinationAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DestinationAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.DestinationChain) > 0 { + i -= len(m.DestinationChain) + copy(dAtA[i:], m.DestinationChain) + i = encodeVarintTx(dAtA, i, uint64(len(m.DestinationChain))) + i-- + dAtA[i] = 0x12 + } + if len(m.Relayer) > 0 { + i -= len(m.Relayer) + copy(dAtA[i:], m.Relayer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Relayer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRelayResponse) 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 *MsgRelayResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRelayResponse) 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 *MsgSetParams) 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)) + } + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRelay) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Relayer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DestinationChain) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DestinationAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Denoms) > 0 { + for _, s := range m.Denoms { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = m.Token.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgRelayResponse) 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 *MsgSetParams) 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: MsgSetParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetParams: 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 m.Params == nil { + m.Params = &Params{} + } + 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 *MsgSetParamsResponse) 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: MsgSetParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRelay) 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: MsgRelay: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRelay: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Relayer", 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.Relayer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationChain", 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.DestinationChain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationAddress", 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.DestinationAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", 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.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token.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 *MsgRelayResponse) 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: MsgRelayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRelayResponse: 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") +) diff --git a/x/oracle/keeper/params.go b/x/oracle/keeper/params.go index 9663a5e6..14fd8087 100644 --- a/x/oracle/keeper/params.go +++ b/x/oracle/keeper/params.go @@ -1,6 +1,9 @@ package keeper import ( + "fmt" + "strings" + "github.com/ojo-network/ojo/x/oracle/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -207,3 +210,13 @@ func (k Keeper) SetCurrencyDeviationThresholds( ) { k.paramSpace.Set(ctx, types.KeyCurrencyDeviationThresholds, currencyDeviationThresholds) } + +func (k Keeper) GetExponent(ctx sdk.Context, denom string) (uint32, error) { + params := k.GetParams(ctx) + for _, v := range params.AcceptList { + if strings.EqualFold(v.SymbolDenom, denom) { + return v.Exponent, nil + } + } + return 0, fmt.Errorf("unable to find exponent for %s", denom) +} From 7482bc9fa2c6e8884f452addf1ba6e7b2f95356b Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:40:03 -0800 Subject: [PATCH 05/13] fix --- x/gmp/keeper/msg_server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go index 494cc255..d6b53ab1 100644 --- a/x/gmp/keeper/msg_server.go +++ b/x/gmp/keeper/msg_server.go @@ -78,7 +78,7 @@ func (ms msgServer) Relay( if err != nil { return nil, err } - _, err = abi.Arguments{{Type: exchangeRateType}}.Pack(rates) + payload, err := abi.Arguments{{Type: exchangeRateType}}.Pack(rates) if err != nil { return nil, err } @@ -87,7 +87,7 @@ func (ms msgServer) Relay( message := types.GmpMessage{ DestinationChain: msg.DestinationChain, DestinationAddress: msg.DestinationAddress, - Payload: "f", + Payload: payload, Type: types.TypeGeneralMessage, } bz, err := message.Marshal() From 8acca6d1da0f6cfe2451e01eab77c9e4dbc33eae Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:51:51 -0800 Subject: [PATCH 06/13] fix go.mod and tools --- go.mod | 41 +++++++++++------------- go.sum | 85 +++++++++++++++++++++++--------------------------- tools/tools.go | 10 +++--- 3 files changed, 63 insertions(+), 73 deletions(-) diff --git a/go.mod b/go.mod index fa7175c7..6f3127fc 100644 --- a/go.mod +++ b/go.mod @@ -15,21 +15,20 @@ require ( github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.2.1 - github.com/ethereum/go-ethereum v1.13.4 + github.com/ethereum/go-ethereum v1.10.17 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.3 github.com/golangci/golangci-lint v1.55.0 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 github.com/mgechev/revive v1.3.4 github.com/ory/dockertest/v3 v3.10.0 github.com/rs/zerolog v1.30.0 github.com/spf13/cast v1.5.1 - github.com/spf13/cobra v1.7.0 + github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.8.4 - google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d google.golang.org/grpc v1.59.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools/v3 v3.5.1 @@ -39,10 +38,10 @@ require ( require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - cloud.google.com/go v0.110.9 // indirect - cloud.google.com/go/compute v1.23.2 // indirect + cloud.google.com/go v0.110.7 // indirect + cloud.google.com/go/compute v1.23.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.4 // indirect + cloud.google.com/go/iam v1.1.1 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/core v0.6.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect @@ -61,7 +60,7 @@ require ( github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect - github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect github.com/alecthomas/go-check-sumtype v0.1.3 // indirect @@ -115,7 +114,7 @@ require ( github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/docker/cli v23.0.1+incompatible // indirect - github.com/docker/docker v24.0.5+incompatible // indirect + github.com/docker/docker v23.0.3+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -129,7 +128,6 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/getsentry/sentry-go v0.23.0 // indirect - github.com/ghodss/yaml v1.0.0 // indirect github.com/ghostiam/protogetter v0.2.3 // indirect github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-kit/kit v0.12.0 // indirect @@ -150,7 +148,7 @@ require ( github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect @@ -161,13 +159,13 @@ require ( github.com/golangci/revgrep v0.5.0 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.3.1 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect + github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect @@ -190,7 +188,6 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect - github.com/holiman/uint256 v1.2.3 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect @@ -225,7 +222,7 @@ require ( github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.13 // indirect + github.com/mattn/go-runewidth v0.0.10 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 // indirect @@ -317,21 +314,21 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.13.0 // indirect + golang.org/x/oauth2 v0.11.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.128.0 // indirect + google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index db24f050..ad3b0ece 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.9 h1:e7ITSqGFFk4rbz/JFIqZh3G4VEHguhAL4BQcFlWtU68= -cloud.google.com/go v0.110.9/go.mod h1:rpxevX/0Lqvlbc88b7Sc1SPNdyK1riNBTUU6JXhYNpM= +cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= +cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -77,8 +77,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.23.2 h1:nWEMDhgbBkBJjfpVySqU4jgWdc22PLR0o4vEexZHers= -cloud.google.com/go/compute v1.23.2/go.mod h1:JJ0atRC0J/oWYiiVBmsSsrRnh92DhZPG4hFDcR04Rns= +cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= +cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -118,8 +118,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.4 h1:K6n/GZHFTtEoKT5aUG3l9diPi0VduZNQ1PfdnpkkIFk= -cloud.google.com/go/iam v1.1.4/go.mod h1:l/rg8l1AaA+VFMho/HYx2Vv6xinPSLMF8qfhRPIZ0L8= +cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= +cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -250,8 +250,8 @@ github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0/go.mod h1:rZLTje5A9kFBe0 github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -476,7 +476,7 @@ github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzU github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -526,8 +526,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/cli v23.0.1+incompatible h1:LRyWITpGzl2C9e9uGxzisptnxAn1zfZKXy13Ul2Q5oM= github.com/docker/cli v23.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= -github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v23.0.3+incompatible h1:9GhVsShNWz1hO//9BNg/dpMnZW25KydO4wtVxWAIbho= +github.com/docker/docker v23.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -559,9 +559,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= +github.com/ethereum/go-ethereum v1.10.17 h1:XEcumY+qSr1cZQaWsQs5Kck3FHB0V2RiMHPdTBJ+oT8= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= -github.com/ethereum/go-ethereum v1.13.4 h1:25HJnaWVg3q1O7Z62LaaI6S9wVq8QCw3K88g8wEzrcM= -github.com/ethereum/go-ethereum v1.13.4/go.mod h1:I0U5VewuuTzvBtVzKo7b3hJzDhXOUtn9mJW7SsIPB0Q= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -593,7 +592,6 @@ github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghostiam/protogetter v0.2.3 h1:qdv2pzo3BpLqezwqfGDLZ+nHEYmc5bUpIdsMbBVwMjw= github.com/ghostiam/protogetter v0.2.3/go.mod h1:KmNLOsy1v04hKbvZs8EfGI1fk39AgTdRDxWNYPfXVc4= @@ -667,7 +665,7 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -723,9 +721,8 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= -github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= @@ -766,9 +763,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -795,8 +791,8 @@ github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= @@ -812,8 +808,8 @@ github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= -github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -823,8 +819,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= +github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -862,8 +858,6 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -920,8 +914,6 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= -github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= -github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= @@ -1091,8 +1083,8 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= -github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= +github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -1301,6 +1293,7 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqn github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= @@ -1379,8 +1372,8 @@ github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -1593,8 +1586,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= @@ -1730,8 +1723,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= -golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= +golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1894,8 +1887,8 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2049,8 +2042,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= -google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= +google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= +google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2171,12 +2164,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 h1:I6WNifs6pF9tNdSob2W24JtyxIYjzFB9qDlpUC76q+U= -google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= diff --git a/tools/tools.go b/tools/tools.go index d07d4264..ed7e85ad 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,14 +1,14 @@ //go:build tools +// +build tools +// This file uses the recommended method for tracking developer tools in a Go +// module. +// +// REF: https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module package tools import ( - _ "github.com/cosmos/gogoproto/protoc-gen-gocosmos" - _ "github.com/golang/protobuf/protoc-gen-go" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" - _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" - _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" - _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" _ "github.com/mgechev/revive" _ "mvdan.cc/gofumpt" ) From cba7fb9f5f4adf912e6ae81dde2c0724d6e92a63 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:10:41 -0800 Subject: [PATCH 07/13] some cleanup & begin the ABI encoding work --- proto/ojo/gmp/v1/gmp.proto | 15 -- x/gmp/keeper/msg_server.go | 7 +- x/gmp/types/abi_encoding.go | 42 +++++ x/gmp/types/abi_encoding_test.go | 21 +++ x/gmp/types/exchange_rate.go | 10 ++ x/gmp/types/gmp.pb.go | 291 +++---------------------------- 6 files changed, 95 insertions(+), 291 deletions(-) create mode 100644 x/gmp/types/abi_encoding.go create mode 100644 x/gmp/types/abi_encoding_test.go create mode 100644 x/gmp/types/exchange_rate.go diff --git a/proto/ojo/gmp/v1/gmp.proto b/proto/ojo/gmp/v1/gmp.proto index 0cb8aaf5..58a51f0d 100644 --- a/proto/ojo/gmp/v1/gmp.proto +++ b/proto/ojo/gmp/v1/gmp.proto @@ -20,21 +20,6 @@ message Params { int64 gmp_timeout = 3; } -// ExchangeRates defines the ExchangeRates to relay -message ExchangeRate { - // symbol_denom is the symbol of the exchange rate (e.x. "BTC") - string symbol_denom = 1; - - // exponent is the exponent of the asset - uint32 exponent = 2; - - // rate is the conversion rate of the asset - string rate = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - // GmpMessage defines the GMP message that we encode in the // IBC memo field and send to Axelar. // diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go index d6b53ab1..4796328d 100644 --- a/x/gmp/keeper/msg_server.go +++ b/x/gmp/keeper/msg_server.go @@ -63,15 +63,10 @@ func (ms msgServer) Relay( if err != nil { return &types.MsgRelayResponse{}, err } - exponent, err := ms.keeper.oracleKeeper.GetExponent(ctx, denom) - if err != nil { - return &types.MsgRelayResponse{}, err - } rates = append(rates, types.ExchangeRate{ SymbolDenom: denom, - Exponent: exponent, - Rate: rate, + Rate: types.DecToInt(rate), }) } exchangeRateType, err := abi.NewType("exchangeRate[]", "exchangeRate[]", nil) diff --git a/x/gmp/types/abi_encoding.go b/x/gmp/types/abi_encoding.go new file mode 100644 index 00000000..cba111f2 --- /dev/null +++ b/x/gmp/types/abi_encoding.go @@ -0,0 +1,42 @@ +package types + +import ( + "math/big" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/accounts/abi" +) + +var RateFactor = sdk.NewDec(10).Power(9) + +func EncodeExchangeRate(rates []ExchangeRate) ([]byte, error) { + abiDefinition := `[{"constant":false,"inputs":[{"name":"rates","type":"tuple[]","components":[{"name":"SymbolDenom","type":"string"},{"name":"Rate","type":"uint256"}]}],"name":"setRates","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]` + parsedABI, err := abi.JSON(strings.NewReader(abiDefinition)) + if err != nil { + return nil, err + } + + var convertedRates []interface{} + for _, rate := range rates { + convertedRates = append(convertedRates, struct { + SymbolDenom string + Rate *big.Int + }{ + SymbolDenom: rate.SymbolDenom, + Rate: rate.Rate, + }) + } + + data, err := parsedABI.Pack("rates", convertedRates) + if err != nil { + return nil, err + } + + return data, nil +} + +// DecToInt multiplies amount by rate factor to make it compatible with contracts +func DecToInt(amount sdk.Dec) *big.Int { + return amount.Mul(RateFactor).TruncateInt().BigInt() +} diff --git a/x/gmp/types/abi_encoding_test.go b/x/gmp/types/abi_encoding_test.go new file mode 100644 index 00000000..ca8db501 --- /dev/null +++ b/x/gmp/types/abi_encoding_test.go @@ -0,0 +1,21 @@ +package types + +import ( + "fmt" + "math/big" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestToMap(t *testing.T) { + rates := []ExchangeRate{ + { + SymbolDenom: "btc", + Rate: big.NewInt(50000), + }, + } + r, err := EncodeExchangeRate(rates) + require.NoError(t, err) + fmt.Println(r) +} diff --git a/x/gmp/types/exchange_rate.go b/x/gmp/types/exchange_rate.go new file mode 100644 index 00000000..4774133f --- /dev/null +++ b/x/gmp/types/exchange_rate.go @@ -0,0 +1,10 @@ +package types + +import ( + "math/big" +) + +type ExchangeRate struct { + SymbolDenom string + Rate *big.Int +} diff --git a/x/gmp/types/gmp.pb.go b/x/gmp/types/gmp.pb.go index e2f74ec6..6cced42e 100644 --- a/x/gmp/types/gmp.pb.go +++ b/x/gmp/types/gmp.pb.go @@ -6,7 +6,6 @@ package types import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" proto "github.com/cosmos/gogoproto/proto" _ "github.com/gogo/protobuf/gogoproto" io "io" @@ -68,49 +67,6 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -// ExchangeRates defines the ExchangeRates to relay -type ExchangeRate struct { - // symbol_denom is the symbol of the exchange rate (e.x. "BTC") - SymbolDenom string `protobuf:"bytes,1,opt,name=symbol_denom,json=symbolDenom,proto3" json:"symbol_denom,omitempty"` - // exponent is the exponent of the asset - Exponent uint32 `protobuf:"varint,2,opt,name=exponent,proto3" json:"exponent,omitempty"` - // rate is the conversion rate of the asset - Rate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate"` -} - -func (m *ExchangeRate) Reset() { *m = ExchangeRate{} } -func (m *ExchangeRate) String() string { return proto.CompactTextString(m) } -func (*ExchangeRate) ProtoMessage() {} -func (*ExchangeRate) Descriptor() ([]byte, []int) { - return fileDescriptor_199820a7e9d7929f, []int{1} -} -func (m *ExchangeRate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExchangeRate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ExchangeRate.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 *ExchangeRate) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExchangeRate.Merge(m, src) -} -func (m *ExchangeRate) XXX_Size() int { - return m.Size() -} -func (m *ExchangeRate) XXX_DiscardUnknown() { - xxx_messageInfo_ExchangeRate.DiscardUnknown(m) -} - -var xxx_messageInfo_ExchangeRate proto.InternalMessageInfo - // GmpMessage defines the GMP message that we encode in the // IBC memo field and send to Axelar. // @@ -130,7 +86,7 @@ func (m *GmpMessage) Reset() { *m = GmpMessage{} } func (m *GmpMessage) String() string { return proto.CompactTextString(m) } func (*GmpMessage) ProtoMessage() {} func (*GmpMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_199820a7e9d7929f, []int{2} + return fileDescriptor_199820a7e9d7929f, []int{1} } func (m *GmpMessage) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -161,39 +117,32 @@ var xxx_messageInfo_GmpMessage proto.InternalMessageInfo func init() { proto.RegisterType((*Params)(nil), "ojo.gmp.v1.Params") - proto.RegisterType((*ExchangeRate)(nil), "ojo.gmp.v1.ExchangeRate") proto.RegisterType((*GmpMessage)(nil), "ojo.gmp.v1.GmpMessage") } func init() { proto.RegisterFile("ojo/gmp/v1/gmp.proto", fileDescriptor_199820a7e9d7929f) } var fileDescriptor_199820a7e9d7929f = []byte{ - // 388 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x52, 0xc1, 0xae, 0xd2, 0x40, - 0x14, 0xed, 0xf8, 0xc8, 0xd3, 0x37, 0x0f, 0x13, 0x1d, 0x59, 0x54, 0x16, 0x05, 0x59, 0x18, 0x12, - 0x43, 0x1b, 0xe2, 0x17, 0x08, 0x18, 0x57, 0x26, 0xa6, 0x71, 0xe5, 0x86, 0x0c, 0xed, 0x64, 0x28, - 0x30, 0x73, 0x27, 0x9d, 0x01, 0xe1, 0x2f, 0x74, 0xe7, 0x27, 0xb1, 0x64, 0x69, 0x5c, 0x10, 0x85, - 0x1f, 0x31, 0x33, 0xd3, 0x92, 0xae, 0xee, 0xbd, 0xe7, 0x9c, 0xf6, 0xde, 0x73, 0x5a, 0xdc, 0x81, - 0x15, 0x24, 0x5c, 0xa8, 0x64, 0x37, 0xb6, 0x25, 0x56, 0x25, 0x18, 0x20, 0x18, 0x56, 0x10, 0xdb, - 0x71, 0x37, 0xee, 0x76, 0x38, 0x70, 0x70, 0x70, 0x62, 0x3b, 0xaf, 0xe8, 0xbe, 0xce, 0x40, 0x0b, - 0xd0, 0x73, 0x4f, 0xf8, 0xc1, 0x53, 0x83, 0x35, 0xbe, 0xff, 0x42, 0x4b, 0x2a, 0x34, 0xe9, 0xe1, - 0x47, 0x2e, 0xd4, 0x9c, 0xe6, 0x79, 0xc9, 0xb4, 0x0e, 0x51, 0x1f, 0x0d, 0x1f, 0x52, 0xcc, 0x85, - 0xfa, 0xe0, 0x91, 0x5a, 0x90, 0x2d, 0xa9, 0x94, 0x6c, 0x13, 0x3e, 0xb9, 0x09, 0xa6, 0x1e, 0xa9, - 0x05, 0xa6, 0x10, 0x0c, 0xb6, 0x26, 0xbc, 0xeb, 0xa3, 0xe1, 0x9d, 0x13, 0x7c, 0xf5, 0xc8, 0xe0, - 0x27, 0xc2, 0xed, 0x8f, 0x7b, 0xfb, 0x02, 0xce, 0x52, 0x6a, 0x18, 0x79, 0x83, 0xdb, 0xfa, 0x20, - 0x16, 0xb0, 0x99, 0xe7, 0x4c, 0x82, 0xa8, 0x96, 0x3e, 0x7a, 0x6c, 0x66, 0x21, 0xd2, 0xc5, 0xcf, - 0xd8, 0x5e, 0x81, 0x64, 0xd2, 0xb8, 0x95, 0xcf, 0xd3, 0xdb, 0x4c, 0x26, 0xb8, 0x55, 0x52, 0xc3, - 0xdc, 0xa6, 0x87, 0x49, 0x7c, 0x3c, 0xf7, 0x82, 0x3f, 0xe7, 0xde, 0x5b, 0x5e, 0x98, 0xe5, 0x76, - 0x11, 0x67, 0x20, 0x2a, 0xaf, 0x55, 0x19, 0xe9, 0x7c, 0x9d, 0x98, 0x83, 0x62, 0x3a, 0x9e, 0xb1, - 0x2c, 0x75, 0xcf, 0x0e, 0x7e, 0x21, 0x8c, 0x3f, 0x09, 0xf5, 0x99, 0x69, 0x4d, 0x39, 0x23, 0xef, - 0xf0, 0xcb, 0x9c, 0x69, 0x53, 0x48, 0x6a, 0x0a, 0x90, 0xd6, 0x6c, 0x21, 0xab, 0xb3, 0x5e, 0x34, - 0x88, 0xa9, 0xc5, 0x49, 0x82, 0x5f, 0x35, 0xc5, 0x75, 0x74, 0x3e, 0x19, 0xd2, 0xa0, 0xea, 0x08, - 0x43, 0xfc, 0x54, 0xd1, 0xc3, 0x06, 0x68, 0xee, 0x6e, 0x6e, 0xa7, 0xf5, 0x48, 0x08, 0x6e, 0xd9, - 0xcb, 0xc2, 0x96, 0x0b, 0xcd, 0xf5, 0x93, 0xd9, 0xf1, 0x5f, 0x14, 0x1c, 0x2f, 0x11, 0x3a, 0x5d, - 0x22, 0xf4, 0xf7, 0x12, 0xa1, 0x1f, 0xd7, 0x28, 0x38, 0x5d, 0xa3, 0xe0, 0xf7, 0x35, 0x0a, 0xbe, - 0x35, 0x6d, 0xc2, 0x0a, 0x46, 0x92, 0x99, 0xef, 0x50, 0xae, 0x6d, 0x9f, 0xec, 0xdd, 0x5f, 0xe2, - 0xac, 0x2e, 0xee, 0xdd, 0x87, 0x7e, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xcc, 0x18, 0xac, - 0x3d, 0x02, 0x00, 0x00, + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xb1, 0x4e, 0x42, 0x31, + 0x18, 0x85, 0x6f, 0x85, 0x60, 0xac, 0x0e, 0x5a, 0x19, 0xae, 0x0c, 0x95, 0x30, 0x18, 0x12, 0x23, + 0x0d, 0xf1, 0x09, 0x14, 0x13, 0x27, 0x13, 0x43, 0x9c, 0x5c, 0x48, 0xe1, 0x36, 0xe5, 0x02, 0xed, + 0xdf, 0xdc, 0x16, 0x94, 0xb7, 0x70, 0xf4, 0x91, 0x18, 0x19, 0x1d, 0x15, 0x5e, 0xc4, 0xb4, 0xf5, + 0x9a, 0x3b, 0xf5, 0x3f, 0xe7, 0x7c, 0xf9, 0x7b, 0xd2, 0xe2, 0x26, 0xcc, 0x80, 0x49, 0x65, 0xd8, + 0xaa, 0xef, 0x8f, 0x9e, 0x29, 0xc0, 0x01, 0xc1, 0x30, 0x83, 0x9e, 0x97, 0xab, 0x7e, 0xab, 0x29, + 0x41, 0x42, 0xb0, 0x99, 0x9f, 0x22, 0xd1, 0xba, 0x98, 0x80, 0x55, 0x60, 0x47, 0x31, 0x88, 0x22, + 0x46, 0x9d, 0x39, 0x6e, 0x3c, 0xf3, 0x82, 0x2b, 0x4b, 0x2e, 0xf1, 0xb1, 0x54, 0x66, 0xc4, 0xb3, + 0xac, 0x10, 0xd6, 0xa6, 0xa8, 0x8d, 0xba, 0x47, 0x43, 0x2c, 0x95, 0xb9, 0x8b, 0x4e, 0x09, 0x4c, + 0xa6, 0x5c, 0x6b, 0xb1, 0x48, 0x0f, 0xfe, 0x81, 0x41, 0x74, 0x4a, 0xc0, 0xe5, 0x4a, 0xc0, 0xd2, + 0xa5, 0xb5, 0x36, 0xea, 0xd6, 0x02, 0xf0, 0x12, 0x9d, 0xce, 0x27, 0xc2, 0xf8, 0x51, 0x99, 0x27, + 0x61, 0x2d, 0x97, 0x82, 0x5c, 0xe3, 0xb3, 0x4c, 0x58, 0x97, 0x6b, 0xee, 0x72, 0xd0, 0x7e, 0x71, + 0xae, 0xff, 0xee, 0x3d, 0xad, 0x04, 0x03, 0xef, 0x13, 0x86, 0xcf, 0xab, 0x70, 0x59, 0x33, 0xb6, + 0x20, 0x95, 0xa8, 0xac, 0x9b, 0xe2, 0x43, 0xc3, 0xd7, 0x0b, 0xe0, 0x59, 0x68, 0x72, 0x32, 0x2c, + 0x25, 0x21, 0xb8, 0xee, 0xd6, 0x46, 0xa4, 0xf5, 0x50, 0x30, 0xcc, 0xf7, 0x0f, 0x9b, 0x1f, 0x9a, + 0x6c, 0x76, 0x14, 0x6d, 0x77, 0x14, 0x7d, 0xef, 0x28, 0xfa, 0xd8, 0xd3, 0x64, 0xbb, 0xa7, 0xc9, + 0xd7, 0x9e, 0x26, 0xaf, 0x57, 0x32, 0x77, 0xd3, 0xe5, 0xb8, 0x37, 0x01, 0xc5, 0x60, 0x06, 0x37, + 0x5a, 0xb8, 0x37, 0x28, 0xe6, 0x7e, 0x66, 0xef, 0xe1, 0x47, 0xfc, 0x12, 0x3b, 0x6e, 0x84, 0x47, + 0xbd, 0xfd, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x07, 0x1d, 0xa3, 0xa9, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -238,51 +187,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ExchangeRate) 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 *ExchangeRate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExchangeRate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Rate.Size() - i -= size - if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGmp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.Exponent != 0 { - i = encodeVarintGmp(dAtA, i, uint64(m.Exponent)) - i-- - dAtA[i] = 0x10 - } - if len(m.SymbolDenom) > 0 { - i -= len(m.SymbolDenom) - copy(dAtA[i:], m.SymbolDenom) - i = encodeVarintGmp(dAtA, i, uint64(len(m.SymbolDenom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *GmpMessage) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -363,24 +267,6 @@ func (m *Params) Size() (n int) { return n } -func (m *ExchangeRate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SymbolDenom) - if l > 0 { - n += 1 + l + sovGmp(uint64(l)) - } - if m.Exponent != 0 { - n += 1 + sovGmp(uint64(m.Exponent)) - } - l = m.Rate.Size() - n += 1 + l + sovGmp(uint64(l)) - return n -} - func (m *GmpMessage) Size() (n int) { if m == nil { return 0 @@ -544,141 +430,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } -func (m *ExchangeRate) 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 ErrIntOverflowGmp - } - 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: ExchangeRate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExchangeRate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SymbolDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGmp - } - 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 ErrInvalidLengthGmp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGmp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SymbolDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) - } - m.Exponent = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGmp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Exponent |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGmp - } - 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 ErrInvalidLengthGmp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGmp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGmp(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGmp - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *GmpMessage) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 9d7b29a84245064bc2c4e0597af89b1656db8d00 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Wed, 8 Nov 2023 13:53:45 -0800 Subject: [PATCH 08/13] abi encoding --- x/gmp/keeper/msg_server.go | 26 +++++++++++++++----------- x/gmp/types/abi_encoding.go | 20 +++++--------------- x/gmp/types/abi_encoding_test.go | 15 ++++++++++----- x/gmp/types/exchange_rate.go | 29 ++++++++++++++++++++++++++--- 4 files changed, 56 insertions(+), 34 deletions(-) diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go index 4796328d..e70e0a30 100644 --- a/x/gmp/keeper/msg_server.go +++ b/x/gmp/keeper/msg_server.go @@ -2,11 +2,11 @@ package keeper import ( "context" + "math/big" "time" "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/accounts/abi" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" @@ -57,23 +57,27 @@ func (ms msgServer) Relay( params := ms.keeper.GetParams(ctx) // encode oracle data - rates := []types.ExchangeRate{} + rates := []types.PriceFeedData{} for _, denom := range msg.Denoms { rate, err := ms.keeper.oracleKeeper.GetExchangeRate(ctx, denom) if err != nil { return &types.MsgRelayResponse{}, err } - rates = append(rates, types.ExchangeRate{ - SymbolDenom: denom, - Rate: types.DecToInt(rate), - }) - } - exchangeRateType, err := abi.NewType("exchangeRate[]", "exchangeRate[]", nil) - if err != nil { - return nil, err + pfData := types.NewPriceFeedData( + denom, + types.DecToInt(rate), + // TODO: replace with actual resolve time + big.NewInt(1), + // TODO: replace with actual id + big.NewInt(1), + ) + + rates = append(rates, pfData) } - payload, err := abi.Arguments{{Type: exchangeRateType}}.Pack(rates) + + // TODO: Fill with actual disableResolve option. + payload, err := types.EncodeABI("postPrices", rates, false) if err != nil { return nil, err } diff --git a/x/gmp/types/abi_encoding.go b/x/gmp/types/abi_encoding.go index cba111f2..77f5eead 100644 --- a/x/gmp/types/abi_encoding.go +++ b/x/gmp/types/abi_encoding.go @@ -10,25 +10,15 @@ import ( var RateFactor = sdk.NewDec(10).Power(9) -func EncodeExchangeRate(rates []ExchangeRate) ([]byte, error) { - abiDefinition := `[{"constant":false,"inputs":[{"name":"rates","type":"tuple[]","components":[{"name":"SymbolDenom","type":"string"},{"name":"Rate","type":"uint256"}]}],"name":"setRates","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]` - parsedABI, err := abi.JSON(strings.NewReader(abiDefinition)) +const ABI = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"MedianDisabled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnAuthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"DeviationPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"MedianPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"MedianStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"PricePosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"RemovedFromWhitelist\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"WhitelistStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"Whitelisted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"assignRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getDeviationData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getDeviationDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"deviationData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getMedianData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getMedianDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"medianData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_base\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_qoute\",\"type\":\"bytes32\"}],\"name\":\"getPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseResolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quoteResolveTime\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getPriceData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getPriceDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"priceData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_deviations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postDeviations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"_medians\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postMedians\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_prices\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"removeAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"revokeRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setMedianStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setWhitelistStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"whitelistAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" + +func EncodeABI(fn string, params ...interface{}) ([]byte, error) { + parsedABI, err := abi.JSON(strings.NewReader(ABI)) if err != nil { return nil, err } - var convertedRates []interface{} - for _, rate := range rates { - convertedRates = append(convertedRates, struct { - SymbolDenom string - Rate *big.Int - }{ - SymbolDenom: rate.SymbolDenom, - Rate: rate.Rate, - }) - } - - data, err := parsedABI.Pack("rates", convertedRates) + data, err := parsedABI.Pack(fn, params...) if err != nil { return nil, err } diff --git a/x/gmp/types/abi_encoding_test.go b/x/gmp/types/abi_encoding_test.go index ca8db501..f2d8114b 100644 --- a/x/gmp/types/abi_encoding_test.go +++ b/x/gmp/types/abi_encoding_test.go @@ -8,14 +8,19 @@ import ( "github.com/stretchr/testify/require" ) -func TestToMap(t *testing.T) { - rates := []ExchangeRate{ +func TestEncodeExchangeRates(t *testing.T) { + assetNameArray := [32]byte{} + copy(assetNameArray[:], []byte("btc")) + rates := [1]PriceFeedData{ { - SymbolDenom: "btc", - Rate: big.NewInt(50000), + AssetName: assetNameArray, + Value: big.NewInt(50000), + ResolveTime: big.NewInt(50000), + Id: big.NewInt(50000), }, } - r, err := EncodeExchangeRate(rates) + disableResolve := false + r, err := EncodeABI("postPrices", rates, disableResolve) require.NoError(t, err) fmt.Println(r) } diff --git a/x/gmp/types/exchange_rate.go b/x/gmp/types/exchange_rate.go index 4774133f..145ea52b 100644 --- a/x/gmp/types/exchange_rate.go +++ b/x/gmp/types/exchange_rate.go @@ -4,7 +4,30 @@ import ( "math/big" ) -type ExchangeRate struct { - SymbolDenom string - Rate *big.Int +// PriceFeedData is a struct to represent the data that is relayed to other chains. +// It contains the asset name, value, resolve time, and id. +// The AssetName is an array of bytes, not a list, because lists are not +// compatible with ABI encoding. +type PriceFeedData struct { + AssetName [32]byte + Value *big.Int + ResolveTime *big.Int + Id *big.Int +} + +func NewPriceFeedData( + assetName string, + value *big.Int, + resolveTime *big.Int, + id *big.Int, +) PriceFeedData { + // convert assetName to an array of bytes + var assetNameBytes [32]byte + copy(assetNameBytes[:], []byte(assetName)) + return PriceFeedData{ + AssetName: assetNameBytes, + Value: value, + ResolveTime: resolveTime, + Id: id, + } } From 6b5f09a7ead3d33ba853d7af1c88a0e33fe0681b Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:26:16 -0800 Subject: [PATCH 09/13] add a logger, handle some tests better, and make the code cleeaner --- x/gmp/keeper/keeper.go | 11 ++++++++ x/gmp/keeper/msg_server.go | 8 ++++-- x/gmp/types/abi_encoding.go | 46 ++++++++++++++++++++++---------- x/gmp/types/abi_encoding_test.go | 1 + x/gmp/types/abi_json.go | 5 ++++ x/gmp/types/exchange_rate.go | 19 ++++++++----- 6 files changed, 68 insertions(+), 22 deletions(-) create mode 100644 x/gmp/types/abi_json.go diff --git a/x/gmp/keeper/keeper.go b/x/gmp/keeper/keeper.go index e761a500..886f11c0 100644 --- a/x/gmp/keeper/keeper.go +++ b/x/gmp/keeper/keeper.go @@ -1,6 +1,12 @@ package keeper import ( + "fmt" + + "github.com/cometbft/cometbft/libs/log" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/ojo-network/ojo/app/ibctransfer" @@ -33,3 +39,8 @@ func NewKeeper( ibcKeeper: ibcKeeper, } } + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go index e70e0a30..f25e60b6 100644 --- a/x/gmp/keeper/msg_server.go +++ b/x/gmp/keeper/msg_server.go @@ -64,7 +64,7 @@ func (ms msgServer) Relay( return &types.MsgRelayResponse{}, err } - pfData := types.NewPriceFeedData( + priceFeed, err := types.NewPriceFeedData( denom, types.DecToInt(rate), // TODO: replace with actual resolve time @@ -72,8 +72,12 @@ func (ms msgServer) Relay( // TODO: replace with actual id big.NewInt(1), ) + if err != nil { + ms.keeper.Logger(ctx).With(err).Error("asset name is too long to relay!") + continue + } - rates = append(rates, pfData) + rates = append(rates, priceFeed) } // TODO: Fill with actual disableResolve option. diff --git a/x/gmp/types/abi_encoding.go b/x/gmp/types/abi_encoding.go index 77f5eead..b005c941 100644 --- a/x/gmp/types/abi_encoding.go +++ b/x/gmp/types/abi_encoding.go @@ -1,6 +1,7 @@ package types import ( + "fmt" "math/big" "strings" @@ -8,25 +9,42 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" ) -var RateFactor = sdk.NewDec(10).Power(9) +var rateFactor = sdk.NewDec(10).Power(9) -const ABI = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"MedianDisabled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnAuthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"DeviationPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"MedianPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"MedianStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"PricePosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"RemovedFromWhitelist\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"WhitelistStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"Whitelisted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"assignRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getDeviationData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getDeviationDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"deviationData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getMedianData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getMedianDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"medianData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_base\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_qoute\",\"type\":\"bytes32\"}],\"name\":\"getPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseResolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quoteResolveTime\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getPriceData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getPriceDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"priceData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_deviations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postDeviations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"_medians\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postMedians\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_prices\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"removeAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"revokeRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setMedianStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setWhitelistStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"whitelistAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" +type FnName string -func EncodeABI(fn string, params ...interface{}) ([]byte, error) { - parsedABI, err := abi.JSON(strings.NewReader(ABI)) - if err != nil { - return nil, err - } +const ( + prices FnName = "postPrices" + medians FnName = "postMedians" + deviations FnName = "postDeviations" +) - data, err := parsedABI.Pack(fn, params...) - if err != nil { - return nil, err +// EncodeABI encodes the function name and parameters into ABI encoding using the above JSON. +// It can only be used with the following functions: +// - postPrices +// - postMedians +// - postDeviations +func EncodeABI(fn string, params ...interface{}) ([]byte, error) { + switch FnName(fn) { + case prices, medians, deviations: + parsedABI, err := abi.JSON(strings.NewReader(abiJson)) + if err != nil { + return nil, err + } + + data, err := parsedABI.Pack(fn, params...) + if err != nil { + return nil, err + } + + return data, nil + + default: + return []byte{}, fmt.Errorf("invalid function name") } - - return data, nil } -// DecToInt multiplies amount by rate factor to make it compatible with contracts +// DecToInt multiplies amount by rate factor to make it compatible with contracts. func DecToInt(amount sdk.Dec) *big.Int { - return amount.Mul(RateFactor).TruncateInt().BigInt() + return amount.Mul(rateFactor).TruncateInt().BigInt() } diff --git a/x/gmp/types/abi_encoding_test.go b/x/gmp/types/abi_encoding_test.go index f2d8114b..049ef1cb 100644 --- a/x/gmp/types/abi_encoding_test.go +++ b/x/gmp/types/abi_encoding_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/require" ) +// TODO: Make these tests more thorough func TestEncodeExchangeRates(t *testing.T) { assetNameArray := [32]byte{} copy(assetNameArray[:], []byte("btc")) diff --git a/x/gmp/types/abi_json.go b/x/gmp/types/abi_json.go new file mode 100644 index 00000000..aa34afd2 --- /dev/null +++ b/x/gmp/types/abi_json.go @@ -0,0 +1,5 @@ +package types + +// abiJson is a string value of the ABI interface for interacting with the +// Ojo EVM contract. +const abiJson = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"MedianDisabled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnAuthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"DeviationPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"MedianPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"MedianStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"PricePosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"RemovedFromWhitelist\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"WhitelistStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"Whitelisted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"assignRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getDeviationData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getDeviationDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"deviationData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getMedianData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getMedianDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"medianData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_base\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_qoute\",\"type\":\"bytes32\"}],\"name\":\"getPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseResolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quoteResolveTime\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getPriceData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getPriceDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"priceData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_deviations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postDeviations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"_medians\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postMedians\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_prices\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"removeAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"revokeRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setMedianStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setWhitelistStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"whitelistAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" diff --git a/x/gmp/types/exchange_rate.go b/x/gmp/types/exchange_rate.go index 145ea52b..c0bb51d8 100644 --- a/x/gmp/types/exchange_rate.go +++ b/x/gmp/types/exchange_rate.go @@ -1,6 +1,7 @@ package types import ( + "fmt" "math/big" ) @@ -20,14 +21,20 @@ func NewPriceFeedData( value *big.Int, resolveTime *big.Int, id *big.Int, -) PriceFeedData { - // convert assetName to an array of bytes - var assetNameBytes [32]byte - copy(assetNameBytes[:], []byte(assetName)) +) (PriceFeedData, error) { + assetSlice := []byte(assetName) + if len(assetSlice) > 32 { + return PriceFeedData{}, fmt.Errorf( + "failed to parse pruning options from flags: %s", assetName, + ) + } + // convert assetSlice to assetArray + var assetArray [32]byte + copy(assetArray[:], []byte(assetSlice)) return PriceFeedData{ - AssetName: assetNameBytes, + AssetName: assetArray, Value: value, ResolveTime: resolveTime, Id: id, - } + }, nil } From 0337f450e5f8a259ab660403a239b681ad333026 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:38:10 -0800 Subject: [PATCH 10/13] some lint, package, cleanup, & proto comment fixes --- go.mod | 5 ++-- go.sum | 10 +++++--- proto/ojo/gmp/v1/gmp.proto | 1 - proto/ojo/gmp/v1/tx.proto | 8 ++++--- x/gmp/keeper/msg_server_test.go | 2 +- x/gmp/types/abi_encoding.go | 2 +- x/gmp/types/abi_json.go | 4 +++- x/gmp/types/exchange_rate.go | 10 +++++--- x/gmp/types/gmp.pb.go | 41 ++++++++++++++++----------------- x/gmp/types/msgs.go | 8 ++++++- x/gmp/types/tx.pb.go | 8 ++++--- 11 files changed, 59 insertions(+), 40 deletions(-) diff --git a/go.mod b/go.mod index 6f3127fc..4fad0340 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.2.1 - github.com/ethereum/go-ethereum v1.10.17 + github.com/ethereum/go-ethereum v1.12.1 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.3 github.com/golangci/golangci-lint v1.55.0 @@ -148,7 +148,7 @@ require ( github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/snappy v0.0.4 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect @@ -188,6 +188,7 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect + github.com/holiman/uint256 v1.2.3 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect diff --git a/go.sum b/go.sum index ad3b0ece..155847db 100644 --- a/go.sum +++ b/go.sum @@ -559,8 +559,9 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= -github.com/ethereum/go-ethereum v1.10.17 h1:XEcumY+qSr1cZQaWsQs5Kck3FHB0V2RiMHPdTBJ+oT8= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= +github.com/ethereum/go-ethereum v1.12.1 h1:1kXDPxhLfyySuQYIfRxVBGYuaHdxNNxevA73vjIwsgk= +github.com/ethereum/go-ethereum v1.12.1/go.mod h1:zKetLweqBR8ZS+1O9iJWI8DvmmD2NzD19apjEWDCsnw= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -721,8 +722,9 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= @@ -791,8 +793,8 @@ github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= @@ -914,6 +916,8 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= +github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= diff --git a/proto/ojo/gmp/v1/gmp.proto b/proto/ojo/gmp/v1/gmp.proto index 58a51f0d..a9aa24c7 100644 --- a/proto/ojo/gmp/v1/gmp.proto +++ b/proto/ojo/gmp/v1/gmp.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package ojo.gmp.v1; import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; option go_package = "github.com/ojo-network/ojo/x/gmp/types"; diff --git a/proto/ojo/gmp/v1/tx.proto b/proto/ojo/gmp/v1/tx.proto index 58785bcb..b3dca7ba 100644 --- a/proto/ojo/gmp/v1/tx.proto +++ b/proto/ojo/gmp/v1/tx.proto @@ -9,9 +9,9 @@ import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/ojo-network/ojo/x/gmp/types"; -// Msg defines the airdrop Msg service. +// Msg defines the gmp Msg service. service Msg { - // SetParams sets the parameters for the airdrop module. + // SetParams sets the parameters for the gmp module. rpc SetParams(MsgSetParams) returns (MsgSetParamsResponse); // Relay relays Ojo data via GMP. @@ -27,13 +27,14 @@ message MsgSetParams { // 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 airdrop parameters to update. + // params defines the gmp parameters to update. Params params = 2; } // MsgSetParamsResponse defines the SetParams response type. message MsgSetParamsResponse {} +// MsgRelay defines the Relay message type. message MsgRelay { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -58,4 +59,5 @@ message MsgRelay { ]; } +// MsgRelay defines the Relay response type. message MsgRelayResponse {} diff --git a/x/gmp/keeper/msg_server_test.go b/x/gmp/keeper/msg_server_test.go index e6f955c0..03765c15 100644 --- a/x/gmp/keeper/msg_server_test.go +++ b/x/gmp/keeper/msg_server_test.go @@ -8,7 +8,7 @@ func (s *IntegrationTestSuite) TestMsgServer_SetParams() { gmpChannel := "channel-1" gmpAddress := "axelar1dv4u5k73pzqrxlzujxg3qp8kvc3pje7jtdvu72npnt5zhq05ejcsn5qme5" timeout := int64(1) - SetParams(s, gmpChannel, gmpAddress, timeout) + SetParams(s, gmpAddress, gmpChannel, timeout) params := types.DefaultParams() diff --git a/x/gmp/types/abi_encoding.go b/x/gmp/types/abi_encoding.go index b005c941..d09f43b3 100644 --- a/x/gmp/types/abi_encoding.go +++ b/x/gmp/types/abi_encoding.go @@ -27,7 +27,7 @@ const ( func EncodeABI(fn string, params ...interface{}) ([]byte, error) { switch FnName(fn) { case prices, medians, deviations: - parsedABI, err := abi.JSON(strings.NewReader(abiJson)) + parsedABI, err := abi.JSON(strings.NewReader(abiJSON)) if err != nil { return nil, err } diff --git a/x/gmp/types/abi_json.go b/x/gmp/types/abi_json.go index aa34afd2..bd5967db 100644 --- a/x/gmp/types/abi_json.go +++ b/x/gmp/types/abi_json.go @@ -2,4 +2,6 @@ package types // abiJson is a string value of the ABI interface for interacting with the // Ojo EVM contract. -const abiJson = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"MedianDisabled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnAuthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"DeviationPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"MedianPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"MedianStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"PricePosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"RemovedFromWhitelist\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"WhitelistStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"Whitelisted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"assignRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getDeviationData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getDeviationDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"deviationData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getMedianData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getMedianDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"medianData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_base\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_qoute\",\"type\":\"bytes32\"}],\"name\":\"getPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseResolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quoteResolveTime\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getPriceData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getPriceDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"priceData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_deviations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postDeviations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"_medians\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postMedians\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_prices\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"removeAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"revokeRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setMedianStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setWhitelistStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"whitelistAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" +// +//nolint:lll +const abiJSON = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"MedianDisabled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnAuthorized\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"DeviationPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"MedianPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"MedianStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"PricePosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"RemovedFromWhitelist\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"WhitelistStatus\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"Whitelisted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"assignRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getDeviationData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getDeviationDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"deviationData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getMedianData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getMedianDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"medianData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_base\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_qoute\",\"type\":\"bytes32\"}],\"name\":\"getPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseResolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quoteResolveTime\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_assetName\",\"type\":\"bytes32\"}],\"name\":\"getPriceData\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_assetNames\",\"type\":\"bytes32[]\"}],\"name\":\"getPriceDataBulk\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"priceData\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_deviations\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postDeviations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"internalType\":\"structPriceFeed.MedianData[]\",\"name\":\"_medians\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postMedians\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"resolveTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"internalType\":\"structPriceFeed.Data[]\",\"name\":\"_prices\",\"type\":\"tuple[]\"},{\"internalType\":\"bool\",\"name\":\"_disableResolve\",\"type\":\"bool\"}],\"name\":\"postPrices\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"removeAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"revokeRelayerRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setMedianStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setWhitelistStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"whitelistAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" diff --git a/x/gmp/types/exchange_rate.go b/x/gmp/types/exchange_rate.go index c0bb51d8..d6b9ea4b 100644 --- a/x/gmp/types/exchange_rate.go +++ b/x/gmp/types/exchange_rate.go @@ -9,13 +9,18 @@ import ( // It contains the asset name, value, resolve time, and id. // The AssetName is an array of bytes, not a list, because lists are not // compatible with ABI encoding. +// Note: the ID field here is declared as "Id" because of the ABI encoding. type PriceFeedData struct { AssetName [32]byte Value *big.Int ResolveTime *big.Int - Id *big.Int + //nolint:stylecheck + Id *big.Int } +// NewPriceFeedData creates a new PriceFeedData struct. +// It must convert the assetName string to a byte array. +// This array may not exceed 32 bytes. func NewPriceFeedData( assetName string, value *big.Int, @@ -28,9 +33,8 @@ func NewPriceFeedData( "failed to parse pruning options from flags: %s", assetName, ) } - // convert assetSlice to assetArray var assetArray [32]byte - copy(assetArray[:], []byte(assetSlice)) + copy(assetArray[:], assetSlice) return PriceFeedData{ AssetName: assetArray, Value: value, diff --git a/x/gmp/types/gmp.pb.go b/x/gmp/types/gmp.pb.go index 6cced42e..470c196b 100644 --- a/x/gmp/types/gmp.pb.go +++ b/x/gmp/types/gmp.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" proto "github.com/cosmos/gogoproto/proto" _ "github.com/gogo/protobuf/gogoproto" io "io" @@ -123,26 +122,26 @@ func init() { func init() { proto.RegisterFile("ojo/gmp/v1/gmp.proto", fileDescriptor_199820a7e9d7929f) } var fileDescriptor_199820a7e9d7929f = []byte{ - // 303 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xb1, 0x4e, 0x42, 0x31, - 0x18, 0x85, 0x6f, 0x85, 0x60, 0xac, 0x0e, 0x5a, 0x19, 0xae, 0x0c, 0x95, 0x30, 0x18, 0x12, 0x23, - 0x0d, 0xf1, 0x09, 0x14, 0x13, 0x27, 0x13, 0x43, 0x9c, 0x5c, 0x48, 0xe1, 0x36, 0xe5, 0x02, 0xed, - 0xdf, 0xdc, 0x16, 0x94, 0xb7, 0x70, 0xf4, 0x91, 0x18, 0x19, 0x1d, 0x15, 0x5e, 0xc4, 0xb4, 0xf5, - 0x9a, 0x3b, 0xf5, 0x3f, 0xe7, 0x7c, 0xf9, 0x7b, 0xd2, 0xe2, 0x26, 0xcc, 0x80, 0x49, 0x65, 0xd8, - 0xaa, 0xef, 0x8f, 0x9e, 0x29, 0xc0, 0x01, 0xc1, 0x30, 0x83, 0x9e, 0x97, 0xab, 0x7e, 0xab, 0x29, - 0x41, 0x42, 0xb0, 0x99, 0x9f, 0x22, 0xd1, 0xba, 0x98, 0x80, 0x55, 0x60, 0x47, 0x31, 0x88, 0x22, - 0x46, 0x9d, 0x39, 0x6e, 0x3c, 0xf3, 0x82, 0x2b, 0x4b, 0x2e, 0xf1, 0xb1, 0x54, 0x66, 0xc4, 0xb3, - 0xac, 0x10, 0xd6, 0xa6, 0xa8, 0x8d, 0xba, 0x47, 0x43, 0x2c, 0x95, 0xb9, 0x8b, 0x4e, 0x09, 0x4c, - 0xa6, 0x5c, 0x6b, 0xb1, 0x48, 0x0f, 0xfe, 0x81, 0x41, 0x74, 0x4a, 0xc0, 0xe5, 0x4a, 0xc0, 0xd2, - 0xa5, 0xb5, 0x36, 0xea, 0xd6, 0x02, 0xf0, 0x12, 0x9d, 0xce, 0x27, 0xc2, 0xf8, 0x51, 0x99, 0x27, - 0x61, 0x2d, 0x97, 0x82, 0x5c, 0xe3, 0xb3, 0x4c, 0x58, 0x97, 0x6b, 0xee, 0x72, 0xd0, 0x7e, 0x71, - 0xae, 0xff, 0xee, 0x3d, 0xad, 0x04, 0x03, 0xef, 0x13, 0x86, 0xcf, 0xab, 0x70, 0x59, 0x33, 0xb6, - 0x20, 0x95, 0xa8, 0xac, 0x9b, 0xe2, 0x43, 0xc3, 0xd7, 0x0b, 0xe0, 0x59, 0x68, 0x72, 0x32, 0x2c, - 0x25, 0x21, 0xb8, 0xee, 0xd6, 0x46, 0xa4, 0xf5, 0x50, 0x30, 0xcc, 0xf7, 0x0f, 0x9b, 0x1f, 0x9a, - 0x6c, 0x76, 0x14, 0x6d, 0x77, 0x14, 0x7d, 0xef, 0x28, 0xfa, 0xd8, 0xd3, 0x64, 0xbb, 0xa7, 0xc9, - 0xd7, 0x9e, 0x26, 0xaf, 0x57, 0x32, 0x77, 0xd3, 0xe5, 0xb8, 0x37, 0x01, 0xc5, 0x60, 0x06, 0x37, - 0x5a, 0xb8, 0x37, 0x28, 0xe6, 0x7e, 0x66, 0xef, 0xe1, 0x47, 0xfc, 0x12, 0x3b, 0x6e, 0x84, 0x47, - 0xbd, 0xfd, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x07, 0x1d, 0xa3, 0xa9, 0x01, 0x00, 0x00, + // 294 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xb1, 0x4e, 0xf3, 0x30, + 0x10, 0xc7, 0xe3, 0xaf, 0x55, 0x3f, 0x61, 0x18, 0xc0, 0x74, 0x88, 0x18, 0x4c, 0xd5, 0x01, 0x55, + 0x42, 0xc4, 0xaa, 0x78, 0x02, 0x28, 0x12, 0x13, 0x12, 0xaa, 0x98, 0x58, 0x90, 0xdb, 0x58, 0x6e, + 0xd2, 0xda, 0x67, 0xc5, 0x6e, 0xa1, 0x6f, 0xc1, 0xc8, 0x23, 0x75, 0xec, 0xc8, 0x08, 0xc9, 0x8b, + 0x20, 0x3b, 0x04, 0x65, 0xf2, 0xdd, 0xff, 0x7e, 0x3a, 0xff, 0x74, 0xb8, 0x0f, 0x39, 0x30, 0xa9, + 0x0c, 0xdb, 0x8c, 0xfd, 0x93, 0x98, 0x02, 0x1c, 0x10, 0x0c, 0x39, 0x24, 0xbe, 0xdd, 0x8c, 0xcf, + 0xfa, 0x12, 0x24, 0x84, 0x98, 0xf9, 0xaa, 0x26, 0x86, 0x4b, 0xdc, 0x7b, 0xe4, 0x05, 0x57, 0x96, + 0x9c, 0xe3, 0x43, 0xa9, 0xcc, 0x0b, 0x4f, 0xd3, 0x42, 0x58, 0x1b, 0xa3, 0x01, 0x1a, 0x1d, 0x4c, + 0xb1, 0x54, 0xe6, 0xa6, 0x4e, 0x1a, 0x60, 0xbe, 0xe0, 0x5a, 0x8b, 0x55, 0xfc, 0xef, 0x0f, 0x98, + 0xd4, 0x49, 0x03, 0xb8, 0x4c, 0x09, 0x58, 0xbb, 0xb8, 0x33, 0x40, 0xa3, 0x4e, 0x00, 0x9e, 0xea, + 0x64, 0xf8, 0x81, 0x30, 0xbe, 0x57, 0xe6, 0x41, 0x58, 0xcb, 0xa5, 0x20, 0x97, 0xf8, 0x24, 0x15, + 0xd6, 0x65, 0x9a, 0xbb, 0x0c, 0xb4, 0x5f, 0x9c, 0xe9, 0xdf, 0x7f, 0x8f, 0x5b, 0x83, 0x89, 0xcf, + 0x09, 0xc3, 0xa7, 0x6d, 0xb8, 0xd1, 0xac, 0x2d, 0x48, 0x6b, 0xd4, 0xe8, 0xc6, 0xf8, 0xbf, 0xe1, + 0xdb, 0x15, 0xf0, 0x34, 0x98, 0x1c, 0x4d, 0x9b, 0x96, 0x10, 0xdc, 0x75, 0x5b, 0x23, 0xe2, 0x6e, + 0x10, 0x0c, 0xf5, 0xed, 0xdd, 0xee, 0x9b, 0x46, 0xbb, 0x92, 0xa2, 0x7d, 0x49, 0xd1, 0x57, 0x49, + 0xd1, 0x7b, 0x45, 0xa3, 0x7d, 0x45, 0xa3, 0xcf, 0x8a, 0x46, 0xcf, 0x17, 0x32, 0x73, 0x8b, 0xf5, + 0x2c, 0x99, 0x83, 0x62, 0x90, 0xc3, 0x95, 0x16, 0xee, 0x15, 0x8a, 0xa5, 0xaf, 0xd9, 0x5b, 0x38, + 0xbb, 0x5f, 0x62, 0x67, 0xbd, 0x70, 0xd4, 0xeb, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xcc, + 0xf0, 0xf6, 0x8e, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/gmp/types/msgs.go b/x/gmp/types/msgs.go index 72d8bd4a..d6095bb4 100644 --- a/x/gmp/types/msgs.go +++ b/x/gmp/types/msgs.go @@ -44,7 +44,13 @@ func (msg MsgSetParams) ValidateBasic() error { return nil } -func NewMsgRelay(relayer string, destinationChain string, destinationAddress string, token sdk.Coin, denoms []string) *MsgRelay { +func NewMsgRelay( + relayer string, + destinationChain string, + destinationAddress string, + token sdk.Coin, + denoms []string, +) *MsgRelay { return &MsgRelay{ Relayer: relayer, DestinationChain: destinationChain, diff --git a/x/gmp/types/tx.pb.go b/x/gmp/types/tx.pb.go index f79186f3..a30d8eee 100644 --- a/x/gmp/types/tx.pb.go +++ b/x/gmp/types/tx.pb.go @@ -35,7 +35,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgSetParams 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 airdrop parameters to update. + // params defines the gmp parameters to update. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } @@ -109,6 +109,7 @@ func (m *MsgSetParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetParamsResponse proto.InternalMessageInfo +// MsgRelay defines the Relay message type. type MsgRelay struct { // authority is the address that signs the message. Relayer string `protobuf:"bytes,1,opt,name=relayer,proto3" json:"relayer,omitempty"` @@ -155,6 +156,7 @@ func (m *MsgRelay) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRelay proto.InternalMessageInfo +// MsgRelay defines the Relay response type. type MsgRelayResponse struct { } @@ -248,7 +250,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 { - // SetParams sets the parameters for the airdrop module. + // SetParams sets the parameters for the gmp module. SetParams(ctx context.Context, in *MsgSetParams, opts ...grpc.CallOption) (*MsgSetParamsResponse, error) // Relay relays Ojo data via GMP. Relay(ctx context.Context, in *MsgRelay, opts ...grpc.CallOption) (*MsgRelayResponse, error) @@ -282,7 +284,7 @@ func (c *msgClient) Relay(ctx context.Context, in *MsgRelay, opts ...grpc.CallOp // MsgServer is the server API for Msg service. type MsgServer interface { - // SetParams sets the parameters for the airdrop module. + // SetParams sets the parameters for the gmp module. SetParams(context.Context, *MsgSetParams) (*MsgSetParamsResponse, error) // Relay relays Ojo data via GMP. Relay(context.Context, *MsgRelay) (*MsgRelayResponse, error) From 2916da5b8ed6df320c2f7ed7a4f3d93921423092 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:46:00 -0800 Subject: [PATCH 11/13] add references to the todos --- x/gmp/client/tests/suite.go | 3 ++- x/gmp/keeper/msg_server.go | 7 ++++--- x/gmp/types/abi_encoding_test.go | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/x/gmp/client/tests/suite.go b/x/gmp/client/tests/suite.go index c002b4ef..2c7cbcf1 100644 --- a/x/gmp/client/tests/suite.go +++ b/x/gmp/client/tests/suite.go @@ -39,7 +39,8 @@ func (s *IntegrationTestSuite) TearDownSuite() { s.network.Cleanup() } -// TODO: Fix tx raw log not having "no gmp account found" message in it +// TODO: Fix tx raw log not having "no gmp account found" message in it. +// Ref: https://github.com/ojo-network/ojo/issues/308 func (s *IntegrationTestSuite) TestRelayGmp() { s.T().Skip() diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go index f25e60b6..b76a213c 100644 --- a/x/gmp/keeper/msg_server.go +++ b/x/gmp/keeper/msg_server.go @@ -67,9 +67,9 @@ func (ms msgServer) Relay( priceFeed, err := types.NewPriceFeedData( denom, types.DecToInt(rate), - // TODO: replace with actual resolve time + // TODO: replace with actual resolve time & id + // Ref: https://github.com/ojo-network/ojo/issues/309 big.NewInt(1), - // TODO: replace with actual id big.NewInt(1), ) if err != nil { @@ -80,7 +80,8 @@ func (ms msgServer) Relay( rates = append(rates, priceFeed) } - // TODO: Fill with actual disableResolve option. + // TODO: fill with actual disableResolve option + // Ref: https://github.com/ojo-network/ojo/issues/309 payload, err := types.EncodeABI("postPrices", rates, false) if err != nil { return nil, err diff --git a/x/gmp/types/abi_encoding_test.go b/x/gmp/types/abi_encoding_test.go index 049ef1cb..5c3f8b7a 100644 --- a/x/gmp/types/abi_encoding_test.go +++ b/x/gmp/types/abi_encoding_test.go @@ -9,7 +9,8 @@ import ( ) // TODO: Make these tests more thorough -func TestEncodeExchangeRates(t *testing.T) { +// Ref: https://github.com/ojo-network/ojo/issues/310 +func TestEncodeABI(t *testing.T) { assetNameArray := [32]byte{} copy(assetNameArray[:], []byte("btc")) rates := [1]PriceFeedData{ From 0d3fec6b6ed2a5034e4497eeab73a7046e1f082c Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:59:16 -0800 Subject: [PATCH 12/13] some cleanup & file renaming --- x/gmp/keeper/msg_server.go | 2 +- x/gmp/types/abi_encoding.go | 9 ------- x/gmp/types/gmp_message_types.go | 12 --------- .../{exchange_rate.go => gmp_messages.go} | 27 ++++++++++++++++--- 4 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 x/gmp/types/gmp_message_types.go rename x/gmp/types/{exchange_rate.go => gmp_messages.go} (58%) diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go index b76a213c..0f9f603b 100644 --- a/x/gmp/keeper/msg_server.go +++ b/x/gmp/keeper/msg_server.go @@ -66,7 +66,7 @@ func (ms msgServer) Relay( priceFeed, err := types.NewPriceFeedData( denom, - types.DecToInt(rate), + rate, // TODO: replace with actual resolve time & id // Ref: https://github.com/ojo-network/ojo/issues/309 big.NewInt(1), diff --git a/x/gmp/types/abi_encoding.go b/x/gmp/types/abi_encoding.go index d09f43b3..fabb8bd5 100644 --- a/x/gmp/types/abi_encoding.go +++ b/x/gmp/types/abi_encoding.go @@ -2,15 +2,11 @@ package types import ( "fmt" - "math/big" "strings" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts/abi" ) -var rateFactor = sdk.NewDec(10).Power(9) - type FnName string const ( @@ -43,8 +39,3 @@ func EncodeABI(fn string, params ...interface{}) ([]byte, error) { return []byte{}, fmt.Errorf("invalid function name") } } - -// DecToInt multiplies amount by rate factor to make it compatible with contracts. -func DecToInt(amount sdk.Dec) *big.Int { - return amount.Mul(rateFactor).TruncateInt().BigInt() -} diff --git a/x/gmp/types/gmp_message_types.go b/x/gmp/types/gmp_message_types.go deleted file mode 100644 index cb61bc11..00000000 --- a/x/gmp/types/gmp_message_types.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -const ( - // TypeUnrecognized means coin type is unrecognized - TypeUnrecognized = iota - // TypeGeneralMessage is a pure message - TypeGeneralMessage - // TypeGeneralMessageWithToken is a general message with token - TypeGeneralMessageWithToken - // TypeSendToken is a direct token transfer - TypeSendToken -) diff --git a/x/gmp/types/exchange_rate.go b/x/gmp/types/gmp_messages.go similarity index 58% rename from x/gmp/types/exchange_rate.go rename to x/gmp/types/gmp_messages.go index d6b9ea4b..fe206b64 100644 --- a/x/gmp/types/exchange_rate.go +++ b/x/gmp/types/gmp_messages.go @@ -3,8 +3,23 @@ package types import ( "fmt" "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // TypeUnrecognized means coin type is unrecognized + TypeUnrecognized = iota + // TypeGeneralMessage is a pure message + TypeGeneralMessage + // TypeGeneralMessageWithToken is a general message with token + TypeGeneralMessageWithToken + // TypeSendToken is a direct token transfer + TypeSendToken ) +var rateFactor = sdk.NewDec(10).Power(9) + // PriceFeedData is a struct to represent the data that is relayed to other chains. // It contains the asset name, value, resolve time, and id. // The AssetName is an array of bytes, not a list, because lists are not @@ -21,24 +36,30 @@ type PriceFeedData struct { // NewPriceFeedData creates a new PriceFeedData struct. // It must convert the assetName string to a byte array. // This array may not exceed 32 bytes. +// TODO: Add a test for this function. func NewPriceFeedData( assetName string, - value *big.Int, + value sdk.Dec, resolveTime *big.Int, id *big.Int, ) (PriceFeedData, error) { assetSlice := []byte(assetName) if len(assetSlice) > 32 { return PriceFeedData{}, fmt.Errorf( - "failed to parse pruning options from flags: %s", assetName, + "asset name is too long to convert to array: %s", assetName, ) } var assetArray [32]byte copy(assetArray[:], assetSlice) return PriceFeedData{ AssetName: assetArray, - Value: value, + Value: decToInt(value), ResolveTime: resolveTime, Id: id, }, nil } + +// DecToInt multiplies amount by rate factor to make it compatible with contracts. +func decToInt(amount sdk.Dec) *big.Int { + return amount.Mul(rateFactor).TruncateInt().BigInt() +} From 4810ae9739d617d1b25045261f8a54d42b08f773 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:33:28 -0800 Subject: [PATCH 13/13] review fixes --- proto/ojo/gmp/v1/tx.proto | 6 +- x/gmp/keeper/msg_server.go | 14 +-- x/gmp/keeper/msg_server_test.go | 3 + x/gmp/types/abi_encoding_test.go | 4 +- x/gmp/types/codec.go | 4 +- x/gmp/types/msgs.go | 12 +- x/gmp/types/tx.pb.go | 184 +++++++++++++++---------------- 7 files changed, 114 insertions(+), 113 deletions(-) diff --git a/proto/ojo/gmp/v1/tx.proto b/proto/ojo/gmp/v1/tx.proto index b3dca7ba..96838445 100644 --- a/proto/ojo/gmp/v1/tx.proto +++ b/proto/ojo/gmp/v1/tx.proto @@ -15,7 +15,7 @@ service Msg { rpc SetParams(MsgSetParams) returns (MsgSetParamsResponse); // Relay relays Ojo data via GMP. - rpc Relay(MsgRelay) returns (MsgRelayResponse); + rpc RelayPrice(MsgRelayPrice) returns (MsgRelayPriceResponse); } // MsgSetParams defines the SetParams message type. @@ -35,7 +35,7 @@ message MsgSetParams { message MsgSetParamsResponse {} // MsgRelay defines the Relay message type. -message MsgRelay { +message MsgRelayPrice { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "relayer"; @@ -60,4 +60,4 @@ message MsgRelay { } // MsgRelay defines the Relay response type. -message MsgRelayResponse {} +message MsgRelayPriceResponse {} diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go index 0f9f603b..015cdf72 100644 --- a/x/gmp/keeper/msg_server.go +++ b/x/gmp/keeper/msg_server.go @@ -49,10 +49,10 @@ func (ms msgServer) SetParams(goCtx context.Context, msg *types.MsgSetParams) (* // Relay implements MsgServer.Relay method. // It defines a method to relay over GMP to recipient chains. -func (ms msgServer) Relay( +func (ms msgServer) RelayPrice( goCtx context.Context, - msg *types.MsgRelay, -) (*types.MsgRelayResponse, error) { + msg *types.MsgRelayPrice, +) (*types.MsgRelayPriceResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) params := ms.keeper.GetParams(ctx) @@ -61,7 +61,7 @@ func (ms msgServer) Relay( for _, denom := range msg.Denoms { rate, err := ms.keeper.oracleKeeper.GetExchangeRate(ctx, denom) if err != nil { - return &types.MsgRelayResponse{}, err + return &types.MsgRelayPriceResponse{}, err } priceFeed, err := types.NewPriceFeedData( @@ -73,7 +73,7 @@ func (ms msgServer) Relay( big.NewInt(1), ) if err != nil { - ms.keeper.Logger(ctx).With(err).Error("asset name is too long to relay!") + ms.keeper.Logger(ctx).With(err).Error("unable to relay price to gmp") continue } @@ -113,8 +113,8 @@ func (ms msgServer) Relay( _, err = ms.keeper.ibcKeeper.Transfer(ctx, transferMsg) if err != nil { - return &types.MsgRelayResponse{}, err + return &types.MsgRelayPriceResponse{}, err } - return &types.MsgRelayResponse{}, nil + return &types.MsgRelayPriceResponse{}, nil } diff --git a/x/gmp/keeper/msg_server_test.go b/x/gmp/keeper/msg_server_test.go index 03765c15..3a91e6c8 100644 --- a/x/gmp/keeper/msg_server_test.go +++ b/x/gmp/keeper/msg_server_test.go @@ -4,6 +4,9 @@ import ( "github.com/ojo-network/ojo/x/gmp/types" ) +// TODO: Add tests for RelayPrice +// Ref: https://github.com/ojo-network/ojo/issues/313 + func (s *IntegrationTestSuite) TestMsgServer_SetParams() { gmpChannel := "channel-1" gmpAddress := "axelar1dv4u5k73pzqrxlzujxg3qp8kvc3pje7jtdvu72npnt5zhq05ejcsn5qme5" diff --git a/x/gmp/types/abi_encoding_test.go b/x/gmp/types/abi_encoding_test.go index 5c3f8b7a..0072efed 100644 --- a/x/gmp/types/abi_encoding_test.go +++ b/x/gmp/types/abi_encoding_test.go @@ -1,7 +1,6 @@ package types import ( - "fmt" "math/big" "testing" @@ -22,7 +21,6 @@ func TestEncodeABI(t *testing.T) { }, } disableResolve := false - r, err := EncodeABI("postPrices", rates, disableResolve) + _, err := EncodeABI("postPrices", rates, disableResolve) require.NoError(t, err) - fmt.Println(r) } diff --git a/x/gmp/types/codec.go b/x/gmp/types/codec.go index 49ed01cc..bf5ad883 100644 --- a/x/gmp/types/codec.go +++ b/x/gmp/types/codec.go @@ -29,14 +29,14 @@ func init() { // RegisterLegacyAminoCodec registers the necessary x/gmp interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgRelay{}, "ojo/gmp/MsgRelay", nil) + cdc.RegisterConcrete(&MsgRelayPrice{}, "ojo/gmp/MsgRelayPrice", nil) cdc.RegisterConcrete(&MsgSetParams{}, "ojo/gmp/MsgSetParams", nil) } // RegisterInterfaces registers the x/gmp interfaces types with the interface registry func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgRelay{}, + &MsgRelayPrice{}, &MsgSetParams{}, ) diff --git a/x/gmp/types/msgs.go b/x/gmp/types/msgs.go index d6095bb4..e9c3a000 100644 --- a/x/gmp/types/msgs.go +++ b/x/gmp/types/msgs.go @@ -50,8 +50,8 @@ func NewMsgRelay( destinationAddress string, token sdk.Coin, denoms []string, -) *MsgRelay { - return &MsgRelay{ +) *MsgRelayPrice { + return &MsgRelayPrice{ Relayer: relayer, DestinationChain: destinationChain, DestinationAddress: destinationAddress, @@ -61,20 +61,20 @@ func NewMsgRelay( } // Type implements LegacyMsg interface -func (msg MsgRelay) Type() string { return sdk.MsgTypeURL(&msg) } +func (msg MsgRelayPrice) Type() string { return sdk.MsgTypeURL(&msg) } // GetSignBytes implements sdk.Msg -func (msg MsgRelay) GetSignBytes() []byte { +func (msg MsgRelayPrice) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) } // GetSigners implements sdk.Msg -func (msg MsgRelay) GetSigners() []sdk.AccAddress { +func (msg MsgRelayPrice) GetSigners() []sdk.AccAddress { return checkers.Signers(msg.Relayer) } // ValidateBasic Implements sdk.Msg -func (msg MsgRelay) ValidateBasic() error { +func (msg MsgRelayPrice) ValidateBasic() error { // TODO validate relay msg return nil } diff --git a/x/gmp/types/tx.pb.go b/x/gmp/types/tx.pb.go index a30d8eee..0a76adcb 100644 --- a/x/gmp/types/tx.pb.go +++ b/x/gmp/types/tx.pb.go @@ -109,8 +109,8 @@ func (m *MsgSetParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetParamsResponse proto.InternalMessageInfo -// MsgRelay defines the Relay message type. -type MsgRelay struct { +// MsgRelayPrice defines the Relay message type. +type MsgRelayPrice struct { // authority is the address that signs the message. Relayer string `protobuf:"bytes,1,opt,name=relayer,proto3" json:"relayer,omitempty"` // destination_chain defines the chain which this will be relayed to. @@ -123,18 +123,18 @@ type MsgRelay struct { Token types.Coin `protobuf:"bytes,5,opt,name=token,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"token"` } -func (m *MsgRelay) Reset() { *m = MsgRelay{} } -func (m *MsgRelay) String() string { return proto.CompactTextString(m) } -func (*MsgRelay) ProtoMessage() {} -func (*MsgRelay) Descriptor() ([]byte, []int) { +func (m *MsgRelayPrice) Reset() { *m = MsgRelayPrice{} } +func (m *MsgRelayPrice) String() string { return proto.CompactTextString(m) } +func (*MsgRelayPrice) ProtoMessage() {} +func (*MsgRelayPrice) Descriptor() ([]byte, []int) { return fileDescriptor_5f28b599a8e3f91d, []int{2} } -func (m *MsgRelay) XXX_Unmarshal(b []byte) error { +func (m *MsgRelayPrice) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRelay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRelayPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRelay.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRelayPrice.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -144,34 +144,34 @@ func (m *MsgRelay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *MsgRelay) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRelay.Merge(m, src) +func (m *MsgRelayPrice) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRelayPrice.Merge(m, src) } -func (m *MsgRelay) XXX_Size() int { +func (m *MsgRelayPrice) XXX_Size() int { return m.Size() } -func (m *MsgRelay) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRelay.DiscardUnknown(m) +func (m *MsgRelayPrice) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRelayPrice.DiscardUnknown(m) } -var xxx_messageInfo_MsgRelay proto.InternalMessageInfo +var xxx_messageInfo_MsgRelayPrice proto.InternalMessageInfo // MsgRelay defines the Relay response type. -type MsgRelayResponse struct { +type MsgRelayPriceResponse struct { } -func (m *MsgRelayResponse) Reset() { *m = MsgRelayResponse{} } -func (m *MsgRelayResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRelayResponse) ProtoMessage() {} -func (*MsgRelayResponse) Descriptor() ([]byte, []int) { +func (m *MsgRelayPriceResponse) Reset() { *m = MsgRelayPriceResponse{} } +func (m *MsgRelayPriceResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRelayPriceResponse) ProtoMessage() {} +func (*MsgRelayPriceResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5f28b599a8e3f91d, []int{3} } -func (m *MsgRelayResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgRelayPriceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRelayPriceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRelayResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRelayPriceResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -181,61 +181,61 @@ func (m *MsgRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *MsgRelayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRelayResponse.Merge(m, src) +func (m *MsgRelayPriceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRelayPriceResponse.Merge(m, src) } -func (m *MsgRelayResponse) XXX_Size() int { +func (m *MsgRelayPriceResponse) XXX_Size() int { return m.Size() } -func (m *MsgRelayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRelayResponse.DiscardUnknown(m) +func (m *MsgRelayPriceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRelayPriceResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgRelayResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgRelayPriceResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgSetParams)(nil), "ojo.gmp.v1.MsgSetParams") proto.RegisterType((*MsgSetParamsResponse)(nil), "ojo.gmp.v1.MsgSetParamsResponse") - proto.RegisterType((*MsgRelay)(nil), "ojo.gmp.v1.MsgRelay") - proto.RegisterType((*MsgRelayResponse)(nil), "ojo.gmp.v1.MsgRelayResponse") + proto.RegisterType((*MsgRelayPrice)(nil), "ojo.gmp.v1.MsgRelayPrice") + proto.RegisterType((*MsgRelayPriceResponse)(nil), "ojo.gmp.v1.MsgRelayPriceResponse") } func init() { proto.RegisterFile("ojo/gmp/v1/tx.proto", fileDescriptor_5f28b599a8e3f91d) } var fileDescriptor_5f28b599a8e3f91d = []byte{ - // 503 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xb6, 0x5b, 0x12, 0xc8, 0xc1, 0x50, 0xae, 0x56, 0x70, 0x23, 0xe4, 0x44, 0x19, 0x50, 0x54, - 0x14, 0x1f, 0x09, 0x12, 0x43, 0x59, 0x20, 0x1d, 0x98, 0x22, 0x21, 0x77, 0x63, 0xa9, 0x2e, 0xf1, - 0xe9, 0xe2, 0x04, 0xdf, 0xb3, 0x7c, 0xd7, 0xd0, 0xac, 0x4c, 0x08, 0x16, 0x7e, 0x42, 0x67, 0x24, - 0x24, 0x06, 0x7e, 0x44, 0xc7, 0x8a, 0x89, 0x09, 0x50, 0x32, 0xc0, 0xcf, 0x40, 0xbe, 0x3b, 0x2b, - 0x16, 0x02, 0x31, 0xe5, 0xde, 0xfb, 0xbe, 0xf7, 0xdd, 0xbb, 0xef, 0x8b, 0xd1, 0x3e, 0xcc, 0x81, - 0xf0, 0x34, 0x23, 0xcb, 0x01, 0x51, 0xe7, 0x61, 0x96, 0x83, 0x02, 0x8c, 0x60, 0x0e, 0x21, 0x4f, - 0xb3, 0x70, 0x39, 0x68, 0x79, 0x1c, 0x38, 0xe8, 0x36, 0x29, 0x4e, 0x86, 0xd1, 0xf2, 0x2a, 0x63, - 0x05, 0xd1, 0x74, 0x0f, 0xa6, 0x20, 0x53, 0x90, 0xa7, 0x86, 0x6e, 0x0a, 0x0b, 0xdd, 0x31, 0x15, - 0x49, 0x25, 0x2f, 0x66, 0x52, 0xc9, 0x2d, 0x10, 0x58, 0x60, 0x42, 0x25, 0x23, 0xcb, 0xc1, 0x84, - 0x29, 0x3a, 0x20, 0x53, 0x48, 0x84, 0xc1, 0xbb, 0x6f, 0x5d, 0x74, 0x6b, 0x2c, 0xf9, 0x09, 0x53, - 0xcf, 0x69, 0x4e, 0x53, 0x89, 0x1f, 0xa1, 0x06, 0x3d, 0x53, 0x33, 0xc8, 0x13, 0xb5, 0xf2, 0xdd, - 0x8e, 0xdb, 0x6b, 0x8c, 0xfc, 0x2f, 0x9f, 0xfb, 0x9e, 0xbd, 0xee, 0x69, 0x1c, 0xe7, 0x4c, 0xca, - 0x13, 0x95, 0x27, 0x82, 0x47, 0x5b, 0x2a, 0x3e, 0x44, 0xf5, 0x4c, 0x2b, 0xf8, 0x3b, 0x1d, 0xb7, - 0x77, 0x73, 0x88, 0xc3, 0xed, 0x2b, 0x43, 0xa3, 0x1d, 0x59, 0xc6, 0x51, 0xf3, 0xcd, 0x45, 0xdb, - 0xf9, 0x75, 0xd1, 0x76, 0x5e, 0xff, 0xfc, 0x74, 0xb8, 0xd5, 0xe8, 0x36, 0x91, 0x57, 0xdd, 0x25, - 0x62, 0x32, 0x03, 0x21, 0x59, 0xf7, 0xe3, 0x0e, 0xba, 0x31, 0x96, 0x3c, 0x62, 0x2f, 0xe9, 0x0a, - 0x0f, 0xd1, 0xf5, 0xbc, 0x38, 0xb0, 0xfc, 0xbf, 0xeb, 0x95, 0x44, 0x7c, 0x1f, 0xdd, 0x8e, 0x99, - 0x54, 0x89, 0xa0, 0x2a, 0x01, 0x71, 0x3a, 0x9d, 0xd1, 0x44, 0xe8, 0x3d, 0x1b, 0xd1, 0x5e, 0x05, - 0x38, 0x2e, 0xfa, 0x98, 0xa0, 0xfd, 0x2a, 0x99, 0x1a, 0x49, 0x7f, 0x57, 0xd3, 0x71, 0x05, 0xb2, - 0x97, 0xe1, 0x26, 0xaa, 0xc7, 0x4c, 0x40, 0x2a, 0xfd, 0x6b, 0x9d, 0xdd, 0x5e, 0x23, 0xb2, 0x15, - 0xa6, 0xa8, 0xa6, 0x60, 0xc1, 0x84, 0x5f, 0xd3, 0x8e, 0x1c, 0x84, 0x76, 0xc9, 0x22, 0x8b, 0xd0, - 0x66, 0x11, 0x1e, 0x43, 0x22, 0x46, 0x0f, 0x2e, 0xbf, 0xb5, 0x9d, 0x0f, 0xdf, 0xdb, 0x3d, 0x9e, - 0xa8, 0xd9, 0xd9, 0x24, 0x9c, 0x42, 0x6a, 0xf3, 0xb5, 0x3f, 0x7d, 0x19, 0x2f, 0x88, 0x5a, 0x65, - 0x4c, 0xea, 0x01, 0x19, 0x19, 0xe5, 0x23, 0xaf, 0xea, 0x64, 0xf9, 0xdc, 0x2e, 0x46, 0x7b, 0xa5, - 0x5d, 0xa5, 0x87, 0xc3, 0x77, 0x2e, 0xda, 0x1d, 0x4b, 0x8e, 0x9f, 0xa1, 0xc6, 0x36, 0x6c, 0xbf, - 0x1a, 0x52, 0xd5, 0xfa, 0x56, 0xe7, 0x5f, 0x48, 0x29, 0x88, 0x1f, 0xa3, 0x9a, 0x09, 0xc4, 0xfb, - 0x83, 0xaa, 0xbb, 0xad, 0xbb, 0x7f, 0xeb, 0x96, 0xc3, 0xa3, 0x27, 0x97, 0xeb, 0xc0, 0xbd, 0x5a, - 0x07, 0xee, 0x8f, 0x75, 0xe0, 0xbe, 0xdf, 0x04, 0xce, 0xd5, 0x26, 0x70, 0xbe, 0x6e, 0x02, 0xe7, - 0xc5, 0xbd, 0x8a, 0x05, 0x30, 0x87, 0xbe, 0x60, 0xea, 0x15, 0xe4, 0x8b, 0xe2, 0x4c, 0xce, 0xf5, - 0x37, 0xa1, 0x6d, 0x98, 0xd4, 0xf5, 0xff, 0xf7, 0xe1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, - 0x1a, 0xa2, 0xfd, 0x62, 0x03, 0x00, 0x00, + // 509 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xb1, 0x6f, 0xd3, 0x4e, + 0x14, 0xb6, 0x9b, 0x5f, 0xf3, 0x53, 0x0e, 0x90, 0xe0, 0x1a, 0x52, 0x27, 0x83, 0x13, 0x32, 0xa0, + 0xa8, 0x28, 0x3e, 0x12, 0x24, 0x86, 0x4e, 0x90, 0x0e, 0x48, 0x48, 0x91, 0x2a, 0x77, 0x63, 0xa9, + 0x2e, 0xf6, 0xe9, 0xe2, 0x04, 0xdf, 0xb3, 0x7c, 0xd7, 0xd0, 0xac, 0x4c, 0x88, 0x89, 0x99, 0xa9, + 0x33, 0x13, 0x42, 0xfc, 0x11, 0x1d, 0x2b, 0x26, 0x26, 0x40, 0xc9, 0x00, 0x7f, 0x06, 0xb2, 0x7d, + 0x96, 0x0f, 0xa4, 0x8a, 0x29, 0xf7, 0xde, 0xf7, 0xbd, 0xef, 0xde, 0x7d, 0x5f, 0x8c, 0xf6, 0x60, + 0x01, 0x84, 0xc7, 0x09, 0x59, 0x8d, 0x88, 0x3a, 0xf7, 0x92, 0x14, 0x14, 0x60, 0x04, 0x0b, 0xf0, + 0x78, 0x9c, 0x78, 0xab, 0x51, 0xa7, 0xc9, 0x81, 0x43, 0xde, 0x26, 0xd9, 0xa9, 0x60, 0x74, 0x9a, + 0xc6, 0x58, 0x46, 0x2c, 0xba, 0xed, 0x00, 0x64, 0x0c, 0xf2, 0xb4, 0xa0, 0x17, 0x85, 0x86, 0xf6, + 0x8b, 0x8a, 0xc4, 0x92, 0x67, 0x33, 0xb1, 0xe4, 0x1a, 0x70, 0x35, 0x30, 0xa3, 0x92, 0x91, 0xd5, + 0x68, 0xc6, 0x14, 0x1d, 0x91, 0x00, 0x22, 0x51, 0xe0, 0xfd, 0xb7, 0x36, 0xba, 0x39, 0x95, 0xfc, + 0x84, 0xa9, 0x63, 0x9a, 0xd2, 0x58, 0xe2, 0xc7, 0xa8, 0x41, 0xcf, 0xd4, 0x1c, 0xd2, 0x48, 0xad, + 0x1d, 0xbb, 0x67, 0x0f, 0x1a, 0x13, 0xe7, 0xcb, 0xe7, 0x61, 0x53, 0x5f, 0xf7, 0x34, 0x0c, 0x53, + 0x26, 0xe5, 0x89, 0x4a, 0x23, 0xc1, 0xfd, 0x8a, 0x8a, 0x0f, 0x50, 0x3d, 0xc9, 0x15, 0x9c, 0x9d, + 0x9e, 0x3d, 0xb8, 0x31, 0xc6, 0x5e, 0xf5, 0x4a, 0xaf, 0xd0, 0xf6, 0x35, 0xe3, 0xb0, 0xf5, 0xe6, + 0xa2, 0x6b, 0xfd, 0xba, 0xe8, 0x5a, 0xaf, 0x7f, 0x7e, 0x3c, 0xa8, 0x34, 0xfa, 0x2d, 0xd4, 0x34, + 0x77, 0xf1, 0x99, 0x4c, 0x40, 0x48, 0xd6, 0xff, 0xb4, 0x83, 0x6e, 0x4d, 0x25, 0xf7, 0xd9, 0x4b, + 0xba, 0x3e, 0x4e, 0xa3, 0x80, 0xe1, 0x31, 0xfa, 0x3f, 0xcd, 0x2a, 0x96, 0xfe, 0x73, 0xc7, 0x92, + 0x88, 0x1f, 0xa0, 0x3b, 0x21, 0x93, 0x2a, 0x12, 0x54, 0x45, 0x20, 0x4e, 0x83, 0x39, 0x8d, 0x44, + 0xbe, 0x6c, 0xc3, 0xbf, 0x6d, 0x00, 0x47, 0x59, 0x1f, 0x13, 0xb4, 0x67, 0x92, 0x69, 0x21, 0xe9, + 0xd4, 0x72, 0x3a, 0x36, 0x20, 0x7d, 0x19, 0x6e, 0xa1, 0x7a, 0xc8, 0x04, 0xc4, 0xd2, 0xf9, 0xaf, + 0x57, 0x1b, 0x34, 0x7c, 0x5d, 0x61, 0x8a, 0x76, 0x15, 0x2c, 0x99, 0x70, 0x76, 0x73, 0x5b, 0xda, + 0x9e, 0x5e, 0x32, 0x0b, 0xc4, 0xd3, 0x81, 0x78, 0x47, 0x10, 0x89, 0xc9, 0xc3, 0xcb, 0x6f, 0x5d, + 0xeb, 0xc3, 0xf7, 0xee, 0x80, 0x47, 0x6a, 0x7e, 0x36, 0xf3, 0x02, 0x88, 0x75, 0xc8, 0xfa, 0x67, + 0x28, 0xc3, 0x25, 0x51, 0xeb, 0x84, 0xc9, 0x7c, 0x40, 0xfa, 0x85, 0xf2, 0x61, 0xd3, 0xb4, 0xb3, + 0x7c, 0x6e, 0x7f, 0x1f, 0xdd, 0xfd, 0xc3, 0xb3, 0xd2, 0xcd, 0xf1, 0x7b, 0x1b, 0xd5, 0xa6, 0x92, + 0xe3, 0x67, 0xa8, 0x51, 0xc5, 0xee, 0x98, 0x71, 0x99, 0x21, 0x74, 0x7a, 0xd7, 0x21, 0xa5, 0x20, + 0x7e, 0x8e, 0x90, 0x11, 0x4d, 0xfb, 0x2f, 0x7e, 0x05, 0x75, 0xee, 0x5d, 0x0b, 0x95, 0x5a, 0x93, + 0x27, 0x97, 0x1b, 0xd7, 0xbe, 0xda, 0xb8, 0xf6, 0x8f, 0x8d, 0x6b, 0xbf, 0xdb, 0xba, 0xd6, 0xd5, + 0xd6, 0xb5, 0xbe, 0x6e, 0x5d, 0xeb, 0xc5, 0x7d, 0xc3, 0x16, 0x58, 0xc0, 0x50, 0x30, 0xf5, 0x0a, + 0xd2, 0x65, 0x76, 0x26, 0xe7, 0xf9, 0xc7, 0x92, 0x5b, 0x33, 0xab, 0xe7, 0x7f, 0xec, 0x47, 0xbf, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x63, 0x69, 0x51, 0x3b, 0x7b, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -253,7 +253,7 @@ type MsgClient interface { // SetParams sets the parameters for the gmp module. SetParams(ctx context.Context, in *MsgSetParams, opts ...grpc.CallOption) (*MsgSetParamsResponse, error) // Relay relays Ojo data via GMP. - Relay(ctx context.Context, in *MsgRelay, opts ...grpc.CallOption) (*MsgRelayResponse, error) + RelayPrice(ctx context.Context, in *MsgRelayPrice, opts ...grpc.CallOption) (*MsgRelayPriceResponse, error) } type msgClient struct { @@ -273,9 +273,9 @@ func (c *msgClient) SetParams(ctx context.Context, in *MsgSetParams, opts ...grp return out, nil } -func (c *msgClient) Relay(ctx context.Context, in *MsgRelay, opts ...grpc.CallOption) (*MsgRelayResponse, error) { - out := new(MsgRelayResponse) - err := c.cc.Invoke(ctx, "/ojo.gmp.v1.Msg/Relay", in, out, opts...) +func (c *msgClient) RelayPrice(ctx context.Context, in *MsgRelayPrice, opts ...grpc.CallOption) (*MsgRelayPriceResponse, error) { + out := new(MsgRelayPriceResponse) + err := c.cc.Invoke(ctx, "/ojo.gmp.v1.Msg/RelayPrice", in, out, opts...) if err != nil { return nil, err } @@ -287,7 +287,7 @@ type MsgServer interface { // SetParams sets the parameters for the gmp module. SetParams(context.Context, *MsgSetParams) (*MsgSetParamsResponse, error) // Relay relays Ojo data via GMP. - Relay(context.Context, *MsgRelay) (*MsgRelayResponse, error) + RelayPrice(context.Context, *MsgRelayPrice) (*MsgRelayPriceResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -297,8 +297,8 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) SetParams(ctx context.Context, req *MsgSetParams) (*MsgSetParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetParams not implemented") } -func (*UnimplementedMsgServer) Relay(ctx context.Context, req *MsgRelay) (*MsgRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Relay not implemented") +func (*UnimplementedMsgServer) RelayPrice(ctx context.Context, req *MsgRelayPrice) (*MsgRelayPriceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayPrice not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { @@ -323,20 +323,20 @@ func _Msg_SetParams_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } -func _Msg_Relay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRelay) +func _Msg_RelayPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRelayPrice) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).Relay(ctx, in) + return srv.(MsgServer).RelayPrice(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ojo.gmp.v1.Msg/Relay", + FullMethod: "/ojo.gmp.v1.Msg/RelayPrice", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Relay(ctx, req.(*MsgRelay)) + return srv.(MsgServer).RelayPrice(ctx, req.(*MsgRelayPrice)) } return interceptor(ctx, in, info, handler) } @@ -350,8 +350,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_SetParams_Handler, }, { - MethodName: "Relay", - Handler: _Msg_Relay_Handler, + MethodName: "RelayPrice", + Handler: _Msg_RelayPrice_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -423,7 +423,7 @@ func (m *MsgSetParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgRelay) Marshal() (dAtA []byte, err error) { +func (m *MsgRelayPrice) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -433,12 +433,12 @@ func (m *MsgRelay) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRelay) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRelayPrice) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRelay) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRelayPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -486,7 +486,7 @@ func (m *MsgRelay) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgRelayResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRelayPriceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -496,12 +496,12 @@ func (m *MsgRelayResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRelayResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRelayPriceResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRelayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRelayPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -546,7 +546,7 @@ func (m *MsgSetParamsResponse) Size() (n int) { return n } -func (m *MsgRelay) Size() (n int) { +func (m *MsgRelayPrice) Size() (n int) { if m == nil { return 0 } @@ -575,7 +575,7 @@ func (m *MsgRelay) Size() (n int) { return n } -func (m *MsgRelayResponse) Size() (n int) { +func (m *MsgRelayPriceResponse) Size() (n int) { if m == nil { return 0 } @@ -758,7 +758,7 @@ func (m *MsgSetParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRelay) Unmarshal(dAtA []byte) error { +func (m *MsgRelayPrice) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -781,10 +781,10 @@ func (m *MsgRelay) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRelay: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRelayPrice: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRelay: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRelayPrice: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -969,7 +969,7 @@ func (m *MsgRelay) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRelayResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRelayPriceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -992,10 +992,10 @@ func (m *MsgRelayResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRelayResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRelayPriceResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRelayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRelayPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: