diff --git a/app/app.go b/app/app.go index 3b7eae529..9b92e6316 100644 --- a/app/app.go +++ b/app/app.go @@ -188,6 +188,11 @@ import ( liquidationsV2keeper "github.com/comdex-official/comdex/x/liquidationsV2/keeper" liquidationsV2types "github.com/comdex-official/comdex/x/liquidationsV2/types" + "github.com/comdex-official/comdex/x/gasless" + gaslessclient "github.com/comdex-official/comdex/x/gasless/client" + gaslesskeeper "github.com/comdex-official/comdex/x/gasless/keeper" + gaslesstypes "github.com/comdex-official/comdex/x/gasless/types" + "github.com/comdex-official/comdex/x/auctionsV2" auctionsV2client "github.com/comdex-official/comdex/x/auctionsV2/client" auctionsV2keeper "github.com/comdex-official/comdex/x/auctionsV2/keeper" @@ -248,6 +253,7 @@ func GetGovProposalHandlers() []govclient.ProposalHandler { proposalHandlers = append(proposalHandlers, liquidityclient.LiquidityProposalHandler...) proposalHandlers = append(proposalHandlers, liquidationsV2client.LiquidationsV2Handler...) proposalHandlers = append(proposalHandlers, auctionsV2client.AuctionsV2Handler...) + proposalHandlers = append(proposalHandlers, gaslessclient.GaslessProposalHandler...) return proposalHandlers } @@ -306,6 +312,7 @@ var ( ibcfee.AppModuleBasic{}, liquidationsV2.AppModuleBasic{}, auctionsV2.AppModuleBasic{}, + gasless.AppModuleBasic{}, icq.AppModuleBasic{}, ibchooks.AppModuleBasic{}, packetforward.AppModuleBasic{}, @@ -388,6 +395,7 @@ type App struct { Rewardskeeper rewardskeeper.Keeper NewliqKeeper liquidationsV2keeper.Keeper NewaucKeeper auctionsV2keeper.Keeper + GaslessKeeper gaslesskeeper.Keeper // IBC modules // transfer module @@ -434,7 +442,8 @@ func New( markettypes.StoreKey, bandoraclemoduletypes.StoreKey, lockertypes.StoreKey, wasm.StoreKey, authzkeeper.StoreKey, auctiontypes.StoreKey, tokenminttypes.StoreKey, rewardstypes.StoreKey, feegrant.StoreKey, liquiditytypes.StoreKey, esmtypes.ModuleName, lendtypes.StoreKey, - liquidationsV2types.StoreKey, auctionsV2types.StoreKey, ibchookstypes.StoreKey, packetforwardtypes.StoreKey, icqtypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, + liquidationsV2types.StoreKey, auctionsV2types.StoreKey, gaslesstypes.StoreKey, + ibchookstypes.StoreKey, packetforwardtypes.StoreKey, icqtypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, ) ) @@ -489,6 +498,7 @@ func New( app.ParamsKeeper.Subspace(rewardstypes.ModuleName) app.ParamsKeeper.Subspace(liquidationsV2types.ModuleName) app.ParamsKeeper.Subspace(auctionsV2types.ModuleName) + app.ParamsKeeper.Subspace(gaslesstypes.ModuleName) app.ParamsKeeper.Subspace(icqtypes.ModuleName) app.ParamsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable()) @@ -881,6 +891,14 @@ func New( &app.TokenmintKeeper, ) + app.GaslessKeeper = gaslesskeeper.NewKeeper( + app.cdc, + app.keys[gaslesstypes.StoreKey], + app.GetSubspace(gaslesstypes.ModuleName), + app.AccountKeeper, + app.BankKeeper, + ) + // ICQ Keeper icqKeeper := icqkeeper.NewKeeper( appCodec, @@ -907,7 +925,7 @@ func New( } supportedFeatures := "iterator,staking,stargate,comdex,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3" - wasmOpts = append(cwasm.RegisterCustomPlugins(&app.LockerKeeper, &app.TokenmintKeeper, &app.AssetKeeper, &app.Rewardskeeper, &app.CollectorKeeper, &app.LiquidationKeeper, &app.AuctionKeeper, &app.EsmKeeper, &app.VaultKeeper, &app.LendKeeper, &app.LiquidityKeeper, &app.MarketKeeper), wasmOpts...) + wasmOpts = append(cwasm.RegisterCustomPlugins(&app.LockerKeeper, &app.TokenmintKeeper, &app.AssetKeeper, &app.Rewardskeeper, &app.CollectorKeeper, &app.LiquidationKeeper, &app.AuctionKeeper, &app.EsmKeeper, &app.VaultKeeper, &app.LendKeeper, &app.LiquidityKeeper, &app.MarketKeeper, &app.GaslessKeeper), wasmOpts...) app.WasmKeeper = wasmkeeper.NewKeeper( app.cdc, @@ -946,7 +964,8 @@ func New( AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IbcKeeper.ClientKeeper)). AddRoute(liquiditytypes.RouterKey, liquidity.NewLiquidityProposalHandler(app.LiquidityKeeper)). AddRoute(liquidationsV2types.RouterKey, liquidationsV2.NewLiquidationsV2Handler(app.NewliqKeeper)). - AddRoute(auctionsV2types.RouterKey, auctionsV2.NewAuctionsV2Handler(app.NewaucKeeper)) + AddRoute(auctionsV2types.RouterKey, auctionsV2.NewAuctionsV2Handler(app.NewaucKeeper)). + AddRoute(gaslesstypes.RouterKey, gasless.NewGaslessProposalHandler(app.GaslessKeeper)) if len(wasmEnabledProposals) != 0 { govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, wasmEnabledProposals)) @@ -1052,6 +1071,7 @@ func New( rewards.NewAppModule(app.cdc, app.Rewardskeeper, app.AccountKeeper, app.BankKeeper), liquidationsV2.NewAppModule(app.cdc, app.NewliqKeeper, app.AccountKeeper, app.BankKeeper), auctionsV2.NewAppModule(app.cdc, app.NewaucKeeper, app.BankKeeper), + gasless.NewAppModule(app.cdc, app.GaslessKeeper, app.AccountKeeper, app.BankKeeper), ibchooks.NewAppModule(app.AccountKeeper), icq.NewAppModule(*app.ICQKeeper), packetforward.NewAppModule(app.PacketForwardKeeper), @@ -1097,6 +1117,7 @@ func New( esmtypes.ModuleName, liquidationsV2types.ModuleName, auctionsV2types.ModuleName, + gaslesstypes.ModuleName, ibchookstypes.ModuleName, icqtypes.ModuleName, packetforwardtypes.ModuleName, @@ -1140,6 +1161,7 @@ func New( esmtypes.ModuleName, liquidationsV2types.ModuleName, auctionsV2types.ModuleName, + gaslesstypes.ModuleName, ibchookstypes.ModuleName, icqtypes.ModuleName, packetforwardtypes.ModuleName, @@ -1187,6 +1209,7 @@ func New( crisistypes.ModuleName, liquidationsV2types.ModuleName, auctionsV2types.ModuleName, + gaslesstypes.ModuleName, ibchookstypes.ModuleName, icqtypes.ModuleName, packetforwardtypes.ModuleName, @@ -1447,6 +1470,7 @@ func (a *App) ModuleAccountsPermissions() map[string][]string { rewardstypes.ModuleName: {authtypes.Minter, authtypes.Burner}, liquidationsV2types.ModuleName: {authtypes.Minter, authtypes.Burner}, auctionsV2types.ModuleName: {authtypes.Minter, authtypes.Burner}, + gaslesstypes.ModuleName: nil, icatypes.ModuleName: nil, ibcfeetypes.ModuleName: nil, assettypes.ModuleName: nil, diff --git a/app/wasm/message_plugin.go b/app/wasm/message_plugin.go index 4eeef075d..54af5375c 100644 --- a/app/wasm/message_plugin.go +++ b/app/wasm/message_plugin.go @@ -18,6 +18,7 @@ import ( "github.com/comdex-official/comdex/app/wasm/bindings" assetkeeper "github.com/comdex-official/comdex/x/asset/keeper" collectorkeeper "github.com/comdex-official/comdex/x/collector/keeper" + gaslessKeeper "github.com/comdex-official/comdex/x/gasless/keeper" liquidityKeeper "github.com/comdex-official/comdex/x/liquidity/keeper" lockerkeeper "github.com/comdex-official/comdex/x/locker/keeper" lockertypes "github.com/comdex-official/comdex/x/locker/types" @@ -27,7 +28,8 @@ import ( func CustomMessageDecorator(lockerKeeper lockerkeeper.Keeper, rewardsKeeper rewardskeeper.Keeper, assetKeeper assetkeeper.Keeper, collectorKeeper collectorkeeper.Keeper, liquidationKeeper liquidationkeeper.Keeper, - auctionKeeper auctionkeeper.Keeper, tokenMintKeeper tokenmintkeeper.Keeper, esmKeeper esmkeeper.Keeper, vaultKeeper vaultkeeper.Keeper, liquiditykeeper liquidityKeeper.Keeper, + auctionKeeper auctionkeeper.Keeper, tokenMintKeeper tokenmintkeeper.Keeper, esmKeeper esmkeeper.Keeper, + vaultKeeper vaultkeeper.Keeper, liquiditykeeper liquidityKeeper.Keeper, gaslesskeeper gaslessKeeper.Keeper, ) func(wasmkeeper.Messenger) wasmkeeper.Messenger { return func(old wasmkeeper.Messenger) wasmkeeper.Messenger { return &CustomMessenger{ @@ -42,6 +44,7 @@ func CustomMessageDecorator(lockerKeeper lockerkeeper.Keeper, rewardsKeeper rewa esmKeeper: esmKeeper, vaultKeeper: vaultKeeper, liquiditykeeper: liquiditykeeper, + gaslesskeeper: gaslesskeeper, } } } @@ -58,6 +61,7 @@ type CustomMessenger struct { esmKeeper esmkeeper.Keeper vaultKeeper vaultkeeper.Keeper liquiditykeeper liquidityKeeper.Keeper + gaslesskeeper gaslessKeeper.Keeper } var _ wasmkeeper.Messenger = (*CustomMessenger)(nil) @@ -564,7 +568,7 @@ func (m *CustomMessenger) ExecuteAddEmissionRewards(ctx sdk.Context, contractAdd if contractAddr.String() != comdex1[1] { return nil, nil, sdkerrors.ErrInvalidAddress } - }else if ctx.ChainID() == "comdex-test3" { + } else if ctx.ChainID() == "comdex-test3" { if contractAddr.String() != testnet3[1] { return nil, nil, sdkerrors.ErrInvalidAddress } diff --git a/app/wasm/queries.go b/app/wasm/queries.go index cb9de874f..a86c6529b 100644 --- a/app/wasm/queries.go +++ b/app/wasm/queries.go @@ -4,6 +4,7 @@ import ( assetKeeper "github.com/comdex-official/comdex/x/asset/keeper" collectorkeeper "github.com/comdex-official/comdex/x/collector/keeper" esmKeeper "github.com/comdex-official/comdex/x/esm/keeper" + gaslessKeeper "github.com/comdex-official/comdex/x/gasless/keeper" lendKeeper "github.com/comdex-official/comdex/x/lend/keeper" liquidationKeeper "github.com/comdex-official/comdex/x/liquidation/keeper" liquidityKeeper "github.com/comdex-official/comdex/x/liquidity/keeper" @@ -27,6 +28,7 @@ type QueryPlugin struct { lendKeeper *lendKeeper.Keeper liquidityKeeper *liquidityKeeper.Keeper marketKeeper *marketKeeper.Keeper + gaslessKeeper *gaslessKeeper.Keeper } func NewQueryPlugin( @@ -41,6 +43,7 @@ func NewQueryPlugin( lendKeeper *lendKeeper.Keeper, liquidityKeeper *liquidityKeeper.Keeper, marketKeeper *marketKeeper.Keeper, + gaslessKeeper *gaslessKeeper.Keeper, ) *QueryPlugin { return &QueryPlugin{ assetKeeper: assetKeeper, @@ -54,6 +57,7 @@ func NewQueryPlugin( lendKeeper: lendKeeper, liquidityKeeper: liquidityKeeper, marketKeeper: marketKeeper, + gaslessKeeper: gaslessKeeper, } } @@ -209,7 +213,7 @@ func (qp QueryPlugin) WasmGetPools(ctx sdk.Context, appID uint64) (pools []uint6 func (qp QueryPlugin) WasmGetAssetPrice(ctx sdk.Context, assetID uint64) (twa uint64, found bool) { assetTwa, found := qp.marketKeeper.GetTwa(ctx, assetID) - if found && assetTwa.IsPriceActive{ + if found && assetTwa.IsPriceActive { return assetTwa.Twa, true } return 0, false diff --git a/app/wasm/test/messages_test.go b/app/wasm/test/messages_test.go index dcc1e2f8b..9cfb5cb4b 100644 --- a/app/wasm/test/messages_test.go +++ b/app/wasm/test/messages_test.go @@ -23,7 +23,8 @@ func TestWhitelistAssetLocker(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgWhiteListAssetLocker @@ -67,7 +68,8 @@ func TestAddMsgAddExtendedPairsVault(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgAddExtendedPairsVault @@ -125,7 +127,8 @@ func TestMsgSetCollectorLookupTable(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgSetCollectorLookupTable @@ -177,7 +180,8 @@ func TestMsgSetAuctionMappingForApp(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgSetAuctionMappingForApp @@ -228,7 +232,8 @@ func TestMsgUpdateCollectorLookupTable(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgUpdateCollectorLookupTable @@ -280,7 +285,8 @@ func TestMsgUpdatePairsVault(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgUpdatePairsVault @@ -336,7 +342,8 @@ func TestMsgWhitelistAppIDLiquidation(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgWhitelistAppIDLiquidation @@ -384,7 +391,8 @@ func TestMsgRemoveWhitelistAppIDLiquidation(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgRemoveWhitelistAppIDLiquidation @@ -428,7 +436,8 @@ func TestMsgAddAuctionParams(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper) + &comdex.MarketKeeper, + &comdex.GaslessKeeper) for _, tc := range []struct { name string msg *bindings.MsgAddAuctionParams diff --git a/app/wasm/wasm.go b/app/wasm/wasm.go index 3aab22cce..6fec011ea 100644 --- a/app/wasm/wasm.go +++ b/app/wasm/wasm.go @@ -8,14 +8,15 @@ import ( auctionKeeper "github.com/comdex-official/comdex/x/auction/keeper" collectorKeeper "github.com/comdex-official/comdex/x/collector/keeper" esmKeeper "github.com/comdex-official/comdex/x/esm/keeper" + gaslessKeeper "github.com/comdex-official/comdex/x/gasless/keeper" lendKeeper "github.com/comdex-official/comdex/x/lend/keeper" liquidationKeeper "github.com/comdex-official/comdex/x/liquidation/keeper" liquidityKeeper "github.com/comdex-official/comdex/x/liquidity/keeper" lockerkeeper "github.com/comdex-official/comdex/x/locker/keeper" + marketKeeper "github.com/comdex-official/comdex/x/market/keeper" rewardsKeeper "github.com/comdex-official/comdex/x/rewards/keeper" tokenMintkeeper "github.com/comdex-official/comdex/x/tokenmint/keeper" vaultKeeper "github.com/comdex-official/comdex/x/vault/keeper" - marketKeeper "github.com/comdex-official/comdex/x/market/keeper" ) func RegisterCustomPlugins( @@ -31,14 +32,15 @@ func RegisterCustomPlugins( lend *lendKeeper.Keeper, liquidity *liquidityKeeper.Keeper, market *marketKeeper.Keeper, + gasless *gaslessKeeper.Keeper, ) []wasmkeeper.Option { - comdexQueryPlugin := NewQueryPlugin(asset, locker, tokenMint, rewards, collector, liquidation, esm, vault, lend, liquidity, market) + comdexQueryPlugin := NewQueryPlugin(asset, locker, tokenMint, rewards, collector, liquidation, esm, vault, lend, liquidity, market, gasless) appDataQueryPluginOpt := wasmkeeper.WithQueryPlugins(&wasmkeeper.QueryPlugins{ Custom: CustomQuerier(comdexQueryPlugin), }) messengerDecoratorOpt := wasmkeeper.WithMessageHandlerDecorator( - CustomMessageDecorator(*locker, *rewards, *asset, *collector, *liquidation, *auction, *tokenMint, *esm, *vault, *liquidity), + CustomMessageDecorator(*locker, *rewards, *asset, *collector, *liquidation, *auction, *tokenMint, *esm, *vault, *liquidity, *gasless), ) return []wasm.Option{ diff --git a/go.mod b/go.mod index 8cac8fadb..97aa2d507 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 + github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -138,7 +139,6 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect diff --git a/proto/comdex/gasless/v1beta1/gasless.proto b/proto/comdex/gasless/v1beta1/gasless.proto new file mode 100644 index 000000000..1ce20eca1 --- /dev/null +++ b/proto/comdex/gasless/v1beta1/gasless.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package comdex.gasless.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/comdex-official/comdex/x/gasless/types"; +option (gogoproto.goproto_getters_all) = false; \ No newline at end of file diff --git a/proto/comdex/gasless/v1beta1/genesis.proto b/proto/comdex/gasless/v1beta1/genesis.proto new file mode 100644 index 000000000..fb72394c7 --- /dev/null +++ b/proto/comdex/gasless/v1beta1/genesis.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package comdex.gasless.v1beta1; + +import "gogoproto/gogo.proto"; +import "comdex/gasless/v1beta1/params.proto"; + +option go_package = "github.com/comdex-official/comdex/x/gasless/types"; +option (gogoproto.goproto_getters_all) = false; + +// GenesisState defines the gasless module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/comdex/gasless/v1beta1/gov.proto b/proto/comdex/gasless/v1beta1/gov.proto new file mode 100644 index 000000000..eccc50555 --- /dev/null +++ b/proto/comdex/gasless/v1beta1/gov.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package comdex.gasless.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/comdex-official/comdex/x/gasless/types"; +option (gogoproto.equal_all) = false; +option (gogoproto.goproto_getters_all) = false; \ No newline at end of file diff --git a/proto/comdex/gasless/v1beta1/params.proto b/proto/comdex/gasless/v1beta1/params.proto new file mode 100644 index 000000000..67ccc0851 --- /dev/null +++ b/proto/comdex/gasless/v1beta1/params.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package comdex.gasless.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/comdex-official/comdex/x/gasless/types"; +option (gogoproto.goproto_getters_all) = false; + +// Params defines the parameters for the module. +message Params {} diff --git a/proto/comdex/gasless/v1beta1/query.proto b/proto/comdex/gasless/v1beta1/query.proto new file mode 100644 index 000000000..b57f7513c --- /dev/null +++ b/proto/comdex/gasless/v1beta1/query.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package comdex.gasless.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "comdex/gasless/v1beta1/params.proto"; + +option go_package = "github.com/comdex-official/comdex/x/gasless/types"; + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + + +// Query defines the gRPC querier service. +service Query { + // Params returns parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/comdex/gasless/v1beta1/params"; + } +} \ No newline at end of file diff --git a/proto/comdex/gasless/v1beta1/tx.proto b/proto/comdex/gasless/v1beta1/tx.proto new file mode 100644 index 000000000..0e183e7b5 --- /dev/null +++ b/proto/comdex/gasless/v1beta1/tx.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package comdex.gasless.v1beta1; + +option go_package = "github.com/comdex-official/comdex/x/gasless/types"; + +// Msg defines the Msg service. +service Msg { +} diff --git a/testutil/keeper/gasless.go b/testutil/keeper/gasless.go new file mode 100644 index 000000000..8ec1332e0 --- /dev/null +++ b/testutil/keeper/gasless.go @@ -0,0 +1,52 @@ +package keeper + +// import ( +// "testing" + +// "github.com/comdex-official/comdex/x/gasless/keeper" +// "github.com/comdex-official/comdex/x/gasless/types" +// "github.com/cosmos/cosmos-sdk/codec" +// codectypes "github.com/cosmos/cosmos-sdk/codec/types" +// "github.com/cosmos/cosmos-sdk/store" +// storetypes "github.com/cosmos/cosmos-sdk/store/types" +// sdk "github.com/cosmos/cosmos-sdk/types" +// typesparams "github.com/cosmos/cosmos-sdk/x/params/types" +// "github.com/stretchr/testify/require" +// "github.com/tendermint/tendermint/libs/log" +// tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +// tmdb "github.com/tendermint/tm-db" +// ) + +// func GaslessKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { +// storeKey := sdk.NewKVStoreKey(types.StoreKey) +// memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + +// db := tmdb.NewMemDB() +// stateStore := store.NewCommitMultiStore(db) +// stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) +// stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) +// require.NoError(t, stateStore.LoadLatestVersion()) + +// registry := codectypes.NewInterfaceRegistry() +// cdc := codec.NewProtoCodec(registry) + +// paramsSubspace := typesparams.NewSubspace(cdc, +// types.Amino, +// storeKey, +// memStoreKey, +// "GaslessParams", +// ) +// k := keeper.NewKeeper( +// cdc, +// storeKey, +// memStoreKey, +// paramsSubspace, +// ) + +// ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + +// // Initialize params +// k.SetParams(ctx, types.DefaultParams()) + +// return k, ctx +// } diff --git a/x/gasless/abci.go b/x/gasless/abci.go new file mode 100644 index 000000000..e690a8963 --- /dev/null +++ b/x/gasless/abci.go @@ -0,0 +1,17 @@ +package gasless + +import ( + "github.com/cosmos/cosmos-sdk/telemetry" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/comdex-official/comdex/x/gasless/keeper" + "github.com/comdex-official/comdex/x/gasless/types" +) + +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { + defer telemetry.ModuleMeasureSince(types.ModuleName, ctx.BlockTime(), telemetry.MetricKeyBeginBlocker) +} + +func EndBlocker(ctx sdk.Context, k keeper.Keeper) { + defer telemetry.ModuleMeasureSince(types.ModuleName, ctx.BlockTime(), telemetry.MetricKeyEndBlocker) +} diff --git a/x/gasless/client/cli/flags.go b/x/gasless/client/cli/flags.go new file mode 100644 index 000000000..cda4bea93 --- /dev/null +++ b/x/gasless/client/cli/flags.go @@ -0,0 +1,19 @@ +package cli + +// DONTCOVER + +import ( + "strings" +) + +func ParseStringSliceFromString(s string, separator string) ([]string, error) { + stringSlice := strings.Split(s, separator) + + parsedStrings := make([]string, 0, len(stringSlice)) + for _, s := range stringSlice { + s = strings.TrimSpace(s) + + parsedStrings = append(parsedStrings, s) + } + return parsedStrings, nil +} diff --git a/x/gasless/client/cli/query.go b/x/gasless/client/cli/query.go new file mode 100644 index 000000000..e1e77f3f0 --- /dev/null +++ b/x/gasless/client/cli/query.go @@ -0,0 +1,67 @@ +package cli + +import ( + "fmt" + "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + + "github.com/comdex-official/comdex/x/gasless/types" +) + +// GetQueryCmd returns the cli query commands for this module. +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "gasless", + Short: fmt.Sprintf("Querying commands for the %s module", "gasless"), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + NewQueryParamsCmd(), + ) + + return cmd +} + +// NewQueryParamsCmd implements the params query command. +func NewQueryParamsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Args: cobra.NoArgs, + Short: "Query the current gasless module's parameters information", + Long: strings.TrimSpace( + fmt.Sprintf(`Query values set as gasless module's parameters. +Example: +$ %s query %s params +`, + version.AppName, types.ModuleName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + resp, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(&resp.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gasless/client/cli/tx.go b/x/gasless/client/cli/tx.go new file mode 100644 index 000000000..47dbe1f71 --- /dev/null +++ b/x/gasless/client/cli/tx.go @@ -0,0 +1,24 @@ +package cli + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" +) + +// GetTxCmd returns the transaction commands for the module. +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "gasless", + Short: fmt.Sprintf("%s transactions subcommands", "gasless"), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand() + + return cmd +} diff --git a/x/gasless/client/proposal_handler.go b/x/gasless/client/proposal_handler.go new file mode 100644 index 000000000..e5bcf7ab1 --- /dev/null +++ b/x/gasless/client/proposal_handler.go @@ -0,0 +1,7 @@ +package client + +import ( + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" +) + +var GaslessProposalHandler = []govclient.ProposalHandler{} diff --git a/x/gasless/expected/keeper.go b/x/gasless/expected/keeper.go new file mode 100644 index 000000000..bf8711282 --- /dev/null +++ b/x/gasless/expected/keeper.go @@ -0,0 +1,28 @@ +package expected + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +// AccountKeeper is the expected account keeper. +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + GetModuleAddress(moduleName string) sdk.AccAddress +} + +// BankKeeper is the expected bank keeper. +type BankKeeper interface { + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetSupply(ctx sdk.Context, denom string) sdk.Coin + IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + SendCoins(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + InputOutputCoins(ctx sdk.Context, inputs []banktypes.Input, outputs []banktypes.Output) error +} diff --git a/x/gasless/genesis.go b/x/gasless/genesis.go new file mode 100644 index 000000000..b5940abb9 --- /dev/null +++ b/x/gasless/genesis.go @@ -0,0 +1,19 @@ +package gasless + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/comdex-official/comdex/x/gasless/keeper" + "github.com/comdex-official/comdex/x/gasless/types" +) + +// InitGenesis initializes the gasless module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.InitGenesis(ctx, genState) +} + +// ExportGenesis returns the gasless module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + return k.ExportGenesis(ctx) +} diff --git a/x/gasless/handler.go b/x/gasless/handler.go new file mode 100644 index 000000000..dfb558eed --- /dev/null +++ b/x/gasless/handler.go @@ -0,0 +1,34 @@ +package gasless + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/pkg/errors" + + "github.com/comdex-official/comdex/x/gasless/keeper" + "github.com/comdex-official/comdex/x/gasless/types" +) + +// NewHandler returns a new msg handler. +func NewHandler(k keeper.Keeper) sdk.Handler { + // msgServer := keeper.NewMsgServerImpl(k) + + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + + switch msg := msg.(type) { + default: + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + } + } +} + +func NewGaslessProposalHandler(k keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch c := content.(type) { + default: + return errors.Wrapf(types.ErrorUnknownProposalType, "%T", c) + } + } +} diff --git a/x/gasless/keeper/genesis.go b/x/gasless/keeper/genesis.go new file mode 100644 index 000000000..a7f839eba --- /dev/null +++ b/x/gasless/keeper/genesis.go @@ -0,0 +1,23 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/comdex-official/comdex/x/gasless/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { + if err := genState.Validate(); err != nil { + panic(err) + } + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the capability module's exported genesis. +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + return &types.GenesisState{ + Params: k.GetParams(ctx), + } +} diff --git a/x/gasless/keeper/gov.go b/x/gasless/keeper/gov.go new file mode 100644 index 000000000..b55569d4a --- /dev/null +++ b/x/gasless/keeper/gov.go @@ -0,0 +1 @@ +package keeper diff --git a/x/gasless/keeper/grpc_query.go b/x/gasless/keeper/grpc_query.go new file mode 100644 index 000000000..5e91863eb --- /dev/null +++ b/x/gasless/keeper/grpc_query.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/comdex-official/comdex/x/gasless/types" +) + +// Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper. +type Querier struct { + Keeper +} + +var _ types.QueryServer = Querier{} + +// Params queries the parameters of the gasless module. +func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + var params types.Params + k.Keeper.paramSpace.GetParamSet(ctx, ¶ms) + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/gasless/keeper/keeper.go b/x/gasless/keeper/keeper.go new file mode 100644 index 000000000..d277279fc --- /dev/null +++ b/x/gasless/keeper/keeper.go @@ -0,0 +1,50 @@ +package keeper + +import ( + "fmt" + + "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/comdex-official/comdex/x/gasless/expected" + "github.com/comdex-official/comdex/x/gasless/types" + storetypes "github.com/cosmos/cosmos-sdk/store/types" +) + +// Keeper of the gasless store. +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + paramSpace paramstypes.Subspace + + accountKeeper expected.AccountKeeper + bankKeeper expected.BankKeeper +} + +// NewKeeper creates a new gasless Keeper instance. +func NewKeeper( + cdc codec.BinaryCodec, + storeKey storetypes.StoreKey, + paramSpace paramstypes.Subspace, + accountKeeper expected.AccountKeeper, + bankKeeper expected.BankKeeper, +) Keeper { + if !paramSpace.HasKeyTable() { + paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) + } + + return Keeper{ + cdc: cdc, + storeKey: storeKey, + paramSpace: paramSpace, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// 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/gasless/keeper/msg_server.go b/x/gasless/keeper/msg_server.go new file mode 100644 index 000000000..ef51d7829 --- /dev/null +++ b/x/gasless/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/comdex-official/comdex/x/gasless/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/gasless/keeper/params.go b/x/gasless/keeper/params.go new file mode 100644 index 000000000..f57c7a29f --- /dev/null +++ b/x/gasless/keeper/params.go @@ -0,0 +1,18 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/comdex-official/comdex/x/gasless/types" +) + +// GetParams returns the parameters for the gasless module. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSpace.GetParamSet(ctx, ¶ms) + return +} + +// SetParams sets the parameters for the gasless module. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSpace.SetParamSet(ctx, ¶ms) +} diff --git a/x/gasless/keeper/store.go b/x/gasless/keeper/store.go new file mode 100644 index 000000000..b55569d4a --- /dev/null +++ b/x/gasless/keeper/store.go @@ -0,0 +1 @@ +package keeper diff --git a/x/gasless/module.go b/x/gasless/module.go new file mode 100644 index 000000000..02f90bd5f --- /dev/null +++ b/x/gasless/module.go @@ -0,0 +1,165 @@ +package gasless + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + 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/comdex-official/comdex/x/gasless/client/cli" + "github.com/comdex-official/comdex/x/gasless/expected" + "github.com/comdex-official/comdex/x/gasless/keeper" + "github.com/comdex-official/comdex/x/gasless/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.Codec +} + +func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the module's types on the LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config 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 genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the 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 capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper expected.AccountKeeper + bankKeeper expected.BankKeeper +} + +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, + accountKeeper expected.AccountKeeper, bankKeeper expected.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// QuerierRoute returns the capability module's query routing key. +func (AppModule) QuerierRoute() string { + return types.QuerierRoute +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.Querier{Keeper: am.keeper}) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability 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 + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + InitGenesis(ctx, am.keeper, genState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the capability 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) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 2 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + BeginBlocker(ctx, am.keeper) +} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + EndBlocker(ctx, am.keeper) + return []abci.ValidatorUpdate{} +} diff --git a/x/gasless/types/codec.go b/x/gasless/types/codec.go new file mode 100644 index 000000000..b6308daff --- /dev/null +++ b/x/gasless/types/codec.go @@ -0,0 +1,42 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "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" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +// RegisterLegacyAminoCodec registers the necessary x/gasless interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +} + +// RegisterInterfaces registers the x/gasless interfaces types with the +// interface registry. +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*govtypes.Content)(nil), + ) + + registry.RegisterImplementations( + (*sdk.Msg)(nil), + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + // sdk.RegisterLegacyAminoCodec(amino) + amino.Seal() +} diff --git a/x/gasless/types/errors.go b/x/gasless/types/errors.go new file mode 100644 index 000000000..e724f490c --- /dev/null +++ b/x/gasless/types/errors.go @@ -0,0 +1,11 @@ +package types + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// DONTCOVER + +var ( + ErrorUnknownProposalType = sdkerrors.Register(ModuleName, 10000, "unknown proposal type") +) diff --git a/x/gasless/types/events.go b/x/gasless/types/events.go new file mode 100644 index 000000000..10b2841c3 --- /dev/null +++ b/x/gasless/types/events.go @@ -0,0 +1,4 @@ +package types + +// Event types for the gasless module. +const () diff --git a/x/gasless/types/gasless.go b/x/gasless/types/gasless.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/gasless/types/gasless.go @@ -0,0 +1 @@ +package types diff --git a/x/gasless/types/gasless.pb.go b/x/gasless/types/gasless.pb.go new file mode 100644 index 000000000..f93b49afa --- /dev/null +++ b/x/gasless/types/gasless.pb.go @@ -0,0 +1,44 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: comdex/gasless/v1beta1/gasless.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/protobuf/types/known/timestamppb" + math "math" +) + +// 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 + +func init() { + proto.RegisterFile("comdex/gasless/v1beta1/gasless.proto", fileDescriptor_a0a6c07135ead427) +} + +var fileDescriptor_a0a6c07135ead427 = []byte{ + // 191 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8f, 0x31, 0xae, 0xc2, 0x30, + 0x0c, 0x86, 0xd3, 0xe5, 0x0d, 0x6f, 0x44, 0x88, 0xa1, 0x83, 0x59, 0x58, 0xa9, 0x55, 0x71, 0x03, + 0x2e, 0xc0, 0xce, 0x96, 0x84, 0x34, 0x44, 0x6a, 0x70, 0x85, 0x53, 0x04, 0xb7, 0xe0, 0x58, 0x1d, + 0x3b, 0x32, 0x42, 0x7b, 0x11, 0x44, 0xd3, 0xc2, 0xe6, 0xcf, 0xfe, 0xf4, 0xcb, 0xff, 0xff, 0x4a, + 0x93, 0x3f, 0x98, 0x2b, 0x5a, 0xc9, 0xa5, 0x61, 0xc6, 0x4b, 0xae, 0x4c, 0x90, 0xf9, 0xc4, 0x59, + 0x75, 0xa6, 0x40, 0xb3, 0x45, 0xb4, 0xb2, 0x69, 0x3b, 0x5a, 0xe9, 0xdc, 0x92, 0xa5, 0x41, 0xc1, + 0xcf, 0x14, 0xed, 0x14, 0x34, 0xb1, 0x27, 0x46, 0x25, 0xd9, 0x7c, 0x03, 0x35, 0xb9, 0xd3, 0x78, + 0x5f, 0x5a, 0x22, 0x5b, 0x1a, 0x1c, 0x48, 0xd5, 0x05, 0x06, 0xe7, 0x0d, 0x07, 0xe9, 0xab, 0x28, + 0x6c, 0x77, 0xcd, 0x0b, 0x44, 0xd3, 0x41, 0xd2, 0x76, 0x90, 0x3c, 0x3b, 0x48, 0xee, 0x3d, 0x88, + 0xb6, 0x07, 0xf1, 0xe8, 0x41, 0xec, 0x73, 0xeb, 0xc2, 0xb1, 0x56, 0x99, 0x26, 0x8f, 0xf1, 0xaf, + 0x35, 0x15, 0x85, 0xd3, 0x4e, 0x96, 0x23, 0xe3, 0xaf, 0x4f, 0xb8, 0x55, 0x86, 0xd5, 0xdf, 0x90, + 0xbb, 0x79, 0x07, 0x00, 0x00, 0xff, 0xff, 0x03, 0xb0, 0x1f, 0x80, 0xee, 0x00, 0x00, 0x00, +} diff --git a/x/gasless/types/genesis.go b/x/gasless/types/genesis.go new file mode 100644 index 000000000..258448f75 --- /dev/null +++ b/x/gasless/types/genesis.go @@ -0,0 +1,21 @@ +package types + +import ( + "fmt" +) + +// DefaultGenesis returns the default Capability genesis state. +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (genState GenesisState) Validate() error { + if err := genState.Params.Validate(); err != nil { + return fmt.Errorf("invalid params: %w", err) + } + return nil +} diff --git a/x/gasless/types/genesis.pb.go b/x/gasless/types/genesis.pb.go new file mode 100644 index 000000000..98af7a060 --- /dev/null +++ b/x/gasless/types/genesis.pb.go @@ -0,0 +1,316 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: comdex/gasless/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the gasless module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_b721e4c5e7630fc2, []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 init() { + proto.RegisterType((*GenesisState)(nil), "comdex.gasless.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("comdex/gasless/v1beta1/genesis.proto", fileDescriptor_b721e4c5e7630fc2) +} + +var fileDescriptor_b721e4c5e7630fc2 = []byte{ + // 208 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xce, 0xcf, 0x4d, + 0x49, 0xad, 0xd0, 0x4f, 0x4f, 0x2c, 0xce, 0x49, 0x2d, 0x2e, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, + 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x12, 0x83, 0xa8, 0xd2, 0x83, 0xaa, 0xd2, 0x83, 0xaa, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, + 0x07, 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0x94, 0x71, 0x98, 0x59, 0x90, 0x58, 0x94, 0x98, + 0x0b, 0x35, 0x52, 0xc9, 0x87, 0x8b, 0xc7, 0x1d, 0x62, 0x47, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, + 0x0d, 0x17, 0x1b, 0x44, 0x5e, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x4e, 0x0f, 0xbb, 0x9d, + 0x7a, 0x01, 0x60, 0x55, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0xf5, 0x38, 0xf9, 0x9f, + 0x78, 0x28, 0xc7, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, + 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x86, 0xe9, + 0x99, 0x25, 0x19, 0xa5, 0x49, 0x20, 0x13, 0xf5, 0x21, 0xa6, 0xea, 0xe6, 0xa7, 0xa5, 0x65, 0x26, + 0x67, 0x26, 0xe6, 0x40, 0xf9, 0xfa, 0x08, 0xd7, 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, + 0x5d, 0x69, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xcf, 0xf6, 0xaa, 0x77, 0x20, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gasless/types/gov.go b/x/gasless/types/gov.go new file mode 100644 index 000000000..ac686edb0 --- /dev/null +++ b/x/gasless/types/gov.go @@ -0,0 +1,3 @@ +package types + +func init() {} diff --git a/x/gasless/types/gov.pb.go b/x/gasless/types/gov.pb.go new file mode 100644 index 000000000..15b8bfac0 --- /dev/null +++ b/x/gasless/types/gov.pb.go @@ -0,0 +1,38 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: comdex/gasless/v1beta1/gov.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// 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 + +func init() { proto.RegisterFile("comdex/gasless/v1beta1/gov.proto", fileDescriptor_af9f24d40621ed13) } + +var fileDescriptor_af9f24d40621ed13 = []byte{ + // 156 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0xcf, 0x4d, + 0x49, 0xad, 0xd0, 0x4f, 0x4f, 0x2c, 0xce, 0x49, 0x2d, 0x2e, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, + 0x49, 0x34, 0xd4, 0x4f, 0xcf, 0x2f, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0xa8, + 0xd0, 0x83, 0xaa, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd1, 0x07, + 0xb1, 0x20, 0xaa, 0x9d, 0x82, 0x4f, 0x3c, 0x94, 0x63, 0x58, 0xf1, 0x48, 0x8e, 0xe1, 0xc4, 0x23, + 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, + 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x0c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, + 0x92, 0xf3, 0x73, 0xf5, 0x21, 0x46, 0xeb, 0xe6, 0xa7, 0xa5, 0x65, 0x26, 0x67, 0x26, 0xe6, 0x40, + 0xf9, 0xfa, 0x08, 0xe7, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xcd, 0x36, 0x06, 0x04, + 0x00, 0x00, 0xff, 0xff, 0xd1, 0xbd, 0xc7, 0x92, 0xad, 0x00, 0x00, 0x00, +} diff --git a/x/gasless/types/keys.go b/x/gasless/types/keys.go new file mode 100644 index 000000000..0a8ef6ba2 --- /dev/null +++ b/x/gasless/types/keys.go @@ -0,0 +1,15 @@ +package types + +const ( + // ModuleName defines the module name. + ModuleName = "gasless" + + // StoreKey defines the primary module store key. + StoreKey = ModuleName + + // RouterKey is the message route for slashing. + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key. + QuerierRoute = ModuleName +) diff --git a/x/gasless/types/msgs.go b/x/gasless/types/msgs.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/gasless/types/msgs.go @@ -0,0 +1 @@ +package types diff --git a/x/gasless/types/params.go b/x/gasless/types/params.go new file mode 100644 index 000000000..c019e8bb2 --- /dev/null +++ b/x/gasless/types/params.go @@ -0,0 +1,34 @@ +package types + +import ( + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramstypes.ParamSet = (*Params)(nil) + +func ParamKeyTable() paramstypes.KeyTable { + return paramstypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// DefaultParams returns a default params for the liquidity module. +func DefaultParams() Params { + return Params{} +} + +// ParamSetPairs implements ParamSet. +func (params *Params) ParamSetPairs() paramstypes.ParamSetPairs { + return paramstypes.ParamSetPairs{} +} + +// Validate validates Params. +func (params Params) Validate() error { + for _, field := range []struct { + val interface{} + validateFunc func(i interface{}) error + }{} { + if err := field.validateFunc(field.val); err != nil { + return err + } + } + return nil +} diff --git a/x/gasless/types/params.pb.go b/x/gasless/types/params.pb.go new file mode 100644 index 000000000..1526ec74a --- /dev/null +++ b/x/gasless/types/params.pb.go @@ -0,0 +1,268 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: comdex/gasless/v1beta1/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { +} + +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_53310061af304758, []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 + +func init() { + proto.RegisterType((*Params)(nil), "comdex.gasless.v1beta1.Params") +} + +func init() { + proto.RegisterFile("comdex/gasless/v1beta1/params.proto", fileDescriptor_53310061af304758) +} + +var fileDescriptor_53310061af304758 = []byte{ + // 162 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xce, 0xcf, 0x4d, + 0x49, 0xad, 0xd0, 0x4f, 0x4f, 0x2c, 0xce, 0x49, 0x2d, 0x2e, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, + 0x49, 0x34, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x83, 0x28, 0xd2, 0x83, 0x2a, 0xd2, 0x83, 0x2a, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, + 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0x95, 0x38, 0xb8, 0xd8, 0x02, 0xc0, 0xba, 0x9d, 0xfc, 0x4f, + 0x3c, 0x94, 0x63, 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, 0xc3, 0xf4, + 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x88, 0x05, 0xba, 0xf9, 0x69, 0x69, + 0x99, 0xc9, 0x99, 0x89, 0x39, 0x50, 0xbe, 0x3e, 0xc2, 0x5d, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, + 0x6c, 0x60, 0x1b, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x02, 0xe7, 0x8a, 0x96, 0xb6, 0x00, + 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 + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(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 + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(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 ErrIntOverflowParams + } + 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 { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gasless/types/query.pb.go b/x/gasless/types/query.pb.go new file mode 100644 index 000000000..ada04200b --- /dev/null +++ b/x/gasless/types/query.pb.go @@ -0,0 +1,533 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: comdex/gasless/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b3f33915e66c7457, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b3f33915e66c7457, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "comdex.gasless.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "comdex.gasless.v1beta1.QueryParamsResponse") +} + +func init() { + proto.RegisterFile("comdex/gasless/v1beta1/query.proto", fileDescriptor_b3f33915e66c7457) +} + +var fileDescriptor_b3f33915e66c7457 = []byte{ + // 309 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x41, 0x4b, 0xf3, 0x30, + 0x18, 0xc7, 0x9b, 0x97, 0xd7, 0x1d, 0xe2, 0x2d, 0x0e, 0x91, 0x21, 0x71, 0x54, 0x10, 0x99, 0xd8, + 0xb0, 0x79, 0xf5, 0xb4, 0x2f, 0xa0, 0xce, 0x9b, 0xb7, 0x74, 0x66, 0x31, 0xb0, 0xf6, 0xc9, 0x9a, + 0x54, 0xdc, 0xd5, 0x9b, 0x37, 0x61, 0x5f, 0xaa, 0xc7, 0x81, 0x17, 0x4f, 0xa2, 0xad, 0x1f, 0x44, + 0xda, 0x44, 0x45, 0x74, 0xe2, 0xad, 0x3c, 0xfd, 0x3d, 0xbf, 0xff, 0x3f, 0x0f, 0x0e, 0xc7, 0x90, + 0x5c, 0x8a, 0x1b, 0x26, 0xb9, 0x99, 0x0a, 0x63, 0xd8, 0x75, 0x3f, 0x16, 0x96, 0xf7, 0xd9, 0x2c, + 0x17, 0xd9, 0x3c, 0xd2, 0x19, 0x58, 0x20, 0x9b, 0x8e, 0x89, 0x3c, 0x13, 0x79, 0xa6, 0xd3, 0x96, + 0x20, 0xa1, 0x41, 0x58, 0xfd, 0xe5, 0xe8, 0xce, 0xb6, 0x04, 0x90, 0x53, 0xc1, 0xb8, 0x56, 0x8c, + 0xa7, 0x29, 0x58, 0x6e, 0x15, 0xa4, 0xc6, 0xff, 0xed, 0x8d, 0xc1, 0x24, 0x60, 0x58, 0xcc, 0x8d, + 0x70, 0x21, 0x1f, 0x91, 0x9a, 0x4b, 0x95, 0x36, 0xb0, 0x67, 0x77, 0x57, 0x74, 0xd3, 0x3c, 0xe3, + 0x89, 0x17, 0x86, 0x6d, 0x4c, 0xce, 0x6a, 0xcd, 0x69, 0x33, 0x1c, 0x89, 0x59, 0x2e, 0x8c, 0x0d, + 0xcf, 0xf1, 0xc6, 0x97, 0xa9, 0xd1, 0x90, 0x1a, 0x41, 0x8e, 0x71, 0xcb, 0x2d, 0x6f, 0xa1, 0x2e, + 0xda, 0x5f, 0x1f, 0xd0, 0xe8, 0xe7, 0xa7, 0x45, 0x6e, 0x6f, 0xf8, 0xbf, 0x78, 0xda, 0x09, 0x46, + 0x7e, 0x67, 0xb0, 0x40, 0x78, 0xad, 0xb1, 0x92, 0x3b, 0x84, 0x5b, 0x0e, 0x21, 0xbd, 0x55, 0x8a, + 0xef, 0xad, 0x3a, 0x07, 0x7f, 0x62, 0x5d, 0xd7, 0x70, 0xef, 0xf6, 0xe1, 0x75, 0xf1, 0xaf, 0x4b, + 0x28, 0xfb, 0xf5, 0x0c, 0xc3, 0x93, 0xe2, 0x85, 0x06, 0x45, 0x49, 0xd1, 0xb2, 0xa4, 0xe8, 0xb9, + 0xa4, 0xe8, 0xbe, 0xa2, 0xc1, 0xb2, 0xa2, 0xc1, 0x63, 0x45, 0x83, 0x8b, 0xbe, 0x54, 0xf6, 0x2a, + 0x8f, 0xeb, 0x60, 0xef, 0x39, 0x84, 0xc9, 0x44, 0x8d, 0x15, 0x9f, 0xbe, 0x7b, 0x3f, 0xcd, 0x76, + 0xae, 0x85, 0x89, 0x5b, 0xcd, 0x61, 0x8f, 0xde, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x2b, 0xf8, + 0x9d, 0x1b, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/comdex.gasless.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "comdex.gasless.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "comdex/gasless/v1beta1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gasless/types/query.pb.gw.go b/x/gasless/types/query.pb.gw.go new file mode 100644 index 000000000..0477c9ea0 --- /dev/null +++ b/x/gasless/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: comdex/gasless/v1beta1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"comdex", "gasless", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/gasless/types/tx.pb.go b/x/gasless/types/tx.pb.go new file mode 100644 index 000000000..e0d3afe87 --- /dev/null +++ b/x/gasless/types/tx.pb.go @@ -0,0 +1,81 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: comdex/gasless/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + math "math" +) + +// 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 + +func init() { proto.RegisterFile("comdex/gasless/v1beta1/tx.proto", fileDescriptor_58c8d01c81a883a9) } + +var fileDescriptor_58c8d01c81a883a9 = []byte{ + // 141 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0xcf, 0x4d, + 0x49, 0xad, 0xd0, 0x4f, 0x4f, 0x2c, 0xce, 0x49, 0x2d, 0x2e, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, + 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0x28, 0xd0, + 0x83, 0x2a, 0xd0, 0x83, 0x2a, 0x30, 0x62, 0xe5, 0x62, 0xf6, 0x2d, 0x4e, 0x77, 0xf2, 0x3e, 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, 0xc3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, + 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x88, 0x19, 0xba, 0xf9, 0x69, 0x69, 0x99, 0xc9, 0x99, 0x89, 0x39, + 0x50, 0xbe, 0x3e, 0xc2, 0xda, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x95, 0xc6, 0x80, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0x9d, 0x20, 0x79, 0x95, 0x00, 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 { +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "comdex.gasless.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "comdex/gasless/v1beta1/tx.proto", +}