diff --git a/app/ante.go b/app/ante.go index 9eab3de53..83860b199 100644 --- a/app/ante.go +++ b/app/ante.go @@ -4,8 +4,6 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/comdex-official/comdex/app/decorators" - "github.com/comdex-official/comdex/x/gasless" - gaslesskeeper "github.com/comdex-official/comdex/x/gasless/keeper" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -32,9 +30,6 @@ type HandlerOptions struct { TxDecoder sdk.TxDecoder TxEncoder sdk.TxEncoder auctionkeeperskip auctionkeeperskip.Keeper - - GaslessKeeper gaslesskeeper.Keeper - BankKeeper gasless.BankKeeper } func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { @@ -63,7 +58,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewTxTimeoutHeightDecorator(), ante.NewValidateMemoDecorator(options.AccountKeeper), ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), - gasless.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker, options.GaslessKeeper), + ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), // SetPubKeyDecorator must be called before all signature verification decorators ante.NewSetPubKeyDecorator(options.AccountKeeper), ante.NewValidateSigCountDecorator(options.AccountKeeper), diff --git a/app/app.go b/app/app.go index 7ba13af9a..0a669a714 100644 --- a/app/app.go +++ b/app/app.go @@ -140,10 +140,6 @@ import ( collectorkeeper "github.com/comdex-official/comdex/x/collector/keeper" collectortypes "github.com/comdex-official/comdex/x/collector/types" - "github.com/comdex-official/comdex/x/common" - commonkeeper "github.com/comdex-official/comdex/x/common/keeper" - commontypes "github.com/comdex-official/comdex/x/common/types" - "github.com/comdex-official/comdex/x/esm" esmkeeper "github.com/comdex-official/comdex/x/esm/keeper" esmtypes "github.com/comdex-official/comdex/x/esm/types" @@ -194,11 +190,6 @@ 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" @@ -215,10 +206,6 @@ import ( auctionkeeperskip "github.com/skip-mev/block-sdk/x/auction/keeper" auctionmoduleskiptypes "github.com/skip-mev/block-sdk/x/auction/types" - "github.com/comdex-official/comdex/x/tokenfactory" - tokenfactorykeeper "github.com/comdex-official/comdex/x/tokenfactory/keeper" - tokenfactorytypes "github.com/comdex-official/comdex/x/tokenfactory/types" - cwasm "github.com/comdex-official/comdex/app/wasm" mv13 "github.com/comdex-official/comdex/app/upgrades/mainnet/v13" @@ -271,7 +258,6 @@ 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 } @@ -330,9 +316,6 @@ var ( ibcfee.AppModuleBasic{}, liquidationsV2.AppModuleBasic{}, auctionsV2.AppModuleBasic{}, - common.AppModuleBasic{}, - tokenfactory.AppModuleBasic{}, - gasless.AppModuleBasic{}, icq.AppModuleBasic{}, ibchooks.AppModuleBasic{}, packetforward.AppModuleBasic{}, @@ -417,11 +400,8 @@ type App struct { Rewardskeeper rewardskeeper.Keeper NewliqKeeper liquidationsV2keeper.Keeper NewaucKeeper auctionsV2keeper.Keeper - CommonKeeper commonkeeper.Keeper // auctionKeeper is the keeper that handles processing auction transactions - AuctionKeeperSkip auctionkeeperskip.Keeper - TokenFactoryKeeper tokenfactorykeeper.Keeper - GaslessKeeper gaslesskeeper.Keeper + AuctionKeeperSkip auctionkeeperskip.Keeper // IBC modules // transfer module @@ -470,7 +450,7 @@ 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, commontypes.StoreKey, tokenfactorytypes.StoreKey, gaslesstypes.StoreKey, + liquidationsV2types.StoreKey, auctionsV2types.StoreKey, ibchookstypes.StoreKey, packetforwardtypes.StoreKey, icqtypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, auctionmoduleskiptypes.StoreKey, ) ) @@ -527,10 +507,7 @@ func New( app.ParamsKeeper.Subspace(liquiditytypes.ModuleName) app.ParamsKeeper.Subspace(rewardstypes.ModuleName) app.ParamsKeeper.Subspace(liquidationsV2types.ModuleName) - app.ParamsKeeper.Subspace(tokenfactorytypes.ModuleName) app.ParamsKeeper.Subspace(auctionsV2types.ModuleName) - app.ParamsKeeper.Subspace(commontypes.ModuleName) - app.ParamsKeeper.Subspace(gaslesstypes.ModuleName) app.ParamsKeeper.Subspace(icqtypes.ModuleName) app.ParamsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable()) @@ -551,12 +528,6 @@ func New( app.mkeys[capabilitytypes.MemStoreKey], ) - var tokenFactoryCapabilities = []string{ - tokenfactorytypes.EnableBurnFrom, - tokenfactorytypes.EnableForceTransfer, - tokenfactorytypes.EnableSetMetadata, - } - // grant capabilities for the ibc and ibc-transfer modules var ( scopedIBCKeeper = app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) @@ -934,26 +905,6 @@ func New( &app.TokenmintKeeper, ) - app.CommonKeeper = commonkeeper.NewKeeper( - app.cdc, - app.keys[commontypes.StoreKey], - app.keys[commontypes.MemStoreKey], - app.GetSubspace(commontypes.ModuleName), - &app.WasmKeeper, - govModAddress, - ) - - // Create the TokenFactory Keeper - app.TokenFactoryKeeper = tokenfactorykeeper.NewKeeper( - appCodec, - app.keys[tokenfactorytypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.DistrKeeper, - tokenFactoryCapabilities, - govModAddress, - ) - app.AuctionKeeperSkip = auctionkeeperskip.NewKeeper( appCodec, keys[auctionmoduleskiptypes.StoreKey], @@ -964,17 +915,6 @@ func New( govModAddress, ) - app.GaslessKeeper = gaslesskeeper.NewKeeper( - app.cdc, - app.keys[gaslesstypes.StoreKey], - app.GetSubspace(gaslesstypes.ModuleName), - app.interfaceRegistry, - app.AccountKeeper, - app.BankKeeper, - &app.WasmKeeper, - govModAddress, - ) - // ICQ Keeper icqKeeper := icqkeeper.NewKeeper( appCodec, @@ -999,9 +939,9 @@ func New( if err != nil { panic(fmt.Sprintf("error while reading wasm config: %s", err)) } - supportedFeatures := "iterator,staking,stargate,comdex,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,token_factory" + 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, app.BankKeeper, &app.TokenFactoryKeeper, &app.GaslessKeeper), 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), wasmOpts...) app.WasmKeeper = wasmkeeper.NewKeeper( app.cdc, @@ -1040,8 +980,7 @@ 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(gaslesstypes.RouterKey, gasless.NewGaslessProposalHandler(app.GaslessKeeper)) + AddRoute(auctionsV2types.RouterKey, auctionsV2.NewAuctionsV2Handler(app.NewaucKeeper)) if len(wasmEnabledProposals) != 0 { govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, wasmEnabledProposals)) @@ -1147,10 +1086,7 @@ func New( liquidity.NewAppModule(app.cdc, app.LiquidityKeeper, app.AccountKeeper, app.BankKeeper, app.AssetKeeper), rewards.NewAppModule(app.cdc, app.Rewardskeeper, app.AccountKeeper, app.BankKeeper), liquidationsV2.NewAppModule(app.cdc, app.NewliqKeeper, app.AccountKeeper, app.BankKeeper), - common.NewAppModule(app.cdc, app.CommonKeeper, app.AccountKeeper, app.BankKeeper, app.WasmKeeper), auctionsV2.NewAppModule(app.cdc, app.NewaucKeeper, app.BankKeeper), - tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)), - gasless.NewAppModule(app.cdc, app.GaslessKeeper, app.AccountKeeper, app.BankKeeper), ibchooks.NewAppModule(app.AccountKeeper), icq.NewAppModule(*app.ICQKeeper), packetforward.NewAppModule(app.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)), @@ -1197,9 +1133,6 @@ func New( esmtypes.ModuleName, liquidationsV2types.ModuleName, auctionsV2types.ModuleName, - commontypes.ModuleName, - tokenfactorytypes.ModuleName, - gaslesstypes.ModuleName, ibchookstypes.ModuleName, icqtypes.ModuleName, packetforwardtypes.ModuleName, @@ -1244,9 +1177,6 @@ func New( esmtypes.ModuleName, liquidationsV2types.ModuleName, auctionsV2types.ModuleName, - commontypes.ModuleName, - tokenfactorytypes.ModuleName, - gaslesstypes.ModuleName, ibchookstypes.ModuleName, icqtypes.ModuleName, packetforwardtypes.ModuleName, @@ -1295,9 +1225,6 @@ func New( crisistypes.ModuleName, liquidationsV2types.ModuleName, auctionsV2types.ModuleName, - commontypes.ModuleName, - tokenfactorytypes.ModuleName, - gaslesstypes.ModuleName, ibchookstypes.ModuleName, icqtypes.ModuleName, packetforwardtypes.ModuleName, @@ -1360,8 +1287,6 @@ func New( TxDecoder: encoding.TxConfig.TxDecoder(), TxEncoder: encoding.TxConfig.TxEncoder(), auctionkeeperskip: app.AuctionKeeperSkip, - GaslessKeeper: app.GaslessKeeper, - BankKeeper: app.BankKeeper, }, ) if err != nil { @@ -1607,7 +1532,7 @@ func (a *App) RegisterNodeService(clientCtx client.Context) { func (a *App) ModuleAccountsPermissions() map[string][]string { return map[string][]string{ - authtypes.FeeCollectorName: {authtypes.Burner}, + authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, @@ -1638,9 +1563,6 @@ 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}, - tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - commontypes.ModuleName: nil, - gaslesstypes.ModuleName: nil, icatypes.ModuleName: nil, ibcfeetypes.ModuleName: nil, assettypes.ModuleName: nil, @@ -1652,7 +1574,7 @@ func (a *App) ModuleAccountsPermissions() map[string][]string { func (a *App) registerUpgradeHandlers() { a.UpgradeKeeper.SetUpgradeHandler( tv14.UpgradeName, - tv14.CreateUpgradeHandlerV14(a.mm, a.configurator, a.CommonKeeper, a.AuctionKeeperSkip, a.LendKeeper, a.TokenFactoryKeeper, a.AccountKeeper), + tv14.CreateUpgradeHandlerV14(a.mm, a.configurator, a.AuctionKeeperSkip, a.LendKeeper), ) // When a planned update height is reached, the old binary will panic // writing on disk the height and name of the update that triggered it @@ -1689,10 +1611,7 @@ func upgradeHandlers(upgradeInfo upgradetypes.Plan, a *App, storeUpgrades *store case upgradeInfo.Name == tv14.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height): storeUpgrades = &storetypes.StoreUpgrades{ Added: []string{ - commontypes.StoreKey, auctionmoduleskiptypes.StoreKey, - tokenfactorytypes.ModuleName, - gaslesstypes.ModuleName, }, } } diff --git a/app/test_helpers.go b/app/test_helpers.go index 9e4f2cf00..250ee128c 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -14,14 +14,13 @@ import ( "github.com/cosmos/cosmos-sdk/std" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/require" "testing" "time" - // simappparams "cosmossdk.io/simapp/params" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" ) // DefaultConsensusParams defines the default Tendermint consensus params used in @@ -52,7 +51,7 @@ func MakeTestEncodingConfig() moduletestutil.TestEncodingConfig { return encodingConfig } -func setup(t *testing.T, withGenesis bool) (*App, GenesisState) { +func setup(_ *testing.T, withGenesis bool) (*App, GenesisState) { db := dbm.NewMemDB() //encCdc := MakeTestEncodingConfig() app := New(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, MakeEncodingConfig(), simtestutil.EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts) diff --git a/app/upgrades/testnet/v14/upgrades.go b/app/upgrades/testnet/v14/upgrades.go index 3496862d1..68293dd6b 100644 --- a/app/upgrades/testnet/v14/upgrades.go +++ b/app/upgrades/testnet/v14/upgrades.go @@ -1,15 +1,9 @@ package v14 import ( - "fmt" - commonkeeper "github.com/comdex-official/comdex/x/common/keeper" - commontypes "github.com/comdex-official/comdex/x/common/types" lendkeeper "github.com/comdex-official/comdex/x/lend/keeper" - tokenfactorykeeper "github.com/comdex-official/comdex/x/tokenfactory/keeper" - tokenfactorytypes "github.com/comdex-official/comdex/x/tokenfactory/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" auctionkeeperskip "github.com/skip-mev/block-sdk/x/auction/keeper" @@ -17,53 +11,26 @@ import ( "strings" ) -// We now charge 2 million gas * gas price to create a denom. -const NewDenomCreationGasConsume uint64 = 2_000_000 - func CreateUpgradeHandlerV14( mm *module.Manager, configurator module.Configurator, - commonkeeper commonkeeper.Keeper, auctionkeeperskip auctionkeeperskip.Keeper, lendKeeper lendkeeper.Keeper, - tokenfactorykeeper tokenfactorykeeper.Keeper, - accountKeeper authkeeper.AccountKeeper, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info("Applying test net upgrade - v14.0.0") - vm, err := mm.RunMigrations(ctx, configurator, fromVM) if err != nil { return vm, err } - moduleAccI := accountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) - moduleAcc := moduleAccI.(*authtypes.ModuleAccount) - moduleAcc.Permissions = []string{authtypes.Burner} - accountKeeper.SetModuleAccount(ctx, moduleAcc) - - ctx.Logger().Info("set common module params") - commonkeeper.SetParams(ctx, commontypes.DefaultParams()) ctx.Logger().Info("setting default params for MEV module (x/auction)") if err = setDefaultMEVParams(ctx, auctionkeeperskip); err != nil { return nil, err } - // x/TokenFactory - // Use denom creation gas consumption instead of fee for contract developers - ctx.Logger().Info("setting params for Tokenfactory module (x/tokenfactory)") - updatedTf := tokenfactorytypes.Params{ - DenomCreationFee: nil, - DenomCreationGasConsume: NewDenomCreationGasConsume, - } - - if err := tokenfactorykeeper.SetParams(ctx, updatedTf); err != nil { - return vm, err - } - ctx.Logger().Info(fmt.Sprintf("updated tokenfactory params to %v", updatedTf)) - //TODO: uncomment this before mainnet upgrade //UpdateLendParams(ctx, lendKeeper) return vm, err diff --git a/app/wasm/bindings/msg.go b/app/wasm/bindings/msg.go index 0f8b42ded..8a50bbc2a 100644 --- a/app/wasm/bindings/msg.go +++ b/app/wasm/bindings/msg.go @@ -1,9 +1,6 @@ package bindings -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "cosmossdk.io/math" -) +import sdk "github.com/cosmos/cosmos-sdk/types" type ComdexMessages struct { MsgWhiteListAssetLocker *MsgWhiteListAssetLocker `json:"msg_white_list_asset_locker,omitempty"` @@ -185,64 +182,3 @@ type MsgEmissionPoolRewards struct { Pools []uint64 `json:"pools"` VotingRatio []sdk.Int `json:"voting_ratio"` } - -type TokenFactoryMsg struct { - /// Contracts can create denoms, namespaced under the contract's address. - /// A contract may create any number of independent sub-denoms. - CreateDenom *CreateDenom `json:"create_denom,omitempty"` - /// Contracts can change the admin of a denom that they are the admin of. - ChangeAdmin *ChangeAdmin `json:"change_admin,omitempty"` - /// Contracts can mint native tokens for an existing factory denom - /// that they are the admin of. - MintTokens *MintTokens `json:"mint_tokens,omitempty"` - /// Contracts can burn native tokens for an existing factory denom - /// that they are the admin of. - /// Currently, the burn from address must be the admin contract. - BurnTokens *BurnTokens `json:"burn_tokens,omitempty"` - /// Sets the metadata on a denom which the contract controls - SetMetadata *SetMetadata `json:"set_metadata,omitempty"` - /// Forces a transfer of tokens from one address to another. - ForceTransfer *ForceTransfer `json:"force_transfer,omitempty"` -} - -// CreateDenom creates a new factory denom, of denomination: -// factory/{creating contract address}/{Subdenom} -// Subdenom can be of length at most 44 characters, in [0-9a-zA-Z./] -// The (creating contract address, subdenom) pair must be unique. -// The created denom's admin is the creating contract address, -// but this admin can be changed using the ChangeAdmin binding. -type CreateDenom struct { - Subdenom string `json:"subdenom"` - Metadata *Metadata `json:"metadata,omitempty"` -} - -// ChangeAdmin changes the admin for a factory denom. -// If the NewAdminAddress is empty, the denom has no admin. -type ChangeAdmin struct { - Denom string `json:"denom"` - NewAdminAddress string `json:"new_admin_address"` -} - -type MintTokens struct { - Denom string `json:"denom"` - Amount math.Int `json:"amount"` - MintToAddress string `json:"mint_to_address"` -} - -type BurnTokens struct { - Denom string `json:"denom"` - Amount math.Int `json:"amount"` - BurnFromAddress string `json:"burn_from_address"` -} - -type SetMetadata struct { - Denom string `json:"denom"` - Metadata Metadata `json:"metadata"` -} - -type ForceTransfer struct { - Denom string `json:"denom"` - Amount math.Int `json:"amount"` - FromAddress string `json:"from_address"` - ToAddress string `json:"to_address"` -} diff --git a/app/wasm/bindings/query.go b/app/wasm/bindings/query.go index 40acfacb2..fe4c9a8a6 100644 --- a/app/wasm/bindings/query.go +++ b/app/wasm/bindings/query.go @@ -31,13 +31,6 @@ type ContractQuery struct { CheckLiquidityProvided *CheckLiquidityProvided `json:"check_liquidity_provided,omitempty"` GetPoolByApp *GetPoolByApp `json:"get_pool_by_app,omitempty"` GetAssetPrice *GetAssetPrice `json:"get_asset_price,omitempty"` - /// Given a subdenom minted by a contract via `OsmosisMsg::MintTokens`, - /// returns the full denom as used by `BankMsg::Send`. - FullDenom *FullDenom `json:"full_denom,omitempty"` - Admin *DenomAdmin `json:"admin,omitempty"` - Metadata *GetMetadata `json:"metadata,omitempty"` - DenomsByCreator *DenomsByCreator `json:"denoms_by_creator,omitempty"` - Params *GetParams `json:"params,omitempty"` } type AppData struct { @@ -307,48 +300,3 @@ type GetAssetPrice struct { type GetAssetPriceResponse struct { Price uint64 `json:"price"` } - -// See https://github.com/CosmWasm/token-bindings/blob/main/packages/bindings/src/query.rs - -// query types - -type FullDenom struct { - CreatorAddr string `json:"creator_addr"` - Subdenom string `json:"subdenom"` -} - -type GetMetadata struct { - Denom string `json:"denom"` -} - -type DenomAdmin struct { - Denom string `json:"denom"` -} - -type DenomsByCreator struct { - Creator string `json:"creator"` -} - -type GetParams struct{} - -// responses - -type FullDenomResponse struct { - Denom string `json:"denom"` -} - -type AdminResponse struct { - Admin string `json:"admin"` -} - -type MetadataResponse struct { - Metadata *Metadata `json:"metadata,omitempty"` -} - -type DenomsByCreatorResponse struct { - Denoms []string `json:"denoms"` -} - -type ParamsResponse struct { - Params Params `json:"params"` -} diff --git a/app/wasm/bindings/types.go b/app/wasm/bindings/types.go deleted file mode 100644 index e5d242e69..000000000 --- a/app/wasm/bindings/types.go +++ /dev/null @@ -1,37 +0,0 @@ -package bindings - -import ( - wasmvmtypes "github.com/CosmWasm/wasmvm/types" -) - -type Metadata struct { - Description string `json:"description"` - // DenomUnits represents the list of DenomUnit's for a given coin - DenomUnits []DenomUnit `json:"denom_units"` - // Base represents the base denom (should be the DenomUnit with exponent = 0). - Base string `json:"base"` - // Display indicates the suggested denom that should be displayed in clients. - Display string `json:"display"` - // Name defines the name of the token (eg: Cosmos Atom) - Name string `json:"name"` - // Symbol is the token symbol usually shown on exchanges (eg: ATOM). - // This can be the same as the display. - Symbol string `json:"symbol"` -} - -type DenomUnit struct { - // Denom represents the string name of the given denom unit (e.g uatom). - Denom string `json:"denom"` - // Exponent represents power of 10 exponent that one must - // raise the base_denom to in order to equal the given DenomUnit's denom - // 1 denom = 1^exponent base_denom - // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with - // exponent = 6, thus: 1 atom = 10^6 uatom). - Exponent uint32 `json:"exponent"` - // Aliases is a list of string aliases for the given denom - Aliases []string `json:"aliases"` -} - -type Params struct { - DenomCreationFee []wasmvmtypes.Coin `json:"denom_creation_fee"` -} diff --git a/app/wasm/message_plugin.go b/app/wasm/message_plugin.go index c793403e8..20b98bb50 100644 --- a/app/wasm/message_plugin.go +++ b/app/wasm/message_plugin.go @@ -1,77 +1,60 @@ package wasm import ( - "encoding/json" - errorsmod "cosmossdk.io/errors" - - esmkeeper "github.com/comdex-official/comdex/x/esm/keeper" - vaultkeeper "github.com/comdex-official/comdex/x/vault/keeper" - - auctionkeeper "github.com/comdex-official/comdex/x/auction/keeper" - liquidationkeeper "github.com/comdex-official/comdex/x/liquidation/keeper" - tokenmintkeeper "github.com/comdex-official/comdex/x/tokenmint/keeper" - + "encoding/json" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmvmtypes "github.com/CosmWasm/wasmvm/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/comdex-official/comdex/app/wasm/bindings" assetkeeper "github.com/comdex-official/comdex/x/asset/keeper" + auctionkeeper "github.com/comdex-official/comdex/x/auction/keeper" collectorkeeper "github.com/comdex-official/comdex/x/collector/keeper" - gaslessKeeper "github.com/comdex-official/comdex/x/gasless/keeper" + esmkeeper "github.com/comdex-official/comdex/x/esm/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" lockertypes "github.com/comdex-official/comdex/x/locker/types" rewardskeeper "github.com/comdex-official/comdex/x/rewards/keeper" rewardstypes "github.com/comdex-official/comdex/x/rewards/types" - tokenfactorykeeper "github.com/comdex-official/comdex/x/tokenfactory/keeper" - tokenfactorytypes "github.com/comdex-official/comdex/x/tokenfactory/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + tokenmintkeeper "github.com/comdex-official/comdex/x/tokenmint/keeper" + vaultkeeper "github.com/comdex-official/comdex/x/vault/keeper" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) 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, - bankkeeper bankkeeper.Keeper, tokenfactorykeeper tokenfactorykeeper.Keeper, gaslesskeeper gaslessKeeper.Keeper, ) func(wasmkeeper.Messenger) wasmkeeper.Messenger { return func(old wasmkeeper.Messenger) wasmkeeper.Messenger { return &CustomMessenger{ - wrapped: old, - lockerKeeper: lockerKeeper, - rewardsKeeper: rewardsKeeper, - assetKeeper: assetKeeper, - collectorKeeper: collectorKeeper, - liquidationKeeper: liquidationKeeper, - auctionKeeper: auctionKeeper, - tokenMintKeeper: tokenMintKeeper, - esmKeeper: esmKeeper, - vaultKeeper: vaultKeeper, - liquiditykeeper: liquiditykeeper, - bankkeeper: bankkeeper, - tokenfactorykeeper: tokenfactorykeeper, - gaslesskeeper: gaslesskeeper, + wrapped: old, + lockerKeeper: lockerKeeper, + rewardsKeeper: rewardsKeeper, + assetKeeper: assetKeeper, + collectorKeeper: collectorKeeper, + liquidationKeeper: liquidationKeeper, + auctionKeeper: auctionKeeper, + tokenMintKeeper: tokenMintKeeper, + esmKeeper: esmKeeper, + vaultKeeper: vaultKeeper, + liquiditykeeper: liquiditykeeper, } } } type CustomMessenger struct { - wrapped wasmkeeper.Messenger - 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 - bankkeeper bankkeeper.Keeper - tokenfactorykeeper tokenfactorykeeper.Keeper - gaslesskeeper gaslessKeeper.Keeper + wrapped wasmkeeper.Messenger + 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 } var _ wasmkeeper.Messenger = (*CustomMessenger)(nil) @@ -147,32 +130,6 @@ func (m *CustomMessenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddre if comdexMsg.MsgEmissionPoolRewards != nil { return m.ExecuteAddEmissionPoolRewards(ctx, contractAddr, comdexMsg.MsgEmissionPoolRewards) } - - // only handle the happy path where this is really creating / minting / swapping ... - // leave everything else for the wrapped version - var contractMsg bindings.TokenFactoryMsg - if err := json.Unmarshal(msg.Custom, &contractMsg); err != nil { - return nil, nil, errorsmod.Wrap(err, "token factory msg") - } - - if contractMsg.CreateDenom != nil { - return m.createDenom(ctx, contractAddr, contractMsg.CreateDenom) - } - if contractMsg.MintTokens != nil { - return m.mintTokens(ctx, contractAddr, contractMsg.MintTokens) - } - if contractMsg.ChangeAdmin != nil { - return m.changeAdmin(ctx, contractAddr, contractMsg.ChangeAdmin) - } - if contractMsg.BurnTokens != nil { - return m.burnTokens(ctx, contractAddr, contractMsg.BurnTokens) - } - if contractMsg.SetMetadata != nil { - return m.setMetadata(ctx, contractAddr, contractMsg.SetMetadata) - } - if contractMsg.ForceTransfer != nil { - return m.forceTransfer(ctx, contractAddr, contractMsg.ForceTransfer) - } } return m.wrapped.DispatchMsg(ctx, contractAddr, contractIBCPortID, msg) } @@ -733,302 +690,3 @@ func MsgGetSurplusFund(collectorKeeper collectorkeeper.Keeper, ctx sdk.Context, } return nil } - -// createDenom creates a new token denom -func (m *CustomMessenger) createDenom(ctx sdk.Context, contractAddr sdk.AccAddress, createDenom *bindings.CreateDenom) ([]sdk.Event, [][]byte, error) { - bz, err := PerformCreateDenom(m.tokenfactorykeeper, m.bankkeeper, ctx, contractAddr, createDenom) - if err != nil { - return nil, nil, errorsmod.Wrap(err, "perform create denom") - } - // TODO: double check how this is all encoded to the contract - return nil, [][]byte{bz}, nil -} - -// PerformCreateDenom is used with createDenom to create a token denom; validates the msgCreateDenom. -func PerformCreateDenom(f tokenfactorykeeper.Keeper, b bankkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, createDenom *bindings.CreateDenom) ([]byte, error) { - if createDenom == nil { - return nil, wasmvmtypes.InvalidRequest{Err: "create denom null create denom"} - } - - msgServer := tokenfactorykeeper.NewMsgServerImpl(f) - - msgCreateDenom := tokenfactorytypes.NewMsgCreateDenom(contractAddr.String(), createDenom.Subdenom) - - if err := msgCreateDenom.ValidateBasic(); err != nil { - return nil, errorsmod.Wrap(err, "failed validating MsgCreateDenom") - } - - // Create denom - resp, err := msgServer.CreateDenom( - sdk.WrapSDKContext(ctx), - msgCreateDenom, - ) - if err != nil { - return nil, errorsmod.Wrap(err, "creating denom") - } - - if createDenom.Metadata != nil { - newDenom := resp.NewTokenDenom - err := PerformSetMetadata(f, b, ctx, contractAddr, newDenom, *createDenom.Metadata) - if err != nil { - return nil, errorsmod.Wrap(err, "setting metadata") - } - } - - return resp.Marshal() -} - -// mintTokens mints tokens of a specified denom to an address. -func (m *CustomMessenger) mintTokens(ctx sdk.Context, contractAddr sdk.AccAddress, mint *bindings.MintTokens) ([]sdk.Event, [][]byte, error) { - err := PerformMint(m.tokenfactorykeeper, m.bankkeeper, ctx, contractAddr, mint) - if err != nil { - return nil, nil, errorsmod.Wrap(err, "perform mint") - } - return nil, nil, nil -} - -// PerformMint used with mintTokens to validate the mint message and mint through token factory. -func PerformMint(f tokenfactorykeeper.Keeper, b bankkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, mint *bindings.MintTokens) error { - if mint == nil { - return wasmvmtypes.InvalidRequest{Err: "mint token null mint"} - } - rcpt, err := parseAddress(mint.MintToAddress) - if err != nil { - return err - } - - coin := sdk.Coin{Denom: mint.Denom, Amount: mint.Amount} - sdkMsg := tokenfactorytypes.NewMsgMint(contractAddr.String(), coin) - - if err = sdkMsg.ValidateBasic(); err != nil { - return err - } - - // Mint through token factory / message server - msgServer := tokenfactorykeeper.NewMsgServerImpl(f) - _, err = msgServer.Mint(sdk.WrapSDKContext(ctx), sdkMsg) - if err != nil { - return errorsmod.Wrap(err, "minting coins from message") - } - - if b.BlockedAddr(rcpt) { - return errorsmod.Wrapf(err, "minting coins to blocked address %s", rcpt.String()) - } - - err = b.SendCoins(ctx, contractAddr, rcpt, sdk.NewCoins(coin)) - if err != nil { - return errorsmod.Wrap(err, "sending newly minted coins from message") - } - return nil -} - -// changeAdmin changes the admin. -func (m *CustomMessenger) changeAdmin(ctx sdk.Context, contractAddr sdk.AccAddress, changeAdmin *bindings.ChangeAdmin) ([]sdk.Event, [][]byte, error) { - err := ChangeAdmin(m.tokenfactorykeeper, ctx, contractAddr, changeAdmin) - if err != nil { - return nil, nil, errorsmod.Wrap(err, "failed to change admin") - } - return nil, nil, nil -} - -// ChangeAdmin is used with changeAdmin to validate changeAdmin messages and to dispatch. -func ChangeAdmin(f tokenfactorykeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, changeAdmin *bindings.ChangeAdmin) error { - if changeAdmin == nil { - return wasmvmtypes.InvalidRequest{Err: "changeAdmin is nil"} - } - newAdminAddr, err := parseAddress(changeAdmin.NewAdminAddress) - if err != nil { - return err - } - - changeAdminMsg := tokenfactorytypes.NewMsgChangeAdmin(contractAddr.String(), changeAdmin.Denom, newAdminAddr.String()) - if err := changeAdminMsg.ValidateBasic(); err != nil { - return err - } - - msgServer := tokenfactorykeeper.NewMsgServerImpl(f) - _, err = msgServer.ChangeAdmin(sdk.WrapSDKContext(ctx), changeAdminMsg) - if err != nil { - return errorsmod.Wrap(err, "failed changing admin from message") - } - return nil -} - -// burnTokens burns tokens. -func (m *CustomMessenger) burnTokens(ctx sdk.Context, contractAddr sdk.AccAddress, burn *bindings.BurnTokens) ([]sdk.Event, [][]byte, error) { - err := PerformBurn(m.tokenfactorykeeper, ctx, contractAddr, burn) - if err != nil { - return nil, nil, errorsmod.Wrap(err, "perform burn") - } - return nil, nil, nil -} - -// PerformBurn performs token burning after validating tokenBurn message. -func PerformBurn(f tokenfactorykeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, burn *bindings.BurnTokens) error { - if burn == nil { - return wasmvmtypes.InvalidRequest{Err: "burn token null mint"} - } - - coin := sdk.Coin{Denom: burn.Denom, Amount: burn.Amount} - sdkMsg := tokenfactorytypes.NewMsgBurn(contractAddr.String(), coin) - if burn.BurnFromAddress != "" { - sdkMsg = tokenfactorytypes.NewMsgBurnFrom(contractAddr.String(), coin, burn.BurnFromAddress) - } - - if err := sdkMsg.ValidateBasic(); err != nil { - return err - } - - // Burn through token factory / message server - msgServer := tokenfactorykeeper.NewMsgServerImpl(f) - _, err := msgServer.Burn(sdk.WrapSDKContext(ctx), sdkMsg) - if err != nil { - return errorsmod.Wrap(err, "burning coins from message") - } - return nil -} - -// forceTransfer moves tokens. -func (m *CustomMessenger) forceTransfer(ctx sdk.Context, contractAddr sdk.AccAddress, forcetransfer *bindings.ForceTransfer) ([]sdk.Event, [][]byte, error) { - err := PerformForceTransfer(m.tokenfactorykeeper, ctx, contractAddr, forcetransfer) - if err != nil { - return nil, nil, errorsmod.Wrap(err, "perform force transfer") - } - return nil, nil, nil -} - -// PerformForceTransfer performs token moving after validating tokenForceTransfer message. -func PerformForceTransfer(f tokenfactorykeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, forcetransfer *bindings.ForceTransfer) error { - if forcetransfer == nil { - return wasmvmtypes.InvalidRequest{Err: "force transfer null"} - } - - _, err := parseAddress(forcetransfer.FromAddress) - if err != nil { - return err - } - - _, err = parseAddress(forcetransfer.ToAddress) - if err != nil { - return err - } - - coin := sdk.Coin{Denom: forcetransfer.Denom, Amount: forcetransfer.Amount} - sdkMsg := tokenfactorytypes.NewMsgForceTransfer(contractAddr.String(), coin, forcetransfer.FromAddress, forcetransfer.ToAddress) - - if err := sdkMsg.ValidateBasic(); err != nil { - return err - } - - // Transfer through token factory / message server - msgServer := tokenfactorykeeper.NewMsgServerImpl(f) - _, err = msgServer.ForceTransfer(sdk.WrapSDKContext(ctx), sdkMsg) - if err != nil { - return errorsmod.Wrap(err, "force transferring from message") - } - return nil -} - -// createDenom creates a new token denom -func (m *CustomMessenger) setMetadata(ctx sdk.Context, contractAddr sdk.AccAddress, setMetadata *bindings.SetMetadata) ([]sdk.Event, [][]byte, error) { - err := PerformSetMetadata(m.tokenfactorykeeper, m.bankkeeper, ctx, contractAddr, setMetadata.Denom, setMetadata.Metadata) - if err != nil { - return nil, nil, errorsmod.Wrap(err, "perform create denom") - } - return nil, nil, nil -} - -// PerformSetMetadata is used with setMetadata to add new metadata -// It also is called inside CreateDenom if optional metadata field is set -func PerformSetMetadata(f tokenfactorykeeper.Keeper, b bankkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, denom string, metadata bindings.Metadata) error { - // ensure contract address is admin of denom - auth, err := f.GetAuthorityMetadata(ctx, denom) - if err != nil { - return err - } - if auth.Admin != contractAddr.String() { - return wasmvmtypes.InvalidRequest{Err: "only admin can set metadata"} - } - - // ensure we are setting proper denom metadata (bank uses Base field, fill it if missing) - if metadata.Base == "" { - metadata.Base = denom - } else if metadata.Base != denom { - // this is the key that we set - return wasmvmtypes.InvalidRequest{Err: "Base must be the same as denom"} - } - - // Create and validate the metadata - bankMetadata := WasmMetadataToSdk(metadata) - if err := bankMetadata.Validate(); err != nil { - return err - } - - b.SetDenomMetaData(ctx, bankMetadata) - return nil -} - -// GetFullDenom is a function, not method, so the message_plugin can use it -func GetFullDenom(contract string, subDenom string) (string, error) { - // Address validation - if _, err := parseAddress(contract); err != nil { - return "", err - } - fullDenom, err := tokenfactorytypes.GetTokenDenom(contract, subDenom) - if err != nil { - return "", errorsmod.Wrap(err, "validate sub-denom") - } - - return fullDenom, nil -} - -// parseAddress parses address from bech32 string and verifies its format. -func parseAddress(addr string) (sdk.AccAddress, error) { - parsed, err := sdk.AccAddressFromBech32(addr) - if err != nil { - return nil, errorsmod.Wrap(err, "address from bech32") - } - err = sdk.VerifyAddressFormat(parsed) - if err != nil { - return nil, errorsmod.Wrap(err, "verify address format") - } - return parsed, nil -} - -func WasmMetadataToSdk(metadata bindings.Metadata) banktypes.Metadata { - denoms := []*banktypes.DenomUnit{} - for _, unit := range metadata.DenomUnits { - denoms = append(denoms, &banktypes.DenomUnit{ - Denom: unit.Denom, - Exponent: unit.Exponent, - Aliases: unit.Aliases, - }) - } - return banktypes.Metadata{ - Description: metadata.Description, - Display: metadata.Display, - Base: metadata.Base, - Name: metadata.Name, - Symbol: metadata.Symbol, - DenomUnits: denoms, - } -} - -func SdkMetadataToWasm(metadata banktypes.Metadata) *bindings.Metadata { - denoms := []bindings.DenomUnit{} - for _, unit := range metadata.DenomUnits { - denoms = append(denoms, bindings.DenomUnit{ - Denom: unit.Denom, - Exponent: unit.Exponent, - Aliases: unit.Aliases, - }) - } - return &bindings.Metadata{ - Description: metadata.Description, - Display: metadata.Display, - Base: metadata.Base, - Name: metadata.Name, - Symbol: metadata.Symbol, - DenomUnits: denoms, - } -} diff --git a/app/wasm/queries.go b/app/wasm/queries.go index 01da9d41b..69d059671 100644 --- a/app/wasm/queries.go +++ b/app/wasm/queries.go @@ -1,12 +1,9 @@ package wasm import ( - "fmt" - 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" @@ -16,28 +13,20 @@ import ( tokenMintKeeper "github.com/comdex-official/comdex/x/tokenmint/keeper" vaultKeeper "github.com/comdex-official/comdex/x/vault/keeper" sdk "github.com/cosmos/cosmos-sdk/types" - - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - - bindingstypes "github.com/comdex-official/comdex/app/wasm/bindings" - tokenfactorykeeper "github.com/comdex-official/comdex/x/tokenfactory/keeper" ) type QueryPlugin struct { - assetKeeper *assetKeeper.Keeper - lockerKeeper *lockerkeeper.Keeper - tokenMintKeeper *tokenMintKeeper.Keeper - rewardsKeeper *rewardsKeeper.Keeper - collectorKeeper *collectorkeeper.Keeper - liquidationKeeper *liquidationKeeper.Keeper - esmKeeper *esmKeeper.Keeper - vaultKeeper *vaultKeeper.Keeper - lendKeeper *lendKeeper.Keeper - liquidityKeeper *liquidityKeeper.Keeper - marketKeeper *marketKeeper.Keeper - bankKeeper bankkeeper.Keeper - tokenFactoryKeeper *tokenfactorykeeper.Keeper - gaslessKeeper *gaslessKeeper.Keeper + assetKeeper *assetKeeper.Keeper + lockerKeeper *lockerkeeper.Keeper + tokenMintKeeper *tokenMintKeeper.Keeper + rewardsKeeper *rewardsKeeper.Keeper + collectorKeeper *collectorkeeper.Keeper + liquidationKeeper *liquidationKeeper.Keeper + esmKeeper *esmKeeper.Keeper + vaultKeeper *vaultKeeper.Keeper + lendKeeper *lendKeeper.Keeper + liquidityKeeper *liquidityKeeper.Keeper + marketKeeper *marketKeeper.Keeper } func NewQueryPlugin( @@ -52,25 +41,19 @@ func NewQueryPlugin( lendKeeper *lendKeeper.Keeper, liquidityKeeper *liquidityKeeper.Keeper, marketKeeper *marketKeeper.Keeper, - bankkeeper bankkeeper.Keeper, - tokenfactorykeeper *tokenfactorykeeper.Keeper, - gaslessKeeper *gaslessKeeper.Keeper, ) *QueryPlugin { return &QueryPlugin{ - assetKeeper: assetKeeper, - lockerKeeper: lockerKeeper, - tokenMintKeeper: tokenMintKeeper, - rewardsKeeper: rewardsKeeper, - collectorKeeper: collectorKeeper, - liquidationKeeper: liquidation, - esmKeeper: esmKeeper, - vaultKeeper: vaultKeeper, - lendKeeper: lendKeeper, - liquidityKeeper: liquidityKeeper, - marketKeeper: marketKeeper, - bankKeeper: bankkeeper, - tokenFactoryKeeper: tokenfactorykeeper, - gaslessKeeper: gaslessKeeper, + assetKeeper: assetKeeper, + lockerKeeper: lockerKeeper, + tokenMintKeeper: tokenMintKeeper, + rewardsKeeper: rewardsKeeper, + collectorKeeper: collectorKeeper, + liquidationKeeper: liquidation, + esmKeeper: esmKeeper, + vaultKeeper: vaultKeeper, + lendKeeper: lendKeeper, + liquidityKeeper: liquidityKeeper, + marketKeeper: marketKeeper, } } @@ -231,36 +214,3 @@ func (qp QueryPlugin) WasmGetAssetPrice(ctx sdk.Context, assetID uint64) (twa ui } return 0, false } - -// GetDenomAdmin is a query to get denom admin. -func (qp QueryPlugin) GetDenomAdmin(ctx sdk.Context, denom string) (*bindingstypes.AdminResponse, error) { - metadata, err := qp.tokenFactoryKeeper.GetAuthorityMetadata(ctx, denom) - if err != nil { - return nil, fmt.Errorf("failed to get admin for denom: %s", denom) - } - return &bindingstypes.AdminResponse{Admin: metadata.Admin}, nil -} - -func (qp QueryPlugin) GetDenomsByCreator(ctx sdk.Context, creator string) (*bindingstypes.DenomsByCreatorResponse, error) { - // TODO: validate creator address - denoms := qp.tokenFactoryKeeper.GetDenomsFromCreator(ctx, creator) - return &bindingstypes.DenomsByCreatorResponse{Denoms: denoms}, nil -} - -func (qp QueryPlugin) GetMetadata(ctx sdk.Context, denom string) (*bindingstypes.MetadataResponse, error) { - metadata, found := qp.bankKeeper.GetDenomMetaData(ctx, denom) - var parsed *bindingstypes.Metadata - if found { - parsed = SdkMetadataToWasm(metadata) - } - return &bindingstypes.MetadataResponse{Metadata: parsed}, nil -} - -func (qp QueryPlugin) GetParams(ctx sdk.Context) (*bindingstypes.ParamsResponse, error) { - params := qp.tokenFactoryKeeper.GetParams(ctx) - return &bindingstypes.ParamsResponse{ - Params: bindingstypes.Params{ - DenomCreationFee: ConvertSdkCoinsToWasmCoins(params.DenomCreationFee), - }, - }, nil -} diff --git a/app/wasm/query_plugin.go b/app/wasm/query_plugin.go index 9ed9828fa..2074cb979 100644 --- a/app/wasm/query_plugin.go +++ b/app/wasm/query_plugin.go @@ -3,12 +3,9 @@ package wasm import ( errorsmod "cosmossdk.io/errors" "encoding/json" - "fmt" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/comdex-official/comdex/app/wasm/bindings" + sdk "github.com/cosmos/cosmos-sdk/types" ) func CustomQuerier(queryPlugin *QueryPlugin) func(ctx sdk.Context, request json.RawMessage) ([]byte, error) { @@ -368,98 +365,8 @@ func CustomQuerier(queryPlugin *QueryPlugin) func(ctx sdk.Context, request json. return nil, errorsmod.Wrap(err, "GetAssetPrice query response") } return bz, nil - case contractQuery.FullDenom != nil: - creator := contractQuery.FullDenom.CreatorAddr - subdenom := contractQuery.FullDenom.Subdenom - - fullDenom, err := GetFullDenom(creator, subdenom) - if err != nil { - return nil, errorsmod.Wrap(err, "osmo full denom query") - } - - res := bindings.FullDenomResponse{ - Denom: fullDenom, - } - - bz, err := json.Marshal(res) - if err != nil { - return nil, errorsmod.Wrap(err, "failed to marshal FullDenomResponse") - } - - return bz, nil - - case contractQuery.Admin != nil: - res, err := queryPlugin.GetDenomAdmin(ctx, contractQuery.Admin.Denom) - if err != nil { - return nil, err - } - - bz, err := json.Marshal(res) - if err != nil { - return nil, fmt.Errorf("failed to JSON marshal AdminResponse: %w", err) - } - - return bz, nil - - case contractQuery.Metadata != nil: - res, err := queryPlugin.GetMetadata(ctx, contractQuery.Metadata.Denom) - if err != nil { - return nil, err - } - - bz, err := json.Marshal(res) - if err != nil { - return nil, fmt.Errorf("failed to JSON marshal MetadataResponse: %w", err) - } - - return bz, nil - - case contractQuery.DenomsByCreator != nil: - res, err := queryPlugin.GetDenomsByCreator(ctx, contractQuery.DenomsByCreator.Creator) - if err != nil { - return nil, err - } - - bz, err := json.Marshal(res) - if err != nil { - return nil, fmt.Errorf("failed to JSON marshal DenomsByCreatorResponse: %w", err) - } - - return bz, nil - - case contractQuery.Params != nil: - res, err := queryPlugin.GetParams(ctx) - if err != nil { - return nil, err - } - - bz, err := json.Marshal(res) - if err != nil { - return nil, fmt.Errorf("failed to JSON marshal ParamsResponse: %w", err) - } - - return bz, nil } return nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown App Data query variant"} } } - -// ConvertSdkCoinsToWasmCoins converts sdk type coins to wasm vm type coins -func ConvertSdkCoinsToWasmCoins(coins []sdk.Coin) wasmvmtypes.Coins { - var toSend wasmvmtypes.Coins - for _, coin := range coins { - c := ConvertSdkCoinToWasmCoin(coin) - toSend = append(toSend, c) - } - return toSend -} - -// ConvertSdkCoinToWasmCoin converts a sdk type coin to a wasm vm type coin -func ConvertSdkCoinToWasmCoin(coin sdk.Coin) wasmvmtypes.Coin { - return wasmvmtypes.Coin{ - Denom: coin.Denom, - // Note: tokenfactory tokens have 18 decimal places, so 10^22 is common, no longer in u64 range - Amount: coin.Amount.String(), - } -} \ No newline at end of file diff --git a/app/wasm/test/custom_msg_test.go b/app/wasm/test/custom_msg_test.go deleted file mode 100644 index 18a127c2a..000000000 --- a/app/wasm/test/custom_msg_test.go +++ /dev/null @@ -1,328 +0,0 @@ -package wasm - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/app" - bindings "github.com/comdex-official/comdex/app/wasm/bindings" - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func TestCreateDenomMsg(t *testing.T) { - creator := RandomAccountAddress() - comdexapp, ctx := SetupCustomApp(t, creator) - - lucky := RandomAccountAddress() - reflect := instantiateReflectContract(t, *ctx, comdexapp, lucky) - require.NotEmpty(t, reflect) - - // Fund reflect contract with 100 base denom creation fees - reflectAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) - fundAccount(t, *ctx, comdexapp, reflect, reflectAmount) - - msg := bindings.TokenFactoryMsg{CreateDenom: &bindings.CreateDenom{ - Subdenom: "SUN", - }} - err := executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - - // query the denom and see if it matches - query := bindings.ContractQuery{ - FullDenom: &bindings.FullDenom{ - CreatorAddr: reflect.String(), - Subdenom: "SUN", - }, - } - resp := bindings.FullDenomResponse{} - queryCustom(t, *ctx, comdexapp, reflect, query, &resp) - - require.Equal(t, resp.Denom, fmt.Sprintf("factory/%s/SUN", reflect.String())) -} - -func TestMintMsg(t *testing.T) { - creator := RandomAccountAddress() - comdexapp, ctx := SetupCustomApp(t, creator) - - lucky := RandomAccountAddress() - reflect := instantiateReflectContract(t, *ctx, comdexapp, lucky) - require.NotEmpty(t, reflect) - - // Fund reflect contract with 100 base denom creation fees - reflectAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) - fundAccount(t, *ctx, comdexapp, reflect, reflectAmount) - - // lucky was broke - balances := comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - require.Empty(t, balances) - - // Create denom for minting - msg := bindings.TokenFactoryMsg{CreateDenom: &bindings.CreateDenom{ - Subdenom: "SUN", - }} - err := executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - sunDenom := fmt.Sprintf("factory/%s/%s", reflect.String(), msg.CreateDenom.Subdenom) - - amount, ok := sdk.NewIntFromString("808010808") - require.True(t, ok) - msg = bindings.TokenFactoryMsg{MintTokens: &bindings.MintTokens{ - Denom: sunDenom, - Amount: amount, - MintToAddress: lucky.String(), - }} - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - - balances = comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - require.Len(t, balances, 1) - coin := balances[0] - require.Equal(t, amount, coin.Amount) - require.Contains(t, coin.Denom, "factory/") - - // query the denom and see if it matches - query := bindings.ContractQuery{ - FullDenom: &bindings.FullDenom{ - CreatorAddr: reflect.String(), - Subdenom: "SUN", - }, - } - resp := bindings.FullDenomResponse{} - queryCustom(t, *ctx, comdexapp, reflect, query, &resp) - - require.Equal(t, resp.Denom, coin.Denom) - - // mint the same denom again - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - - balances = comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - require.Len(t, balances, 1) - coin = balances[0] - require.Equal(t, amount.MulRaw(2), coin.Amount) - require.Contains(t, coin.Denom, "factory/") - - // query the denom and see if it matches - query = bindings.ContractQuery{ - FullDenom: &bindings.FullDenom{ - CreatorAddr: reflect.String(), - Subdenom: "SUN", - }, - } - resp = bindings.FullDenomResponse{} - queryCustom(t, *ctx, comdexapp, reflect, query, &resp) - - require.Equal(t, resp.Denom, coin.Denom) - - // now mint another amount / denom - // create it first - msg = bindings.TokenFactoryMsg{CreateDenom: &bindings.CreateDenom{ - Subdenom: "MOON", - }} - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - moonDenom := fmt.Sprintf("factory/%s/%s", reflect.String(), msg.CreateDenom.Subdenom) - - amount = amount.SubRaw(1) - msg = bindings.TokenFactoryMsg{MintTokens: &bindings.MintTokens{ - Denom: moonDenom, - Amount: amount, - MintToAddress: lucky.String(), - }} - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - - balances = comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - require.Len(t, balances, 2) - coin = balances[0] - require.Equal(t, amount, coin.Amount) - require.Contains(t, coin.Denom, "factory/") - - // query the denom and see if it matches - query = bindings.ContractQuery{ - FullDenom: &bindings.FullDenom{ - CreatorAddr: reflect.String(), - Subdenom: "MOON", - }, - } - resp = bindings.FullDenomResponse{} - queryCustom(t, *ctx, comdexapp, reflect, query, &resp) - - require.Equal(t, resp.Denom, coin.Denom) - - // and check the first denom is unchanged - coin = balances[1] - require.Equal(t, amount.AddRaw(1).MulRaw(2), coin.Amount) - require.Contains(t, coin.Denom, "factory/") - - // query the denom and see if it matches - query = bindings.ContractQuery{ - FullDenom: &bindings.FullDenom{ - CreatorAddr: reflect.String(), - Subdenom: "SUN", - }, - } - resp = bindings.FullDenomResponse{} - queryCustom(t, *ctx, comdexapp, reflect, query, &resp) - - require.Equal(t, resp.Denom, coin.Denom) -} - -func TestForceTransfer(t *testing.T) { - creator := RandomAccountAddress() - comdexapp, ctx := SetupCustomApp(t, creator) - - lucky := RandomAccountAddress() - rcpt := RandomAccountAddress() - reflect := instantiateReflectContract(t, *ctx, comdexapp, lucky) - require.NotEmpty(t, reflect) - - // Fund reflect contract with 100 base denom creation fees - reflectAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) - fundAccount(t, *ctx, comdexapp, reflect, reflectAmount) - - // lucky was broke - balances := comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - require.Empty(t, balances) - - // Create denom for minting - msg := bindings.TokenFactoryMsg{CreateDenom: &bindings.CreateDenom{ - Subdenom: "SUN", - }} - err := executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - sunDenom := fmt.Sprintf("factory/%s/%s", reflect.String(), msg.CreateDenom.Subdenom) - - amount, ok := sdk.NewIntFromString("808010808") - require.True(t, ok) - - // Mint new tokens to lucky - msg = bindings.TokenFactoryMsg{MintTokens: &bindings.MintTokens{ - Denom: sunDenom, - Amount: amount, - MintToAddress: lucky.String(), - }} - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - - // Force move 100 tokens from lucky to rcpt - msg = bindings.TokenFactoryMsg{ForceTransfer: &bindings.ForceTransfer{ - Denom: sunDenom, - Amount: sdk.NewInt(100), - FromAddress: lucky.String(), - ToAddress: rcpt.String(), - }} - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - - // check the balance of rcpt - balances = comdexapp.BankKeeper.GetAllBalances(*ctx, rcpt) - require.Len(t, balances, 1) - coin := balances[0] - require.Equal(t, sdk.NewInt(100), coin.Amount) -} - -func TestBurnMsg(t *testing.T) { - creator := RandomAccountAddress() - comdexapp, ctx := SetupCustomApp(t, creator) - - lucky := RandomAccountAddress() - reflect := instantiateReflectContract(t, *ctx, comdexapp, lucky) - require.NotEmpty(t, reflect) - - // Fund reflect contract with 100 base denom creation fees - reflectAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) - fundAccount(t, *ctx, comdexapp, reflect, reflectAmount) - - // lucky was broke - balances := comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - require.Empty(t, balances) - - // Create denom for minting - msg := bindings.TokenFactoryMsg{CreateDenom: &bindings.CreateDenom{ - Subdenom: "SUN", - }} - err := executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - sunDenom := fmt.Sprintf("factory/%s/%s", reflect.String(), msg.CreateDenom.Subdenom) - - amount, ok := sdk.NewIntFromString("808010809") - require.True(t, ok) - - msg = bindings.TokenFactoryMsg{MintTokens: &bindings.MintTokens{ - Denom: sunDenom, - Amount: amount, - MintToAddress: lucky.String(), - }} - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - - // can burn from different address with burnFrom - amt, ok := sdk.NewIntFromString("1") - require.True(t, ok) - msg = bindings.TokenFactoryMsg{BurnTokens: &bindings.BurnTokens{ - Denom: sunDenom, - Amount: amt, - BurnFromAddress: lucky.String(), - }} - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) - - // lucky needs to send balance to reflect contract to burn it - luckyBalance := comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - err = comdexapp.BankKeeper.SendCoins(*ctx, lucky, reflect, luckyBalance) - require.NoError(t, err) - - msg = bindings.TokenFactoryMsg{BurnTokens: &bindings.BurnTokens{ - Denom: sunDenom, - Amount: amount.Abs().Sub(sdk.NewInt(1)), - BurnFromAddress: reflect.String(), - }} - err = executeCustom(t, *ctx, comdexapp, reflect, lucky, msg, sdk.Coin{}) - require.NoError(t, err) -} - -type ReflectExec struct { - ReflectMsg *ReflectMsgs `json:"reflect_msg,omitempty"` - ReflectSubMsg *ReflectSubMsgs `json:"reflect_sub_msg,omitempty"` -} - -type ReflectMsgs struct { - Msgs []wasmvmtypes.CosmosMsg `json:"msgs"` -} - -type ReflectSubMsgs struct { - Msgs []wasmvmtypes.SubMsg `json:"msgs"` -} - -func executeCustom(t *testing.T, ctx sdk.Context, comdexapp *app.App, contract sdk.AccAddress, sender sdk.AccAddress, msg bindings.TokenFactoryMsg, funds sdk.Coin) error { //nolint:unparam // funds is always nil but could change in the future. - customBz, err := json.Marshal(msg) - require.NoError(t, err) - - reflectMsg := ReflectExec{ - ReflectMsg: &ReflectMsgs{ - Msgs: []wasmvmtypes.CosmosMsg{{ - Custom: customBz, - }}, - }, - } - reflectBz, err := json.Marshal(reflectMsg) - require.NoError(t, err) - - // no funds sent if amount is 0 - var coins sdk.Coins - if !funds.Amount.IsNil() { - coins = sdk.Coins{funds} - } - - contractKeeper := keeper.NewDefaultPermissionKeeper(comdexapp.WasmKeeper) - _, err = contractKeeper.Execute(ctx, contract, sender, reflectBz, coins) - return err -} diff --git a/app/wasm/test/custom_query_test.go b/app/wasm/test/custom_query_test.go deleted file mode 100644 index 64670aec2..000000000 --- a/app/wasm/test/custom_query_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package wasm - -import ( - "encoding/json" - "fmt" - "testing" - - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/app" - bindings "github.com/comdex-official/comdex/app/wasm/bindings" -) - -func TestQueryFullDenom(t *testing.T) { - actor := RandomAccountAddress() - comdexapp, ctx := SetupCustomApp(t, actor) - - reflect := instantiateReflectContract(t, *ctx, comdexapp, actor) - require.NotEmpty(t, reflect) - - // query full denom - query := bindings.ContractQuery{ - FullDenom: &bindings.FullDenom{ - CreatorAddr: reflect.String(), - Subdenom: "ustart", - }, - } - resp := bindings.FullDenomResponse{} - queryCustom(t, *ctx, comdexapp, reflect, query, &resp) - - expected := fmt.Sprintf("factory/%s/ustart", reflect.String()) - require.EqualValues(t, expected, resp.Denom) -} - -type ReflectQuery struct { - Chain *ChainRequest `json:"chain,omitempty"` -} - -type ChainRequest struct { - Request wasmvmtypes.QueryRequest `json:"request"` -} - -type ChainResponse struct { - Data []byte `json:"data"` -} - -func queryCustom(t *testing.T, ctx sdk.Context, comdexapp *app.App, contract sdk.AccAddress, request bindings.ContractQuery, response interface{}) { - msgBz, err := json.Marshal(request) - require.NoError(t, err) - fmt.Println("queryCustom1", string(msgBz)) - - query := ReflectQuery{ - Chain: &ChainRequest{ - Request: wasmvmtypes.QueryRequest{Custom: msgBz}, - }, - } - queryBz, err := json.Marshal(query) - require.NoError(t, err) - fmt.Println("queryCustom2", string(queryBz)) - - resBz, err := comdexapp.WasmKeeper.QuerySmart(ctx, contract, queryBz) - require.NoError(t, err) - var resp ChainResponse - err = json.Unmarshal(resBz, &resp) - require.NoError(t, err) - err = json.Unmarshal(resp.Data, response) - require.NoError(t, err) -} diff --git a/app/wasm/test/helpers_test.go b/app/wasm/test/helpers_test.go index b61364e0f..4f5e3bf8d 100644 --- a/app/wasm/test/helpers_test.go +++ b/app/wasm/test/helpers_test.go @@ -2,28 +2,23 @@ package wasm import ( "fmt" - "os" - "testing" - "time" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + "github.com/comdex-official/comdex/app" "github.com/comdex-official/comdex/app/wasm/bindings" assetTypes "github.com/comdex-official/comdex/x/asset/types" + "github.com/comdex-official/comdex/x/tokenmint/keeper" tokenmintTypes "github.com/comdex-official/comdex/x/tokenmint/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - - "github.com/stretchr/testify/require" - "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" - // simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/app" - "github.com/comdex-official/comdex/x/tokenmint/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/stretchr/testify/require" + "os" + "testing" + "time" ) // func SetupCustomApp(t *testing.T) (*app.App, *sdk.Context) { diff --git a/app/wasm/test/messages_test.go b/app/wasm/test/messages_test.go index 6859858d1..f75c20183 100644 --- a/app/wasm/test/messages_test.go +++ b/app/wasm/test/messages_test.go @@ -23,10 +23,7 @@ func TestWhitelistAssetLocker(t *testing.T) { &comdex.VaultKeeper, &comdex.LendKeeper, &comdex.LiquidityKeeper, - &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + &comdex.MarketKeeper) for _, tc := range []struct { name string msg *bindings.MsgWhiteListAssetLocker @@ -71,9 +68,7 @@ func TestAddMsgAddExtendedPairsVault(t *testing.T) { &comdex.LendKeeper, &comdex.LiquidityKeeper, &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + ) for _, tc := range []struct { name string msg *bindings.MsgAddExtendedPairsVault @@ -132,9 +127,7 @@ func TestMsgSetCollectorLookupTable(t *testing.T) { &comdex.LendKeeper, &comdex.LiquidityKeeper, &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + ) for _, tc := range []struct { name string msg *bindings.MsgSetCollectorLookupTable @@ -187,9 +180,7 @@ func TestMsgSetAuctionMappingForApp(t *testing.T) { &comdex.LendKeeper, &comdex.LiquidityKeeper, &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + ) for _, tc := range []struct { name string msg *bindings.MsgSetAuctionMappingForApp @@ -241,9 +232,7 @@ func TestMsgUpdateCollectorLookupTable(t *testing.T) { &comdex.LendKeeper, &comdex.LiquidityKeeper, &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + ) for _, tc := range []struct { name string msg *bindings.MsgUpdateCollectorLookupTable @@ -296,9 +285,7 @@ func TestMsgUpdatePairsVault(t *testing.T) { &comdex.LendKeeper, &comdex.LiquidityKeeper, &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + ) for _, tc := range []struct { name string msg *bindings.MsgUpdatePairsVault @@ -355,9 +342,7 @@ func TestMsgWhitelistAppIDLiquidation(t *testing.T) { &comdex.LendKeeper, &comdex.LiquidityKeeper, &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + ) for _, tc := range []struct { name string msg *bindings.MsgWhitelistAppIDLiquidation @@ -406,9 +391,7 @@ func TestMsgRemoveWhitelistAppIDLiquidation(t *testing.T) { &comdex.LendKeeper, &comdex.LiquidityKeeper, &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + ) for _, tc := range []struct { name string msg *bindings.MsgRemoveWhitelistAppIDLiquidation @@ -453,9 +436,7 @@ func TestMsgAddAuctionParams(t *testing.T) { &comdex.LendKeeper, &comdex.LiquidityKeeper, &comdex.MarketKeeper, - comdex.BankKeeper, - &comdex.TokenFactoryKeeper, - &comdex.GaslessKeeper) + ) for _, tc := range []struct { name string msg *bindings.MsgAddAuctionParams diff --git a/app/wasm/test/validate_msg_test.go b/app/wasm/test/validate_msg_test.go deleted file mode 100644 index 4d374ebdb..000000000 --- a/app/wasm/test/validate_msg_test.go +++ /dev/null @@ -1,415 +0,0 @@ -package wasm - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - wasm "github.com/comdex-official/comdex/app/wasm" - bindings "github.com/comdex-official/comdex/app/wasm/bindings" - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func TestCreateDenom(t *testing.T) { - actor := RandomAccountAddress() - comdexapp, ctx := SetupCustomApp(t, actor) - - // Fund actor with 100 base denom creation fees - actorAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) - fundAccount(t, *ctx, comdexapp, actor, actorAmount) - - specs := map[string]struct { - createDenom *bindings.CreateDenom - expErr bool - }{ - "valid sub-denom": { - createDenom: &bindings.CreateDenom{ - Subdenom: "MOON", - }, - }, - "empty sub-denom": { - createDenom: &bindings.CreateDenom{ - Subdenom: "", - }, - expErr: false, - }, - "invalid sub-denom": { - createDenom: &bindings.CreateDenom{ - Subdenom: "sub-denom_2", - }, - expErr: false, - }, - "null create denom": { - createDenom: nil, - expErr: true, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - // when - _, gotErr := wasm.PerformCreateDenom(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, actor, spec.createDenom) - // then - if spec.expErr { - t.Logf("validate_msg_test got error: %v", gotErr) - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - }) - } -} - -func TestChangeAdmin(t *testing.T) { - const validDenom = "validdenom" - - tokenCreator := RandomAccountAddress() - - specs := map[string]struct { - actor sdk.AccAddress - changeAdmin *bindings.ChangeAdmin - - expErrMsg string - }{ - "valid": { - changeAdmin: &bindings.ChangeAdmin{ - Denom: fmt.Sprintf("factory/%s/%s", tokenCreator.String(), validDenom), - NewAdminAddress: RandomBech32AccountAddress(), - }, - actor: tokenCreator, - }, - "typo in factory in denom name": { - changeAdmin: &bindings.ChangeAdmin{ - Denom: fmt.Sprintf("facory/%s/%s", tokenCreator.String(), validDenom), - NewAdminAddress: RandomBech32AccountAddress(), - }, - actor: tokenCreator, - expErrMsg: "denom prefix is incorrect. Is: facory. Should be: factory: invalid denom", - }, - "invalid address in denom": { - changeAdmin: &bindings.ChangeAdmin{ - Denom: fmt.Sprintf("factory/%s/%s", RandomBech32AccountAddress(), validDenom), - NewAdminAddress: RandomBech32AccountAddress(), - }, - actor: tokenCreator, - expErrMsg: "failed changing admin from message: unauthorized account", - }, - "other denom name in 3 part name": { - changeAdmin: &bindings.ChangeAdmin{ - Denom: fmt.Sprintf("factory/%s/%s", tokenCreator.String(), "invalid denom"), - NewAdminAddress: RandomBech32AccountAddress(), - }, - actor: tokenCreator, - expErrMsg: fmt.Sprintf("invalid denom: factory/%s/invalid denom", tokenCreator.String()), - }, - "empty denom": { - changeAdmin: &bindings.ChangeAdmin{ - Denom: "", - NewAdminAddress: RandomBech32AccountAddress(), - }, - actor: tokenCreator, - expErrMsg: "invalid denom: ", - }, - "empty address": { - changeAdmin: &bindings.ChangeAdmin{ - Denom: fmt.Sprintf("factory/%s/%s", tokenCreator.String(), validDenom), - NewAdminAddress: "", - }, - actor: tokenCreator, - expErrMsg: "address from bech32: empty address string is not allowed", - }, - "creator is a different address": { - changeAdmin: &bindings.ChangeAdmin{ - Denom: fmt.Sprintf("factory/%s/%s", tokenCreator.String(), validDenom), - NewAdminAddress: RandomBech32AccountAddress(), - }, - actor: RandomAccountAddress(), - expErrMsg: "failed changing admin from message: unauthorized account", - }, - "change to the same address": { - changeAdmin: &bindings.ChangeAdmin{ - Denom: fmt.Sprintf("factory/%s/%s", tokenCreator.String(), validDenom), - NewAdminAddress: tokenCreator.String(), - }, - actor: tokenCreator, - }, - "nil binding": { - actor: tokenCreator, - expErrMsg: "invalid request: changeAdmin is nil - original request: ", - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - // Setup - comdexapp, ctx := SetupCustomApp(t, tokenCreator) - - // Fund actor with 100 base denom creation fees - actorAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) - fundAccount(t, *ctx, comdexapp, tokenCreator, actorAmount) - - _, err := wasm.PerformCreateDenom(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, tokenCreator, &bindings.CreateDenom{ - Subdenom: validDenom, - }) - require.NoError(t, err) - - err = wasm.ChangeAdmin(comdexapp.TokenFactoryKeeper, *ctx, spec.actor, spec.changeAdmin) - if len(spec.expErrMsg) > 0 { - require.Error(t, err) - actualErrMsg := err.Error() - require.Equal(t, spec.expErrMsg, actualErrMsg) - return - } - require.NoError(t, err) - }) - } -} - -func TestMint(t *testing.T) { - creator := RandomAccountAddress() - comdexapp, ctx := SetupCustomApp(t, creator) - - // Fund actor with 100 base denom creation fees - tokenCreationFeeAmt := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) - fundAccount(t, *ctx, comdexapp, creator, tokenCreationFeeAmt) - - // Create denoms for valid mint tests - validDenom := bindings.CreateDenom{ - Subdenom: "MOON", - } - _, err := wasm.PerformCreateDenom(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, creator, &validDenom) - require.NoError(t, err) - - emptyDenom := bindings.CreateDenom{ - Subdenom: "", - } - _, err = wasm.PerformCreateDenom(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, creator, &emptyDenom) - require.NoError(t, err) - - validDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), validDenom.Subdenom) - emptyDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), emptyDenom.Subdenom) - - lucky := RandomAccountAddress() - - // lucky was broke - balances := comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - require.Empty(t, balances) - - amount, ok := sdk.NewIntFromString("8080") - require.True(t, ok) - - specs := map[string]struct { - mint *bindings.MintTokens - expErr bool - }{ - "valid mint": { - mint: &bindings.MintTokens{ - Denom: validDenomStr, - Amount: amount, - MintToAddress: lucky.String(), - }, - }, - "empty sub-denom": { - mint: &bindings.MintTokens{ - Denom: emptyDenomStr, - Amount: amount, - MintToAddress: lucky.String(), - }, - expErr: false, - }, - "nonexistent sub-denom": { - mint: &bindings.MintTokens{ - Denom: fmt.Sprintf("factory/%s/%s", creator.String(), "SUN"), - Amount: amount, - MintToAddress: lucky.String(), - }, - expErr: true, - }, - "invalid sub-denom": { - mint: &bindings.MintTokens{ - Denom: "sub-denom_2", - Amount: amount, - MintToAddress: lucky.String(), - }, - expErr: true, - }, - "zero amount": { - mint: &bindings.MintTokens{ - Denom: validDenomStr, - Amount: sdk.ZeroInt(), - MintToAddress: lucky.String(), - }, - expErr: true, - }, - "negative amount": { - mint: &bindings.MintTokens{ - Denom: validDenomStr, - Amount: amount.Neg(), - MintToAddress: lucky.String(), - }, - expErr: true, - }, - "empty recipient": { - mint: &bindings.MintTokens{ - Denom: validDenomStr, - Amount: amount, - MintToAddress: "", - }, - expErr: true, - }, - "invalid recipient": { - mint: &bindings.MintTokens{ - Denom: validDenomStr, - Amount: amount, - MintToAddress: "invalid", - }, - expErr: true, - }, - "null mint": { - mint: nil, - expErr: true, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - // when - gotErr := wasm.PerformMint(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, creator, spec.mint) - // then - if spec.expErr { - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - }) - } -} - -func TestBurn(t *testing.T) { - creator := RandomAccountAddress() - comdexapp, ctx := SetupCustomApp(t, creator) - - // Fund actor with 100 base denom creation fees - tokenCreationFeeAmt := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) - fundAccount(t, *ctx, comdexapp, creator, tokenCreationFeeAmt) - - // Create denoms for valid burn tests - validDenom := bindings.CreateDenom{ - Subdenom: "MOON", - } - _, err := wasm.PerformCreateDenom(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, creator, &validDenom) - require.NoError(t, err) - - emptyDenom := bindings.CreateDenom{ - Subdenom: "", - } - _, err = wasm.PerformCreateDenom(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, creator, &emptyDenom) - require.NoError(t, err) - - lucky := RandomAccountAddress() - - // lucky was broke - balances := comdexapp.BankKeeper.GetAllBalances(*ctx, lucky) - require.Empty(t, balances) - - validDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), validDenom.Subdenom) - emptyDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), emptyDenom.Subdenom) - mintAmount, ok := sdk.NewIntFromString("8080") - require.True(t, ok) - - specs := map[string]struct { - burn *bindings.BurnTokens - expErr bool - }{ - "valid burn": { - burn: &bindings.BurnTokens{ - Denom: validDenomStr, - Amount: mintAmount, - BurnFromAddress: creator.String(), - }, - expErr: false, - }, - "non admin address": { - burn: &bindings.BurnTokens{ - Denom: validDenomStr, - Amount: mintAmount, - BurnFromAddress: lucky.String(), - }, - expErr: true, - }, - "empty sub-denom": { - burn: &bindings.BurnTokens{ - Denom: emptyDenomStr, - Amount: mintAmount, - BurnFromAddress: creator.String(), - }, - expErr: false, - }, - "invalid sub-denom": { - burn: &bindings.BurnTokens{ - Denom: "sub-denom_2", - Amount: mintAmount, - BurnFromAddress: creator.String(), - }, - expErr: true, - }, - "non-minted denom": { - burn: &bindings.BurnTokens{ - Denom: fmt.Sprintf("factory/%s/%s", creator.String(), "SUN"), - Amount: mintAmount, - BurnFromAddress: creator.String(), - }, - expErr: true, - }, - "zero amount": { - burn: &bindings.BurnTokens{ - Denom: validDenomStr, - Amount: sdk.ZeroInt(), - BurnFromAddress: creator.String(), - }, - expErr: true, - }, - "negative amount": { - burn: nil, - expErr: true, - }, - "null burn": { - burn: &bindings.BurnTokens{ - Denom: validDenomStr, - Amount: mintAmount.Neg(), - BurnFromAddress: creator.String(), - }, - expErr: true, - }, - } - - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - // Mint valid denom str and empty denom string for burn test - mintBinding := &bindings.MintTokens{ - Denom: validDenomStr, - Amount: mintAmount, - MintToAddress: creator.String(), - } - err := wasm.PerformMint(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, creator, mintBinding) - require.NoError(t, err) - - emptyDenomMintBinding := &bindings.MintTokens{ - Denom: emptyDenomStr, - Amount: mintAmount, - MintToAddress: creator.String(), - } - err = wasm.PerformMint(comdexapp.TokenFactoryKeeper, comdexapp.BankKeeper, *ctx, creator, emptyDenomMintBinding) - require.NoError(t, err) - - // when - gotErr := wasm.PerformBurn(comdexapp.TokenFactoryKeeper, *ctx, creator, spec.burn) - // then - if spec.expErr { - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - }) - } -} diff --git a/app/wasm/test/validate_queries_test.go b/app/wasm/test/validate_queries_test.go deleted file mode 100644 index c6151de58..000000000 --- a/app/wasm/test/validate_queries_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package wasm - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - wasm "github.com/comdex-official/comdex/app/wasm" -) - -func TestFullDenom(t *testing.T) { - actor := RandomAccountAddress() - - specs := map[string]struct { - addr string - subdenom string - expFullDenom string - expErr bool - }{ - "valid address": { - addr: actor.String(), - subdenom: "subDenom1", - expFullDenom: fmt.Sprintf("factory/%s/subDenom1", actor.String()), - }, - "empty address": { - addr: "", - subdenom: "subDenom1", - expErr: true, - }, - "invalid address": { - addr: "invalid", - subdenom: "subDenom1", - expErr: true, - }, - "empty sub-denom": { - addr: actor.String(), - subdenom: "", - expFullDenom: fmt.Sprintf("factory/%s/", actor.String()), - }, - "valid sub-denom (contains underscore)": { - addr: actor.String(), - subdenom: "sub_denom", - expFullDenom: fmt.Sprintf("factory/%s/sub_denom", actor.String()), - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - // when - gotFullDenom, gotErr := wasm.GetFullDenom(spec.addr, spec.subdenom) - // then - if spec.expErr { - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - assert.Equal(t, spec.expFullDenom, gotFullDenom, "exp %s but got %s", spec.expFullDenom, gotFullDenom) - }) - } -} - -func TestDenomAdmin(t *testing.T) { - addr := RandomAccountAddress() - app, ctx := SetupCustomApp(t, addr) - - // set token creation fee to zero to make testing easier - tfParams := app.TokenFactoryKeeper.GetParams(*ctx) - tfParams.DenomCreationFee = sdk.NewCoins() - if err := app.TokenFactoryKeeper.SetParams(*ctx, tfParams); err != nil { - t.Fatal(err) - } - - // create a subdenom via the token factory - admin := sdk.AccAddress([]byte("addr1_______________")) - tfDenom, err := app.TokenFactoryKeeper.CreateDenom(*ctx, admin.String(), "subdenom") - require.NoError(t, err) - require.NotEmpty(t, tfDenom) - - queryPlugin := wasm.NewQueryPlugin(&app.AssetKeeper, - &app.LockerKeeper, - &app.TokenmintKeeper, - &app.Rewardskeeper, - &app.CollectorKeeper, - &app.LiquidationKeeper, - &app.EsmKeeper, - &app.VaultKeeper, - &app.LendKeeper, - &app.LiquidityKeeper, - &app.MarketKeeper, - app.BankKeeper, - &app.TokenFactoryKeeper, - &app.GaslessKeeper) - - testCases := []struct { - name string - denom string - expectErr bool - expectAdmin string - }{ - { - name: "valid token factory denom", - denom: tfDenom, - expectAdmin: admin.String(), - }, - { - name: "invalid token factory denom", - denom: "uosmo", - expectErr: false, - expectAdmin: "", - }, - } - - for _, tc := range testCases { - tc := tc - - t.Run(tc.name, func(t *testing.T) { - resp, err := queryPlugin.GetDenomAdmin(*ctx, tc.denom) - if tc.expectErr { - require.Error(t, err) - } else { - require.NoError(t, err) - require.NotNil(t, resp) - require.Equal(t, tc.expectAdmin, resp.Admin) - } - }) - } -} diff --git a/app/wasm/testdata/README.md b/app/wasm/testdata/README.md deleted file mode 100644 index 221c6518f..000000000 --- a/app/wasm/testdata/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# token-reflect-contract - - - -Commit: 834bb36573fb21c74f8e78207308d9001df127a2 diff --git a/app/wasm/testdata/token_reflect.wasm b/app/wasm/testdata/token_reflect.wasm deleted file mode 100755 index 0526f1749..000000000 Binary files a/app/wasm/testdata/token_reflect.wasm and /dev/null differ diff --git a/app/wasm/wasm.go b/app/wasm/wasm.go index d3c1ac35c..b5652326b 100644 --- a/app/wasm/wasm.go +++ b/app/wasm/wasm.go @@ -3,22 +3,18 @@ package wasm import ( "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - assetkeeper "github.com/comdex-official/comdex/x/asset/keeper" 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" - tokenfactorykeeper "github.com/comdex-official/comdex/x/tokenfactory/keeper" tokenMintkeeper "github.com/comdex-official/comdex/x/tokenmint/keeper" vaultKeeper "github.com/comdex-official/comdex/x/vault/keeper" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" ) func RegisterCustomPlugins( @@ -34,17 +30,14 @@ func RegisterCustomPlugins( lend *lendKeeper.Keeper, liquidity *liquidityKeeper.Keeper, market *marketKeeper.Keeper, - bank bankkeeper.Keeper, - tokenfactory *tokenfactorykeeper.Keeper, - gasless *gaslessKeeper.Keeper, ) []wasmkeeper.Option { - comdexQueryPlugin := NewQueryPlugin(asset, locker, tokenMint, rewards, collector, liquidation, esm, vault, lend, liquidity, market, bank, tokenfactory, gasless) + comdexQueryPlugin := NewQueryPlugin(asset, locker, tokenMint, rewards, collector, liquidation, esm, vault, lend, liquidity, market) appDataQueryPluginOpt := wasmkeeper.WithQueryPlugins(&wasmkeeper.QueryPlugins{ Custom: CustomQuerier(comdexQueryPlugin), }) messengerDecoratorOpt := wasmkeeper.WithMessageHandlerDecorator( - CustomMessageDecorator(*locker, *rewards, *asset, *collector, *liquidation, *auction, *tokenMint, *esm, *vault, *liquidity, bank, *tokenfactory, *gasless), + CustomMessageDecorator(*locker, *rewards, *asset, *collector, *liquidation, *auction, *tokenMint, *esm, *vault, *liquidity), ) return []wasm.Option{ diff --git a/go.mod b/go.mod index d7bb684cc..047b6638f 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,6 @@ require ( github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 @@ -316,6 +315,7 @@ require ( go.uber.org/multierr v1.10.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.18.0 // 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.14.0 // indirect golang.org/x/net v0.20.0 // indirect @@ -344,18 +344,13 @@ require ( replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - //TODO: to be replaced from comdex fork of bandchain-packet github.com/bandprotocol/bandchain-packet => github.com/InjectiveLabs/bandchain-packet v0.0.4-0.20230327115226-35199d4659d5 - // fork of block-sdk, module name changed github.com/skip-mev/block-sdk => github.com/comdex-official/block-sdk v1.4.0-comdex - // https://github.com/cosmos/cosmos-sdk/blob/v0.47.5/UPGRADING.md#protobuf // github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - // https://github.com/skip-mev/block-sdk/blob/v1.4.0/go.mod#L331 golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb ) diff --git a/proto/buf.lock b/proto/buf.lock index 9d1fda100..4dbbcc212 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -4,8 +4,8 @@ deps: - remote: buf.build owner: cosmos repository: cosmos-proto - commit: 1935555c206d4afb9e94615dfd0fad31 - digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 + commit: 04467658e59e44bbb22fe568206e1f70 + digest: shake256:73a640bd60e0c523b0f8237ff34eab67c45a38b64bbbde1d80224819d272dbf316ac183526bd245f994af6608b025f5130483d0133c5edd385531326b5990466 - remote: buf.build owner: cosmos repository: cosmos-sdk @@ -19,5 +19,5 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: 7a6bc1e3207144b38e9066861e1de0ff - digest: shake256:d646836485c34192401253703c4e7ce899c826fceec060bf4b2a62c4749bd9976dc960833e134a1f814725e1ffd60b1bb3cf0335a7e99ef0e8cec34b070ffb66 + commit: f0e53af8f2fc4556b94f482688b57223 + digest: shake256:de26a277fc28b8b411ecf58729d78d32fcf15090ffd998a4469225b17889bfb51442eaab04bb7a8d88d203ecdf0a9febd4ffd52c18ed1c2229160c7bd353ca95 diff --git a/proto/comdex/common/v1beta1/common.proto b/proto/comdex/common/v1beta1/common.proto deleted file mode 100644 index 4553f255c..000000000 --- a/proto/comdex/common/v1beta1/common.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -package comdex.common.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/comdex-official/comdex/x/common/types"; - -message WhitelistedContract { - uint64 game_id = 1; - string security_address = 2; - string contract_admin = 3; - string game_name = 4; - string contract_address = 5; - uint64 game_type = 6; -} diff --git a/proto/comdex/common/v1beta1/genesis.proto b/proto/comdex/common/v1beta1/genesis.proto deleted file mode 100644 index 89984cecf..000000000 --- a/proto/comdex/common/v1beta1/genesis.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto3"; -package comdex.common.v1beta1; - -import "gogoproto/gogo.proto"; -import "comdex/common/v1beta1/params.proto"; -import "comdex/common/v1beta1/common.proto"; - -option go_package = "github.com/comdex-official/comdex/x/common/types"; - -// GenesisState defines the common module's genesis state. -message GenesisState { - Params params = 1 [ - (gogoproto.moretags) = "yaml:\"params\"", - (gogoproto.nullable) = false - ]; - repeated WhitelistedContract whitelisted_contracts = 2 [ - (gogoproto.moretags) = "yaml:\"whitelisted_contracts\"", - (gogoproto.nullable) = false - ]; -} diff --git a/proto/comdex/common/v1beta1/params.proto b/proto/comdex/common/v1beta1/params.proto deleted file mode 100644 index 1dd8dcde8..000000000 --- a/proto/comdex/common/v1beta1/params.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto3"; -package comdex.common.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/comdex-official/comdex/x/common/types"; - -// Params defines the set of module parameters. -message Params { - // Security address that can whitelist/delist contract - repeated string security_address = 1 [ - (gogoproto.jsontag) = "security_address,omitempty", - (gogoproto.moretags) = "yaml:\"security_address\"" - ]; - - uint64 contract_gas_limit = 2 [ - (gogoproto.jsontag) = "contract_gas_limit,omitempty", - (gogoproto.moretags) = "yaml:\"contract_gas_limit\"" - ]; -} diff --git a/proto/comdex/common/v1beta1/query.proto b/proto/comdex/common/v1beta1/query.proto deleted file mode 100644 index 697d47d84..000000000 --- a/proto/comdex/common/v1beta1/query.proto +++ /dev/null @@ -1,42 +0,0 @@ -syntax = "proto3"; -package comdex.common.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "comdex/common/v1beta1/params.proto"; -import "comdex/common/v1beta1/common.proto"; - -option go_package = "github.com/comdex-official/comdex/x/common/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/comdex/common/v1beta1/params"; - } - rpc QueryWhitelistedContracts(QueryWhitelistedContractsRequest) returns (QueryWhitelistedContractsResponse) { - option (google.api.http).get = "/comdex/common/v1beta1/whitelisted_contracts"; - } -} - -// 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 holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryWhitelistedContractsRequest{ - cosmos.base.query.v1beta1.PageRequest pagination = 1 - [(gogoproto.moretags) = "yaml:\"pagination\""]; -} - -message QueryWhitelistedContractsResponse { - repeated WhitelistedContract whilisted_contracts = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2 - [(gogoproto.moretags) = "yaml:\"pagination\""]; -} - diff --git a/proto/comdex/common/v1beta1/tx.proto b/proto/comdex/common/v1beta1/tx.proto deleted file mode 100644 index 4a1ac2380..000000000 --- a/proto/comdex/common/v1beta1/tx.proto +++ /dev/null @@ -1,55 +0,0 @@ -syntax = "proto3"; -package comdex.common.v1beta1; -import "gogoproto/gogo.proto"; - -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "comdex/common/v1beta1/params.proto"; - - -option go_package = "github.com/comdex-official/comdex/x/common/types"; - -// Msg defines the Msg service. -service Msg { - rpc RegisterContract(MsgRegisterContract) returns(MsgRegisterContractResponse); - rpc DeRegisterContract(MsgDeRegisterContract) returns(MsgDeRegisterContractResponse); - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); -} - -message MsgRegisterContract { - string security_address = 1; - string game_name = 2; - string contract_address = 3; - uint64 game_type = 4; // 1 -> single, 2 -> multi, 3 -> both - } - -message MsgRegisterContractResponse {} - -message MsgDeRegisterContract { - string security_address = 1; - uint64 game_id = 2; -} - -message MsgDeRegisterContractResponse {} - - -// MsgUpdateParams is the MsgUpdateParams request type. -// -// Since: 0.47 -message MsgUpdateParams { - 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 x/common parameters to update. - // - // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false]; -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: 0.47 -message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/proto/comdex/gasless/v1beta1/gasless.proto b/proto/comdex/gasless/v1beta1/gasless.proto deleted file mode 100644 index 7880fb4b1..000000000 --- a/proto/comdex/gasless/v1beta1/gasless.proto +++ /dev/null @@ -1,70 +0,0 @@ -syntax = "proto3"; -package comdex.gasless.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/comdex-official/comdex/x/gasless/types"; -option (gogoproto.goproto_getters_all) = false; - - -// AddressType enumerates the available types of a address. -enum AddressType { - option (gogoproto.goproto_enum_prefix) = false; - - // the 32 bytes length address type of ADR 028. - ADDRESS_TYPE_32_BYTES = 0 [(gogoproto.enumvalue_customname) = "AddressType32Bytes"]; - // the default 20 bytes length address type. - ADDRESS_TYPE_20_BYTES = 1 [(gogoproto.enumvalue_customname) = "AddressType20Bytes"]; - } - -message TxGTIDs { - string tx_path_or_contract_address = 1; - repeated uint64 gas_tank_ids = 2; -} - -message GasTank { - uint64 id = 1; - string provider = 2; - string reserve = 3; - bool is_active = 4; - uint64 max_txs_count_per_consumer = 5; - string max_fee_usage_per_consumer = 6 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - string max_fee_usage_per_tx = 7 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - repeated string txs_allowed = 8; - repeated string contracts_allowed = 9; - repeated string authorized_actors = 10; - string fee_denom = 11; -} - -message UsageDetail { - google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - string gas_consumed = 2 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; -} - -message UsageDetails { - string usage_identifier = 1; - repeated UsageDetail details = 2; -} - -message Usage { - repeated UsageDetails txs = 1; - repeated UsageDetails contracts = 2; -} - -message ConsumptionDetail { - uint64 gas_tank_id = 1; - bool is_blocked = 2; - uint64 total_txs_allowed = 3; - uint64 total_txs_made = 4; - string total_fee_consumption_allowed = 5 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - string total_fees_consumed = 6 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - Usage usage = 7; -} - -message GasConsumer { - string consumer = 1; - repeated ConsumptionDetail consumptions = 2; -} - - diff --git a/proto/comdex/gasless/v1beta1/genesis.proto b/proto/comdex/gasless/v1beta1/genesis.proto deleted file mode 100644 index c9233adab..000000000 --- a/proto/comdex/gasless/v1beta1/genesis.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package comdex.gasless.v1beta1; - -import "gogoproto/gogo.proto"; -import "comdex/gasless/v1beta1/params.proto"; -import "comdex/gasless/v1beta1/gasless.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]; - repeated TxGTIDs tx_to_gas_tank_ids = 2 [(gogoproto.nullable) = false]; - uint64 last_gas_tank_id = 3; - repeated GasTank gas_tanks = 4 [(gogoproto.nullable) = false]; - repeated GasConsumer gas_consumers = 5 [(gogoproto.nullable) = false]; -} diff --git a/proto/comdex/gasless/v1beta1/gov.proto b/proto/comdex/gasless/v1beta1/gov.proto deleted file mode 100644 index eccc50555..000000000 --- a/proto/comdex/gasless/v1beta1/gov.proto +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 0650c1a23..000000000 --- a/proto/comdex/gasless/v1beta1/params.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; -package comdex.gasless.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.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 { - uint64 tank_creation_limit = 1; - repeated cosmos.base.v1beta1.Coin minimum_gas_deposit = 2 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; - string fee_burning_percentage = 3 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; -} diff --git a/proto/comdex/gasless/v1beta1/query.proto b/proto/comdex/gasless/v1beta1/query.proto deleted file mode 100644 index a6404a684..000000000 --- a/proto/comdex/gasless/v1beta1/query.proto +++ /dev/null @@ -1,177 +0,0 @@ -syntax = "proto3"; -package comdex.gasless.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "comdex/gasless/v1beta1/params.proto"; -import "comdex/gasless/v1beta1/gasless.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos/base/v1beta1/coin.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]; -} - -// QueryMessagesAndContractsRequest is a request type for the Query/MessagesAndContracts RPC method. -message QueryMessagesAndContractsRequest {} - -message ContractDetails { - uint64 code_id = 1; - string address = 2; - string lable = 3; -} - -// QueryMessagesAndContractsResponse is a response type for the Query/MessagesAndContracts RPC method. -message QueryMessagesAndContractsResponse { - repeated string messages = 1; - repeated ContractDetails contracts = 2; -} - -message GasTankResponse { - uint64 id = 1; - string provider = 2; - string reserve = 3; - cosmos.base.v1beta1.Coin gas_tank_balance = 4 [(gogoproto.nullable) = false]; - bool is_active = 5; - uint64 max_txs_count_per_consumer = 6; - string max_fee_usage_per_consumer = 7 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - string max_fee_usage_per_tx = 8 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - repeated string txs_allowed = 9; - repeated string contracts_allowed = 10; - repeated string authorized_actors = 11; - string fee_denom = 12; -} - -// QueryGasTankRequest is a request type for the Query/GasTank RPC method. -message QueryGasTankRequest { - uint64 gas_tank_id = 1; -} - -// QueryGasTankResponse is a response type for the Query/GasTank RPC method. -message QueryGasTankResponse { - GasTankResponse gas_tank = 1 [(gogoproto.nullable) = false]; -} - -// QueryGasTanksRequest is a request type for the Query/GasTanks RPC method. -message QueryGasTanksRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -// QueryGasTanksResponse is a response type for the Query/GasTanks RPC method. -message QueryGasTanksResponse { - repeated GasTankResponse gas_tanks = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryGasTanksByProviderRequest is a request type for the Query/GasTanksByProvider RPC method. -message QueryGasTanksByProviderRequest { - string provider = 1; -} - -// QueryGasTanksByProviderResponse is a response type for the Query/GasTanksByProvider RPC method. -message QueryGasTanksByProviderResponse { - repeated GasTankResponse gas_tanks = 1 [(gogoproto.nullable) = false]; -} - -// QueryGasConsumerRequest is a request type for the Query/GasConsumer RPC method. -message QueryGasConsumerRequest { - string consumer = 1; -} - -// QueryGasConsumerResponse is a response type for the Query/GasConsumer RPC method. -message QueryGasConsumerResponse { - GasConsumer gas_consumer = 1 [(gogoproto.nullable) = false]; -} - -// QueryGasConsumersRequest is a request type for the Query/GasConsumers RPC method. -message QueryGasConsumersRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -// QueryGasConsumersResponse is a response type for the Query/GasConsumers RPC method. -message QueryGasConsumersResponse { - repeated GasConsumer gas_consumers = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message GasConsumersByGasTankIDResponse { - string consumer = 1; - bool is_blocked = 2; - uint64 total_txs_allowed = 3; - uint64 total_txs_made = 4; - cosmos.base.v1beta1.Coin total_fee_consumption_allowed = 5 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin total_fees_consumed = 6 [(gogoproto.nullable) = false]; - Usage usage = 7; -} - -// QueryGasConsumersByGasTankIDRequest is a request type for the Query/GasConsumersByGasTankID RPC method. -message QueryGasConsumersByGasTankIDRequest { - uint64 gas_tank_id = 1; -} - -// QueryGasConsumersByGasTankIDResponse is a response type for the Query/GasConsumersByGasTankID RPC method. -message QueryGasConsumersByGasTankIDResponse { - uint64 gas_tank_id = 1; - cosmos.base.v1beta1.Coin overall_fees_consumed = 2 [(gogoproto.nullable) = false]; - repeated GasConsumersByGasTankIDResponse gas_consumers = 3 [(gogoproto.nullable) = false]; -} - -message QueryGasTankIdsForAllTXC {} - -message QueryGasTankIdsForAllTXCResponse { - repeated TxGTIDs tx_to_gt_ids = 1; -} - -// 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"; - } - - // MessagesAndContracts return all cosmos.base.v1beta1.Msg messages and available contract details - rpc MessagesAndContracts(QueryMessagesAndContractsRequest) returns (QueryMessagesAndContractsResponse) { - option (google.api.http).get = "/comdex/gasless/v1beta1/mac"; - } - - // GasTank returns gas tank details - rpc GasTank(QueryGasTankRequest) returns (QueryGasTankResponse) { - option (google.api.http).get = "/comdex/gasless/v1beta1/tank/{gas_tank_id}"; - } - - // GasTanks return details of all the gas tanks - rpc GasTanks(QueryGasTanksRequest) returns (QueryGasTanksResponse) { - option (google.api.http).get = "/comdex/gasless/v1beta1/tanks"; - } - - // GasTanksByProvider return details of all the gas tanks for the given provider - rpc GasTanksByProvider(QueryGasTanksByProviderRequest) returns (QueryGasTanksByProviderResponse) { - option (google.api.http).get = "/comdex/gasless/v1beta1/provider/tanks/{provider}"; - } - - // GasConsumer returns gas consumer details - rpc GasConsumer(QueryGasConsumerRequest) returns (QueryGasConsumerResponse) { - option (google.api.http).get = "/comdex/gasless/v1beta1/consumer/{consumer}"; - } - - // GasConsumers return details of all the gas consumers - rpc GasConsumers(QueryGasConsumersRequest) returns (QueryGasConsumersResponse) { - option (google.api.http).get = "/comdex/gasless/v1beta1/consumers"; - } - - // GasConsumersByGasTankID return details of all the gas consumers for the given tank ID - rpc GasConsumersByGasTankID(QueryGasConsumersByGasTankIDRequest) returns (QueryGasConsumersByGasTankIDResponse) { - option (google.api.http).get = "/comdex/gasless/v1beta1/tank/consumers/{gas_tank_id}"; - } - - // GasTankIdsForAllTXC returns gas tanks ids with all available tx or contracts - rpc GasTankIdsForAllTXC(QueryGasTankIdsForAllTXC) returns (QueryGasTankIdsForAllTXCResponse) { - option (google.api.http).get = "/comdex/gasless/v1beta1/txc"; - } -} \ No newline at end of file diff --git a/proto/comdex/gasless/v1beta1/tx.proto b/proto/comdex/gasless/v1beta1/tx.proto deleted file mode 100644 index 028b23277..000000000 --- a/proto/comdex/gasless/v1beta1/tx.proto +++ /dev/null @@ -1,187 +0,0 @@ -syntax = "proto3"; -package comdex.gasless.v1beta1; - -import "amino/amino.proto"; -import "cosmos/msg/v1/msg.proto"; -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos_proto/cosmos.proto"; -import "comdex/gasless/v1beta1/params.proto"; - -option go_package = "github.com/comdex-official/comdex/x/gasless/types"; - -// Msg defines the Msg service. -service Msg { - // CreateGasTank defines a method for creating a new gas tank - rpc CreateGasTank(MsgCreateGasTank) returns (MsgCreateGasTankResponse); - - // AuthorizeActors defines a method for authorizing accounts to take actions on provider's behalf - rpc AuthorizeActors(MsgAuthorizeActors) returns (MsgAuthorizeActorsResponse); - - // UpdateGasTankStatus defines a method for marking gas tank as active or inactive - rpc UpdateGasTankStatus(MsgUpdateGasTankStatus) returns (MsgUpdateGasTankStatusResponse); - - // UpdateGasTankConfigs defines a method for updating the configs of gas tank - rpc UpdateGasTankConfigs(MsgUpdateGasTankConfig) returns (MsgUpdateGasTankConfigResponse); - - // BlockConsumer defines a method for blocking a suspected malicious consumer - rpc BlockConsumer(MsgBlockConsumer) returns (MsgBlockConsumerResponse); - - // UnblockConsumer defines a method for unblocking consumer - rpc UnblockConsumer(MsgUnblockConsumer) returns (MsgUnblockConsumerResponse); - - // UpdateGasConsumerLimit defines a method for updating consumption limit of gas consumer - rpc UpdateGasConsumerLimit(MsgUpdateGasConsumerLimit) returns (MsgUpdateGasConsumerLimitResponse); - - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); -} - - -// MsgCreateGasTank defines an SDK message for creating a new GasTank. -message MsgCreateGasTank { - // provider specifies the bech32-encoded address that is the gas provider. - string provider = 1; - - // fee_denom specifies the denom of the gas deposit coin - string fee_denom = 2; - - // max_fee_usage_per_tx specifies the maximum fee allowed for each tx - string max_fee_usage_per_tx = 3 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - - // max_txs_count_per_consumer specifies the number of txs allowed for each consumer - uint64 max_txs_count_per_consumer = 4; - - // max_fee_usage_per_consumer specifies the maximum fee consumption allowed for each consumer - string max_fee_usage_per_consumer = 5 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - - // txs_allowed specifies txs paths allowed to consume gas from the gas tank - repeated string txs_allowed = 6; - - // contracts_allowed specifies wasm contracts allowed to consume gas from the gas tank - repeated string contracts_allowed = 7; - - // gas_deposit specifies the initial desposit in the gas tank - cosmos.base.v1beta1.Coin gas_deposit = 8 [(gogoproto.nullable) = false]; -} - -message MsgCreateGasTankResponse {} - -// MsgAuthorizeActors defines the SDK message for authorizing accounts to take actions on provider's behalf -message MsgAuthorizeActors { - // gas_tank_id specifies the id of the gas tank - uint64 gas_tank_id = 1; - - // provider specifies the bech32-encoded address that is the gas provider. - string provider = 2; - - // actors specifies the list of bech32-encoded address allowed to take actions - repeated string actors = 3; -} - -message MsgAuthorizeActorsResponse {} - -// MsgUpdateGasTankStatus defines an SDK message for updating the status of gas tank. -message MsgUpdateGasTankStatus { - // gas_tank_id specifies the id of the gas tank - uint64 gas_tank_id = 1; - - // provider specifies the bech32-encoded address that is the gas provider. - string provider = 2; -} - -message MsgUpdateGasTankStatusResponse{} - -// MsgUpdateGasTankConfig defines an SDK message for updating the configs of gas tank. -message MsgUpdateGasTankConfig { - // gas_tank_id specifies the id of the gas tank - uint64 gas_tank_id = 1; - - // provider specifies the bech32-encoded address that is the gas provider. - string provider = 2; - - // max_fee_usage_per_tx specifies the maximum fee allowed for each tx - string max_fee_usage_per_tx = 3 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - - // max_txs_count_per_consumer specifies the number of txs allowed for each consumer - uint64 max_txs_count_per_consumer = 4; - - // max_fee_usage_per_consumer specifies the maximum fee consumption allowed for each consumer - string max_fee_usage_per_consumer = 5 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; - - // txs_allowed specifies txs paths allowed to consume gas from the gas tank - repeated string txs_allowed = 6; - - // contracts_allowed specifies wasm contracts allowed to consume gas from the gas tank - repeated string contracts_allowed = 7; -} - -message MsgUpdateGasTankConfigResponse {} - -// MsgBlockConsumer defines an SDK message for blocking the suspected malicious consumer. -message MsgBlockConsumer { - // gas_tank_id specifies the id of the gas tank - uint64 gas_tank_id = 1; - - // actor specifies the bech32-encoded address that is the gas provider or authorized actor. - string actor = 2; - - // consumer specifies the bech32-encoded address of a consumer. - string consumer = 3; -} - -message MsgBlockConsumerResponse {} - -// MsgUnblockConsumer defines an SDK message for unblocking consumer. -message MsgUnblockConsumer { - // gas_tank_id specifies the id of the gas tank - uint64 gas_tank_id = 1; - - // actor specifies the bech32-encoded address that is the gas provider or authorized actor. - string actor = 2; - - // consumer specifies the bech32-encoded address of a consumer. - string consumer = 3; -} - -message MsgUnblockConsumerResponse {} - -// MsgUpdateGasConsumerLimit defines an SDK message for updating the consumption limits of gas consumer. -message MsgUpdateGasConsumerLimit { - // gas_tank_id specifies the id of the gas tank - uint64 gas_tank_id = 1; - - // provider specifies the bech32-encoded address that is the gas provider. - string provider = 2; - - // consumer specifies the bech32-encoded address of a consumer. - string consumer = 3; - - // total_txs_allowed specifies the number of txs allowed for each consumer - uint64 total_txs_allowed = 4; - - // total_fee_consumption_allowed specifies the maximum fee consumption allowed for each consumer - string total_fee_consumption_allowed = 5 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; -} - -message MsgUpdateGasConsumerLimitResponse {} - -// MsgUpdateParams is the MsgUpdateParams request type. -// -// Since: 0.47 -message MsgUpdateParams { - 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 x/gasless parameters to update. - // - // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false]; - } - - // MsgUpdateParamsResponse defines the response structure for executing a - // MsgUpdateParams message. - // - // Since: 0.47 - message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto b/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto deleted file mode 100755 index 79d328b17..000000000 --- a/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package osmosis.tokenfactory.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/comdex-official/comdex/x/tokenfactory/types"; - -// DenomAuthorityMetadata specifies metadata for addresses that have specific -// capabilities over a token factory denom. Right now there is only one Admin -// permission, but is planned to be extended to the future. -message DenomAuthorityMetadata { - option (gogoproto.equal) = true; - - // Can be empty for no admin, or a valid osmosis address - string admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; -} \ No newline at end of file diff --git a/proto/osmosis/tokenfactory/v1beta1/genesis.proto b/proto/osmosis/tokenfactory/v1beta1/genesis.proto deleted file mode 100755 index 245dda286..000000000 --- a/proto/osmosis/tokenfactory/v1beta1/genesis.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; -package osmosis.tokenfactory.v1beta1; - -import "gogoproto/gogo.proto"; -import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; -import "osmosis/tokenfactory/v1beta1/params.proto"; - -option go_package = "github.com/comdex-official/comdex/x/tokenfactory/types"; - -// GenesisState defines the tokenfactory module's genesis state. -message GenesisState { - // params defines the parameters of the module. - Params params = 1 [ (gogoproto.nullable) = false ]; - - repeated GenesisDenom factory_denoms = 2 [ - (gogoproto.moretags) = "yaml:\"factory_denoms\"", - (gogoproto.nullable) = false - ]; -} - -// GenesisDenom defines a tokenfactory denom that is defined within genesis -// state. The structure contains DenomAuthorityMetadata which defines the -// denom's admin. -message GenesisDenom { - option (gogoproto.equal) = true; - - string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; - DenomAuthorityMetadata authority_metadata = 2 [ - (gogoproto.moretags) = "yaml:\"authority_metadata\"", - (gogoproto.nullable) = false - ]; -} \ No newline at end of file diff --git a/proto/osmosis/tokenfactory/v1beta1/params.proto b/proto/osmosis/tokenfactory/v1beta1/params.proto deleted file mode 100755 index 339034874..000000000 --- a/proto/osmosis/tokenfactory/v1beta1/params.proto +++ /dev/null @@ -1,26 +0,0 @@ -syntax = "proto3"; -package osmosis.tokenfactory.v1beta1; - -import "gogoproto/gogo.proto"; -import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/comdex-official/comdex/x/tokenfactory/types"; - -// Params defines the parameters for the tokenfactory module. -message Params { - repeated cosmos.base.v1beta1.Coin denom_creation_fee = 1 [ - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", - (gogoproto.nullable) = false - ]; - - // if denom_creation_fee is an empty array, then this field is used to add more gas consumption - // to the base cost. - // https://github.com/CosmWasm/token-factory/issues/11 - uint64 denom_creation_gas_consume = 2 [ - (gogoproto.moretags) = "yaml:\"denom_creation_gas_consume\"", - (gogoproto.nullable) = true - ]; -} \ No newline at end of file diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto deleted file mode 100755 index c58cee4c9..000000000 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ /dev/null @@ -1,71 +0,0 @@ -syntax = "proto3"; -package osmosis.tokenfactory.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; -import "osmosis/tokenfactory/v1beta1/params.proto"; - -option go_package = "github.com/comdex-official/comdex/x/tokenfactory/types"; - -// Query defines the gRPC querier service. -service Query { - // Params defines a gRPC query method that returns the tokenfactory module's - // parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/osmosis/tokenfactory/v1beta1/params"; - } - - // DenomAuthorityMetadata defines a gRPC query method for fetching - // DenomAuthorityMetadata for a particular denom. - rpc DenomAuthorityMetadata(QueryDenomAuthorityMetadataRequest) - returns (QueryDenomAuthorityMetadataResponse) { - option (google.api.http).get = - "/osmosis/tokenfactory/v1beta1/denoms/{denom}/authority_metadata"; - } - - // DenomsFromCreator defines a gRPC query method for fetching all - // denominations created by a specific admin/creator. - rpc DenomsFromCreator(QueryDenomsFromCreatorRequest) - returns (QueryDenomsFromCreatorResponse) { - option (google.api.http).get = - "/osmosis/tokenfactory/v1beta1/denoms_from_creator/{creator}"; - } -} - -// QueryParamsRequest is the request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1 [ (gogoproto.nullable) = false ]; -} - -// QueryDenomAuthorityMetadataRequest defines the request structure for the -// DenomAuthorityMetadata gRPC query. -message QueryDenomAuthorityMetadataRequest { - string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; -} - -// QueryDenomAuthorityMetadataResponse defines the response structure for the -// DenomAuthorityMetadata gRPC query. -message QueryDenomAuthorityMetadataResponse { - DenomAuthorityMetadata authority_metadata = 1 [ - (gogoproto.moretags) = "yaml:\"authority_metadata\"", - (gogoproto.nullable) = false - ]; -} - -// QueryDenomsFromCreatorRequest defines the request structure for the -// DenomsFromCreator gRPC query. -message QueryDenomsFromCreatorRequest { - string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; -} - -// QueryDenomsFromCreatorRequest defines the response structure for the -// DenomsFromCreator gRPC query. -message QueryDenomsFromCreatorResponse { - repeated string denoms = 1 [ (gogoproto.moretags) = "yaml:\"denoms\"" ]; -} diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto deleted file mode 100755 index 3f7ac9974..000000000 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ /dev/null @@ -1,139 +0,0 @@ -syntax = "proto3"; -package osmosis.tokenfactory.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/bank/v1beta1/bank.proto"; -import "osmosis/tokenfactory/v1beta1/params.proto"; -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; - -option go_package = "github.com/comdex-official/comdex/x/tokenfactory/types"; - -// Msg defines the tokefactory module's gRPC message service. -service Msg { - rpc CreateDenom(MsgCreateDenom) returns (MsgCreateDenomResponse); - rpc Mint(MsgMint) returns (MsgMintResponse); - rpc Burn(MsgBurn) returns (MsgBurnResponse); - rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse); - rpc SetDenomMetadata(MsgSetDenomMetadata) - returns (MsgSetDenomMetadataResponse); - rpc ForceTransfer(MsgForceTransfer) returns (MsgForceTransferResponse); - - // UpdateParams defines a governance operation for updating the x/mint module - // parameters. The authority is hard-coded to the x/gov module account. - // - // Since: cosmos-sdk 0.47 - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); -} - -// MsgCreateDenom defines the message structure for the CreateDenom gRPC service -// method. It allows an account to create a new denom. It requires a sender -// address and a sub denomination. The (sender_address, sub_denomination) tuple -// must be unique and cannot be re-used. -// -// The resulting denom created is defined as -// . The resulting denom's admin is -// originally set to be the creator, but this can be changed later. The token -// denom does not indicate the current admin. -message MsgCreateDenom { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - // subdenom can be up to 44 "alphanumeric" characters long. - string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ]; -} - -// MsgCreateDenomResponse is the return value of MsgCreateDenom -// It returns the full string of the newly created denom -message MsgCreateDenomResponse { - string new_token_denom = 1 - [ (gogoproto.moretags) = "yaml:\"new_token_denom\"" ]; -} - -// MsgMint is the sdk.Msg type for allowing an admin account to mint -// more of a token. For now, we only support minting to the sender account -message MsgMint { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - cosmos.base.v1beta1.Coin amount = 2 [ - (gogoproto.moretags) = "yaml:\"amount\"", - (gogoproto.nullable) = false - ]; - string mintToAddress = 3 - [ (gogoproto.moretags) = "yaml:\"mint_to_address\"" ]; -} - -message MsgMintResponse {} - -// MsgBurn is the sdk.Msg type for allowing an admin account to burn -// a token. For now, we only support burning from the sender account. -message MsgBurn { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - cosmos.base.v1beta1.Coin amount = 2 [ - (gogoproto.moretags) = "yaml:\"amount\"", - (gogoproto.nullable) = false - ]; - string burnFromAddress = 3 - [ (gogoproto.moretags) = "yaml:\"burn_from_address\"" ]; -} - -message MsgBurnResponse {} - -// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign -// adminship of a denom to a new account -message MsgChangeAdmin { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; - string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; -} - -// MsgChangeAdminResponse defines the response structure for an executed -// MsgChangeAdmin message. -message MsgChangeAdminResponse {} - -// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set -// the denom's bank metadata -message MsgSetDenomMetadata { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - cosmos.bank.v1beta1.Metadata metadata = 2 [ - (gogoproto.moretags) = "yaml:\"metadata\"", - (gogoproto.nullable) = false - ]; -} - -// MsgSetDenomMetadataResponse defines the response structure for an executed -// MsgSetDenomMetadata message. -message MsgSetDenomMetadataResponse {} - -message MsgForceTransfer { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - cosmos.base.v1beta1.Coin amount = 2 [ - (gogoproto.moretags) = "yaml:\"amount\"", - (gogoproto.nullable) = false - ]; - string transferFromAddress = 3 - [ (gogoproto.moretags) = "yaml:\"transfer_from_address\"" ]; - string transferToAddress = 4 - [ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ]; -} - -message MsgForceTransferResponse {} - -// MsgUpdateParams is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 -message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - - // authority is the address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // params defines the x/mint parameters to update. - // - // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false]; -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 -message MsgUpdateParamsResponse {} diff --git a/x/common/abci.go b/x/common/abci.go deleted file mode 100644 index 2324dd24a..000000000 --- a/x/common/abci.go +++ /dev/null @@ -1,22 +0,0 @@ -package common - -import ( - "github.com/comdex-official/comdex/x/common/keeper" - commonTypes "github.com/comdex-official/comdex/x/common/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { - allContracts := k.GetAllContract(ctx) - - for _, data := range allContracts { - if data.GameType == 1 { - k.SinglePlayer(ctx, data.ContractAddress, commonTypes.ResolveSinglePlayer, data.GameName) - } else if data.GameType == 2 { - k.MultiPlayer(ctx, data.ContractAddress, commonTypes.SetupMultiPlayer, commonTypes.ResolveMultiPlayer, data.GameName) - } else { - k.SinglePlayer(ctx, data.ContractAddress, commonTypes.ResolveSinglePlayer, data.GameName) - k.MultiPlayer(ctx, data.ContractAddress, commonTypes.SetupMultiPlayer, commonTypes.ResolveMultiPlayer, data.GameName) - } - } -} diff --git a/x/common/client/cli/query.go b/x/common/client/cli/query.go deleted file mode 100644 index e66baeabc..000000000 --- a/x/common/client/cli/query.go +++ /dev/null @@ -1,65 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/x/common/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group common queries under a subcommand - 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(CmdQueryParams(), - QueryWhitelistedContracts()) - // this line is used by starport scaffolding # 1 - - return cmd -} - -func QueryWhitelistedContracts() *cobra.Command { - cmd := &cobra.Command{ - Use: "whitelisted-contracts", - Short: "Query all whitelisted contracts", - RunE: func(cmd *cobra.Command, args []string) error { - ctx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - pagination, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(ctx) - - res, err := queryClient.QueryWhitelistedContracts(cmd.Context(), &types.QueryWhitelistedContractsRequest{ - Pagination: pagination, - }) - if err != nil { - return err - } - return ctx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, "whitelisted-contracts") - - return cmd -} diff --git a/x/common/client/cli/query_params.go b/x/common/client/cli/query_params.go deleted file mode 100644 index d47a30299..000000000 --- a/x/common/client/cli/query_params.go +++ /dev/null @@ -1,34 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - "github.com/comdex-official/comdex/x/common/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/common/client/cli/tx.go b/x/common/client/cli/tx.go deleted file mode 100644 index a8662557b..000000000 --- a/x/common/client/cli/tx.go +++ /dev/null @@ -1,107 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - "time" - - "github.com/spf13/cobra" - - "github.com/comdex-official/comdex/x/common/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdRegisterContract(), - CmdDeRegisterContract()) - - // this line is used by starport scaffolding # 1 - - return cmd -} - -func CmdRegisterContract() *cobra.Command { - cmd := &cobra.Command{ - Use: "register-contract [game name] [contract address] [game type]", - Short: "Register game contract", - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) (err error) { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - gameType, err := strconv.ParseUint(args[2], 10, 64) - if err != nil { - return fmt.Errorf("game-type '%s' not a valid uint", args[0]) - } - - msg := types.NewMsgRegisterContract( - clientCtx.GetFromAddress().String(), - args[0], - args[1], - gameType, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdDeRegisterContract() *cobra.Command { - cmd := &cobra.Command{ - Use: "de-register-contract [game id]", - Short: "De Register game contract", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - gameID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("game-id '%s' not a valid uint", args[0]) - } - - msg := types.NewMsgDeRegisterContract( - clientCtx.GetFromAddress().String(), - gameID, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/common/expected/keeper.go b/x/common/expected/keeper.go deleted file mode 100644 index 57bc99ede..000000000 --- a/x/common/expected/keeper.go +++ /dev/null @@ -1,13 +0,0 @@ -package expected - -import ( - wasmvmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// ContractOpsKeeper contains mutable operations on a contract. -type ContractOpsKeeper interface { - // Sudo allows to call privileged entry point of a contract. - Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) - GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *wasmvmtypes.ContractInfo -} \ No newline at end of file diff --git a/x/common/genesis.go b/x/common/genesis.go deleted file mode 100644 index bee0ca0c8..000000000 --- a/x/common/genesis.go +++ /dev/null @@ -1,32 +0,0 @@ -package common - -import ( - "github.com/comdex-official/comdex/x/common/keeper" - "github.com/comdex-official/comdex/x/common/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// InitGenesis initializes the capability module's state from a provided genesis -// state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState *types.GenesisState) { - var ( - GameID uint64 - ) - // this line is used by starport scaffolding # genesis/module/init - for _, item := range genState.WhitelistedContracts { - if item.GameId > GameID { - GameID = item.GameId - } - k.SetContract(ctx, item) - } - k.SetGameID(ctx, GameID) - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the capability module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - return types.NewGenesisState( - k.GetAllContract(ctx), - k.GetParams(ctx), - ) -} diff --git a/x/common/handler.go b/x/common/handler.go deleted file mode 100644 index 115600027..000000000 --- a/x/common/handler.go +++ /dev/null @@ -1,34 +0,0 @@ -package common - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/comdex-official/comdex/x/common/keeper" - "github.com/comdex-official/comdex/x/common/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - // this line is used by starport scaffolding # handler/msgServer - - server := keeper.NewMsgServerImpl(k) - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgRegisterContract: - res, err := server.RegisterContract(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgDeRegisterContract: - res, err := server.DeRegisterContract(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - // this line is used by starport scaffolding # 1 - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/x/common/keeper/grpc_query.go b/x/common/keeper/grpc_query.go deleted file mode 100644 index 101c4dcca..000000000 --- a/x/common/keeper/grpc_query.go +++ /dev/null @@ -1,60 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/comdex-official/comdex/x/common/types" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -var _ types.QueryServer = QueryServer{} - -type QueryServer struct { - Keeper -} - -func NewQueryServerImpl(k Keeper) types.QueryServer { - return &QueryServer{ - Keeper: k, - } -} - -func (q QueryServer) QueryWhitelistedContracts(c context.Context, req *types.QueryWhitelistedContractsRequest) (*types.QueryWhitelistedContractsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "request cannot be empty") - } - - var ( - items []types.WhitelistedContract - ctx = sdk.UnwrapSDKContext(c) - ) - - pagination, err := query.FilteredPaginate( - prefix.NewStore(q.Store(ctx), types.SetContractKeyPrefix), - req.Pagination, - func(_, value []byte, accumulate bool) (bool, error) { - var item types.WhitelistedContract - if err := q.cdc.Unmarshal(value, &item); err != nil { - return false, err - } - - if accumulate { - items = append(items, item) - } - - return true, nil - }, - ) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryWhitelistedContractsResponse{ - WhilistedContracts: items, - Pagination: pagination, - }, nil -} diff --git a/x/common/keeper/grpc_query_params.go b/x/common/keeper/grpc_query_params.go deleted file mode 100644 index a868e5999..000000000 --- a/x/common/keeper/grpc_query_params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/comdex-official/comdex/x/common/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/common/keeper/keeper.go b/x/common/keeper/keeper.go deleted file mode 100644 index 895abc2e2..000000000 --- a/x/common/keeper/keeper.go +++ /dev/null @@ -1,119 +0,0 @@ -package keeper - -import ( - "fmt" - - "encoding/hex" - "github.com/cometbft/cometbft/libs/log" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/comdex-official/comdex/x/common/expected" - "github.com/comdex-official/comdex/x/common/types" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - conOps expected.ContractOpsKeeper - // the address capable of executing a MsgUpdateParams message. Typically, this - // should be the x/gov module account. - authority string - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - conOps expected.ContractOpsKeeper, - authority string, - -) Keeper { - - return Keeper{ - - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - conOps: conOps, - authority: authority, - } -} - -// GetAuthority returns the x/common module's authority. -func (k Keeper) GetAuthority() string { - return k.authority -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -//nolint:staticcheck -func (k Keeper) SudoContractCall(ctx sdk.Context, contractAddress string, p []byte) error { - - contractAddr, err := sdk.AccAddressFromBech32(contractAddress) - if err != nil { - return sdkerrors.Wrapf(err, "contract") - } - data, err := k.conOps.Sudo(ctx, contractAddr, p) - if err != nil { - return err - } - - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeContractSudoMsg, - sdk.NewAttribute(types.AttributeKeyResultDataHex, hex.EncodeToString(data)), - )) - return nil -} - -func (k Keeper) CheckSecurityAddress(ctx sdk.Context, from string) bool { - params := k.GetParams(ctx) - for _, addr := range params.SecurityAddress { - if addr == from { - return true - } - } - return false -} - -func (k Keeper) Store(ctx sdk.Context) sdk.KVStore { - return ctx.KVStore(k.storeKey) -} - -func (k Keeper) SinglePlayer(ctx sdk.Context, contractAddress string, ResolveSinglePlayer []byte, gameName string) { - logger := k.Logger(ctx) - err := k.SudoContractCall(ctx, contractAddress, ResolveSinglePlayer) - if err != nil { - logger.Error(fmt.Sprintf("Game %s contract call error for single-player", gameName)) - } else { - logger.Info(fmt.Sprintf("Game %s contract call for single-player success", gameName)) - } -} - -func (k Keeper) MultiPlayer(ctx sdk.Context, contractAddress string, SetupMultiPlayer []byte, ResolveMultiPlayer []byte, gameName string) { - logger := k.Logger(ctx) - err := k.SudoContractCall(ctx, contractAddress, SetupMultiPlayer) - if err != nil { - logger.Error(fmt.Sprintf("Game %s contract call error for setup multi-player", gameName)) - } else { - logger.Info(fmt.Sprintf("Game %s contract call for setup multi-player success", gameName)) - } - - err = k.SudoContractCall(ctx, contractAddress, ResolveMultiPlayer) - if err != nil { - logger.Error(fmt.Sprintf("Game %s contract call error for resolve multi-player", gameName)) - } else { - logger.Info(fmt.Sprintf("Game %s contract call for resolve multi-player success", gameName)) - } -} diff --git a/x/common/keeper/msg_server.go b/x/common/keeper/msg_server.go deleted file mode 100644 index a972118cd..000000000 --- a/x/common/keeper/msg_server.go +++ /dev/null @@ -1,117 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "cosmossdk.io/errors" - "github.com/comdex-official/comdex/x/common/types" - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -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{} - -func (k msgServer) RegisterContract(goCtx context.Context, msg *types.MsgRegisterContract) (*types.MsgRegisterContractResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if err := msg.ValidateBasic(); err != nil { - ctx.Logger().Error(fmt.Sprintf("request invalid: %s", err)) - return &types.MsgRegisterContractResponse{}, err - } - - // Validation such that only the user who instantiated the contract can register contract - contractAddr, err := sdk.AccAddressFromBech32(msg.ContractAddress) - if err != nil { - return &types.MsgRegisterContractResponse{}, sdkerrors.ErrInvalidAddress - } - contractInfo := k.conOps.GetContractInfo(ctx, contractAddr) - - // check if sender is authorized - exists := k.CheckSecurityAddress(ctx, msg.SecurityAddress) - if !exists { - return &types.MsgRegisterContractResponse{}, sdkerrors.ErrUnauthorized - } - - allContracts := k.GetAllContract(ctx) - - for _, data := range allContracts { - if data.ContractAddress == msg.ContractAddress{ - return &types.MsgRegisterContractResponse{}, sdkerrors.Wrapf(sdkerrors.ErrNotFound, "contract already registered") - } - } - gameID := k.GetGameID(ctx) - contract := types.WhitelistedContract { - GameId: gameID+1, - SecurityAddress: msg.SecurityAddress, - ContractAdmin: contractInfo.Admin, - GameName: msg.GameName, - ContractAddress: msg.ContractAddress, - GameType: msg.GameType, - } - - err = k.SetContract(ctx, contract) - if err != nil { - ctx.Logger().Error("failed to set new contract") - return &types.MsgRegisterContractResponse{}, err - } - k.SetGameID(ctx, gameID+1) - - return &types.MsgRegisterContractResponse{}, nil -} - -func (k msgServer) DeRegisterContract(goCtx context.Context, msg *types.MsgDeRegisterContract) (*types.MsgDeRegisterContractResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if err := msg.ValidateBasic(); err != nil { - ctx.Logger().Error(fmt.Sprintf("request invalid: %s", err)) - return &types.MsgDeRegisterContractResponse{}, err - } - - // Get Game info from Game Id - gameInfo, found := k.GetContract(ctx, msg.GameId) - if !found { - return &types.MsgDeRegisterContractResponse{}, sdkerrors.Wrapf(sdkerrors.ErrNotFound, "no contract found for this game ID") - } - - // Validation such that only the user who instantiated the contract can register contract - contractAddr, err := sdk.AccAddressFromBech32(gameInfo.ContractAddress) - if err != nil { - return &types.MsgDeRegisterContractResponse{}, sdkerrors.ErrInvalidAddress - } - contractInfo := k.conOps.GetContractInfo(ctx, contractAddr) - - // check if sender is authorized - exists := k.CheckSecurityAddress(ctx, msg.SecurityAddress) - if !exists && contractInfo.Admin != msg.SecurityAddress{ - return &types.MsgDeRegisterContractResponse{}, sdkerrors.ErrUnauthorized - } - - k.DeleteContract(ctx, msg.GameId) - - return &types.MsgDeRegisterContractResponse{}, nil -} - -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if k.authority != req.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - if err := k.SetParams(ctx, req.Params); err != nil { - return nil, err - } - - return &types.MsgUpdateParamsResponse{}, nil -} \ No newline at end of file diff --git a/x/common/keeper/params.go b/x/common/keeper/params.go deleted file mode 100644 index 13e7289a4..000000000 --- a/x/common/keeper/params.go +++ /dev/null @@ -1,32 +0,0 @@ -package keeper - -import ( - "github.com/comdex-official/comdex/x/common/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// SetParams sets the x/common module parameters. -func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { - if err := p.Validate(); err != nil { - return err - } - - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&p) - store.Set(types.ParamsKey, bz) - - return nil -} - -// GetParams returns the current x/common module parameters. -func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ParamsKey) - if bz == nil { - return p - } - - k.cdc.MustUnmarshal(bz, &p) - return p -} - diff --git a/x/common/keeper/store.go b/x/common/keeper/store.go deleted file mode 100644 index e7484be8b..000000000 --- a/x/common/keeper/store.go +++ /dev/null @@ -1,94 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/comdex-official/comdex/x/common/types" - protobuftypes "github.com/cosmos/gogoproto/types" -) - -func (k Keeper) SetGameID(ctx sdk.Context, id uint64) { - var ( - store = k.Store(ctx) - key = types.GameIDKey - value = k.cdc.MustMarshal( - &protobuftypes.UInt64Value{ - Value: id, - }, - ) - ) - - store.Set(key, value) -} - -func (k Keeper) GetGameID(ctx sdk.Context) uint64 { - var ( - store = k.Store(ctx) - key = types.GameIDKey - value = store.Get(key) - ) - - if value == nil { - return 0 - } - - var id protobuftypes.UInt64Value - k.cdc.MustUnmarshal(value, &id) - - return id.GetValue() -} - -func (k Keeper) SetContract(ctx sdk.Context, msg types.WhitelistedContract) error { - var ( - store = k.Store(ctx) - key = types.ContractKey(msg.GameId) - value = k.cdc.MustMarshal(&msg) - ) - - store.Set(key, value) - return nil -} - -func (k Keeper) GetContract(ctx sdk.Context, gameID uint64) (contract types.WhitelistedContract, found bool) { - var ( - store = k.Store(ctx) - key = types.ContractKey(gameID) - value = store.Get(key) - ) - - if value == nil { - return contract, false - } - - k.cdc.MustUnmarshal(value, &contract) - return contract, true -} - -func (k Keeper) DeleteContract(ctx sdk.Context, gameID uint64) { - var ( - store = k.Store(ctx) - key = types.ContractKey(gameID) - ) - - store.Delete(key) -} - -func (k Keeper) GetAllContract(ctx sdk.Context) (contracts []types.WhitelistedContract) { - var ( - store = k.Store(ctx) - iter = sdk.KVStorePrefixIterator(store, types.SetContractKeyPrefix) - ) - - defer func(iter sdk.Iterator) { - err := iter.Close() - if err != nil { - return - } - }(iter) - - for ; iter.Valid(); iter.Next() { - var contract types.WhitelistedContract - k.cdc.MustUnmarshal(iter.Value(), &contract) - contracts = append(contracts, contract) - } - return contracts -} \ No newline at end of file diff --git a/x/common/module.go b/x/common/module.go deleted file mode 100644 index 0c43682cb..000000000 --- a/x/common/module.go +++ /dev/null @@ -1,170 +0,0 @@ -package common - -import ( - "context" - "encoding/json" - "fmt" - // this line is used by starport scaffolding # 1 - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/comdex-official/comdex/x/common/client/cli" - "github.com/comdex-official/comdex/x/common/expected" - "github.com/comdex-official/comdex/x/common/keeper" - "github.com/comdex-official/comdex/x/common/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" -) - -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 -} - -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.DefaultGenesisState()) -} - -// ValidateGenesis performs genesis state validation for the capability 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 genState.ValidateGenesis() -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - _ = types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) - // this line is used by starport scaffolding # 2 -} - -// 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(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - conOps expected.ContractOpsKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, - conOps expected.ContractOpsKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - conOps: conOps, - } -} - -// 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.NewQueryServerImpl(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(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/common/types/codec.go b/x/common/types/codec.go deleted file mode 100644 index 30033969e..000000000 --- a/x/common/types/codec.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - // this line is used by starport scaffolding # 1 - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" -) - -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 - cdc.RegisterConcrete(&MsgRegisterContract{}, "comdex/common/MsgRegisterContract", nil) - cdc.RegisterConcrete(&MsgDeRegisterContract{}, "comdex/common/MsgDeRegisterContract", nil) - cdc.RegisterConcrete(&Params{}, "comdex/common/Params", nil) - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "comdex/common/MsgUpdateParams") - -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgRegisterContract{}, - &MsgDeRegisterContract{}, - &MsgUpdateParams{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(Amino) - // ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) - -func init() { - RegisterLegacyAminoCodec(Amino) - cryptocodec.RegisterCrypto(Amino) - RegisterLegacyAminoCodec(authzcodec.Amino) - Amino.Seal() -} diff --git a/x/common/types/common.pb.go b/x/common/types/common.pb.go deleted file mode 100644 index 1f8c2ea66..000000000 --- a/x/common/types/common.pb.go +++ /dev/null @@ -1,549 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/common/v1beta1/common.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type WhitelistedContract struct { - GameId uint64 `protobuf:"varint,1,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"` - SecurityAddress string `protobuf:"bytes,2,opt,name=security_address,json=securityAddress,proto3" json:"security_address,omitempty"` - ContractAdmin string `protobuf:"bytes,3,opt,name=contract_admin,json=contractAdmin,proto3" json:"contract_admin,omitempty"` - GameName string `protobuf:"bytes,4,opt,name=game_name,json=gameName,proto3" json:"game_name,omitempty"` - ContractAddress string `protobuf:"bytes,5,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - GameType uint64 `protobuf:"varint,6,opt,name=game_type,json=gameType,proto3" json:"game_type,omitempty"` -} - -func (m *WhitelistedContract) Reset() { *m = WhitelistedContract{} } -func (m *WhitelistedContract) String() string { return proto.CompactTextString(m) } -func (*WhitelistedContract) ProtoMessage() {} -func (*WhitelistedContract) Descriptor() ([]byte, []int) { - return fileDescriptor_3c9dacbe026f0484, []int{0} -} -func (m *WhitelistedContract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WhitelistedContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WhitelistedContract.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 *WhitelistedContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_WhitelistedContract.Merge(m, src) -} -func (m *WhitelistedContract) XXX_Size() int { - return m.Size() -} -func (m *WhitelistedContract) XXX_DiscardUnknown() { - xxx_messageInfo_WhitelistedContract.DiscardUnknown(m) -} - -var xxx_messageInfo_WhitelistedContract proto.InternalMessageInfo - -func (m *WhitelistedContract) GetGameId() uint64 { - if m != nil { - return m.GameId - } - return 0 -} - -func (m *WhitelistedContract) GetSecurityAddress() string { - if m != nil { - return m.SecurityAddress - } - return "" -} - -func (m *WhitelistedContract) GetContractAdmin() string { - if m != nil { - return m.ContractAdmin - } - return "" -} - -func (m *WhitelistedContract) GetGameName() string { - if m != nil { - return m.GameName - } - return "" -} - -func (m *WhitelistedContract) GetContractAddress() string { - if m != nil { - return m.ContractAddress - } - return "" -} - -func (m *WhitelistedContract) GetGameType() uint64 { - if m != nil { - return m.GameType - } - return 0 -} - -func init() { - proto.RegisterType((*WhitelistedContract)(nil), "comdex.common.v1beta1.WhitelistedContract") -} - -func init() { - proto.RegisterFile("comdex/common/v1beta1/common.proto", fileDescriptor_3c9dacbe026f0484) -} - -var fileDescriptor_3c9dacbe026f0484 = []byte{ - // 290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x4f, 0x4b, 0xc3, 0x30, - 0x18, 0xc6, 0x1b, 0x9d, 0xd5, 0x05, 0xfc, 0x43, 0x55, 0x2c, 0x0a, 0x61, 0x0c, 0x84, 0x79, 0x70, - 0x75, 0xf8, 0x09, 0xa6, 0x27, 0x3d, 0x78, 0x18, 0x82, 0xe0, 0xa5, 0xa4, 0xc9, 0xbb, 0x2e, 0xb0, - 0x34, 0xa5, 0xcd, 0xc4, 0x7e, 0x0b, 0x3f, 0x96, 0xc7, 0x1d, 0x3d, 0x4a, 0x8b, 0xdf, 0x43, 0x92, - 0xb4, 0xba, 0x5b, 0xde, 0x87, 0x1f, 0xbf, 0x27, 0x3c, 0x78, 0xc8, 0x94, 0xe4, 0xf0, 0x1e, 0x31, - 0x25, 0xa5, 0xca, 0xa2, 0xb7, 0x49, 0x02, 0x9a, 0x4e, 0xda, 0x73, 0x9c, 0x17, 0x4a, 0xab, 0xe0, - 0xd4, 0x31, 0xe3, 0x36, 0x6c, 0x99, 0xf3, 0x93, 0x54, 0xa5, 0xca, 0x12, 0x91, 0x79, 0x39, 0x78, - 0xf8, 0x83, 0xf0, 0xf1, 0xcb, 0x42, 0x68, 0x58, 0x8a, 0x52, 0x03, 0xbf, 0x57, 0x99, 0x2e, 0x28, - 0xd3, 0xc1, 0x19, 0xde, 0x4d, 0xa9, 0x84, 0x58, 0xf0, 0x10, 0x0d, 0xd0, 0xa8, 0x37, 0xf3, 0xcd, - 0xf9, 0xc0, 0x83, 0x2b, 0x7c, 0x54, 0x02, 0x5b, 0x15, 0x42, 0x57, 0x31, 0xe5, 0xbc, 0x80, 0xb2, - 0x0c, 0xb7, 0x06, 0x68, 0xd4, 0x9f, 0x1d, 0x76, 0xf9, 0xd4, 0xc5, 0xc1, 0x25, 0x3e, 0x60, 0xad, - 0x2f, 0xa6, 0x5c, 0x8a, 0x2c, 0xdc, 0xb6, 0xe0, 0x7e, 0x97, 0x4e, 0x4d, 0x18, 0x5c, 0xe0, 0xbe, - 0xad, 0xca, 0xa8, 0x84, 0xb0, 0x67, 0x89, 0x3d, 0x13, 0x3c, 0x51, 0x09, 0xa6, 0x6e, 0xc3, 0xe1, - 0xea, 0x76, 0x5c, 0xdd, 0xbf, 0xc5, 0xd5, 0x75, 0x1e, 0x5d, 0xe5, 0x10, 0xfa, 0xf6, 0xd3, 0xd6, - 0xf3, 0x5c, 0xe5, 0x70, 0xf7, 0xf8, 0x59, 0x13, 0xb4, 0xae, 0x09, 0xfa, 0xae, 0x09, 0xfa, 0x68, - 0x88, 0xb7, 0x6e, 0x88, 0xf7, 0xd5, 0x10, 0xef, 0xf5, 0x26, 0x15, 0x7a, 0xb1, 0x4a, 0xcc, 0x5c, - 0x91, 0x5b, 0xee, 0x5a, 0xcd, 0xe7, 0x82, 0x09, 0xba, 0x6c, 0xef, 0xe8, 0x6f, 0x6f, 0xa3, 0x2e, - 0x13, 0xdf, 0x4e, 0x77, 0xfb, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x86, 0xbd, 0xb6, 0x33, 0x8d, 0x01, - 0x00, 0x00, -} - -func (m *WhitelistedContract) 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 *WhitelistedContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WhitelistedContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GameType != 0 { - i = encodeVarintCommon(dAtA, i, uint64(m.GameType)) - i-- - dAtA[i] = 0x30 - } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintCommon(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0x2a - } - if len(m.GameName) > 0 { - i -= len(m.GameName) - copy(dAtA[i:], m.GameName) - i = encodeVarintCommon(dAtA, i, uint64(len(m.GameName))) - i-- - dAtA[i] = 0x22 - } - if len(m.ContractAdmin) > 0 { - i -= len(m.ContractAdmin) - copy(dAtA[i:], m.ContractAdmin) - i = encodeVarintCommon(dAtA, i, uint64(len(m.ContractAdmin))) - i-- - dAtA[i] = 0x1a - } - if len(m.SecurityAddress) > 0 { - i -= len(m.SecurityAddress) - copy(dAtA[i:], m.SecurityAddress) - i = encodeVarintCommon(dAtA, i, uint64(len(m.SecurityAddress))) - i-- - dAtA[i] = 0x12 - } - if m.GameId != 0 { - i = encodeVarintCommon(dAtA, i, uint64(m.GameId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintCommon(dAtA []byte, offset int, v uint64) int { - offset -= sovCommon(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *WhitelistedContract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GameId != 0 { - n += 1 + sovCommon(uint64(m.GameId)) - } - l = len(m.SecurityAddress) - if l > 0 { - n += 1 + l + sovCommon(uint64(l)) - } - l = len(m.ContractAdmin) - if l > 0 { - n += 1 + l + sovCommon(uint64(l)) - } - l = len(m.GameName) - if l > 0 { - n += 1 + l + sovCommon(uint64(l)) - } - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovCommon(uint64(l)) - } - if m.GameType != 0 { - n += 1 + sovCommon(uint64(m.GameType)) - } - return n -} - -func sovCommon(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCommon(x uint64) (n int) { - return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *WhitelistedContract) 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 ErrIntOverflowCommon - } - 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: WhitelistedContract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WhitelistedContract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GameId", wireType) - } - m.GameId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GameId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SecurityAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - 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 ErrInvalidLengthCommon - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCommon - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SecurityAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAdmin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - 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 ErrInvalidLengthCommon - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCommon - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractAdmin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GameName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - 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 ErrInvalidLengthCommon - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCommon - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GameName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - 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 ErrInvalidLengthCommon - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCommon - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GameType", wireType) - } - m.GameType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GameType |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCommon(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommon - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCommon(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, ErrIntOverflowCommon - } - 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, ErrIntOverflowCommon - } - 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, ErrIntOverflowCommon - } - 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, ErrInvalidLengthCommon - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCommon - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCommon - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCommon = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCommon = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCommon = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/common/types/errors.go b/x/common/types/errors.go deleted file mode 100644 index ff0dee22a..000000000 --- a/x/common/types/errors.go +++ /dev/null @@ -1,13 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// x/common module sentinel errors -var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") - -) diff --git a/x/common/types/events.go b/x/common/types/events.go deleted file mode 100644 index c928ff1c4..000000000 --- a/x/common/types/events.go +++ /dev/null @@ -1,8 +0,0 @@ -package types - -const ( - CommonModuleEventType = "common" - - EventTypeContractSudoMsg = "sudo_msg" - AttributeKeyResultDataHex = "result" -) diff --git a/x/common/types/expected_keepers.go b/x/common/types/expected_keepers.go deleted file mode 100644 index 04a3b5acd..000000000 --- a/x/common/types/expected_keepers.go +++ /dev/null @@ -1,20 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - - - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here -} \ No newline at end of file diff --git a/x/common/types/genesis.go b/x/common/types/genesis.go deleted file mode 100644 index c015664de..000000000 --- a/x/common/types/genesis.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -func NewGenesisState(whitelistedContracts []WhitelistedContract, params Params) *GenesisState { - return &GenesisState{ - WhitelistedContracts: whitelistedContracts, - Params: params, - } -} - -func DefaultGenesisState() *GenesisState { - return NewGenesisState( - []WhitelistedContract{}, - DefaultParams(), - ) -} - -func (m *GenesisState) ValidateGenesis() error { - return nil -} diff --git a/x/common/types/genesis.pb.go b/x/common/types/genesis.pb.go deleted file mode 100644 index 46a8f4b3d..000000000 --- a/x/common/types/genesis.pb.go +++ /dev/null @@ -1,390 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/common/v1beta1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the common module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - WhitelistedContracts []WhitelistedContract `protobuf:"bytes,2,rep,name=whitelisted_contracts,json=whitelistedContracts,proto3" json:"whitelisted_contracts" yaml:"whitelisted_contracts"` -} - -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_6226eee8ed557a35, []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 (m *GenesisState) GetWhitelistedContracts() []WhitelistedContract { - if m != nil { - return m.WhitelistedContracts - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "comdex.common.v1beta1.GenesisState") -} - -func init() { - proto.RegisterFile("comdex/common/v1beta1/genesis.proto", fileDescriptor_6226eee8ed557a35) -} - -var fileDescriptor_6226eee8ed557a35 = []byte{ - // 283 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, 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, - 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x12, 0x85, 0x28, 0xd2, 0x83, 0x28, 0xd2, 0x83, 0x2a, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, - 0xab, 0xd0, 0x07, 0xb1, 0x20, 0x8a, 0xa5, 0x94, 0xb0, 0x9b, 0x58, 0x90, 0x58, 0x94, 0x98, 0x5b, - 0x8c, 0x5f, 0x0d, 0xd4, 0x7c, 0xb0, 0x1a, 0xa5, 0x27, 0x8c, 0x5c, 0x3c, 0xee, 0x10, 0x67, 0x04, - 0x97, 0x24, 0x96, 0xa4, 0x0a, 0xf9, 0x70, 0xb1, 0x41, 0x0c, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, - 0x36, 0x92, 0xd5, 0xc3, 0xea, 0x2c, 0xbd, 0x00, 0xb0, 0x22, 0x27, 0xd1, 0x13, 0xf7, 0xe4, 0x19, - 0x3e, 0xdd, 0x93, 0xe7, 0xad, 0x4c, 0xcc, 0xcd, 0xb1, 0x52, 0x82, 0x68, 0x55, 0x0a, 0x82, 0x9a, - 0x21, 0xd4, 0xca, 0xc8, 0x25, 0x5a, 0x9e, 0x91, 0x59, 0x92, 0x9a, 0x93, 0x59, 0x5c, 0x92, 0x9a, - 0x12, 0x9f, 0x9c, 0x9f, 0x57, 0x52, 0x94, 0x98, 0x5c, 0x52, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, - 0x6d, 0xa4, 0x85, 0xc3, 0xf4, 0x70, 0x84, 0x1e, 0x67, 0xa8, 0x16, 0x27, 0x15, 0xa8, 0x55, 0x32, - 0x10, 0xab, 0xb0, 0x1a, 0xab, 0x14, 0x24, 0x52, 0x8e, 0xa9, 0xb5, 0xd8, 0xc9, 0xeb, 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, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0x40, - 0x0e, 0xd0, 0x87, 0xb8, 0x45, 0x37, 0x3f, 0x2d, 0x2d, 0x33, 0x39, 0x33, 0x31, 0x07, 0xca, 0xd7, - 0x87, 0x87, 0x60, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xe4, 0x8c, 0x01, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x1b, 0x0d, 0x3b, 0x6c, 0xd5, 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 - if len(m.WhitelistedContracts) > 0 { - for iNdEx := len(m.WhitelistedContracts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.WhitelistedContracts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - 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)) - if len(m.WhitelistedContracts) > 0 { - for _, e := range m.WhitelistedContracts { - l = e.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 - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WhitelistedContracts", 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 - } - m.WhitelistedContracts = append(m.WhitelistedContracts, WhitelistedContract{}) - if err := m.WhitelistedContracts[len(m.WhitelistedContracts)-1].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/common/types/genesis_test.go b/x/common/types/genesis_test.go deleted file mode 100644 index a1b73d54e..000000000 --- a/x/common/types/genesis_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package types_test - -// import ( -// "testing" - -// "github.com/stretchr/testify/require" -// "github.com/comdex-official/comdex/x/common/types" -// ) - -// func TestGenesisState_Validate(t *testing.T) { -// for _, tc := range []struct { -// desc string -// genState *types.GenesisState -// valid bool -// } { -// { -// desc: "default is valid", -// genState: types.DefaultGenesis(), -// valid: true, -// }, -// { -// desc: "valid genesis state", -// genState: &types.GenesisState{ - -// // this line is used by starport scaffolding # types/genesis/validField -// }, -// valid: true, -// }, -// // this line is used by starport scaffolding # types/genesis/testcase -// } { -// t.Run(tc.desc, func(t *testing.T) { -// err := tc.genState.Validate() -// if tc.valid { -// require.NoError(t, err) -// } else { -// require.Error(t, err) -// } -// }) -// } -// } \ No newline at end of file diff --git a/x/common/types/keys.go b/x/common/types/keys.go deleted file mode 100644 index 016dc70d6..000000000 --- a/x/common/types/keys.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName defines the module name - ModuleName = "common" - - // 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 - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_common" -) - -var ( - SetContractKeyPrefix = []byte{0x11} - GameIDKey = []byte{0x12} - ParamsKey = []byte{0x13} -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} - -func ContractKey(gameID uint64) []byte { - return append(SetContractKeyPrefix, sdk.Uint64ToBigEndian(gameID)...) -} diff --git a/x/common/types/message_de_register_contract.go b/x/common/types/message_de_register_contract.go deleted file mode 100644 index 43ff3f664..000000000 --- a/x/common/types/message_de_register_contract.go +++ /dev/null @@ -1,50 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -const TypeMsgDeRegisterContract = "de_register_contract" - -var _ sdk.Msg = &MsgDeRegisterContract{} - -func NewMsgDeRegisterContract( - securityAddress string, - gameID uint64, -) *MsgDeRegisterContract { - return &MsgDeRegisterContract{ - SecurityAddress: securityAddress, - GameId: gameID, - } -} - -func (msg *MsgDeRegisterContract) Route() string { - return RouterKey -} - -func (msg *MsgDeRegisterContract) Type() string { - return TypeMsgDeRegisterContract -} - -func (msg *MsgDeRegisterContract) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.SecurityAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg *MsgDeRegisterContract) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgDeRegisterContract) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.SecurityAddress) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) - } - - return nil -} diff --git a/x/common/types/message_register_contract.go b/x/common/types/message_register_contract.go deleted file mode 100644 index 1910ccdb8..000000000 --- a/x/common/types/message_register_contract.go +++ /dev/null @@ -1,64 +0,0 @@ -package types - -import ( - "slices" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -const TypeMsgRegisterContract = "register_contract" - -var _ sdk.Msg = &MsgRegisterContract{} - -func NewMsgRegisterContract( - securityAddress string, - gameName string, - contractAddress string, - gameType uint64, -) *MsgRegisterContract { - return &MsgRegisterContract{ - SecurityAddress: securityAddress, - GameName: gameName, - ContractAddress: contractAddress, - GameType: gameType, - } -} - -func (msg *MsgRegisterContract) Route() string { - return RouterKey -} - -func (msg *MsgRegisterContract) Type() string { - return TypeMsgRegisterContract -} - -func (msg *MsgRegisterContract) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.SecurityAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg *MsgRegisterContract) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgRegisterContract) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.SecurityAddress) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) - } - - _, err = sdk.AccAddressFromBech32(msg.ContractAddress) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", err) - } - gameType := []uint64{1, 2, 3} - if !slices.Contains(gameType, msg.GameType) { - return sdkerrors.Wrap(sdkerrors.ErrInvalidType, "invalid game type, should be 1,2 or 3") - } - - return nil -} diff --git a/x/common/types/message_update_params.go b/x/common/types/message_update_params.go deleted file mode 100644 index 9c12198b2..000000000 --- a/x/common/types/message_update_params.go +++ /dev/null @@ -1,35 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var _ sdk.Msg = &MsgUpdateParams{} - -func (msg *MsgUpdateParams) Route() string { - return RouterKey -} - -func (msg *MsgUpdateParams) Type() string { - return "update-params" -} - -func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg *MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) -} - -func (msg *MsgUpdateParams) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { - return errorsmod.Wrap(err, "authority is invalid") - } - return nil -} diff --git a/x/common/types/params.go b/x/common/types/params.go deleted file mode 100644 index 47f3672cc..000000000 --- a/x/common/types/params.go +++ /dev/null @@ -1,62 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -func NewParams( - securityAddress []string, contractGasLimit uint64, -) Params { - return Params{ - SecurityAddress: securityAddress, - ContractGasLimit: contractGasLimit, - } -} - -// default minting module parameters -func DefaultParams() Params { - return Params{ - SecurityAddress: []string{"comdex1nh4gxgzq7hw8fvtkxjg4kpfqmsq65szqxxdqye"}, - ContractGasLimit: uint64(1000000000), - } -} - -// validate params -func (p Params) Validate() error { - minimumGas := uint64(100_000) - if p.ContractGasLimit < minimumGas { - return errorsmod.Wrapf( - sdkerrors.ErrInvalidRequest, - "invalid contract gas limit: %d. Must be above %d", p.ContractGasLimit, minimumGas, - ) - } - - for _, addr := range p.SecurityAddress { - // Valid address check - if _, err := sdk.AccAddressFromBech32(addr); err != nil { - return errorsmod.Wrapf( - sdkerrors.ErrInvalidAddress, - "invalid security address: %s", err.Error(), - ) - } - - // duplicate address check - count := 0 - for _, addr2 := range p.SecurityAddress { - if addr == addr2 { - count++ - } - - if count > 1 { - return errorsmod.Wrapf( - sdkerrors.ErrInvalidAddress, - "duplicate contract address: %s", addr, - ) - } - } - } - - return nil -} diff --git a/x/common/types/params.pb.go b/x/common/types/params.pb.go deleted file mode 100644 index 231e6853a..000000000 --- a/x/common/types/params.pb.go +++ /dev/null @@ -1,366 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/common/v1beta1/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the set of module parameters. -type Params struct { - // Security address that can whitelist/delist contract - SecurityAddress []string `protobuf:"bytes,1,rep,name=security_address,json=securityAddress,proto3" json:"security_address,omitempty" yaml:"security_address"` - ContractGasLimit uint64 `protobuf:"varint,2,opt,name=contract_gas_limit,json=contractGasLimit,proto3" json:"contract_gas_limit,omitempty" yaml:"contract_gas_limit"` -} - -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_06465d9b92afff70, []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 (m *Params) GetSecurityAddress() []string { - if m != nil { - return m.SecurityAddress - } - return nil -} - -func (m *Params) GetContractGasLimit() uint64 { - if m != nil { - return m.ContractGasLimit - } - return 0 -} - -func init() { - proto.RegisterType((*Params)(nil), "comdex.common.v1beta1.Params") -} - -func init() { - proto.RegisterFile("comdex/common/v1beta1/params.proto", fileDescriptor_06465d9b92afff70) -} - -var fileDescriptor_06465d9b92afff70 = []byte{ - // 276 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0xce, 0xcf, 0x4d, - 0x49, 0xad, 0xd0, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, - 0x34, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, - 0x85, 0xa8, 0xd1, 0x83, 0xa8, 0xd1, 0x83, 0xaa, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, - 0xd0, 0x07, 0xb1, 0x20, 0x8a, 0x95, 0x6e, 0x33, 0x72, 0xb1, 0x05, 0x80, 0x75, 0x0b, 0xa5, 0x70, - 0x09, 0x14, 0xa7, 0x26, 0x97, 0x16, 0x65, 0x96, 0x54, 0xc6, 0x27, 0xa6, 0xa4, 0x14, 0xa5, 0x16, - 0x17, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x3a, 0x59, 0xbe, 0xba, 0x27, 0x2f, 0x85, 0x2e, 0xa7, - 0x93, 0x9f, 0x9b, 0x59, 0x92, 0x9a, 0x5b, 0x50, 0x52, 0xf9, 0xe9, 0x9e, 0xbc, 0x78, 0x65, 0x62, - 0x6e, 0x8e, 0x95, 0x12, 0xba, 0x1a, 0xa5, 0x20, 0x7e, 0x98, 0x90, 0x23, 0x44, 0x44, 0x28, 0x9b, - 0x4b, 0x28, 0x39, 0x3f, 0xaf, 0xa4, 0x28, 0x31, 0xb9, 0x24, 0x3e, 0x3d, 0xb1, 0x38, 0x3e, 0x27, - 0x33, 0x37, 0xb3, 0x44, 0x82, 0x49, 0x81, 0x51, 0x83, 0xc5, 0xc9, 0xf6, 0xd5, 0x3d, 0x79, 0x19, - 0x4c, 0x59, 0x14, 0x9b, 0x24, 0x21, 0x36, 0x61, 0xaa, 0x52, 0x0a, 0x12, 0x80, 0x09, 0xba, 0x27, - 0x16, 0xfb, 0x80, 0x84, 0x9c, 0xbc, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, - 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, - 0xca, 0x20, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x09, 0x14, 0x48, 0xfa, 0x90, 0xf0, 0xd2, 0xcd, 0x4f, - 0x4b, 0xcb, 0x4c, 0xce, 0x4c, 0xcc, 0x81, 0xf2, 0xf5, 0xe1, 0xa1, 0x5c, 0x52, 0x59, 0x90, 0x5a, - 0x9c, 0xc4, 0x06, 0x0e, 0x30, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x70, 0x67, 0x0b, 0x1e, - 0x83, 0x01, 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.ContractGasLimit != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.ContractGasLimit)) - i-- - dAtA[i] = 0x10 - } - if len(m.SecurityAddress) > 0 { - for iNdEx := len(m.SecurityAddress) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.SecurityAddress[iNdEx]) - copy(dAtA[i:], m.SecurityAddress[iNdEx]) - i = encodeVarintParams(dAtA, i, uint64(len(m.SecurityAddress[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - 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 - if len(m.SecurityAddress) > 0 { - for _, s := range m.SecurityAddress { - l = len(s) - n += 1 + l + sovParams(uint64(l)) - } - } - if m.ContractGasLimit != 0 { - n += 1 + sovParams(uint64(m.ContractGasLimit)) - } - 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 { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SecurityAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SecurityAddress = append(m.SecurityAddress, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractGasLimit", wireType) - } - m.ContractGasLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ContractGasLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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/common/types/query.pb.go b/x/common/types/query.pb.go deleted file mode 100644 index 405e2be12..000000000 --- a/x/common/types/query.pb.go +++ /dev/null @@ -1,1004 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/common/v1beta1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - query "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_6fca43c4ee348693, []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_6fca43c4ee348693, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -type QueryWhitelistedContractsRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty" yaml:"pagination"` -} - -func (m *QueryWhitelistedContractsRequest) Reset() { *m = QueryWhitelistedContractsRequest{} } -func (m *QueryWhitelistedContractsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryWhitelistedContractsRequest) ProtoMessage() {} -func (*QueryWhitelistedContractsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6fca43c4ee348693, []int{2} -} -func (m *QueryWhitelistedContractsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryWhitelistedContractsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryWhitelistedContractsRequest.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 *QueryWhitelistedContractsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryWhitelistedContractsRequest.Merge(m, src) -} -func (m *QueryWhitelistedContractsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryWhitelistedContractsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryWhitelistedContractsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryWhitelistedContractsRequest proto.InternalMessageInfo - -func (m *QueryWhitelistedContractsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -type QueryWhitelistedContractsResponse struct { - WhilistedContracts []WhitelistedContract `protobuf:"bytes,1,rep,name=whilisted_contracts,json=whilistedContracts,proto3" json:"whilisted_contracts"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty" yaml:"pagination"` -} - -func (m *QueryWhitelistedContractsResponse) Reset() { *m = QueryWhitelistedContractsResponse{} } -func (m *QueryWhitelistedContractsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryWhitelistedContractsResponse) ProtoMessage() {} -func (*QueryWhitelistedContractsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6fca43c4ee348693, []int{3} -} -func (m *QueryWhitelistedContractsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryWhitelistedContractsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryWhitelistedContractsResponse.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 *QueryWhitelistedContractsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryWhitelistedContractsResponse.Merge(m, src) -} -func (m *QueryWhitelistedContractsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryWhitelistedContractsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryWhitelistedContractsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryWhitelistedContractsResponse proto.InternalMessageInfo - -func (m *QueryWhitelistedContractsResponse) GetWhilistedContracts() []WhitelistedContract { - if m != nil { - return m.WhilistedContracts - } - return nil -} - -func (m *QueryWhitelistedContractsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "comdex.common.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "comdex.common.v1beta1.QueryParamsResponse") - proto.RegisterType((*QueryWhitelistedContractsRequest)(nil), "comdex.common.v1beta1.QueryWhitelistedContractsRequest") - proto.RegisterType((*QueryWhitelistedContractsResponse)(nil), "comdex.common.v1beta1.QueryWhitelistedContractsResponse") -} - -func init() { proto.RegisterFile("comdex/common/v1beta1/query.proto", fileDescriptor_6fca43c4ee348693) } - -var fileDescriptor_6fca43c4ee348693 = []byte{ - // 468 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0xcf, 0x05, 0xc8, 0x70, 0x9d, 0xb8, 0xb6, 0x52, 0x89, 0xa8, 0x93, 0x9e, 0x04, 0x94, 0x08, - 0xee, 0x68, 0x40, 0x02, 0xc1, 0x16, 0x36, 0x26, 0xc8, 0x82, 0x84, 0x04, 0xe8, 0xe2, 0x5e, 0x9d, - 0x93, 0x62, 0x3f, 0xd7, 0x77, 0xa1, 0x64, 0x84, 0x81, 0x19, 0x89, 0xaf, 0xc4, 0xd0, 0xb1, 0x12, - 0x03, 0x4c, 0x15, 0x4a, 0x10, 0x1f, 0x80, 0x4f, 0x80, 0x7c, 0x77, 0xb1, 0xa9, 0x88, 0x4d, 0xd9, - 0x2c, 0xbf, 0xdf, 0xdf, 0xe7, 0x67, 0xbc, 0x13, 0x42, 0xbc, 0x2f, 0xdf, 0xf2, 0x10, 0xe2, 0x18, - 0x12, 0xfe, 0x66, 0x6f, 0x24, 0x8d, 0xd8, 0xe3, 0x87, 0x53, 0x99, 0xcd, 0x58, 0x9a, 0x81, 0x01, - 0xb2, 0xe9, 0x20, 0xcc, 0x41, 0x98, 0x87, 0xb4, 0x37, 0x22, 0x88, 0xc0, 0x22, 0x78, 0xfe, 0xe4, - 0xc0, 0xed, 0xab, 0x11, 0x40, 0x34, 0x91, 0x5c, 0xa4, 0x8a, 0x8b, 0x24, 0x01, 0x23, 0x8c, 0x82, - 0x44, 0xfb, 0x69, 0x2f, 0x04, 0x1d, 0x83, 0xe6, 0x23, 0xa1, 0xa5, 0xf3, 0x28, 0x1c, 0x53, 0x11, - 0xa9, 0xc4, 0x82, 0x3d, 0x96, 0xae, 0x4e, 0x96, 0x8a, 0x4c, 0xc4, 0xba, 0x1e, 0xe3, 0x93, 0x5a, - 0x0c, 0xdd, 0xc0, 0xe4, 0x59, 0xee, 0xf4, 0xd4, 0x12, 0x87, 0xf2, 0x70, 0x2a, 0xb5, 0xa1, 0x43, - 0xbc, 0x7e, 0xe6, 0xad, 0x4e, 0x21, 0xd1, 0x92, 0x3c, 0xc2, 0x2d, 0x67, 0xb0, 0x85, 0xba, 0x68, - 0x77, 0xad, 0xbf, 0xcd, 0x56, 0x96, 0x67, 0x8e, 0x36, 0xb8, 0x78, 0x7c, 0xda, 0x69, 0x0c, 0x3d, - 0x85, 0xbe, 0x43, 0xb8, 0x6b, 0x45, 0x9f, 0x8f, 0x95, 0x91, 0x13, 0xa5, 0x8d, 0xdc, 0x7f, 0x0c, - 0x89, 0xc9, 0x44, 0x68, 0x96, 0xc6, 0xe4, 0x25, 0xc6, 0x65, 0x55, 0xef, 0x72, 0x9d, 0xb9, 0xbd, - 0xb0, 0x7c, 0x2f, 0xcc, 0xed, 0xbe, 0x74, 0x8a, 0xa4, 0xe7, 0x0e, 0x36, 0x7f, 0x9d, 0x76, 0x2e, - 0xcf, 0x44, 0x3c, 0x79, 0x48, 0x4b, 0x0d, 0x3a, 0xfc, 0x43, 0x90, 0xfe, 0x44, 0x78, 0xa7, 0x26, - 0x83, 0xaf, 0x29, 0xf0, 0xfa, 0xd1, 0x58, 0xb9, 0xe9, 0xeb, 0x70, 0x39, 0xde, 0x42, 0xdd, 0x0b, - 0xbb, 0x6b, 0xfd, 0x5e, 0x45, 0xe7, 0x15, 0x8a, 0x7e, 0x01, 0xa4, 0x10, 0x2b, 0xac, 0xc8, 0xab, - 0x33, 0x3d, 0x9b, 0xb6, 0xe7, 0x8d, 0x7f, 0xf6, 0x74, 0xf9, 0xce, 0x51, 0xb4, 0xff, 0xb5, 0x89, - 0x2f, 0xd9, 0xa2, 0xe4, 0x03, 0xc2, 0x2d, 0xf7, 0x3d, 0xc8, 0xcd, 0x8a, 0xe8, 0x7f, 0x1f, 0x40, - 0xbb, 0x77, 0x1e, 0xa8, 0x8b, 0x43, 0xaf, 0xbd, 0xff, 0xf2, 0xe3, 0x53, 0xb3, 0x43, 0xb6, 0x79, - 0xdd, 0x4d, 0x92, 0xcf, 0x08, 0x5f, 0xa9, 0xdc, 0x3d, 0xb9, 0x5f, 0x67, 0x58, 0x73, 0x31, 0xed, - 0x07, 0xff, 0x4f, 0xf4, 0xb9, 0xef, 0xd9, 0xdc, 0x8c, 0xdc, 0xaa, 0xc8, 0x7d, 0x54, 0x92, 0xcb, - 0x2b, 0x18, 0x3c, 0x39, 0x9e, 0x07, 0xe8, 0x64, 0x1e, 0xa0, 0xef, 0xf3, 0x00, 0x7d, 0x5c, 0x04, - 0x8d, 0x93, 0x45, 0xd0, 0xf8, 0xb6, 0x08, 0x1a, 0x2f, 0xee, 0x44, 0xca, 0x8c, 0xa7, 0xa3, 0x3c, - 0x88, 0x57, 0xbc, 0x0d, 0x07, 0x07, 0x2a, 0x54, 0x62, 0xb2, 0x74, 0x28, 0x3c, 0xcc, 0x2c, 0x95, - 0x7a, 0xd4, 0xb2, 0xff, 0xe0, 0xdd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x94, 0x2e, 0x9c, 0xb4, - 0x67, 0x04, 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) - QueryWhitelistedContracts(ctx context.Context, in *QueryWhitelistedContractsRequest, opts ...grpc.CallOption) (*QueryWhitelistedContractsResponse, 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.common.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) QueryWhitelistedContracts(ctx context.Context, in *QueryWhitelistedContractsRequest, opts ...grpc.CallOption) (*QueryWhitelistedContractsResponse, error) { - out := new(QueryWhitelistedContractsResponse) - err := c.cc.Invoke(ctx, "/comdex.common.v1beta1.Query/QueryWhitelistedContracts", 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) - QueryWhitelistedContracts(context.Context, *QueryWhitelistedContractsRequest) (*QueryWhitelistedContractsResponse, 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 (*UnimplementedQueryServer) QueryWhitelistedContracts(ctx context.Context, req *QueryWhitelistedContractsRequest) (*QueryWhitelistedContractsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryWhitelistedContracts 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.common.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) -} - -func _Query_QueryWhitelistedContracts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryWhitelistedContractsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryWhitelistedContracts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.common.v1beta1.Query/QueryWhitelistedContracts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryWhitelistedContracts(ctx, req.(*QueryWhitelistedContractsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "comdex.common.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "QueryWhitelistedContracts", - Handler: _Query_QueryWhitelistedContracts_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "comdex/common/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 (m *QueryWhitelistedContractsRequest) 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 *QueryWhitelistedContractsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryWhitelistedContractsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.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 (m *QueryWhitelistedContractsResponse) 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 *QueryWhitelistedContractsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryWhitelistedContractsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.WhilistedContracts) > 0 { - for iNdEx := len(m.WhilistedContracts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.WhilistedContracts[iNdEx].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 (m *QueryWhitelistedContractsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryWhitelistedContractsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.WhilistedContracts) > 0 { - for _, e := range m.WhilistedContracts { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.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 (m *QueryWhitelistedContractsRequest) 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: QueryWhitelistedContractsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryWhitelistedContractsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.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 (m *QueryWhitelistedContractsResponse) 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: QueryWhitelistedContractsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryWhitelistedContractsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WhilistedContracts", 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 - } - m.WhilistedContracts = append(m.WhilistedContracts, WhitelistedContract{}) - if err := m.WhilistedContracts[len(m.WhilistedContracts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.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/common/types/query.pb.gw.go b/x/common/types/query.pb.gw.go deleted file mode 100644 index 11b1e4ad8..000000000 --- a/x/common/types/query.pb.gw.go +++ /dev/null @@ -1,236 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: comdex/common/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 - -} - -var ( - filter_Query_QueryWhitelistedContracts_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_QueryWhitelistedContracts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryWhitelistedContractsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryWhitelistedContracts_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.QueryWhitelistedContracts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_QueryWhitelistedContracts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryWhitelistedContractsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryWhitelistedContracts_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.QueryWhitelistedContracts(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()...) - - }) - - mux.Handle("GET", pattern_Query_QueryWhitelistedContracts_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_QueryWhitelistedContracts_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_QueryWhitelistedContracts_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()...) - - }) - - mux.Handle("GET", pattern_Query_QueryWhitelistedContracts_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_QueryWhitelistedContracts_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_QueryWhitelistedContracts_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", "common", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_QueryWhitelistedContracts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"comdex", "common", "v1beta1", "whitelisted_contracts"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_QueryWhitelistedContracts_0 = runtime.ForwardResponseMessage -) diff --git a/x/common/types/tx.pb.go b/x/common/types/tx.pb.go deleted file mode 100644 index 5ef19fc96..000000000 --- a/x/common/types/tx.pb.go +++ /dev/null @@ -1,1428 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/common/v1beta1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type MsgRegisterContract struct { - SecurityAddress string `protobuf:"bytes,1,opt,name=security_address,json=securityAddress,proto3" json:"security_address,omitempty"` - GameName string `protobuf:"bytes,2,opt,name=game_name,json=gameName,proto3" json:"game_name,omitempty"` - ContractAddress string `protobuf:"bytes,3,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - GameType uint64 `protobuf:"varint,4,opt,name=game_type,json=gameType,proto3" json:"game_type,omitempty"` -} - -func (m *MsgRegisterContract) Reset() { *m = MsgRegisterContract{} } -func (m *MsgRegisterContract) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterContract) ProtoMessage() {} -func (*MsgRegisterContract) Descriptor() ([]byte, []int) { - return fileDescriptor_63826287044af113, []int{0} -} -func (m *MsgRegisterContract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRegisterContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRegisterContract.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 *MsgRegisterContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterContract.Merge(m, src) -} -func (m *MsgRegisterContract) XXX_Size() int { - return m.Size() -} -func (m *MsgRegisterContract) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterContract.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRegisterContract proto.InternalMessageInfo - -func (m *MsgRegisterContract) GetSecurityAddress() string { - if m != nil { - return m.SecurityAddress - } - return "" -} - -func (m *MsgRegisterContract) GetGameName() string { - if m != nil { - return m.GameName - } - return "" -} - -func (m *MsgRegisterContract) GetContractAddress() string { - if m != nil { - return m.ContractAddress - } - return "" -} - -func (m *MsgRegisterContract) GetGameType() uint64 { - if m != nil { - return m.GameType - } - return 0 -} - -type MsgRegisterContractResponse struct { -} - -func (m *MsgRegisterContractResponse) Reset() { *m = MsgRegisterContractResponse{} } -func (m *MsgRegisterContractResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterContractResponse) ProtoMessage() {} -func (*MsgRegisterContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_63826287044af113, []int{1} -} -func (m *MsgRegisterContractResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRegisterContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRegisterContractResponse.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 *MsgRegisterContractResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterContractResponse.Merge(m, src) -} -func (m *MsgRegisterContractResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRegisterContractResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterContractResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRegisterContractResponse proto.InternalMessageInfo - -type MsgDeRegisterContract struct { - SecurityAddress string `protobuf:"bytes,1,opt,name=security_address,json=securityAddress,proto3" json:"security_address,omitempty"` - GameId uint64 `protobuf:"varint,2,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"` -} - -func (m *MsgDeRegisterContract) Reset() { *m = MsgDeRegisterContract{} } -func (m *MsgDeRegisterContract) String() string { return proto.CompactTextString(m) } -func (*MsgDeRegisterContract) ProtoMessage() {} -func (*MsgDeRegisterContract) Descriptor() ([]byte, []int) { - return fileDescriptor_63826287044af113, []int{2} -} -func (m *MsgDeRegisterContract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeRegisterContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeRegisterContract.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 *MsgDeRegisterContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeRegisterContract.Merge(m, src) -} -func (m *MsgDeRegisterContract) XXX_Size() int { - return m.Size() -} -func (m *MsgDeRegisterContract) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeRegisterContract.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeRegisterContract proto.InternalMessageInfo - -func (m *MsgDeRegisterContract) GetSecurityAddress() string { - if m != nil { - return m.SecurityAddress - } - return "" -} - -func (m *MsgDeRegisterContract) GetGameId() uint64 { - if m != nil { - return m.GameId - } - return 0 -} - -type MsgDeRegisterContractResponse struct { -} - -func (m *MsgDeRegisterContractResponse) Reset() { *m = MsgDeRegisterContractResponse{} } -func (m *MsgDeRegisterContractResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDeRegisterContractResponse) ProtoMessage() {} -func (*MsgDeRegisterContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_63826287044af113, []int{3} -} -func (m *MsgDeRegisterContractResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeRegisterContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeRegisterContractResponse.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 *MsgDeRegisterContractResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeRegisterContractResponse.Merge(m, src) -} -func (m *MsgDeRegisterContractResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDeRegisterContractResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeRegisterContractResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeRegisterContractResponse proto.InternalMessageInfo - -// MsgUpdateParams is the MsgUpdateParams request type. -// -// Since: 0.47 -type MsgUpdateParams struct { - // authority is the address that controls the module (defaults to x/gov unless overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/common parameters to update. - // - // NOTE: All parameters must be supplied. - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` -} - -func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } -func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParams) ProtoMessage() {} -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_63826287044af113, []int{4} -} -func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParams.Merge(m, src) -} -func (m *MsgUpdateParams) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo - -func (m *MsgUpdateParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgUpdateParams) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: 0.47 -type MsgUpdateParamsResponse struct { -} - -func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } -func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_63826287044af113, []int{5} -} -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) -} -func (m *MsgUpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgRegisterContract)(nil), "comdex.common.v1beta1.MsgRegisterContract") - proto.RegisterType((*MsgRegisterContractResponse)(nil), "comdex.common.v1beta1.MsgRegisterContractResponse") - proto.RegisterType((*MsgDeRegisterContract)(nil), "comdex.common.v1beta1.MsgDeRegisterContract") - proto.RegisterType((*MsgDeRegisterContractResponse)(nil), "comdex.common.v1beta1.MsgDeRegisterContractResponse") - proto.RegisterType((*MsgUpdateParams)(nil), "comdex.common.v1beta1.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "comdex.common.v1beta1.MsgUpdateParamsResponse") -} - -func init() { proto.RegisterFile("comdex/common/v1beta1/tx.proto", fileDescriptor_63826287044af113) } - -var fileDescriptor_63826287044af113 = []byte{ - // 495 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0xc7, 0x9b, 0xad, 0x2a, 0xf4, 0x03, 0xb1, 0x29, 0x6c, 0x6a, 0x97, 0xa9, 0xd9, 0x94, 0x03, - 0x1a, 0x13, 0x4b, 0x68, 0x41, 0x1c, 0xe0, 0x44, 0xe1, 0x02, 0x52, 0x11, 0x0a, 0x70, 0x81, 0x43, - 0xe5, 0x26, 0xae, 0x17, 0x09, 0xc7, 0x91, 0xed, 0x4e, 0xed, 0x95, 0x27, 0xe0, 0xc4, 0x1b, 0x70, - 0xe7, 0xc0, 0x43, 0xec, 0x38, 0x71, 0x42, 0x42, 0x42, 0xa8, 0x3d, 0xf0, 0x1a, 0xc8, 0xb1, 0x93, - 0xc1, 0x96, 0x4a, 0x43, 0x3b, 0xb5, 0xfe, 0xfe, 0x7f, 0xff, 0xfe, 0x9f, 0xfd, 0xc5, 0xe0, 0x46, - 0x8c, 0xc6, 0x78, 0x1a, 0x44, 0x8c, 0x52, 0x96, 0x06, 0x47, 0xdd, 0x11, 0x96, 0xa8, 0x1b, 0xc8, - 0xa9, 0x9f, 0x71, 0x26, 0x99, 0xbd, 0xa9, 0x75, 0x5f, 0xeb, 0xbe, 0xd1, 0x9d, 0x0d, 0xc2, 0x08, - 0xcb, 0x1d, 0x81, 0xfa, 0xa7, 0xcd, 0x4e, 0x2b, 0x62, 0x82, 0x32, 0x11, 0x50, 0x41, 0x82, 0xa3, - 0xae, 0xfa, 0x31, 0xc2, 0x96, 0x16, 0x86, 0x7a, 0x87, 0x5e, 0x18, 0xc9, 0xab, 0x6e, 0x20, 0x43, - 0x1c, 0x51, 0xe3, 0xf1, 0x3e, 0x5b, 0x70, 0x73, 0x20, 0x48, 0x88, 0x49, 0x22, 0x24, 0xe6, 0x4f, - 0x58, 0x2a, 0x39, 0x8a, 0xa4, 0x7d, 0x1b, 0xd6, 0x05, 0x8e, 0x26, 0x3c, 0x91, 0xb3, 0x21, 0x8a, - 0x63, 0x8e, 0x85, 0x68, 0x5b, 0xbb, 0xd6, 0x5e, 0x33, 0x5c, 0x2b, 0xea, 0x8f, 0x75, 0xd9, 0xde, - 0x86, 0x26, 0x41, 0x14, 0x0f, 0x53, 0x44, 0x71, 0x7b, 0x25, 0xf7, 0x5c, 0x55, 0x85, 0x17, 0x88, - 0x62, 0xc5, 0x89, 0x0c, 0xb3, 0xe4, 0xac, 0x6a, 0x4e, 0x51, 0x3f, 0xcb, 0x91, 0xb3, 0x0c, 0xb7, - 0xeb, 0xbb, 0xd6, 0x5e, 0x5d, 0x73, 0x5e, 0xcf, 0x32, 0xec, 0x75, 0x60, 0xbb, 0xa2, 0xcd, 0x10, - 0x8b, 0x8c, 0xa5, 0x02, 0x7b, 0xef, 0x60, 0x73, 0x20, 0xc8, 0x53, 0x7c, 0x99, 0x73, 0xb4, 0xe0, - 0x4a, 0x9e, 0x9f, 0xc4, 0xf9, 0x29, 0xea, 0x61, 0x43, 0x2d, 0x9f, 0xc5, 0xde, 0x0e, 0x74, 0x2a, - 0xe1, 0x65, 0xfa, 0x27, 0x0b, 0xd6, 0x06, 0x82, 0xbc, 0xc9, 0x62, 0x24, 0xf1, 0xcb, 0xfc, 0x7a, - 0xed, 0x07, 0xd0, 0x44, 0x13, 0x79, 0xc8, 0x54, 0x82, 0x4e, 0xec, 0xb7, 0xbf, 0x7d, 0x3d, 0xd8, - 0x30, 0x13, 0x32, 0xa1, 0xaf, 0x24, 0x4f, 0x52, 0x12, 0x9e, 0x5a, 0xed, 0x47, 0xd0, 0xd0, 0x03, - 0xca, 0x9b, 0xb8, 0xd6, 0xeb, 0xf8, 0x95, 0x9f, 0x89, 0xaf, 0x63, 0xfa, 0xf5, 0xe3, 0x9f, 0x3b, - 0xb5, 0xd0, 0x6c, 0x79, 0x78, 0xe3, 0xc3, 0xef, 0x2f, 0xfb, 0xa7, 0x30, 0x6f, 0x0b, 0x5a, 0x67, - 0xfa, 0x2a, 0x7a, 0xee, 0xfd, 0x58, 0x81, 0xd5, 0x81, 0x20, 0x36, 0x87, 0xf5, 0x73, 0x97, 0xb6, - 0xbf, 0x24, 0xb3, 0x62, 0x02, 0x4e, 0xef, 0xe2, 0xde, 0x22, 0xdb, 0x9e, 0x82, 0x5d, 0x31, 0xaa, - 0x3b, 0xcb, 0x49, 0xe7, 0xdd, 0xce, 0xfd, 0xff, 0x71, 0x97, 0xc9, 0x63, 0xb8, 0xfe, 0xcf, 0x94, - 0x6e, 0x2d, 0xa7, 0xfc, 0xed, 0x73, 0xfc, 0x8b, 0xf9, 0x8a, 0x9c, 0xfe, 0xf3, 0xe3, 0xb9, 0x6b, - 0x9d, 0xcc, 0x5d, 0xeb, 0xd7, 0xdc, 0xb5, 0x3e, 0x2e, 0xdc, 0xda, 0xc9, 0xc2, 0xad, 0x7d, 0x5f, - 0xb8, 0xb5, 0xb7, 0x77, 0x49, 0x22, 0x0f, 0x27, 0x23, 0x05, 0x0a, 0x34, 0xf3, 0x80, 0x8d, 0xc7, - 0x49, 0x94, 0xa0, 0xf7, 0x66, 0x1d, 0x94, 0x2f, 0x56, 0xbd, 0x04, 0x31, 0x6a, 0xe4, 0x2f, 0xf5, - 0xde, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x68, 0xe9, 0xc2, 0x50, 0x04, 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 { - RegisterContract(ctx context.Context, in *MsgRegisterContract, opts ...grpc.CallOption) (*MsgRegisterContractResponse, error) - DeRegisterContract(ctx context.Context, in *MsgDeRegisterContract, opts ...grpc.CallOption) (*MsgDeRegisterContractResponse, error) - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) RegisterContract(ctx context.Context, in *MsgRegisterContract, opts ...grpc.CallOption) (*MsgRegisterContractResponse, error) { - out := new(MsgRegisterContractResponse) - err := c.cc.Invoke(ctx, "/comdex.common.v1beta1.Msg/RegisterContract", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) DeRegisterContract(ctx context.Context, in *MsgDeRegisterContract, opts ...grpc.CallOption) (*MsgDeRegisterContractResponse, error) { - out := new(MsgDeRegisterContractResponse) - err := c.cc.Invoke(ctx, "/comdex.common.v1beta1.Msg/DeRegisterContract", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/comdex.common.v1beta1.Msg/UpdateParams", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - RegisterContract(context.Context, *MsgRegisterContract) (*MsgRegisterContractResponse, error) - DeRegisterContract(context.Context, *MsgDeRegisterContract) (*MsgDeRegisterContractResponse, error) - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) RegisterContract(ctx context.Context, req *MsgRegisterContract) (*MsgRegisterContractResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterContract not implemented") -} -func (*UnimplementedMsgServer) DeRegisterContract(ctx context.Context, req *MsgDeRegisterContract) (*MsgDeRegisterContractResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeRegisterContract not implemented") -} -func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_RegisterContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRegisterContract) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RegisterContract(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.common.v1beta1.Msg/RegisterContract", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RegisterContract(ctx, req.(*MsgRegisterContract)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_DeRegisterContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeRegisterContract) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).DeRegisterContract(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.common.v1beta1.Msg/DeRegisterContract", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DeRegisterContract(ctx, req.(*MsgDeRegisterContract)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.common.v1beta1.Msg/UpdateParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "comdex.common.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "RegisterContract", - Handler: _Msg_RegisterContract_Handler, - }, - { - MethodName: "DeRegisterContract", - Handler: _Msg_DeRegisterContract_Handler, - }, - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "comdex/common/v1beta1/tx.proto", -} - -func (m *MsgRegisterContract) 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 *MsgRegisterContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRegisterContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GameType != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GameType)) - i-- - dAtA[i] = 0x20 - } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.GameName) > 0 { - i -= len(m.GameName) - copy(dAtA[i:], m.GameName) - i = encodeVarintTx(dAtA, i, uint64(len(m.GameName))) - i-- - dAtA[i] = 0x12 - } - if len(m.SecurityAddress) > 0 { - i -= len(m.SecurityAddress) - copy(dAtA[i:], m.SecurityAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.SecurityAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgRegisterContractResponse) 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 *MsgRegisterContractResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRegisterContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDeRegisterContract) 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 *MsgDeRegisterContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDeRegisterContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GameId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GameId)) - i-- - dAtA[i] = 0x10 - } - if len(m.SecurityAddress) > 0 { - i -= len(m.SecurityAddress) - copy(dAtA[i:], m.SecurityAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.SecurityAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgDeRegisterContractResponse) 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 *MsgDeRegisterContractResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDeRegisterContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParamsResponse) 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 *MsgRegisterContract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SecurityAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.GameName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.GameType != 0 { - n += 1 + sovTx(uint64(m.GameType)) - } - return n -} - -func (m *MsgRegisterContractResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDeRegisterContract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SecurityAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.GameId != 0 { - n += 1 + sovTx(uint64(m.GameId)) - } - return n -} - -func (m *MsgDeRegisterContractResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUpdateParamsResponse) 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 *MsgRegisterContract) 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: MsgRegisterContract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterContract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SecurityAddress", 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.SecurityAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GameName", 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.GameName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", 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.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GameType", wireType) - } - m.GameType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GameType |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *MsgRegisterContractResponse) 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: MsgRegisterContractResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterContractResponse: 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 *MsgDeRegisterContract) 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: MsgDeRegisterContract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeRegisterContract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SecurityAddress", 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.SecurityAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GameId", wireType) - } - m.GameId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GameId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *MsgDeRegisterContractResponse) 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: MsgDeRegisterContractResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeRegisterContractResponse: 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 *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: 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/common/types/types.go b/x/common/types/types.go deleted file mode 100644 index f5f4387ae..000000000 --- a/x/common/types/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package types - -var ( - ResolveSinglePlayer = []byte(`{"resolve_bet":{}}`) - SetupMultiPlayer = []byte(`{"setup_multiplayer":{}}`) - ResolveMultiPlayer = []byte(`{"resolve_multiplayer":{}}`) -) diff --git a/x/gasless/abci.go b/x/gasless/abci.go deleted file mode 100644 index e690a8963..000000000 --- a/x/gasless/abci.go +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100644 index 80c4758d2..000000000 --- a/x/gasless/client/cli/flags.go +++ /dev/null @@ -1,23 +0,0 @@ -package cli - -// DONTCOVER - -import ( - "strings" -) - -func ParseStringSliceFromString(s string, separator string) ([]string, error) { - if s == "" { - return []string{}, nil - } - - 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 deleted file mode 100644 index 20c3dfcf0..000000000 --- a/x/gasless/client/cli/query.go +++ /dev/null @@ -1,422 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - "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" - sdk "github.com/cosmos/cosmos-sdk/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(), - NewQueryMessagesAndContractsCmd(), - NewQueryGasTankCmd(), - NewQueryGasTanksCmd(), - NewQueryGasTanksByProviderCmd(), - NewQueryGasConsumerCmd(), - NewQueryGasConsumersCmd(), - NewQueryGasConsumersByGasTankIDCmd(), - NewQueryTxGtidsCmd(), - ) - - 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 -} - -// NewQueryMessagesAndContractsCmd implements the messages and contracts query command. -func NewQueryMessagesAndContractsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "mac", - Args: cobra.NoArgs, - Short: "Query all the available messages and contract addresses", - Long: strings.TrimSpace( - fmt.Sprintf(`Query all the available messages and contract addresses. -Example: -$ %s query %s mac -`, - 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.MessagesAndContracts( - cmd.Context(), - &types.QueryMessagesAndContractsRequest{}, - ) - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func NewQueryGasTankCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "gastank [gas-tank-id]", - Args: cobra.MinimumNArgs(1), - Short: "Query details of the gas tank", - Long: strings.TrimSpace( - fmt.Sprintf(`Query details of the gas tank -Example: -$ %s query %s gastank 1 -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gasTankID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("parse gas_tank_id: %w", err) - } - - queryClient := types.NewQueryClient(clientCtx) - resp, err := queryClient.GasTank( - cmd.Context(), - &types.QueryGasTankRequest{ - GasTankId: gasTankID, - }, - ) - - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func NewQueryGasTanksCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "gastanks ", - Args: cobra.NoArgs, - Short: "Query details of all the gas tanks", - Long: strings.TrimSpace( - fmt.Sprintf(`Query details of all the gas tanks -Example: -$ %s query %s gastanks -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - resp, err := queryClient.GasTanks( - cmd.Context(), - &types.QueryGasTanksRequest{ - Pagination: pageReq, - }, - ) - - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func NewQueryGasTanksByProviderCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "gas-tanks-by-provider [provider]", - Args: cobra.MinimumNArgs(1), - Short: "Query details of all the gas tanks for the given provider", - Long: strings.TrimSpace( - fmt.Sprintf(`Query details of all the gas tanks for the given provider -Example: -$ %s query %s gas-tanks-by-provider comdex1y755txyzr5n5yy956ydkjttmj8jhwdljawwve8 -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - sanitizedProvider, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - resp, err := queryClient.GasTanksByProvider( - cmd.Context(), - &types.QueryGasTanksByProviderRequest{ - Provider: sanitizedProvider.String(), - }, - ) - - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func NewQueryGasConsumerCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "gasconsumer [consumer]", - Args: cobra.MinimumNArgs(1), - Short: "Query details of the gas consumer", - Long: strings.TrimSpace( - fmt.Sprintf(`Query details of the gas consumer -Example: -$ %s query %s gasconsumer comdex1y755txyzr5n5yy956ydkjttmj8jhwdljawwve8 -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - sanitizedConsumer, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - resp, err := queryClient.GasConsumer( - cmd.Context(), - &types.QueryGasConsumerRequest{ - Consumer: sanitizedConsumer.String(), - }, - ) - - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func NewQueryGasConsumersCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "gasconsumers", - Args: cobra.NoArgs, - Short: "Query details of all the gas consumers", - Long: strings.TrimSpace( - fmt.Sprintf(`Query details of all the gas consumers -Example: -$ %s query %s gasconsumers -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - resp, err := queryClient.GasConsumers( - cmd.Context(), - &types.QueryGasConsumersRequest{ - Pagination: pageReq, - }, - ) - - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func NewQueryGasConsumersByGasTankIDCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "gas-consumers-by-tank-id [gas-tank-id]", - Args: cobra.MinimumNArgs(1), - Short: "Query all gas consumers for given gas tank id", - Long: strings.TrimSpace( - fmt.Sprintf(`Query all gas consumers for given gas tank id -Example: -$ %s query %s gas-consumers-by-tank-id 1 -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gasTankID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("parse gas_tank_id: %w", err) - } - - queryClient := types.NewQueryClient(clientCtx) - resp, err := queryClient.GasConsumersByGasTankID( - cmd.Context(), - &types.QueryGasConsumersByGasTankIDRequest{ - GasTankId: gasTankID, - }, - ) - - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// NewQueryTxGtidsCmd implements the tx-gtids query command. -func NewQueryTxGtidsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "tx-gtids", - Args: cobra.NoArgs, - Short: "Query all the tx type url and contract address along with associcated gas tank ids", - Long: strings.TrimSpace( - fmt.Sprintf(`Query all the tx type url and contract address along with associcated gas tank ids -Example: -$ %s query %s tx-gtids -`, - 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.GasTankIdsForAllTXC(cmd.Context(), &types.QueryGasTankIdsForAllTXC{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gasless/client/cli/tx.go b/x/gasless/client/cli/tx.go deleted file mode 100644 index 0e5886f9f..000000000 --- a/x/gasless/client/cli/tx.go +++ /dev/null @@ -1,444 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - "strings" - - "github.com/spf13/cobra" - - "github.com/comdex-official/comdex/x/gasless/types" - "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" - "github.com/cosmos/cosmos-sdk/version" -) - -// 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( - NewCreateGasTankCmd(), - NewAuthorizeActorsCmd(), - NewUpdateGasTankStatusCmd(), - NewUpdateGasTankConfigsCmd(), - NewBlockConsumerCmd(), - NewUnblockConsumerCmd(), - NewUpdateGasConsumerLimitCmd(), - ) - - return cmd -} - -func NewCreateGasTankCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-gas-tank [fee-denom] [max-fee-usage-per-tx] [max-txs-count-per-consumer] [max-fee-usage-per-consumer] [txs-allowed] [contracts-allowed] [gas-deposit]", - Args: cobra.ExactArgs(7), - Short: "Create a gas tank", - Long: strings.TrimSpace( - fmt.Sprintf(`Create a gas tank. -Example: -$ %s tx %s create-gas-tank ucmdx 25000 200 5000000 /comdex.liquidity.v1beta1.MsgLimitOrder,/comdex.liquidity.v1beta1.MsgMarketOrder comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3,comdex1zh9gzcw3j5jd53ulfjx9lj4088plur7xy3jayndwr7jxrdqhg7jqqsfqzx 10000000000ucmdx --from mykey -$ %s tx %s create-gas-tank ucmdx 25000 200 5000000 /comdex.liquidity.v1beta1.MsgLimitOrder comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3 10000000000ucmdx --from mykey -$ %s tx %s create-gas-tank ucmdx 25000 200 5000000 /comdex.liquidity.v1beta1.MsgLimitOrder "" 10000000000ucmdx --from mykey -`, - version.AppName, types.ModuleName, - version.AppName, types.ModuleName, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - feeDenom := args[0] - if err := sdk.ValidateDenom(feeDenom); err != nil { - return fmt.Errorf("invalid fee denom: %w", err) - } - - maxFeeUsagePerTx, ok := sdk.NewIntFromString(args[1]) - if !ok { - return fmt.Errorf("invalid max-fee-usage-per-tx: %s", args[1]) - } - - maxTxsCountPerConsumer, err := strconv.ParseUint(args[2], 10, 64) - if err != nil { - return fmt.Errorf("parse max-txs-count-per-consumer: %w", err) - } - - maxFeeUsagePerConsumer, ok := sdk.NewIntFromString(args[3]) - if !ok { - return fmt.Errorf("invalid max-fee-usage-per-consumer: %s", args[3]) - } - - txsAllowed, err := ParseStringSliceFromString(args[4], ",") - if err != nil { - return err - } - - contractsAllowed, err := ParseStringSliceFromString(args[5], ",") - if err != nil { - return err - } - - gasDeposit, err := sdk.ParseCoinNormalized(args[6]) - if err != nil { - return fmt.Errorf("invalid gas-deposit: %w", err) - } - - msg := types.NewMsgCreateGasTank( - clientCtx.GetFromAddress(), - feeDenom, - maxFeeUsagePerTx, - maxTxsCountPerConsumer, - maxFeeUsagePerConsumer, - txsAllowed, - contractsAllowed, - gasDeposit, - ) - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewAuthorizeActorsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-authorized-actors [gas-tank-id] [actors]", - Args: cobra.ExactArgs(2), - Short: "Update authorized actors of the gas tank", - Long: strings.TrimSpace( - fmt.Sprintf(`Update authorized actors of the gas tank. -Example: -$ %s tx %s update-authorized-actors 1 comdex1...,comdex2... --from mykey -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gasTankID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("parse gas-tank-id: %w", err) - } - - actors, err := ParseStringSliceFromString(args[1], ",") - if err != nil { - return err - } - - sanitizedActors := []sdk.AccAddress{} - for _, actor := range actors { - sanitizedActor, err := sdk.AccAddressFromBech32(actor) - if err != nil { - return err - } - sanitizedActors = append(sanitizedActors, sanitizedActor) - } - - msg := types.NewMsgAuthorizeActors( - gasTankID, - clientCtx.GetFromAddress(), - sanitizedActors, - ) - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewUpdateGasTankStatusCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-gas-tank-status [gas-tank-id]", - Args: cobra.ExactArgs(1), - Short: "Update status of the gas tank", - Long: strings.TrimSpace( - fmt.Sprintf(`Update status of the gas tank. -Example: -$ %s tx %s update-gas-tank-status 32 --from mykey -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gasTankID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("parse gas-tank-id: %w", err) - } - - msg := types.NewMsgUpdateGasTankStatus( - gasTankID, - clientCtx.GetFromAddress(), - ) - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewUpdateGasTankConfigsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-gas-tank-config [gas-tank-id] [max-fee-usage-per-tx] [max-txs-count-per-consumer] [max-fee-usage-per-consumer] [txs-allowed] [contracts-allowed]", - Args: cobra.ExactArgs(6), - Short: "Update configs of the gas tank", - Long: strings.TrimSpace( - fmt.Sprintf(`Update configs of the gas tank. -Example: -$ %s tx %s update-gas-tank-config 1 25000 200 5000000 /comdex.liquidity.v1beta1.MsgLimitOrder,/comdex.liquidity.v1beta1.MsgMarketOrder comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3,comdex1zh9gzcw3j5jd53ulfjx9lj4088plur7xy3jayndwr7jxrdqhg7jqqsfqzx --from mykey -$ %s tx %s update-gas-tank-config 1 25000 200 5000000 /comdex.liquidity.v1beta1.MsgLimitOrder comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3 --from mykey -$ %s tx %s update-gas-tank-config 1 25000 200 5000000 /comdex.liquidity.v1beta1.MsgLimitOrder "" --from mykey -`, - version.AppName, types.ModuleName, - version.AppName, types.ModuleName, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gasTankID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("parse gas-tank-id: %w", err) - } - - maxFeeUsagePerTx, ok := sdk.NewIntFromString(args[1]) - if !ok { - return fmt.Errorf("invalid max-fee-usage-per-tx: %s", args[1]) - } - - maxTxsCountPerConsumer, err := strconv.ParseUint(args[2], 10, 64) - if err != nil { - return fmt.Errorf("parse max-txs-count-per-consumer: %w", err) - } - - maxFeeUsagePerConsumer, ok := sdk.NewIntFromString(args[3]) - if !ok { - return fmt.Errorf("invalid max-fee-usage-per-consumer: %s", args[3]) - } - - txsAllowed, err := ParseStringSliceFromString(args[4], ",") - if err != nil { - return err - } - - contractsAllowed, err := ParseStringSliceFromString(args[5], ",") - if err != nil { - return err - } - - msg := types.NewMsgUpdateGasTankConfig( - gasTankID, - clientCtx.GetFromAddress(), - maxFeeUsagePerTx, - maxTxsCountPerConsumer, - maxFeeUsagePerConsumer, - txsAllowed, - contractsAllowed, - ) - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewBlockConsumerCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "block-consumer [gas-tank-id] [consumer]", - Args: cobra.ExactArgs(2), - Short: "Block consumer", - Long: strings.TrimSpace( - fmt.Sprintf(`Block consumer. -Example: -$ %s tx %s block-consumer 1 comdex1.. --from mykey -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gasTankID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("parse gas-tank-id: %w", err) - } - - sanitizedConsumer, err := sdk.AccAddressFromBech32(args[1]) - if err != nil { - return err - } - - msg := types.NewMsgBlockConsumer( - gasTankID, - clientCtx.GetFromAddress(), - sanitizedConsumer, - ) - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewUnblockConsumerCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "unblock-consumer [gas-tank-id] [consumer]", - Args: cobra.ExactArgs(2), - Short: "Unblock consumer", - Long: strings.TrimSpace( - fmt.Sprintf(`Unblock consumer. -Example: -$ %s tx %s unblock-consumer 1 comdex1.. --from mykey -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gasTankID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("parse gas-tank-id: %w", err) - } - - sanitizedConsumer, err := sdk.AccAddressFromBech32(args[1]) - if err != nil { - return err - } - - msg := types.NewMsgUnblockConsumer( - gasTankID, - clientCtx.GetFromAddress(), - sanitizedConsumer, - ) - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewUpdateGasConsumerLimitCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-consumer-limit [gas-tank-id] [consumer] [total-txs-allowed] [total-fee-consumption-allowed]", - Args: cobra.ExactArgs(4), - Short: "Update consumer consumption limit", - Long: strings.TrimSpace( - fmt.Sprintf(`Update consumer consumption limit. -Example: -$ %s tx %s update-consumer-limit 1 comdex1.. 200 5000000 --from mykey -`, - version.AppName, types.ModuleName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gasTankID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("parse gas-tank-id: %w", err) - } - - sanitizedConsumer, err := sdk.AccAddressFromBech32(args[1]) - if err != nil { - return err - } - - totalTxsAllowed, err := strconv.ParseUint(args[2], 10, 64) - if err != nil { - return fmt.Errorf("parse total-txs-allowed: %w", err) - } - - totalFeeConsumptionAllowed, ok := sdk.NewIntFromString(args[3]) - if !ok { - return fmt.Errorf("invalid total-fee-consumption-allowed: %s", args[3]) - } - - msg := types.NewMsgUpdateGasConsumerLimit( - gasTankID, - clientCtx.GetFromAddress(), - sanitizedConsumer, - totalTxsAllowed, - totalFeeConsumptionAllowed, - ) - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gasless/client/proposal_handler.go b/x/gasless/client/proposal_handler.go deleted file mode 100644 index e5bcf7ab1..000000000 --- a/x/gasless/client/proposal_handler.go +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index ce304187f..000000000 --- a/x/gasless/expected/keeper.go +++ /dev/null @@ -1,21 +0,0 @@ -package expected - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/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 - 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 -} diff --git a/x/gasless/fee.go b/x/gasless/fee.go deleted file mode 100644 index 0dfe1048c..000000000 --- a/x/gasless/fee.go +++ /dev/null @@ -1,224 +0,0 @@ -package gasless - -import ( - "fmt" - "math" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - gaslesskeeper "github.com/comdex-official/comdex/x/gasless/keeper" - sdk "github.com/cosmos/cosmos-sdk/types" - errortypes "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// BankKeeper defines the contract needed for supply related APIs (noalias) -type BankKeeper interface { - IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error - SendCoins(ctx sdk.Context, from, to sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error -} - -// DeductFeeDecorator deducts fees from the fee payer. The fee payer is the fee granter (if specified) or first signer of the tx. -// If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error. -// Call next AnteHandler if fees successfully deducted. -// CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator -type DeductFeeDecorator struct { - accountKeeper ante.AccountKeeper - bankKeeper BankKeeper - feegrantKeeper ante.FeegrantKeeper - txFeeChecker ante.TxFeeChecker - gaslessKeeper gaslesskeeper.Keeper -} - -func NewDeductFeeDecorator( - ak ante.AccountKeeper, - bk BankKeeper, - fk ante.FeegrantKeeper, - tfc ante.TxFeeChecker, - glk gaslesskeeper.Keeper, -) DeductFeeDecorator { - if tfc == nil { - tfc = checkTxFeeWithValidatorMinGasPrices - } - - return DeductFeeDecorator{ - accountKeeper: ak, - bankKeeper: bk, - feegrantKeeper: fk, - txFeeChecker: tfc, - gaslessKeeper: glk, - } -} - -func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { - feeTx, ok := tx.(sdk.FeeTx) - if !ok { - return ctx, sdkerrors.Wrap(errortypes.ErrTxDecode, "Tx must be a FeeTx") - } - - if !simulate && ctx.BlockHeight() > 0 && feeTx.GetGas() == 0 { - return ctx, sdkerrors.Wrap(errortypes.ErrInvalidGasLimit, "must provide positive gas") - } - - var ( - priority int64 - err error - ) - - fee := feeTx.GetFee() - if !simulate { - fee, priority, err = dfd.txFeeChecker(ctx, tx) - if err != nil { - return ctx, err - } - } - if err := dfd.checkDeductFee(ctx, tx, fee); err != nil { - return ctx, err - } - - newCtx := ctx.WithPriority(priority) - - return next(newCtx, tx, simulate) -} - -func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee sdk.Coins) error { - feeTx, ok := sdkTx.(sdk.FeeTx) - if !ok { - return sdkerrors.Wrap(errortypes.ErrTxDecode, "Tx must be a FeeTx") - } - - if addr := dfd.accountKeeper.GetModuleAddress(types.FeeCollectorName); addr == nil { - return fmt.Errorf("fee collector module account (%s) has not been set", types.FeeCollectorName) - } - - feePayer := feeTx.FeePayer() - feeGranter := feeTx.FeeGranter() - deductFeesFrom := feePayer - - // if feegranter set deduct fee from feegranter account. - // this works with only when feegrant enabled. - if feeGranter != nil { - if dfd.feegrantKeeper == nil { - return errortypes.ErrInvalidRequest.Wrap("fee grants are not enabled") - } else if !feeGranter.Equals(feePayer) { - err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, fee, sdkTx.GetMsgs()) - if err != nil { - return sdkerrors.Wrapf(err, "%s does not allow to pay fees for %s", feeGranter, feePayer) - } - } - - deductFeesFrom = feeGranter - } else { - deductFeesFrom = dfd.gaslessKeeper.GetFeeSource(ctx, sdkTx, feePayer, fee) - } - - deductFeesFromAcc := dfd.accountKeeper.GetAccount(ctx, deductFeesFrom) - if deductFeesFromAcc == nil { - return errortypes.ErrUnknownAddress.Wrapf("fee payer address: %s does not exist", deductFeesFrom) - } - - // deduct the fees - if !fee.IsZero() { - err := DeductFees(dfd.bankKeeper, ctx, deductFeesFromAcc, fee, dfd.gaslessKeeper.GetParams(ctx).FeeBurningPercentage) - if err != nil { - return err - } - } - - events := sdk.Events{ - sdk.NewEvent( - sdk.EventTypeTx, - sdk.NewAttribute(sdk.AttributeKeyFee, fee.String()), - sdk.NewAttribute(sdk.AttributeKeyFeePayer, deductFeesFrom.String()), - ), - } - ctx.EventManager().EmitEvents(events) - - return nil -} - -// DeductFees deducts fees from the given account. -func DeductFees(bankKeeper BankKeeper, ctx sdk.Context, acc types.AccountI, fees sdk.Coins, fbp sdkmath.Int) error { - if !fees.IsValid() { - return sdkerrors.Wrapf(errortypes.ErrInsufficientFee, "invalid fee amount: %s", fees) - } - - // Calculate burning amounts by given percentage and fee amounts - burningFees := sdk.Coins{} - for _, fee := range fees { - burningAmount := fee.Amount.Mul(fbp).Quo(sdk.NewInt(100)) - burningFees = burningFees.Add(sdk.NewCoin(fee.Denom, burningAmount)) - } - - err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), types.FeeCollectorName, fees) - if err != nil { - return sdkerrors.Wrapf(errortypes.ErrInsufficientFunds, err.Error()) - } - - err = bankKeeper.BurnCoins(ctx, types.FeeCollectorName, burningFees) - if err != nil { - return sdkerrors.Wrapf(errortypes.ErrInsufficientFunds, err.Error()) - } - - return nil -} - -// checkTxFeeWithValidatorMinGasPrices implements the default fee logic, where the minimum price per -// unit of gas is fixed and set by each validator, can the tx priority is computed from the gas price. -func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) { - feeTx, ok := tx.(sdk.FeeTx) - if !ok { - return nil, 0, sdkerrors.Wrap(errortypes.ErrTxDecode, "Tx must be a FeeTx") - } - - feeCoins := feeTx.GetFee() - gas := feeTx.GetGas() - - // Ensure that the provided fees meet a minimum threshold for the validator, - // if this is a CheckTx. This is only for local mempool purposes, and thus - // is only ran on check tx. - if ctx.IsCheckTx() { - minGasPrices := ctx.MinGasPrices() - if !minGasPrices.IsZero() { - requiredFees := make(sdk.Coins, len(minGasPrices)) - - // Determine the required fees by multiplying each required minimum gas - // price by the gas limit, where fee = ceil(minGasPrice * gasLimit). - glDec := sdkmath.LegacyNewDec(int64(gas)) - for i, gp := range minGasPrices { - fee := gp.Amount.Mul(glDec) - requiredFees[i] = sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt()) - } - - if !feeCoins.IsAnyGTE(requiredFees) { - return nil, 0, sdkerrors.Wrapf(errortypes.ErrInsufficientFee, "insufficient fees; got: %s required: %s", feeCoins, requiredFees) - } - } - } - - priority := getTxPriority(feeCoins, int64(gas)) - return feeCoins, priority, nil -} - -// getTxPriority returns a naive tx priority based on the amount of the smallest denomination of the gas price -// provided in a transaction. -// NOTE: This implementation should be used with a great consideration as it opens potential attack vectors -// where txs with multiple coins could not be prioritize as expected. -func getTxPriority(fee sdk.Coins, gas int64) int64 { - var priority int64 - for _, c := range fee { - p := int64(math.MaxInt64) - gasPrice := c.Amount.QuoRaw(gas) - if gasPrice.IsInt64() { - p = gasPrice.Int64() - } - if priority == 0 || p < priority { - priority = p - } - } - - return priority -} diff --git a/x/gasless/genesis.go b/x/gasless/genesis.go deleted file mode 100644 index b5940abb9..000000000 --- a/x/gasless/genesis.go +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index f6d40b894..000000000 --- a/x/gasless/handler.go +++ /dev/null @@ -1,52 +0,0 @@ -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) { - case *types.MsgCreateGasTank: - res, err := msgServer.CreateGasTank(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgAuthorizeActors: - res, err := msgServer.AuthorizeActors(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgUpdateGasTankStatus: - res, err := msgServer.UpdateGasTankStatus(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgUpdateGasTankConfig: - res, err := msgServer.UpdateGasTankConfigs(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgBlockConsumer: - res, err := msgServer.BlockConsumer(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgUnblockConsumer: - res, err := msgServer.UnblockConsumer(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - 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/fee_helper.go b/x/gasless/keeper/fee_helper.go deleted file mode 100644 index 4e8e1a605..000000000 --- a/x/gasless/keeper/fee_helper.go +++ /dev/null @@ -1,238 +0,0 @@ -package keeper - -import ( - "strconv" - "strings" - - sdkerrors "cosmossdk.io/errors" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - "github.com/comdex-official/comdex/x/gasless/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k Keeper) EmitFeeConsumptionEvent( - ctx sdk.Context, - feeSource sdk.AccAddress, - failedGasTankIDs []uint64, - failedGasTankErrors []error, - succeededGtid uint64, -) { - failedGasTankIDsStr := []string{} - for _, id := range failedGasTankIDs { - failedGasTankIDsStr = append(failedGasTankIDsStr, strconv.FormatUint(id, 10)) - } - failedGasTankErrorMessages := []string{} - for _, err := range failedGasTankErrors { - failedGasTankErrorMessages = append(failedGasTankErrorMessages, err.Error()) - } - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeFeeConsumption, - sdk.NewAttribute(types.AttributeKeyFeeSource, feeSource.String()), - sdk.NewAttribute(types.AttributeKeyFailedGasTankIDs, strings.Join(failedGasTankIDsStr, ",")), - sdk.NewAttribute(types.AttributeKeyFailedGasTankErrors, strings.Join(failedGasTankErrorMessages, ",")), - sdk.NewAttribute(types.AttributeKeySucceededGtid, strconv.FormatUint(succeededGtid, 10)), - ), - }) -} - -func (k Keeper) CanGasTankBeUsedAsSource(ctx sdk.Context, gtid uint64, consumer types.GasConsumer, fee sdk.Coin) (gasTank types.GasTank, isValid bool, err error) { - gasTank, found := k.GetGasTank(ctx, gtid) - // there is no gas tank with given id, likely impossible to happen - // exists only as aditional check. - if !found { - return gasTank, false, sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "gas tank not found") - } - - // gas tank is not active and cannot be used as fee source - if !gasTank.IsActive { - return gasTank, false, sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "gas tank not active") - } - - // fee denom does not match between gas tank and asked fee - if fee.Denom != gasTank.FeeDenom { - return gasTank, false, sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "denom mismatch between tank and asked fee") - } - - // asked fee amount is more than the allowed fee usage for tx. - if fee.Amount.GT(gasTank.MaxFeeUsagePerTx) { - return gasTank, false, sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "fee amount more than allowed limit") - } - - // insufficient reserve in the gas tank to fulfill the transaction fee - gasTankReserveBalance := k.bankKeeper.GetBalance(ctx, gasTank.GetGasTankReserveAddress(), gasTank.FeeDenom) - if gasTankReserveBalance.IsLT(fee) { - return gasTank, false, sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "funds insufficient in gas reserve tank") - } - - found = false - consumptionIndex := 0 - for index, consumption := range consumer.Consumptions { - if consumption.GasTankId == gasTank.Id { - consumptionIndex = index - found = true - } - } - // no need to check the consumption usage since there is no key available with given gas tank id - // i.e the consumer has never used this gas reserve before and the first time visitor for the given gas tank - if !found { - return gasTank, true, nil - } - - consumptionDetails := consumer.Consumptions[consumptionIndex] - - // consumer is blocked by the gas tank - if consumptionDetails.IsBlocked { - return gasTank, false, sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "blocked by gas tank") - } - - // consumer exhausted the transaction count limit, hence not eligible with given gas tank - if consumptionDetails.TotalTxsMade >= consumptionDetails.TotalTxsAllowed { - return gasTank, false, sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "exhausted tx limit") - } - - // if total fees consumed by the consumer is more than or equal to the allowed consumption - // i.e consumer has exhausted its fee limit and hence is not eligible for the given tank - totalFeeConsumption := consumptionDetails.TotalFeesConsumed.Add(fee.Amount) - if totalFeeConsumption.GTE(consumptionDetails.TotalFeeConsumptionAllowed) { - return gasTank, false, sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "exhausted total fee usage or pending fee limit insufficient for tx") - } - - return gasTank, true, nil -} - -func (k Keeper) GetFeeSource(ctx sdk.Context, sdkTx sdk.Tx, originalFeePayer sdk.AccAddress, fees sdk.Coins) sdk.AccAddress { - if len(sdkTx.GetMsgs()) > 1 { - k.EmitFeeConsumptionEvent(ctx, originalFeePayer, []uint64{}, []error{sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "multiple messages")}, 0) - return originalFeePayer - } - - // only one fee coin is supported, tx containing multiple coins as fees are not allowed. - if len(fees) != 1 { - k.EmitFeeConsumptionEvent(ctx, originalFeePayer, []uint64{}, []error{sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "asked fee != 1")}, 0) - return originalFeePayer - } - - fee := fees[0] - - msg := sdkTx.GetMsgs()[0] - msgTypeURL := sdk.MsgTypeURL(msg) - - isContract := false - var contractAddress string - - executeContractMessage, ok := msg.(*wasmtypes.MsgExecuteContract) - if ok { - isContract = true - contractAddress = executeContractMessage.GetContract() - } - - txIdentifier := msgTypeURL - if isContract { - txIdentifier = contractAddress - } - - // check if there are any gas tansk for given txIdentifier i.e msgTypeURL or Contract address - // if there is no gas tank for the given identifier, fee source will be original feePayer - txGtids, found := k.GetTxGTIDs(ctx, txIdentifier) - if !found { - k.EmitFeeConsumptionEvent(ctx, originalFeePayer, []uint64{}, []error{sdkerrors.Wrapf(types.ErrorFeeConsumptionFailure, "no gas tanks found")}, 0) - return originalFeePayer - } - - tempConsumer, found := k.GetGasConsumer(ctx, originalFeePayer) - if !found { - tempConsumer = types.NewGasConsumer(originalFeePayer) - } - - failedGtids := []uint64{} - failedGtidErrors := []error{} - gasTank := types.GasTank{} - isValid := false - var err error - gasTankIds := txGtids.GasTankIds - for _, gtid := range gasTankIds { - gasTank, isValid, err = k.CanGasTankBeUsedAsSource(ctx, gtid, tempConsumer, fee) - if isValid { - break - } - failedGtidErrors = append(failedGtidErrors, err) - failedGtids = append(failedGtids, gtid) - } - - if !isValid { - k.EmitFeeConsumptionEvent(ctx, originalFeePayer, failedGtids, failedGtidErrors, 0) - return originalFeePayer - } - - // update the consumption and usage details of the consumer - gasConsumer, consumptionIndex := k.GetOrCreateGasConsumer(ctx, originalFeePayer, gasTank) - gasConsumer.Consumptions[consumptionIndex].TotalTxsMade = gasConsumer.Consumptions[consumptionIndex].TotalTxsMade + 1 - gasConsumer.Consumptions[consumptionIndex].TotalFeesConsumed = gasConsumer.Consumptions[consumptionIndex].TotalFeesConsumed.Add(fee.Amount) - - usage := gasConsumer.Consumptions[consumptionIndex].Usage - if isContract { - found := false - contractUsageIdentifierIndex := 0 - - for index, contractUsage := range usage.Contracts { - if contractUsage.UsageIdentifier == contractAddress { - found = true - contractUsageIdentifierIndex = index - break - } - } - - usageDetail := types.UsageDetail{ - Timestamp: ctx.BlockTime(), - GasConsumed: fee.Amount, - } - - if !found { - usage.Contracts = append(usage.Contracts, &types.UsageDetails{ - UsageIdentifier: contractAddress, - Details: []*types.UsageDetail{&usageDetail}, - }) - } else { - usage.Contracts[contractUsageIdentifierIndex].Details = append(usage.Contracts[contractUsageIdentifierIndex].Details, &usageDetail) - } - } else { - found := false - messageTypeURLUsageIdentifierIndex := 0 - - for index, txType := range usage.Txs { - if txType.UsageIdentifier == msgTypeURL { - found = true - messageTypeURLUsageIdentifierIndex = index - break - } - } - - usageDetail := types.UsageDetail{ - Timestamp: ctx.BlockTime(), - GasConsumed: fee.Amount, - } - - if !found { - usage.Txs = append(usage.Txs, &types.UsageDetails{ - UsageIdentifier: msgTypeURL, - Details: []*types.UsageDetail{&usageDetail}, - }) - } else { - usage.Txs[messageTypeURLUsageIdentifierIndex].Details = append(usage.Txs[messageTypeURLUsageIdentifierIndex].Details, &usageDetail) - } - } - // assign the updated usage and set it to the store - gasConsumer.Consumptions[consumptionIndex].Usage = usage - k.SetGasConsumer(ctx, gasConsumer) - - // shift the used gas tank at the end of all tanks, so that a different gas tank can be picked - // in next cycle if there exists any. - txGtids.GasTankIds = types.ShiftToEndUint64(txGtids.GasTankIds, gasTank.Id) - k.SetTxGTIDs(ctx, txGtids) - - feeSource := gasTank.GetGasTankReserveAddress() - k.EmitFeeConsumptionEvent(ctx, feeSource, failedGtids, failedGtidErrors, gasTank.Id) - - return feeSource -} diff --git a/x/gasless/keeper/gasless.go b/x/gasless/keeper/gasless.go deleted file mode 100644 index 257f3491b..000000000 --- a/x/gasless/keeper/gasless.go +++ /dev/null @@ -1,512 +0,0 @@ -package keeper - -import ( - "strconv" - "strings" - - sdkerrors "cosmossdk.io/errors" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - "github.com/comdex-official/comdex/x/gasless/types" - sdk "github.com/cosmos/cosmos-sdk/types" - errors "github.com/cosmos/cosmos-sdk/types/errors" -) - -func (k Keeper) GetAvailableMessages(_ sdk.Context) []string { - return k.interfaceRegistry.ListImplementations("cosmos.base.v1beta1.Msg") -} - -func (k Keeper) GetAllContractInfos(ctx sdk.Context) (contractInfos []wasmtypes.ContractInfo) { - contractInfos = []wasmtypes.ContractInfo{} - k.wasmKeeper.IterateContractInfo(ctx, func(aa sdk.AccAddress, ci wasmtypes.ContractInfo) bool { - contractInfos = append(contractInfos, ci) - return false - }) - return contractInfos -} - -func (k Keeper) GetAllContractsByCode(ctx sdk.Context, codeID uint64) (contracts []string) { - contracts = []string{} - k.wasmKeeper.IterateContractsByCode(ctx, codeID, func(address sdk.AccAddress) bool { - contracts = append(contracts, address.String()) - return false - }) - return contracts -} - -func (k Keeper) GetAllAvailableContracts(ctx sdk.Context) (contractsDetails []types.ContractDetails) { - contractsDetails = []types.ContractDetails{} - contractInfos := k.GetAllContractInfos(ctx) - for _, ci := range contractInfos { - contracts := k.GetAllContractsByCode(ctx, ci.CodeID) - for _, c := range contracts { - contractsDetails = append(contractsDetails, types.ContractDetails{ - CodeId: ci.CodeID, - Address: c, - Lable: ci.Label, - }) - } - } - return contractsDetails -} - -func (k Keeper) ValidateMsgCreateGasTank(ctx sdk.Context, msg *types.MsgCreateGasTank) error { - params := k.GetParams(ctx) - allGasTanks := k.GetAllGasTanks(ctx) - gasTanks := uint64(0) - for _, gt := range allGasTanks { - if gt.Provider == msg.Provider { - gasTanks++ - } - } - if gasTanks >= params.TankCreationLimit { - return sdkerrors.Wrapf(types.ErrorMaxLimitReachedByProvider, " %d gas tanks already created by the provider", params.TankCreationLimit) - } - - if msg.FeeDenom != msg.GasDeposit.Denom { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, " fee denom %s do not match gas depoit denom %s ", msg.FeeDenom, msg.GasDeposit.Denom) - } - - if msg.MaxTxsCountPerConsumer == 0 { - return sdkerrors.Wrap(types.ErrorInvalidrequest, "max tx count per consumer must not be 0") - } - - if !msg.MaxFeeUsagePerTx.IsPositive() { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "max_fee_usage_per_tx should be positive") - } - if !msg.MaxFeeUsagePerConsumer.IsPositive() { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "max_fee_usage_per_consumer should be positive") - } - - if len(msg.TxsAllowed) == 0 && len(msg.ContractsAllowed) == 0 { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "request should have atleast one tx path or contract address") - } - - if len(msg.TxsAllowed) > 0 { - allAvailableMessages := k.GetAvailableMessages(ctx) - for _, message := range msg.TxsAllowed { - if !types.ItemExists(allAvailableMessages, message) { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "invalid message - %s", message) - } - } - } - - if len(msg.ContractsAllowed) > 0 { - allAvailableContractsDetails := k.GetAllAvailableContracts(ctx) - contracts := []string{} - for _, cdetails := range allAvailableContractsDetails { - contracts = append(contracts, cdetails.Address) - } - for _, contract := range msg.ContractsAllowed { - if !types.ItemExists(contracts, contract) { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "invalid contract address - %s", contract) - } - } - } - - minDepositRequired, found := types.GetCoinByDenomFromCoins(msg.FeeDenom, params.MinimumGasDeposit) - if !found { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, " fee denom %s not allowed ", msg.FeeDenom) - } - - if msg.GasDeposit.IsLT(minDepositRequired) { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "minimum required deposit is %s", minDepositRequired.String()) - } - - return nil -} - -func (k Keeper) CreateGasTank(ctx sdk.Context, msg *types.MsgCreateGasTank) (types.GasTank, error) { - if err := k.ValidateMsgCreateGasTank(ctx, msg); err != nil { - return types.GasTank{}, err - } - id := k.GetNextGasTankIDWithUpdate(ctx) - gasTank := types.NewGasTank( - id, - sdk.MustAccAddressFromBech32(msg.GetProvider()), - msg.MaxTxsCountPerConsumer, - msg.MaxFeeUsagePerConsumer, - msg.MaxFeeUsagePerTx, - msg.TxsAllowed, - msg.ContractsAllowed, - msg.FeeDenom, - ) - - // Send gas deposit coins to the gas tank's reserve account. - provider, err := sdk.AccAddressFromBech32(msg.GetProvider()) - if err != nil { - return types.GasTank{}, err - } - if err := k.bankKeeper.SendCoins(ctx, provider, gasTank.GetGasTankReserveAddress(), sdk.NewCoins(msg.GasDeposit)); err != nil { - return types.GasTank{}, err - } - - k.AddToTxGtids(ctx, gasTank.TxsAllowed, gasTank.ContractsAllowed, gasTank.Id) - k.SetGasTank(ctx, gasTank) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeCreateGasTank, - sdk.NewAttribute(types.AttributeKeyProvider, msg.Provider), - sdk.NewAttribute(types.AttributeKeyGasTankID, strconv.FormatUint(gasTank.Id, 10)), - sdk.NewAttribute(types.AttributeKeyFeeDenom, msg.FeeDenom), - sdk.NewAttribute(types.AttributeKeyMaxFeeUsagePerTx, msg.MaxFeeUsagePerTx.String()), - sdk.NewAttribute(types.AttributeKeyMaxTxsCountPerConsumer, strconv.FormatUint(msg.MaxTxsCountPerConsumer, 10)), - sdk.NewAttribute(types.AttributeKeyMaxFeeUsagePerConsumer, msg.MaxFeeUsagePerConsumer.String()), - sdk.NewAttribute(types.AttributeKeyTxsAllowed, strings.Join(gasTank.TxsAllowed, ",")), - sdk.NewAttribute(types.AttributeKeyContractsAllowed, strings.Join(gasTank.ContractsAllowed, ",")), - ), - }) - - return gasTank, nil -} - -func (k Keeper) ValidateMsgAuthorizeActors(ctx sdk.Context, msg *types.MsgAuthorizeActors) error { - gasTank, found := k.GetGasTank(ctx, msg.GasTankId) - if !found { - return sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", msg.GasTankId) - } - - if !gasTank.IsActive { - return sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive") - } - - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - - if gasTank.Provider != msg.Provider { - return sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized provider") - } - - msg.Actors = types.RemoveDuplicates(msg.Actors) - if len(msg.Actors) > types.MaximumAuthorizedActorsLimit { - return sdkerrors.Wrapf(errors.ErrInvalidRequest, "maximum %d actors can be authorized", types.MaximumAuthorizedActorsLimit) - } - - for _, actor := range msg.Actors { - if _, err := sdk.AccAddressFromBech32(actor); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid actor address - %s : %v", actor, err) - } - } - - return nil -} - -func (k Keeper) AuthorizeActors(ctx sdk.Context, msg *types.MsgAuthorizeActors) (types.GasTank, error) { - if err := k.ValidateMsgAuthorizeActors(ctx, msg); err != nil { - return types.GasTank{}, err - } - - gasTank, _ := k.GetGasTank(ctx, msg.GasTankId) - gasTank.AuthorizedActors = types.RemoveDuplicates(msg.Actors) - - k.SetGasTank(ctx, gasTank) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeAuthorizeActors, - sdk.NewAttribute(types.AttributeKeyProvider, msg.Provider), - sdk.NewAttribute(types.AttributeKeyGasTankID, strconv.FormatUint(gasTank.Id, 10)), - sdk.NewAttribute(types.AttributeKeyAuthorizedActors, strings.Join(msg.Actors, ",")), - ), - }) - - return gasTank, nil -} - -func (k Keeper) ValidatMsgUpdateGasTankStatus(ctx sdk.Context, msg *types.MsgUpdateGasTankStatus) error { - gasTank, found := k.GetGasTank(ctx, msg.GasTankId) - if !found { - return sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", msg.GasTankId) - } - - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - - if gasTank.Provider != msg.Provider { - return sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized provider") - } - return nil -} - -func (k Keeper) UpdateGasTankStatus(ctx sdk.Context, msg *types.MsgUpdateGasTankStatus) (types.GasTank, error) { - if err := k.ValidatMsgUpdateGasTankStatus(ctx, msg); err != nil { - return types.GasTank{}, err - } - gasTank, _ := k.GetGasTank(ctx, msg.GasTankId) - gasTank.IsActive = !gasTank.IsActive - - k.SetGasTank(ctx, gasTank) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpdateGasTankStatus, - sdk.NewAttribute(types.AttributeKeyProvider, msg.Provider), - sdk.NewAttribute(types.AttributeKeyGasTankID, strconv.FormatUint(gasTank.Id, 10)), - sdk.NewAttribute(types.AttributeKeyGasTankStatus, strconv.FormatBool(gasTank.IsActive)), - ), - }) - - return gasTank, nil -} - -func (k Keeper) ValidateMsgUpdateGasTankConfig(ctx sdk.Context, msg *types.MsgUpdateGasTankConfig) error { - gasTank, found := k.GetGasTank(ctx, msg.GasTankId) - if !found { - return sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", msg.GasTankId) - } - - if !gasTank.IsActive { - return sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive") - } - - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - - if gasTank.Provider != msg.Provider { - return sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized provider") - } - - if msg.MaxTxsCountPerConsumer == 0 { - return sdkerrors.Wrap(types.ErrorInvalidrequest, "max tx count per consumer must not be 0") - } - - if !msg.MaxFeeUsagePerTx.IsPositive() { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "max_fee_usage_per_tx should be positive") - } - if !msg.MaxFeeUsagePerConsumer.IsPositive() { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "max_fee_usage_per_consumer should be positive") - } - - if len(msg.TxsAllowed) == 0 && len(msg.ContractsAllowed) == 0 { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "request should have atleast one tx path or contract address") - } - - if len(msg.TxsAllowed) > 0 { - allAvailableMessages := k.GetAvailableMessages(ctx) - for _, message := range msg.TxsAllowed { - if !types.ItemExists(allAvailableMessages, message) { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "invalid message - %s", message) - } - } - } - - if len(msg.ContractsAllowed) > 0 { - allAvailableContractsDetails := k.GetAllAvailableContracts(ctx) - contracts := []string{} - for _, cdetails := range allAvailableContractsDetails { - contracts = append(contracts, cdetails.Address) - } - for _, contract := range msg.ContractsAllowed { - if !types.ItemExists(contracts, contract) { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "invalid contract address - %s", contract) - } - } - } - - return nil -} - -func (k Keeper) UpdateGasTankConfig(ctx sdk.Context, msg *types.MsgUpdateGasTankConfig) (types.GasTank, error) { - if err := k.ValidateMsgUpdateGasTankConfig(ctx, msg); err != nil { - return types.GasTank{}, err - } - - gasTank, _ := k.GetGasTank(ctx, msg.GasTankId) - - consumerUpdateRequire := false - if gasTank.MaxTxsCountPerConsumer != msg.MaxTxsCountPerConsumer || !gasTank.MaxFeeUsagePerConsumer.Equal(msg.MaxFeeUsagePerConsumer) { - consumerUpdateRequire = true - } - k.RemoveFromTxGtids(ctx, gasTank.TxsAllowed, gasTank.ContractsAllowed, gasTank.Id) - - gasTank.MaxFeeUsagePerTx = msg.MaxFeeUsagePerTx - gasTank.MaxTxsCountPerConsumer = msg.MaxTxsCountPerConsumer - gasTank.MaxFeeUsagePerConsumer = msg.MaxFeeUsagePerConsumer - - gasTank.TxsAllowed = types.RemoveDuplicates(msg.TxsAllowed) - gasTank.ContractsAllowed = types.RemoveDuplicates(msg.ContractsAllowed) - - if consumerUpdateRequire { - k.UpdateConsumerAllowance(ctx, gasTank) - } - k.AddToTxGtids(ctx, gasTank.TxsAllowed, gasTank.ContractsAllowed, gasTank.Id) - - k.SetGasTank(ctx, gasTank) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpdateGasTankConfig, - sdk.NewAttribute(types.AttributeKeyProvider, msg.Provider), - sdk.NewAttribute(types.AttributeKeyGasTankID, strconv.FormatUint(gasTank.Id, 10)), - sdk.NewAttribute(types.AttributeKeyMaxFeeUsagePerTx, msg.MaxFeeUsagePerTx.String()), - sdk.NewAttribute(types.AttributeKeyMaxTxsCountPerConsumer, strconv.FormatUint(msg.MaxTxsCountPerConsumer, 10)), - sdk.NewAttribute(types.AttributeKeyMaxFeeUsagePerConsumer, msg.MaxFeeUsagePerConsumer.String()), - sdk.NewAttribute(types.AttributeKeyTxsAllowed, strings.Join(gasTank.TxsAllowed, ",")), - sdk.NewAttribute(types.AttributeKeyContractsAllowed, strings.Join(gasTank.ContractsAllowed, ",")), - ), - }) - - return gasTank, nil -} - -func (k Keeper) ValidateMsgBlockConsumer(ctx sdk.Context, msg *types.MsgBlockConsumer) error { - gasTank, found := k.GetGasTank(ctx, msg.GasTankId) - if !found { - return sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", msg.GasTankId) - } - - if !gasTank.IsActive { - return sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive") - } - - if _, err := sdk.AccAddressFromBech32(msg.Actor); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid actor address: %v", err) - } - - if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid consumer address: %v", err) - } - - authorizedActors := gasTank.AuthorizedActors - authorizedActors = append(authorizedActors, gasTank.Provider) - - if !types.ItemExists(authorizedActors, msg.Actor) { - return sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized actor") - } - return nil -} - -func (k Keeper) BlockConsumer(ctx sdk.Context, msg *types.MsgBlockConsumer) (types.GasConsumer, error) { - if err := k.ValidateMsgBlockConsumer(ctx, msg); err != nil { - return types.GasConsumer{}, err - } - - gasTank, _ := k.GetGasTank(ctx, msg.GasTankId) - gasConsumer, consumptionIndex := k.GetOrCreateGasConsumer(ctx, sdk.MustAccAddressFromBech32(msg.Consumer), gasTank) - gasConsumer.Consumptions[consumptionIndex].IsBlocked = true - k.SetGasConsumer(ctx, gasConsumer) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeBlockConsumer, - sdk.NewAttribute(types.AttributeKeyActor, msg.Actor), - sdk.NewAttribute(types.AttributeKeyConsumer, msg.Consumer), - sdk.NewAttribute(types.AttributeKeyGasTankID, strconv.FormatUint(msg.GasTankId, 10)), - ), - }) - - return gasConsumer, nil -} - -func (k Keeper) ValidateMsgUnblockConsumer(ctx sdk.Context, msg *types.MsgUnblockConsumer) error { - gasTank, found := k.GetGasTank(ctx, msg.GasTankId) - if !found { - return sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", msg.GasTankId) - } - - if !gasTank.IsActive { - return sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive") - } - - if _, err := sdk.AccAddressFromBech32(msg.Actor); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid actor address: %v", err) - } - - if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid consumer address: %v", err) - } - - authorizedActors := gasTank.AuthorizedActors - authorizedActors = append(authorizedActors, gasTank.Provider) - - if !types.ItemExists(authorizedActors, msg.Actor) { - return sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized actor") - } - return nil -} - -func (k Keeper) UnblockConsumer(ctx sdk.Context, msg *types.MsgUnblockConsumer) (types.GasConsumer, error) { - if err := k.ValidateMsgUnblockConsumer(ctx, msg); err != nil { - return types.GasConsumer{}, err - } - - gasTank, _ := k.GetGasTank(ctx, msg.GasTankId) - gasConsumer, consumptionIndex := k.GetOrCreateGasConsumer(ctx, sdk.MustAccAddressFromBech32(msg.Consumer), gasTank) - gasConsumer.Consumptions[consumptionIndex].IsBlocked = false - k.SetGasConsumer(ctx, gasConsumer) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUnblockConsumer, - sdk.NewAttribute(types.AttributeKeyActor, msg.Actor), - sdk.NewAttribute(types.AttributeKeyConsumer, msg.Consumer), - sdk.NewAttribute(types.AttributeKeyGasTankID, strconv.FormatUint(msg.GasTankId, 10)), - ), - }) - - return gasConsumer, nil -} - -func (k Keeper) ValidateMsgUpdateGasConsumerLimit(ctx sdk.Context, msg *types.MsgUpdateGasConsumerLimit) error { - gasTank, found := k.GetGasTank(ctx, msg.GasTankId) - if !found { - return sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", msg.GasTankId) - } - - if !gasTank.IsActive { - return sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive") - } - - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - - if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid consumer address: %v", err) - } - - if gasTank.Provider != msg.Provider { - return sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized provider") - } - - if msg.TotalTxsAllowed == 0 { - return sdkerrors.Wrap(types.ErrorInvalidrequest, "total txs allowed must not be 0") - } - - if !msg.TotalFeeConsumptionAllowed.IsPositive() { - return sdkerrors.Wrapf(types.ErrorInvalidrequest, "total fee consumption allowed should be positive") - } - - return nil -} - -func (k Keeper) UpdateGasConsumerLimit(ctx sdk.Context, msg *types.MsgUpdateGasConsumerLimit) (types.GasConsumer, error) { - if err := k.ValidateMsgUpdateGasConsumerLimit(ctx, msg); err != nil { - return types.GasConsumer{}, err - } - - gasTank, _ := k.GetGasTank(ctx, msg.GasTankId) - gasConsumer, consumptionIndex := k.GetOrCreateGasConsumer(ctx, sdk.MustAccAddressFromBech32(msg.Consumer), gasTank) - if !gasConsumer.Consumptions[consumptionIndex].TotalFeeConsumptionAllowed.Equal(msg.TotalFeeConsumptionAllowed) || - gasConsumer.Consumptions[consumptionIndex].TotalTxsAllowed != msg.TotalTxsAllowed { - gasConsumer.Consumptions[consumptionIndex].TotalFeeConsumptionAllowed = msg.TotalFeeConsumptionAllowed - gasConsumer.Consumptions[consumptionIndex].TotalTxsAllowed = msg.TotalTxsAllowed - k.SetGasConsumer(ctx, gasConsumer) - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeBlockConsumer, - sdk.NewAttribute(types.AttributeKeyProvider, msg.Provider), - sdk.NewAttribute(types.AttributeKeyConsumer, msg.Consumer), - sdk.NewAttribute(types.AttributeKeyGasTankID, strconv.FormatUint(msg.GasTankId, 10)), - sdk.NewAttribute(types.AttributeKeyMaxTxsCountPerConsumer, strconv.FormatUint(msg.TotalTxsAllowed, 10)), - sdk.NewAttribute(types.AttributeKeyMaxFeeUsagePerConsumer, msg.TotalFeeConsumptionAllowed.String()), - ), - }) - - return gasConsumer, nil -} diff --git a/x/gasless/keeper/gasless_test.go b/x/gasless/keeper/gasless_test.go deleted file mode 100644 index 94d46799b..000000000 --- a/x/gasless/keeper/gasless_test.go +++ /dev/null @@ -1,916 +0,0 @@ -package keeper_test - -import ( - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/comdex-official/comdex/x/gasless/types" - sdk "github.com/cosmos/cosmos-sdk/types" - errors "github.com/cosmos/cosmos-sdk/types/errors" - _ "github.com/stretchr/testify/suite" - "golang.org/x/exp/slices" -) - -func (s *KeeperTestSuite) TestCreateGasTank() { - params := s.keeper.GetParams(s.ctx) - - provider1 := s.addr(1) - provider1Tanks := []types.GasTank{} - for i := 0; i < int(params.TankCreationLimit); i++ { - tank := s.CreateNewGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - provider1Tanks = append(provider1Tanks, tank) - } - - testCases := []struct { - Name string - Msg types.MsgCreateGasTank - ExpErr error - }{ - { - Name: "error tank creation limit reached", - Msg: *types.NewMsgCreateGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{}, []string{"comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3"}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: sdkerrors.Wrapf(types.ErrorMaxLimitReachedByProvider, " %d gas tanks already created by the provider", params.TankCreationLimit), - }, - { - Name: "error fee and deposit denom mismatch", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "uatom", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{}, []string{"comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3"}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, " fee denom %s do not match gas depoit denom %s ", "uatom", "ucmdx"), - }, - { - Name: "error max tx count consumer is 0", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "ucmdx", sdkmath.NewInt(1000), 0, sdkmath.NewInt(1000000), []string{}, []string{"comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3"}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: sdkerrors.Wrap(types.ErrorInvalidrequest, "max tx count per consumer must not be 0"), - }, - { - Name: "error max fee usage per tx should be positive", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "ucmdx", sdkmath.NewInt(0), 123, sdkmath.NewInt(1000000), []string{}, []string{"comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3"}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "max_fee_usage_per_tx should be positive"), - }, - { - Name: "error max fee usage per consumer should be positive", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "ucmdx", sdkmath.NewInt(123), 123, sdkmath.NewInt(0), []string{}, []string{"comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3"}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "max_fee_usage_per_consumer should be positive"), - }, - { - Name: "error atleast one txPath or contract is required", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "ucmdx", sdkmath.NewInt(123), 123, sdkmath.NewInt(1000000), []string{}, []string{}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "request should have atleast one tx path or contract address"), - }, - { - Name: "error deposit samller than required min deposit", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "ucmdx", sdkmath.NewInt(123), 123, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, sdk.NewCoin("ucmdx", sdk.NewInt(100))), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "minimum required deposit is %s", params.MinimumGasDeposit[0].String()), - }, - { - Name: "error fee denom not allowed", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "uatom", sdkmath.NewInt(123), 123, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, sdk.NewCoin("uatom", sdk.NewInt(100))), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, " fee denom %s not allowed ", "uatom"), - }, - { - Name: "error invalid message type URL", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "ucmdx", sdkmath.NewInt(123), 123, sdkmath.NewInt(1000000), []string{"random message type"}, []string{""}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "invalid message - %s", "random message type"), - }, - { - Name: "error invalid contract address", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "ucmdx", sdkmath.NewInt(123), 123, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{"comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3"}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "invalid contract address - %s", "comdex1qa4hswlcjmttulj0q9qa46jf64f93pecl6tydcsjldfe0hy5ju0s7r3hn3"), - }, - { - Name: "success gas tank creation", - Msg: *types.NewMsgCreateGasTank(s.addr(2), "ucmdx", sdkmath.NewInt(123), 123, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, sdk.NewCoin("ucmdx", sdk.NewInt(100000000))), - ExpErr: nil, - }, - } - - for _, tc := range testCases { - s.Run(tc.Name, func() { - // add funds to acount for valid case - if tc.ExpErr == nil { - s.fundAddr(sdk.MustAccAddressFromBech32(tc.Msg.Provider), sdk.NewCoins(tc.Msg.GasDeposit)) - } - - tank, err := s.keeper.CreateGasTank(s.ctx, &tc.Msg) - if tc.ExpErr != nil { - s.Require().Error(err) - s.Require().EqualError(err, tc.ExpErr.Error()) - } else { - s.Require().NoError(err) - s.Require().NotNil(tank) - - s.Require().IsType(types.GasTank{}, tank) - s.Require().Equal(tc.Msg.FeeDenom, tank.FeeDenom) - s.Require().Equal(tc.Msg.MaxFeeUsagePerTx, tank.MaxFeeUsagePerTx) - s.Require().Equal(tc.Msg.MaxTxsCountPerConsumer, tank.MaxTxsCountPerConsumer) - s.Require().Equal(tc.Msg.MaxFeeUsagePerConsumer, tank.MaxFeeUsagePerConsumer) - s.Require().Equal(tc.Msg.TxsAllowed, tank.TxsAllowed) - s.Require().Equal(tc.Msg.ContractsAllowed, tank.ContractsAllowed) - s.Require().Equal(tc.Msg.GasDeposit, s.getBalance(tank.GetGasTankReserveAddress(), tank.FeeDenom)) - - for _, tx := range tc.Msg.TxsAllowed { - txGtids, found := s.keeper.GetTxGTIDs(s.ctx, tx) - s.Require().True(found) - s.Require().IsType(types.TxGTIDs{}, txGtids) - s.Require().IsType([]uint64{}, txGtids.GasTankIds) - s.Require().Equal(txGtids.TxPathOrContractAddress, tx) - s.Require().Equal(tank.Id, txGtids.GasTankIds[len(txGtids.GasTankIds)-1]) - } - - for _, c := range tc.Msg.ContractsAllowed { - txGtids, found := s.keeper.GetTxGTIDs(s.ctx, c) - s.Require().True(found) - s.Require().IsType(types.TxGTIDs{}, txGtids) - s.Require().IsType([]uint64{}, txGtids.GasTankIds) - s.Require().Equal(txGtids.TxPathOrContractAddress, c) - s.Require().Equal(tank.Id, txGtids.GasTankIds[len(txGtids.GasTankIds)-1]) - } - } - }) - } -} - -func (s *KeeperTestSuite) TestAuthorizeActors() { - provider1 := s.addr(1) - tank1 := s.CreateNewGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - - provider2 := s.addr(2) - inactiveTank := s.CreateNewGasTank(provider2, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - inactiveTank.IsActive = false - s.keeper.SetGasTank(s.ctx, inactiveTank) - - testCases := []struct { - Name string - Msg types.MsgAuthorizeActors - ExpErr error - }{ - { - Name: "error invalid gas tank ID", - Msg: *types.NewMsgAuthorizeActors( - 12, provider1, []sdk.AccAddress{s.addr(10), s.addr(11), s.addr(12)}, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", 12), - }, - { - Name: "error unauthorized provider", - Msg: *types.NewMsgAuthorizeActors( - tank1.Id, provider2, []sdk.AccAddress{s.addr(10), s.addr(11), s.addr(12)}, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized provider"), - }, - { - Name: "error inactive tank", - Msg: *types.NewMsgAuthorizeActors( - inactiveTank.Id, provider2, []sdk.AccAddress{s.addr(10), s.addr(11), s.addr(12)}, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive"), - }, - { - Name: "error max actor limit ", - Msg: *types.NewMsgAuthorizeActors( - tank1.Id, provider1, []sdk.AccAddress{s.addr(10), s.addr(11), s.addr(12), s.addr(13), s.addr(14), s.addr(15), s.addr(16)}, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrInvalidRequest, "maximum %d actors can be authorized", types.MaximumAuthorizedActorsLimit), - }, - { - Name: "success with duplicate actors", - Msg: *types.NewMsgAuthorizeActors( - tank1.Id, provider1, []sdk.AccAddress{s.addr(10), s.addr(10), s.addr(10), s.addr(10), s.addr(10), s.addr(10), s.addr(10)}, - ), - ExpErr: nil, - }, - { - Name: "success with unique actors", - Msg: *types.NewMsgAuthorizeActors( - tank1.Id, provider1, []sdk.AccAddress{s.addr(10), s.addr(11), s.addr(12), s.addr(13), s.addr(14)}, - ), - ExpErr: nil, - }, - } - - for _, tc := range testCases { - s.Run(tc.Name, func() { - tank, err := s.keeper.AuthorizeActors(s.ctx, &tc.Msg) - if tc.ExpErr != nil { - s.Require().Error(err) - s.Require().EqualError(err, tc.ExpErr.Error()) - } else { - s.Require().NoError(err) - s.Require().NotNil(tank) - - s.Require().IsType(types.GasTank{}, tank) - s.Require().Equal(len(types.RemoveDuplicates(tc.Msg.Actors)), len(tank.AuthorizedActors)) - slices.Sort(tc.Msg.Actors) - slices.Sort(tank.AuthorizedActors) - s.Require().Equal(tc.Msg.Actors, tank.AuthorizedActors) - } - }) - } - -} - -func (s *KeeperTestSuite) TestUpdateGasTankStatus() { - provider1 := s.addr(1) - tank1 := s.CreateNewGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - - testCases := []struct { - Name string - Msg types.MsgUpdateGasTankStatus - ExpErr error - }{ - { - Name: "error invalid gas tank ID", - Msg: *types.NewMsgUpdateGasTankStatus( - 12, provider1, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", 12), - }, - { - Name: "error unauthorized provider", - Msg: *types.NewMsgUpdateGasTankStatus( - tank1.Id, s.addr(10), - ), - ExpErr: sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized provider"), - }, - { - Name: "success update status to inactive", - Msg: *types.NewMsgUpdateGasTankStatus( - tank1.Id, provider1, - ), - ExpErr: nil, - }, - { - Name: "success update status to active", - Msg: *types.NewMsgUpdateGasTankStatus( - tank1.Id, provider1, - ), - ExpErr: nil, - }, - } - - for _, tc := range testCases { - s.Run(tc.Name, func() { - tank, _ := s.keeper.GetGasTank(s.ctx, tc.Msg.GasTankId) - updatedTank, err := s.keeper.UpdateGasTankStatus(s.ctx, &tc.Msg) - if tc.ExpErr != nil { - s.Require().Error(err) - s.Require().EqualError(err, tc.ExpErr.Error()) - } else { - s.Require().NoError(err) - s.Require().NotNil(tank) - - s.Require().IsType(types.GasTank{}, updatedTank) - s.Require().Equal(tank.IsActive, !updatedTank.IsActive) - } - }) - } -} - -func (s *KeeperTestSuite) TestUpdateGasTankConfig() { - provider1 := s.addr(1) - tank1 := s.CreateNewGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - - provider2 := s.addr(2) - inactiveTank := s.CreateNewGasTank(provider2, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgCreatePool"}, []string{}, "100000000ucmdx") - inactiveTank.IsActive = false - s.keeper.SetGasTank(s.ctx, inactiveTank) - - testCases := []struct { - Name string - Msg types.MsgUpdateGasTankConfig - ExpErr error - }{ - { - Name: "error invalid gas tank ID", - Msg: *types.NewMsgUpdateGasTankConfig( - 12, provider1, sdk.NewInt(1000), 10, sdk.NewInt(1000000), - []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, - []string{}, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", 12), - }, - { - Name: "error unauthorized provider", - Msg: *types.NewMsgUpdateGasTankConfig( - tank1.Id, provider2, sdk.NewInt(1000), 10, sdk.NewInt(1000000), - []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, - []string{}, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized provider"), - }, - { - Name: "error inactive tank", - Msg: *types.NewMsgUpdateGasTankConfig( - inactiveTank.Id, provider1, sdk.NewInt(1000), 10, sdk.NewInt(1000000), - []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, - []string{}, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive"), - }, - { - Name: "error max tx count consumer is 0", - Msg: *types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.NewInt(1000), 0, sdk.NewInt(1000000), - []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, - []string{}, - ), - ExpErr: sdkerrors.Wrap(types.ErrorInvalidrequest, "max tx count per consumer must not be 0"), - }, - { - Name: "error max fee usage per tx should be positive", - Msg: *types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.ZeroInt(), 10, sdk.NewInt(1000000), - []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, - []string{}, - ), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "max_fee_usage_per_tx should be positive"), - }, - { - Name: "error max fee usage per consumer should be positive", - Msg: *types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.NewInt(1000), 10, sdk.ZeroInt(), - []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, - []string{}, - ), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "max_fee_usage_per_consumer should be positive"), - }, - { - Name: "error atleast one txPath or contract is required", - Msg: *types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.NewInt(1000), 10, sdk.NewInt(1000000), - []string{}, - []string{}, - ), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "request should have atleast one tx path or contract address"), - }, - { - Name: "error invalid message type URL", - Msg: *types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.NewInt(1000), 10, sdk.NewInt(1000000), - []string{"random message type"}, - []string{"contract address"}, - ), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "invalid message - %s", "random message type"), - }, - { - Name: "error invalid contract address", - Msg: *types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.NewInt(1000), 10, sdk.NewInt(1000000), - []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, - []string{"invalid contract address"}, - ), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "invalid contract address - %s", "invalid contract address"), - }, - { - Name: "success tank configs updated", - Msg: *types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.NewInt(25000), 120, sdk.NewInt(150000000), - []string{"/comdex.liquidity.v1beta1.MsgMarketOrder"}, - nil, - ), - ExpErr: nil, - }, - } - - for _, tc := range testCases { - s.Run(tc.Name, func() { - resp, err := s.keeper.UpdateGasTankConfig(s.ctx, &tc.Msg) - if tc.ExpErr != nil { - s.Require().Error(err) - s.Require().EqualError(err, tc.ExpErr.Error()) - } else { - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().IsType(types.GasTank{}, resp) - - checkTank, _ := s.keeper.GetGasTank(s.ctx, tc.Msg.GasTankId) - s.Require().Equal(tc.Msg.MaxFeeUsagePerTx, checkTank.MaxFeeUsagePerTx) - s.Require().Equal(tc.Msg.MaxTxsCountPerConsumer, checkTank.MaxTxsCountPerConsumer) - s.Require().Equal(tc.Msg.MaxFeeUsagePerConsumer, checkTank.MaxFeeUsagePerConsumer) - slices.Sort(tc.Msg.TxsAllowed) - slices.Sort(checkTank.TxsAllowed) - slices.Sort(tc.Msg.ContractsAllowed) - slices.Sort(checkTank.ContractsAllowed) - s.Require().Equal(tc.Msg.TxsAllowed, checkTank.TxsAllowed) - s.Require().Equal(tc.Msg.ContractsAllowed, checkTank.ContractsAllowed) - - // validate if new txs and contracts has been added to the index of TxGTIDs - for _, tx := range tc.Msg.TxsAllowed { - txGtids, found := s.keeper.GetTxGTIDs(s.ctx, tx) - s.Require().True(found) - s.Require().IsType(types.TxGTIDs{}, txGtids) - s.Require().IsType([]uint64{}, txGtids.GasTankIds) - s.Require().Equal(txGtids.TxPathOrContractAddress, tx) - s.Require().Equal(resp.Id, txGtids.GasTankIds[len(txGtids.GasTankIds)-1]) - } - - for _, c := range tc.Msg.ContractsAllowed { - txGtids, found := s.keeper.GetTxGTIDs(s.ctx, c) - s.Require().True(found) - s.Require().IsType(types.TxGTIDs{}, txGtids) - s.Require().IsType([]uint64{}, txGtids.GasTankIds) - s.Require().Equal(txGtids.TxPathOrContractAddress, c) - s.Require().Equal(resp.Id, txGtids.GasTankIds[len(txGtids.GasTankIds)-1]) - } - - // validate if old txs and contracts has been removed from the index of TxGTIDs - for _, tx := range tank1.TxsAllowed { - _, found := s.keeper.GetTxGTIDs(s.ctx, tx) - s.Require().False(found) - } - - for _, c := range tank1.ContractsAllowed { - _, found := s.keeper.GetTxGTIDs(s.ctx, c) - s.Require().False(found) - } - } - }) - } -} - -func (s *KeeperTestSuite) TestBlockConsumer() { - provider1 := s.addr(1) - tank1 := s.CreateNewGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - actors := []sdk.AccAddress{s.addr(2), s.addr(3), s.addr(4)} - s.keeper.AuthorizeActors(s.ctx, types.NewMsgAuthorizeActors(tank1.Id, provider1, actors)) - - provider2 := s.addr(5) - inactiveTank := s.CreateNewGasTank(provider2, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgCreatePool"}, []string{}, "100000000ucmdx") - inactiveTank.IsActive = false - s.keeper.SetGasTank(s.ctx, inactiveTank) - - consumer1 := s.addr(6) - consumer2 := s.addr(7) - consumer3 := s.addr(8) - - testCases := []struct { - Name string - Msg types.MsgBlockConsumer - ExpErr error - }{ - { - Name: "error invalid gas tank ID", - Msg: *types.NewMsgBlockConsumer( - 12, provider1, consumer1, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", 12), - }, - { - Name: "error inactive tank", - Msg: *types.NewMsgBlockConsumer( - inactiveTank.Id, provider1, consumer1, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive"), - }, - { - Name: "error unauthorized actor", - Msg: *types.NewMsgBlockConsumer( - tank1.Id, consumer1, consumer1, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized actor"), - }, - { - Name: "success provider consumer block", - Msg: *types.NewMsgBlockConsumer( - tank1.Id, provider1, consumer1, - ), - ExpErr: nil, - }, - { - Name: "success authorized consumer block 1", - Msg: *types.NewMsgBlockConsumer( - tank1.Id, actors[0], consumer1, - ), - ExpErr: nil, - }, - { - Name: "success authorized consumer block 2", - Msg: *types.NewMsgBlockConsumer( - tank1.Id, actors[1], consumer2, - ), - ExpErr: nil, - }, - { - Name: "success authorized consumer block 3", - Msg: *types.NewMsgBlockConsumer( - tank1.Id, actors[2], consumer3, - ), - ExpErr: nil, - }, - } - - for _, tc := range testCases { - s.Run(tc.Name, func() { - resp, err := s.keeper.BlockConsumer(s.ctx, &tc.Msg) - if tc.ExpErr != nil { - s.Require().Error(err) - s.Require().EqualError(err, tc.ExpErr.Error()) - } else { - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().IsType(types.GasConsumer{}, resp) - - consumer, found := s.keeper.GetGasConsumer(s.ctx, sdk.MustAccAddressFromBech32(tc.Msg.Consumer)) - s.Require().True(found) - - for _, consumption := range consumer.Consumptions { - if consumption.GasTankId == tc.Msg.GasTankId { - s.Require().True(consumption.IsBlocked) - - tank, found := s.keeper.GetGasTank(s.ctx, tc.Msg.GasTankId) - s.Require().True(found) - - s.Require().Equal(tank.MaxTxsCountPerConsumer, consumption.TotalTxsAllowed) - s.Require().Equal(uint64(0), consumption.TotalTxsMade) - s.Require().Equal(tank.MaxFeeUsagePerConsumer, consumption.TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), consumption.TotalFeesConsumed) - } - } - - } - }) - } - -} - -func (s *KeeperTestSuite) TestUnblockConsumer() { - provider1 := s.addr(1) - tank1 := s.CreateNewGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - actors := []sdk.AccAddress{s.addr(2), s.addr(3), s.addr(4)} - s.keeper.AuthorizeActors(s.ctx, types.NewMsgAuthorizeActors(tank1.Id, provider1, actors)) - - provider2 := s.addr(5) - inactiveTank := s.CreateNewGasTank(provider2, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgCreatePool"}, []string{}, "100000000ucmdx") - inactiveTank.IsActive = false - s.keeper.SetGasTank(s.ctx, inactiveTank) - - consumer1 := s.addr(6) - c, err := s.keeper.BlockConsumer(s.ctx, types.NewMsgBlockConsumer(tank1.Id, actors[0], consumer1)) - s.Require().NoError(err) - s.Require().True(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - consumer2 := s.addr(7) - c, err = s.keeper.BlockConsumer(s.ctx, types.NewMsgBlockConsumer(tank1.Id, actors[1], consumer2)) - s.Require().NoError(err) - s.Require().True(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - consumer3 := s.addr(8) - c, err = s.keeper.BlockConsumer(s.ctx, types.NewMsgBlockConsumer(tank1.Id, actors[2], consumer3)) - s.Require().NoError(err) - s.Require().True(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - testCases := []struct { - Name string - Msg types.MsgUnblockConsumer - ExpErr error - }{ - { - Name: "error invalid gas tank ID", - Msg: *types.NewMsgUnblockConsumer( - 12, provider1, consumer1, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", 12), - }, - { - Name: "error inactive tank", - Msg: *types.NewMsgUnblockConsumer( - inactiveTank.Id, provider1, consumer1, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive"), - }, - { - Name: "error unauthorized actor", - Msg: *types.NewMsgUnblockConsumer( - tank1.Id, consumer1, consumer1, - ), - ExpErr: sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized actor"), - }, - { - Name: "success provider consumer unblock", - Msg: *types.NewMsgUnblockConsumer( - tank1.Id, provider1, consumer1, - ), - ExpErr: nil, - }, - { - Name: "success authorized consumer unblock 1", - Msg: *types.NewMsgUnblockConsumer( - tank1.Id, actors[0], consumer1, - ), - ExpErr: nil, - }, - { - Name: "success authorized consumer unblock 2", - Msg: *types.NewMsgUnblockConsumer( - tank1.Id, actors[0], consumer2, - ), - ExpErr: nil, - }, - { - Name: "success authorized consumer unblock 3", - Msg: *types.NewMsgUnblockConsumer( - tank1.Id, actors[0], consumer3, - ), - ExpErr: nil, - }, - } - - for _, tc := range testCases { - s.Run(tc.Name, func() { - resp, err := s.keeper.UnblockConsumer(s.ctx, &tc.Msg) - if tc.ExpErr != nil { - s.Require().Error(err) - s.Require().EqualError(err, tc.ExpErr.Error()) - } else { - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().IsType(types.GasConsumer{}, resp) - - consumer, found := s.keeper.GetGasConsumer(s.ctx, sdk.MustAccAddressFromBech32(tc.Msg.Consumer)) - s.Require().True(found) - - for _, consumption := range consumer.Consumptions { - if consumption.GasTankId == tc.Msg.GasTankId { - s.Require().False(consumption.IsBlocked) - - tank, found := s.keeper.GetGasTank(s.ctx, tc.Msg.GasTankId) - s.Require().True(found) - - s.Require().Equal(tank.MaxTxsCountPerConsumer, consumption.TotalTxsAllowed) - s.Require().Equal(uint64(0), consumption.TotalTxsMade) - s.Require().Equal(tank.MaxFeeUsagePerConsumer, consumption.TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), consumption.TotalFeesConsumed) - } - } - } - }) - } -} - -func (s *KeeperTestSuite) TestUpdateGasConsumerLimit() { - provider1 := s.addr(1) - tank1 := s.CreateNewGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - actors := []sdk.AccAddress{s.addr(2), s.addr(3), s.addr(4)} - s.keeper.AuthorizeActors(s.ctx, types.NewMsgAuthorizeActors(tank1.Id, provider1, actors)) - - provider2 := s.addr(5) - inactiveTank := s.CreateNewGasTank(provider2, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgCreatePool"}, []string{}, "100000000ucmdx") - inactiveTank.IsActive = false - s.keeper.SetGasTank(s.ctx, inactiveTank) - - // unblocking consumer, so that a new consumer can be created with default values - consumer1 := s.addr(6) - c, err := s.keeper.UnblockConsumer(s.ctx, types.NewMsgUnblockConsumer(tank1.Id, actors[0], consumer1)) - s.Require().NoError(err) - s.Require().False(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - consumer2 := s.addr(7) - c, err = s.keeper.UnblockConsumer(s.ctx, types.NewMsgUnblockConsumer(tank1.Id, actors[1], consumer2)) - s.Require().NoError(err) - s.Require().False(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - consumer3 := s.addr(8) - c, err = s.keeper.UnblockConsumer(s.ctx, types.NewMsgUnblockConsumer(tank1.Id, actors[2], consumer3)) - s.Require().NoError(err) - s.Require().False(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - testCases := []struct { - Name string - Msg types.MsgUpdateGasConsumerLimit - ExpErr error - }{ - { - Name: "error invalid gas tank ID", - Msg: *types.NewMsgUpdateGasConsumerLimit( - 12, provider1, consumer1, 12, sdk.NewInt(1234), - ), - ExpErr: sdkerrors.Wrapf(errors.ErrNotFound, "gas tank with id %d not found", 12), - }, - { - Name: "error inactive tank", - Msg: *types.NewMsgUpdateGasConsumerLimit( - inactiveTank.Id, provider1, consumer1, 12, sdk.NewInt(1234), - ), - ExpErr: sdkerrors.Wrapf(errors.ErrInvalidRequest, "gas tank inactive"), - }, - { - Name: "error unauthorized provider", - Msg: *types.NewMsgUpdateGasConsumerLimit( - tank1.Id, provider2, consumer1, 12, sdk.NewInt(1234), - ), - ExpErr: sdkerrors.Wrapf(errors.ErrUnauthorized, "unauthorized provider"), - }, - { - Name: "error total txs allowed should be positive", - Msg: *types.NewMsgUpdateGasConsumerLimit( - tank1.Id, provider1, consumer1, 0, sdk.NewInt(1234), - ), - ExpErr: sdkerrors.Wrap(types.ErrorInvalidrequest, "total txs allowed must not be 0"), - }, - { - Name: "error total fee consumption allowed should be positive", - Msg: *types.NewMsgUpdateGasConsumerLimit( - tank1.Id, provider1, consumer1, 69, sdk.NewInt(0), - ), - ExpErr: sdkerrors.Wrapf(types.ErrorInvalidrequest, "total fee consumption allowed should be positive"), - }, - { - Name: "success consumer limit update 1", - Msg: *types.NewMsgUpdateGasConsumerLimit( - tank1.Id, provider1, consumer1, 16, sdk.NewInt(9876), - ), - ExpErr: nil, - }, - { - Name: "success consumer limit update 2", - Msg: *types.NewMsgUpdateGasConsumerLimit( - tank1.Id, provider1, consumer1, 23, sdk.NewInt(45687), - ), - ExpErr: nil, - }, - { - Name: "success consumer limit update 3", - Msg: *types.NewMsgUpdateGasConsumerLimit( - tank1.Id, provider1, consumer2, 57, sdk.NewInt(9075412), - ), - ExpErr: nil, - }, - { - Name: "success consumer limit update 4", - Msg: *types.NewMsgUpdateGasConsumerLimit( - tank1.Id, provider1, consumer3, 57, sdk.NewInt(9075412), - ), - ExpErr: nil, - }, - } - - for _, tc := range testCases { - s.Run(tc.Name, func() { - resp, err := s.keeper.UpdateGasConsumerLimit(s.ctx, &tc.Msg) - if tc.ExpErr != nil { - s.Require().Error(err) - s.Require().EqualError(err, tc.ExpErr.Error()) - } else { - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().IsType(types.GasConsumer{}, resp) - - consumer, found := s.keeper.GetGasConsumer(s.ctx, sdk.MustAccAddressFromBech32(tc.Msg.Consumer)) - s.Require().True(found) - - for _, consumption := range consumer.Consumptions { - if consumption.GasTankId == tc.Msg.GasTankId { - s.Require().False(consumption.IsBlocked) - - tank, found := s.keeper.GetGasTank(s.ctx, tc.Msg.GasTankId) - s.Require().True(found) - - s.Require().Equal(uint64(0), consumption.TotalTxsMade) - s.Require().NotEqual(tank.MaxTxsCountPerConsumer, consumption.TotalTxsAllowed) - s.Require().Equal(tc.Msg.TotalTxsAllowed, consumption.TotalTxsAllowed) - - s.Require().Equal(sdk.ZeroInt(), consumption.TotalFeesConsumed) - s.Require().NotEqual(tank.MaxFeeUsagePerConsumer, consumption.TotalFeeConsumptionAllowed) - s.Require().Equal(tc.Msg.TotalFeeConsumptionAllowed, consumption.TotalFeeConsumptionAllowed) - } - } - } - }) - } -} - -func (s *KeeperTestSuite) TestConsumerUpdateWhenGasTankUpdate() { - provider1 := s.addr(1) - tank1 := s.CreateNewGasTank(provider1, "ucmdx", sdkmath.NewInt(1000), 10, sdkmath.NewInt(1000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, "100000000ucmdx") - - // unblocking consumer, so that a new consumer can be created with default values - consumer1 := s.addr(11) - c, err := s.keeper.UnblockConsumer(s.ctx, types.NewMsgUnblockConsumer(tank1.Id, provider1, consumer1)) - s.Require().NoError(err) - s.Require().False(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - consumer2 := s.addr(12) - c, err = s.keeper.UnblockConsumer(s.ctx, types.NewMsgUnblockConsumer(tank1.Id, provider1, consumer2)) - s.Require().NoError(err) - s.Require().False(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - consumer3 := s.addr(13) - c, err = s.keeper.UnblockConsumer(s.ctx, types.NewMsgUnblockConsumer(tank1.Id, provider1, consumer3)) - s.Require().NoError(err) - s.Require().False(c.Consumptions[0].IsBlocked) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - - _, err = s.keeper.UpdateGasTankConfig(s.ctx, types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.NewInt(33000), 250, sdk.NewInt(120000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, - )) - s.Require().NoError(err) - - tank1, found := s.keeper.GetGasTank(s.ctx, tank1.Id) - s.Require().True(found) - - c, found = s.keeper.GetGasConsumer(s.ctx, consumer1) - s.Require().True(found) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - - c, found = s.keeper.GetGasConsumer(s.ctx, consumer2) - s.Require().True(found) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - - c, found = s.keeper.GetGasConsumer(s.ctx, consumer3) - s.Require().True(found) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - - _, err = s.keeper.UpdateGasConsumerLimit(s.ctx, types.NewMsgUpdateGasConsumerLimit( - tank1.Id, provider1, consumer1, 57, sdk.NewInt(9075412), - )) - c, found = s.keeper.GetGasConsumer(s.ctx, consumer1) - s.Require().True(found) - - s.Require().False(c.Consumptions[0].IsBlocked) - - tank1, found = s.keeper.GetGasTank(s.ctx, tank1.Id) - s.Require().True(found) - - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().NotEqual(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(uint64(57), c.Consumptions[0].TotalTxsAllowed) - - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - s.Require().NotEqual(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - s.Require().Equal(sdk.NewInt(9075412), c.Consumptions[0].TotalFeeConsumptionAllowed) - - _, err = s.keeper.UpdateGasTankConfig(s.ctx, types.NewMsgUpdateGasTankConfig( - tank1.Id, provider1, sdk.NewInt(34000), 150, sdk.NewInt(110000000), []string{"/comdex.liquidity.v1beta1.MsgLimitOrder"}, []string{}, - )) - s.Require().NoError(err) - - tank1, found = s.keeper.GetGasTank(s.ctx, tank1.Id) - s.Require().True(found) - - c, found = s.keeper.GetGasConsumer(s.ctx, consumer1) - s.Require().True(found) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - - c, found = s.keeper.GetGasConsumer(s.ctx, consumer2) - s.Require().True(found) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) - - c, found = s.keeper.GetGasConsumer(s.ctx, consumer3) - s.Require().True(found) - s.Require().Equal(uint64(0), c.Consumptions[0].TotalTxsMade) - s.Require().Equal(tank1.MaxTxsCountPerConsumer, c.Consumptions[0].TotalTxsAllowed) - s.Require().Equal(sdk.ZeroInt(), c.Consumptions[0].TotalFeesConsumed) - s.Require().Equal(tank1.MaxFeeUsagePerConsumer, c.Consumptions[0].TotalFeeConsumptionAllowed) -} diff --git a/x/gasless/keeper/genesis.go b/x/gasless/keeper/genesis.go deleted file mode 100644 index a74a13208..000000000 --- a/x/gasless/keeper/genesis.go +++ /dev/null @@ -1,41 +0,0 @@ -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) - - for _, txToTankIDs := range genState.TxToGasTankIds { - k.SetTxGTIDs(ctx, txToTankIDs) - } - - k.SetLastGasTankID(ctx, genState.LastGasTankId) - - for _, tank := range genState.GasTanks { - k.SetGasTank(ctx, tank) - } - - for _, consumer := range genState.GasConsumers { - k.SetGasConsumer(ctx, consumer) - } -} - -// ExportGenesis returns the capability module's exported genesis. -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - return &types.GenesisState{ - Params: k.GetParams(ctx), - TxToGasTankIds: k.GetAllTxGTIDs(ctx), - LastGasTankId: k.GetLastGasTankID(ctx), - GasTanks: k.GetAllGasTanks(ctx), - GasConsumers: k.GetAllGasConsumers(ctx), - } -} diff --git a/x/gasless/keeper/gov.go b/x/gasless/keeper/gov.go deleted file mode 100644 index b55569d4a..000000000 --- a/x/gasless/keeper/gov.go +++ /dev/null @@ -1 +0,0 @@ -package keeper diff --git a/x/gasless/keeper/grpc_query.go b/x/gasless/keeper/grpc_query.go deleted file mode 100644 index 285a008e6..000000000 --- a/x/gasless/keeper/grpc_query.go +++ /dev/null @@ -1,233 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/x/gasless/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// 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 -} - -func (k Querier) MessagesAndContracts(c context.Context, _ *types.QueryMessagesAndContractsRequest) (*types.QueryMessagesAndContractsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - messages := k.GetAvailableMessages(ctx) - contractsDetails := k.GetAllAvailableContracts(ctx) - contracts := []*types.ContractDetails{} - for _, c := range contractsDetails { - contract := c - contracts = append(contracts, &contract) - } - return &types.QueryMessagesAndContractsResponse{ - Messages: messages, - Contracts: contracts, - }, nil -} - -func (k Querier) GasTank(c context.Context, req *types.QueryGasTankRequest) (*types.QueryGasTankResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - if req.GasTankId == 0 { - return nil, status.Error(codes.InvalidArgument, "gas tank id cannot be 0") - } - - ctx := sdk.UnwrapSDKContext(c) - - gt, found := k.GetGasTank(ctx, req.GasTankId) - if !found { - return nil, status.Errorf(codes.NotFound, "gas tank with id %d doesn't exist", req.GasTankId) - } - - gasTankBalance := k.bankKeeper.GetBalance(ctx, sdk.MustAccAddressFromBech32(gt.Reserve), gt.FeeDenom) - return &types.QueryGasTankResponse{ - GasTank: types.NewGasTankResponse(gt, gasTankBalance), - }, nil -} - -func (k Querier) GasTanks(c context.Context, req *types.QueryGasTanksRequest) (*types.QueryGasTanksResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - ctx := sdk.UnwrapSDKContext(c) - store := ctx.KVStore(k.storeKey) - - keyPrefix := types.GetAllGasTanksKey() - gtGetter := func(_, value []byte) types.GasTank { - return types.MustUnmarshalGasTank(k.cdc, value) - } - gtStore := prefix.NewStore(store, keyPrefix) - var gasTanks []types.GasTankResponse - - pageRes, err := query.FilteredPaginate(gtStore, req.Pagination, func(key, value []byte, accumulate bool) (bool, error) { - gt := gtGetter(key, value) - if accumulate { - gasTankBalance := k.bankKeeper.GetBalance(ctx, sdk.MustAccAddressFromBech32(gt.Reserve), gt.FeeDenom) - gasTanks = append(gasTanks, types.NewGasTankResponse(gt, gasTankBalance)) - } - - return true, nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - return &types.QueryGasTanksResponse{ - GasTanks: gasTanks, - Pagination: pageRes, - }, nil -} - -func (k Querier) GasTanksByProvider(c context.Context, req *types.QueryGasTanksByProviderRequest) (*types.QueryGasTanksByProviderResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - if _, err := sdk.AccAddressFromBech32(req.Provider); err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid provider address") - } - - ctx := sdk.UnwrapSDKContext(c) - - allGasTanks := k.GetAllGasTanks(ctx) - - providerGasTanks := []types.GasTankResponse{} - for _, tank := range allGasTanks { - if tank.Provider == req.Provider { - tankBalance := k.bankKeeper.GetBalance(ctx, sdk.MustAccAddressFromBech32(tank.Reserve), tank.FeeDenom) - providerGasTanks = append(providerGasTanks, types.NewGasTankResponse(tank, tankBalance)) - } - } - return &types.QueryGasTanksByProviderResponse{ - GasTanks: providerGasTanks, - }, nil -} - -func (k Querier) GasConsumer(c context.Context, req *types.QueryGasConsumerRequest) (*types.QueryGasConsumerResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - if _, err := sdk.AccAddressFromBech32(req.Consumer); err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid consumer address") - } - - ctx := sdk.UnwrapSDKContext(c) - - gc, found := k.GetGasConsumer(ctx, sdk.MustAccAddressFromBech32(req.Consumer)) - if !found { - return nil, status.Errorf(codes.NotFound, "gas consumer %s not found", req.Consumer) - } - return &types.QueryGasConsumerResponse{ - GasConsumer: gc, - }, nil -} - -func (k Querier) GasConsumers(c context.Context, req *types.QueryGasConsumersRequest) (*types.QueryGasConsumersResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - ctx := sdk.UnwrapSDKContext(c) - store := ctx.KVStore(k.storeKey) - - keyPrefix := types.GetAllGasConsumersKey() - gcGetter := func(_, value []byte) types.GasConsumer { - return types.MustUnmarshalGasConsumer(k.cdc, value) - } - gcStore := prefix.NewStore(store, keyPrefix) - var gasConsumers []types.GasConsumer - - pageRes, err := query.FilteredPaginate(gcStore, req.Pagination, func(key, value []byte, accumulate bool) (bool, error) { - gc := gcGetter(key, value) - if accumulate { - gasConsumers = append(gasConsumers, gc) - } - - return true, nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - return &types.QueryGasConsumersResponse{ - GasConsumers: gasConsumers, - Pagination: pageRes, - }, nil -} - -func (k Querier) GasConsumersByGasTankID(c context.Context, req *types.QueryGasConsumersByGasTankIDRequest) (*types.QueryGasConsumersByGasTankIDResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - if req.GasTankId == 0 { - return nil, status.Error(codes.InvalidArgument, "gas tank id cannot be 0") - } - - ctx := sdk.UnwrapSDKContext(c) - - gt, found := k.GetGasTank(ctx, req.GasTankId) - if !found { - return nil, status.Errorf(codes.NotFound, "gas tank with id %d doesn't exist", req.GasTankId) - } - - tankConsumers := []types.GasConsumersByGasTankIDResponse{} - overallFeesConsumed := sdk.NewCoin(gt.FeeDenom, sdk.ZeroInt()) - - allConsumers := k.GetAllGasConsumers(ctx) - for _, consumer := range allConsumers { - for _, consumption := range consumer.Consumptions { - if consumption.GasTankId == req.GasTankId { - overallFeesConsumed.Amount = overallFeesConsumed.Amount.Add(consumption.TotalFeesConsumed) - tankConsumers = append(tankConsumers, types.GasConsumersByGasTankIDResponse{ - Consumer: consumer.Consumer, - IsBlocked: consumption.IsBlocked, - TotalTxsAllowed: consumption.TotalTxsAllowed, - TotalTxsMade: consumption.TotalTxsMade, - TotalFeeConsumptionAllowed: sdk.NewCoin(gt.FeeDenom, consumption.TotalFeeConsumptionAllowed), - TotalFeesConsumed: sdk.NewCoin(gt.FeeDenom, consumption.TotalFeesConsumed), - Usage: consumption.Usage, - }) - break - } - } - } - - return &types.QueryGasConsumersByGasTankIDResponse{ - GasTankId: req.GasTankId, - OverallFeesConsumed: overallFeesConsumed, - GasConsumers: tankConsumers, - }, nil -} - -func (k Querier) GasTankIdsForAllTXC(c context.Context, _ *types.QueryGasTankIdsForAllTXC) (*types.QueryGasTankIdsForAllTXCResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - txToGtids := []*types.TxGTIDs{} - allTxGtids := k.GetAllTxGTIDs(ctx) - for _, val := range allTxGtids { - gtids := val - txToGtids = append(txToGtids, >ids) - } - return &types.QueryGasTankIdsForAllTXCResponse{ - TxToGtIds: txToGtids, - }, nil -} diff --git a/x/gasless/keeper/keeper.go b/x/gasless/keeper/keeper.go deleted file mode 100644 index 597cc224a..000000000 --- a/x/gasless/keeper/keeper.go +++ /dev/null @@ -1,61 +0,0 @@ -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" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - "github.com/comdex-official/comdex/x/gasless/expected" - "github.com/comdex-official/comdex/x/gasless/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/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 - interfaceRegistry codectypes.InterfaceRegistry - - accountKeeper expected.AccountKeeper - bankKeeper expected.BankKeeper - wasmKeeper *wasmkeeper.Keeper - authority string -} - -// NewKeeper creates a new gasless Keeper instance. -func NewKeeper( - cdc codec.BinaryCodec, - storeKey storetypes.StoreKey, - paramSpace paramstypes.Subspace, - interfaceRegistry codectypes.InterfaceRegistry, - accountKeeper expected.AccountKeeper, - bankKeeper expected.BankKeeper, - wasmKeeper *wasmkeeper.Keeper, - authority string, -) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - cdc: cdc, - storeKey: storeKey, - paramSpace: paramSpace, - interfaceRegistry: interfaceRegistry, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - wasmKeeper: wasmKeeper, - authority: authority, - } -} - -// 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/keeper_test.go b/x/gasless/keeper/keeper_test.go deleted file mode 100644 index 83d1cc941..000000000 --- a/x/gasless/keeper/keeper_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package keeper_test - -import ( - "encoding/binary" - "testing" - - "github.com/stretchr/testify/suite" - - sdkmath "cosmossdk.io/math" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - sdk "github.com/cosmos/cosmos-sdk/types" - - chain "github.com/comdex-official/comdex/app" - utils "github.com/comdex-official/comdex/types" - "github.com/comdex-official/comdex/x/gasless" - "github.com/comdex-official/comdex/x/gasless/keeper" - "github.com/comdex-official/comdex/x/gasless/types" - liquiditytypes "github.com/comdex-official/comdex/x/liquidity/types" -) - -type KeeperTestSuite struct { - suite.Suite - - app *chain.App - ctx sdk.Context - keeper keeper.Keeper - querier keeper.Querier - msgServer types.MsgServer -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func (s *KeeperTestSuite) SetupTest() { - s.app = chain.Setup(s.T(), false) - s.ctx = s.app.BaseApp.NewContext(false, tmproto.Header{}) - s.keeper = s.app.GaslessKeeper - s.querier = keeper.Querier{Keeper: s.keeper} - s.msgServer = keeper.NewMsgServerImpl(s.keeper) -} - -// Below are just shortcuts to frequently-used functions. -func (s *KeeperTestSuite) getBalances(addr sdk.AccAddress) sdk.Coins { - return s.app.BankKeeper.GetAllBalances(s.ctx, addr) -} - -func (s *KeeperTestSuite) getBalance(addr sdk.AccAddress, denom string) sdk.Coin { - return s.app.BankKeeper.GetBalance(s.ctx, addr, denom) -} - -func (s *KeeperTestSuite) sendCoins(fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) { - s.T().Helper() - err := s.app.BankKeeper.SendCoins(s.ctx, fromAddr, toAddr, amt) - s.Require().NoError(err) -} - -func (s *KeeperTestSuite) nextBlock() { - gasless.EndBlocker(s.ctx, s.keeper) - gasless.BeginBlocker(s.ctx, s.keeper) -} - -// Below are useful helpers to write test code easily. -func (s *KeeperTestSuite) addr(addrNum int) sdk.AccAddress { - addr := make(sdk.AccAddress, 20) - binary.PutVarint(addr, int64(addrNum)) - return addr -} - -func (s *KeeperTestSuite) fundAddr(addr sdk.AccAddress, amt sdk.Coins) { - // using liquidity module to mint new test coins, since gasless module is not allowed to mint coins - s.T().Helper() - err := s.app.BankKeeper.MintCoins(s.ctx, liquiditytypes.ModuleName, amt) - s.Require().NoError(err) - err = s.app.BankKeeper.SendCoinsFromModuleToAccount(s.ctx, liquiditytypes.ModuleName, addr, amt) - s.Require().NoError(err) -} - -func newInt(i int64) sdkmath.Int { - return sdkmath.NewInt(i) -} - -func newDec(i int64) sdkmath.LegacyDec { - return sdkmath.LegacyNewDec(i) -} - -func coinEq(exp, got sdk.Coin) (bool, string, string, string) { - return exp.IsEqual(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() -} - -func coinsEq(exp, got sdk.Coins) (bool, string, string, string) { - return exp.IsEqual(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() -} - -func intEq(exp, got sdkmath.Int) (bool, string, string, string) { - return exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() -} - -func decEq(exp, got sdkmath.LegacyDec) (bool, string, string, string) { - return exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() -} - -func (s *KeeperTestSuite) CreateNewGasTank( - provider sdk.AccAddress, - feeDenom string, - maxFeeUsagePerTx sdkmath.Int, - maxTxsCountsPerConsumer uint64, - maxFeeUsagePerConsumer sdkmath.Int, - txsAllowed, contractsAllowed []string, - deposit string, -) types.GasTank { - parsedDepositCoin := utils.ParseCoin(deposit) - s.fundAddr(provider, sdk.NewCoins(parsedDepositCoin)) - - txsAllowed = types.RemoveDuplicates(txsAllowed) - contractsAllowed = types.RemoveDuplicates(contractsAllowed) - tank, err := s.keeper.CreateGasTank(s.ctx, types.NewMsgCreateGasTank( - provider, - feeDenom, - maxFeeUsagePerTx, - maxTxsCountsPerConsumer, - maxFeeUsagePerConsumer, - txsAllowed, - contractsAllowed, - parsedDepositCoin, - )) - s.Require().NoError(err) - s.Require().IsType(types.GasTank{}, tank) - s.Require().Equal(feeDenom, tank.FeeDenom) - s.Require().Equal(maxFeeUsagePerTx, tank.MaxFeeUsagePerTx) - s.Require().Equal(maxTxsCountsPerConsumer, tank.MaxTxsCountPerConsumer) - s.Require().Equal(maxFeeUsagePerConsumer, tank.MaxFeeUsagePerConsumer) - s.Require().Equal(txsAllowed, tank.TxsAllowed) - s.Require().Equal(contractsAllowed, tank.ContractsAllowed) - s.Require().Equal(utils.ParseCoin(deposit), s.getBalance(tank.GetGasTankReserveAddress(), feeDenom)) - - for _, tx := range txsAllowed { - txGtids, found := s.keeper.GetTxGTIDs(s.ctx, tx) - s.Require().True(found) - s.Require().IsType(types.TxGTIDs{}, txGtids) - s.Require().IsType([]uint64{}, txGtids.GasTankIds) - s.Require().Equal(txGtids.TxPathOrContractAddress, tx) - s.Require().Equal(tank.Id, txGtids.GasTankIds[len(txGtids.GasTankIds)-1]) - } - - for _, c := range contractsAllowed { - txGtids, found := s.keeper.GetTxGTIDs(s.ctx, c) - s.Require().True(found) - s.Require().IsType(types.TxGTIDs{}, txGtids) - s.Require().IsType([]uint64{}, txGtids.GasTankIds) - s.Require().Equal(txGtids.TxPathOrContractAddress, c) - s.Require().Equal(tank.Id, txGtids.GasTankIds[len(txGtids.GasTankIds)-1]) - } - - return tank -} diff --git a/x/gasless/keeper/msg_server.go b/x/gasless/keeper/msg_server.go deleted file mode 100644 index 679c72932..000000000 --- a/x/gasless/keeper/msg_server.go +++ /dev/null @@ -1,110 +0,0 @@ -package keeper - -import ( - "context" - "cosmossdk.io/errors" - - "github.com/comdex-official/comdex/x/gasless/types" - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/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{} - -// CreateGasTank defines a method to create a new gas tank -func (m msgServer) CreateGasTank(goCtx context.Context, msg *types.MsgCreateGasTank) (*types.MsgCreateGasTankResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if _, err := m.Keeper.CreateGasTank(ctx, msg); err != nil { - return nil, err - } - - return &types.MsgCreateGasTankResponse{}, nil -} - -// AuthorizeActors defines a method to update the actors in gas tank -func (m msgServer) AuthorizeActors(goCtx context.Context, msg *types.MsgAuthorizeActors) (*types.MsgAuthorizeActorsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if _, err := m.Keeper.AuthorizeActors(ctx, msg); err != nil { - return nil, err - } - - return &types.MsgAuthorizeActorsResponse{}, nil -} - -// UpdateGasTankStatus defines a method to update the active status of gas tank -func (m msgServer) UpdateGasTankStatus(goCtx context.Context, msg *types.MsgUpdateGasTankStatus) (*types.MsgUpdateGasTankStatusResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if _, err := m.Keeper.UpdateGasTankStatus(ctx, msg); err != nil { - return nil, err - } - - return &types.MsgUpdateGasTankStatusResponse{}, nil -} - -// UpdateGasTankConfigs defines a method to update a gas tank -func (m msgServer) UpdateGasTankConfigs(goCtx context.Context, msg *types.MsgUpdateGasTankConfig) (*types.MsgUpdateGasTankConfigResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if _, err := m.Keeper.UpdateGasTankConfig(ctx, msg); err != nil { - return nil, err - } - - return &types.MsgUpdateGasTankConfigResponse{}, nil -} - -// BlockConsumer defines a method to block a gas consumer -func (m msgServer) BlockConsumer(goCtx context.Context, msg *types.MsgBlockConsumer) (*types.MsgBlockConsumerResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if _, err := m.Keeper.BlockConsumer(ctx, msg); err != nil { - return nil, err - } - - return &types.MsgBlockConsumerResponse{}, nil -} - -// UnblockConsumer defines a method to unblock a consumer -func (m msgServer) UnblockConsumer(goCtx context.Context, msg *types.MsgUnblockConsumer) (*types.MsgUnblockConsumerResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if _, err := m.Keeper.UnblockConsumer(ctx, msg); err != nil { - return nil, err - } - - return &types.MsgUnblockConsumerResponse{}, nil -} - -// UpdateGasConsumerLimit defines a method to increase consumption limit for a consumer -func (m msgServer) UpdateGasConsumerLimit(goCtx context.Context, msg *types.MsgUpdateGasConsumerLimit) (*types.MsgUpdateGasConsumerLimitResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if _, err := m.Keeper.UpdateGasConsumerLimit(ctx, msg); err != nil { - return nil, err - } - - return &types.MsgUpdateGasConsumerLimitResponse{}, nil -} - -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if k.authority != req.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - k.SetParams(ctx, req.Params) - - return &types.MsgUpdateParamsResponse{}, nil -} diff --git a/x/gasless/keeper/params.go b/x/gasless/keeper/params.go deleted file mode 100644 index f57c7a29f..000000000 --- a/x/gasless/keeper/params.go +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 78f9e8e3d..000000000 --- a/x/gasless/keeper/store.go +++ /dev/null @@ -1,268 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - gogotypes "github.com/cosmos/gogoproto/types" - - "github.com/comdex-official/comdex/x/gasless/types" -) - -func (k Keeper) GetTxGTIDs(ctx sdk.Context, txPathOrContractAddress string) (txGTIDs types.TxGTIDs, found bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetTxGTIDsKey(txPathOrContractAddress)) - if bz == nil { - return - } - txGTIDs = types.MustUnmarshalTxGTIDs(k.cdc, bz) - return txGTIDs, true -} - -func (k Keeper) IterateAllTxGTIDs(ctx sdk.Context, cb func(txGTIDs types.TxGTIDs) (stop bool, err error)) error { - store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.GetAllTxGTIDsKey()) - defer func(iter sdk.Iterator) { - err := iter.Close() - if err != nil { - return - } - }(iter) - for ; iter.Valid(); iter.Next() { - txGTIDs := types.MustUnmarshalTxGTIDs(k.cdc, iter.Value()) - stop, err := cb(txGTIDs) - if err != nil { - return err - } - if stop { - break - } - } - return nil -} - -func (k Keeper) GetAllTxGTIDs(ctx sdk.Context) (txGTIDss []types.TxGTIDs) { - txGTIDss = []types.TxGTIDs{} - _ = k.IterateAllTxGTIDs(ctx, func(txGTIDs types.TxGTIDs) (stop bool, err error) { - txGTIDss = append(txGTIDss, txGTIDs) - return false, nil - }) - return txGTIDss -} - -func (k Keeper) SetTxGTIDs(ctx sdk.Context, txGTIDs types.TxGTIDs) { - store := ctx.KVStore(k.storeKey) - bz := types.MustMarshalTxGTIDs(k.cdc, txGTIDs) - store.Set(types.GetTxGTIDsKey(txGTIDs.TxPathOrContractAddress), bz) -} - -// DeleteTxGTIDs deletes an TxGTIDs. -func (k Keeper) DeleteTxGTIDs(ctx sdk.Context, txGTIDs types.TxGTIDs) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.GetTxGTIDsKey(txGTIDs.TxPathOrContractAddress)) -} - -func (k Keeper) GetLastGasTankID(ctx sdk.Context) (id uint64) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetLastGasTankIDKey()) - if bz == nil { - id = 0 // initialize the GasTankID - } else { - var val gogotypes.UInt64Value - k.cdc.MustUnmarshal(bz, &val) - id = val.GetValue() - } - return -} - -func (k Keeper) SetLastGasTankID(ctx sdk.Context, id uint64) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&gogotypes.UInt64Value{Value: id}) - store.Set(types.GetLastGasTankIDKey(), bz) -} - -func (k Keeper) GetNextGasTankIDWithUpdate(ctx sdk.Context) uint64 { - id := k.GetLastGasTankID(ctx) + 1 - k.SetLastGasTankID(ctx, id) - return id -} - -func (k Keeper) GetGasTank(ctx sdk.Context, id uint64) (gasTank types.GasTank, found bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetGasTankKey(id)) - if bz == nil { - return - } - gasTank = types.MustUnmarshalGasTank(k.cdc, bz) - return gasTank, true -} - -func (k Keeper) IterateAllGasTanks(ctx sdk.Context, cb func(gasTank types.GasTank) (stop bool, err error)) error { - store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.GetAllGasTanksKey()) - defer func(iter sdk.Iterator) { - err := iter.Close() - if err != nil { - return - } - }(iter) - for ; iter.Valid(); iter.Next() { - gasTank := types.MustUnmarshalGasTank(k.cdc, iter.Value()) - stop, err := cb(gasTank) - if err != nil { - return err - } - if stop { - break - } - } - return nil -} - -func (k Keeper) GetAllGasTanks(ctx sdk.Context) (gasTanks []types.GasTank) { - gasTanks = []types.GasTank{} - _ = k.IterateAllGasTanks(ctx, func(gasTank types.GasTank) (stop bool, err error) { - gasTanks = append(gasTanks, gasTank) - return false, nil - }) - return gasTanks -} - -func (k Keeper) SetGasTank(ctx sdk.Context, gasTank types.GasTank) { - store := ctx.KVStore(k.storeKey) - bz := types.MustMarshalGasTank(k.cdc, gasTank) - store.Set(types.GetGasTankKey(gasTank.Id), bz) -} - -func (k Keeper) GetGasConsumer(ctx sdk.Context, consumer sdk.AccAddress) (gasConsumer types.GasConsumer, found bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetGasConsumerKey(consumer)) - if bz == nil { - return - } - gasConsumer = types.MustUnmarshalGasConsumer(k.cdc, bz) - return gasConsumer, true -} - -func (k Keeper) IterateAllGasConsumers(ctx sdk.Context, cb func(gasConsumer types.GasConsumer) (stop bool, err error)) error { - store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.GetAllGasConsumersKey()) - defer func(iter sdk.Iterator) { - err := iter.Close() - if err != nil { - return - } - }(iter) - for ; iter.Valid(); iter.Next() { - gasConsumer := types.MustUnmarshalGasConsumer(k.cdc, iter.Value()) - stop, err := cb(gasConsumer) - if err != nil { - return err - } - if stop { - break - } - } - return nil -} - -func (k Keeper) GetAllGasConsumers(ctx sdk.Context) (gasConsumers []types.GasConsumer) { - gasConsumers = []types.GasConsumer{} - _ = k.IterateAllGasConsumers(ctx, func(gasConsumer types.GasConsumer) (stop bool, err error) { - gasConsumers = append(gasConsumers, gasConsumer) - return false, nil - }) - return gasConsumers -} - -func (k Keeper) SetGasConsumer(ctx sdk.Context, gasConsumer types.GasConsumer) { - store := ctx.KVStore(k.storeKey) - bz := types.MustMarshalGasConsumer(k.cdc, gasConsumer) - store.Set(types.GetGasConsumerKey(sdk.MustAccAddressFromBech32(gasConsumer.Consumer)), bz) -} - -func (k Keeper) GetOrCreateGasConsumer(ctx sdk.Context, consumer sdk.AccAddress, gasTank types.GasTank) (gasConsumer types.GasConsumer, consumptionIndex uint64) { - gasConsumer, found := k.GetGasConsumer(ctx, consumer) - if !found { - gasConsumer = types.NewGasConsumer(consumer) - } - - consumptionLength := uint64(0) - for consumptionIndex, consumption := range gasConsumer.Consumptions { - if consumption.GasTankId == gasTank.Id { - return gasConsumer, uint64(consumptionIndex) - } - consumptionLength++ - } - - gasConsumer.Consumptions = append(gasConsumer.Consumptions, types.NewConsumptionDetail( - gasTank.Id, - gasTank.MaxTxsCountPerConsumer, - gasTank.MaxFeeUsagePerConsumer, - )) - k.SetGasConsumer(ctx, gasConsumer) - // eg. if length of existing consumption is 2, so after adding new consumption the index of appended consuption will also be 2 since sequence begins from 0 - return gasConsumer, consumptionLength -} - -func (k Keeper) AddToTxGtids(ctx sdk.Context, txs, contracts []string, gtid uint64) { - for _, txPath := range txs { - txGtids, found := k.GetTxGTIDs(ctx, txPath) - if !found { - txGtids = types.NewTxGTIDs(txPath) - } - txGtids.GasTankIds = append(txGtids.GasTankIds, gtid) - txGtids.GasTankIds = types.RemoveDuplicatesUint64(txGtids.GasTankIds) - k.SetTxGTIDs(ctx, txGtids) - } - - for _, c := range contracts { - txGtids, found := k.GetTxGTIDs(ctx, c) - if !found { - txGtids = types.NewTxGTIDs(c) - } - txGtids.GasTankIds = append(txGtids.GasTankIds, gtid) - txGtids.GasTankIds = types.RemoveDuplicatesUint64(txGtids.GasTankIds) - k.SetTxGTIDs(ctx, txGtids) - } -} - -func (k Keeper) RemoveFromTxGtids(ctx sdk.Context, txs, contracts []string, gtid uint64) { - for _, txPath := range txs { - txGtids, found := k.GetTxGTIDs(ctx, txPath) - if !found { - continue - } - txGtids.GasTankIds = types.RemoveValueFromListUint64(txGtids.GasTankIds, gtid) - if len(txGtids.GasTankIds) == 0 { - k.DeleteTxGTIDs(ctx, txGtids) - continue - } - k.SetTxGTIDs(ctx, txGtids) - } - - for _, c := range contracts { - txGtids, found := k.GetTxGTIDs(ctx, c) - if !found { - continue - } - txGtids.GasTankIds = types.RemoveValueFromListUint64(txGtids.GasTankIds, gtid) - if len(txGtids.GasTankIds) == 0 { - k.DeleteTxGTIDs(ctx, txGtids) - continue - } - k.SetTxGTIDs(ctx, txGtids) - } -} - -func (k Keeper) UpdateConsumerAllowance(ctx sdk.Context, gasTank types.GasTank) { - allConsumers := k.GetAllGasConsumers(ctx) - for _, consumer := range allConsumers { - for index, consumption := range consumer.Consumptions { - if consumption.GasTankId == gasTank.Id { - consumer.Consumptions[index].TotalTxsAllowed = gasTank.MaxTxsCountPerConsumer - consumer.Consumptions[index].TotalFeeConsumptionAllowed = gasTank.MaxFeeUsagePerConsumer - k.SetGasConsumer(ctx, consumer) - break - } - } - } -} diff --git a/x/gasless/module.go b/x/gasless/module.go deleted file mode 100644 index 02f90bd5f..000000000 --- a/x/gasless/module.go +++ /dev/null @@ -1,165 +0,0 @@ -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 deleted file mode 100644 index 0c76ef7c9..000000000 --- a/x/gasless/types/codec.go +++ /dev/null @@ -1,60 +0,0 @@ -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" - "github.com/cosmos/cosmos-sdk/codec/legacy" - 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) { - cdc.RegisterConcrete(&MsgCreateGasTank{}, "comdex/gasless/MsgCreateGasTank", nil) - cdc.RegisterConcrete(&MsgAuthorizeActors{}, "comdex/gasless/MsgAuthorizeActors", nil) - cdc.RegisterConcrete(&MsgUpdateGasTankStatus{}, "comdex/gasless/MsgUpdateGasTankStatus", nil) - cdc.RegisterConcrete(&MsgUpdateGasTankConfig{}, "comdex/gasless/MsgUpdateGasTankConfig", nil) - cdc.RegisterConcrete(&MsgBlockConsumer{}, "comdex/gasless/MsgBlockConsumer", nil) - cdc.RegisterConcrete(&MsgUnblockConsumer{}, "comdex/gasless/MsgUnblockConsumer", nil) - cdc.RegisterConcrete(&MsgUpdateGasConsumerLimit{}, "comdex/gasless/MsgUpdateGasConsumerLimit", nil) - cdc.RegisterConcrete(&Params{}, "comdex/gasless/Params", nil) - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "comdex/gasless/MsgUpdateParams") -} - -// 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), - &MsgCreateGasTank{}, - &MsgAuthorizeActors{}, - &MsgUpdateGasTankStatus{}, - &MsgUpdateGasTankConfig{}, - &MsgBlockConsumer{}, - &MsgUnblockConsumer{}, - &MsgUpdateGasConsumerLimit{}, - &MsgUpdateParams{}, - ) - - 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 deleted file mode 100644 index e1f4cc862..000000000 --- a/x/gasless/types/errors.go +++ /dev/null @@ -1,14 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// DONTCOVER - -var ( - ErrorUnknownProposalType = sdkerrors.Register(ModuleName, 10000, "unknown proposal type") - ErrorInvalidrequest = sdkerrors.Register(ModuleName, 10001, "invalid request") - ErrorMaxLimitReachedByProvider = sdkerrors.Register(ModuleName, 10002, "provider reached maximum limit to create gas tanks") - ErrorFeeConsumptionFailure = sdkerrors.Register(ModuleName, 10003, "fee cannot be deducted from gas tank") -) diff --git a/x/gasless/types/events.go b/x/gasless/types/events.go deleted file mode 100644 index 8fa8e6e61..000000000 --- a/x/gasless/types/events.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -// Event types for the gasless module. -const ( - EventTypeCreateGasTank = "create_gas_tank" - EventTypeAuthorizeActors = "authorize_actors" - EventTypeUpdateGasTankStatus = "update_gas_tank_status" - EventTypeUpdateGasTankConfig = "update_gas_tank_config" - EventTypeBlockConsumer = "block_consumer" - EventTypeUnblockConsumer = "unblock_consumer" - EventTypeFeeConsumption = "fee_consumption" - - AttributeKeyCreator = "creator" - AttributeKeyProvider = "provider" - AttributeKeyActor = "actor" - AttributeKeyConsumer = "consumer" - AttributeKeyGasTankID = "gas_tank_id" - AttributeKeyFeeDenom = "fee_denom" - AttributeKeyAuthorizedActors = "authorized_actors" - AttributeKeyGasTankStatus = "gas_tank_status" - AttributeKeyMaxFeeUsagePerTx = "max_fee_usage_per_tx" - AttributeKeyMaxTxsCountPerConsumer = "max_txs_count_per_consumer" - AttributeKeyMaxFeeUsagePerConsumer = "max_fee_usage_per_consumer" - AttributeKeyTxsAllowed = "txs_allowed" - AttributeKeyContractsAllowed = "contracts_allowed" - AttributeKeyFeeConsumptionMessage = "message" - AttributeKeyFeeSource = "fee_source" - AttributeKeyFailedGasTankIDs = "failed_gas_tank_ids" - AttributeKeyFailedGasTankErrors = "failed_gas_tank_errors" - AttributeKeySucceededGtid = "succeeded_gas_tank_id" -) diff --git a/x/gasless/types/gasless.go b/x/gasless/types/gasless.go deleted file mode 100644 index 40ffd2f38..000000000 --- a/x/gasless/types/gasless.go +++ /dev/null @@ -1,173 +0,0 @@ -package types - -import ( - fmt "fmt" - "strconv" - "strings" - - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// MustMarshalTxGTIDs returns the TxGTIDs bytes. -// It throws panic if it fails. -func MustMarshalTxGTIDs(cdc codec.BinaryCodec, txGTIDs TxGTIDs) []byte { - return cdc.MustMarshal(&txGTIDs) -} - -// MustUnmarshalTxGTIDs return the unmarshalled TxGTIDs from bytes. -// It throws panic if it fails. -func MustUnmarshalTxGTIDs(cdc codec.BinaryCodec, value []byte) TxGTIDs { - txGTIDs, err := UnmarshalTxGTIDs(cdc, value) - if err != nil { - panic(err) - } - - return txGTIDs -} - -// UnmarshalTxGTIDs returns the TxGTIDs from bytes. -func UnmarshalTxGTIDs(cdc codec.BinaryCodec, value []byte) (txGTIDs TxGTIDs, err error) { - err = cdc.Unmarshal(value, &txGTIDs) - return txGTIDs, err -} - -// MustMarshalGasTank returns the GasTank bytes. -// It throws panic if it fails. -func MustMarshalGasTank(cdc codec.BinaryCodec, gasTank GasTank) []byte { - return cdc.MustMarshal(&gasTank) -} - -// MustUnmarshalGasTank return the unmarshalled GasTank from bytes. -// It throws panic if it fails. -func MustUnmarshalGasTank(cdc codec.BinaryCodec, value []byte) GasTank { - gasTank, err := UnmarshalGasTank(cdc, value) - if err != nil { - panic(err) - } - - return gasTank -} - -// UnmarshalGasTank returns the GasTank from bytes. -func UnmarshalGasTank(cdc codec.BinaryCodec, value []byte) (gasTank GasTank, err error) { - err = cdc.Unmarshal(value, &gasTank) - return gasTank, err -} - -// MustMarshalGasConsumer returns the GasConsumer bytes. -// It throws panic if it fails. -func MustMarshalGasConsumer(cdc codec.BinaryCodec, gasConsumer GasConsumer) []byte { - return cdc.MustMarshal(&gasConsumer) -} - -// MustUnmarshalGasConsumer return the unmarshalled GasConsumer from bytes. -// It throws panic if it fails. -func MustUnmarshalGasConsumer(cdc codec.BinaryCodec, value []byte) GasConsumer { - gasConsumer, err := UnmarshalGasConsumer(cdc, value) - if err != nil { - panic(err) - } - - return gasConsumer -} - -// UnmarshalGasConsumer returns the GasConsumer from bytes. -func UnmarshalGasConsumer(cdc codec.BinaryCodec, value []byte) (gasConsumer GasConsumer, err error) { - err = cdc.Unmarshal(value, &gasConsumer) - return gasConsumer, err -} - -func DeriveGasTankReserveAddress(gasTankID uint64) sdk.AccAddress { - return DeriveAddress( - AddressType32Bytes, - ModuleName, - strings.Join([]string{GasTankAddressPrefix, strconv.FormatUint(gasTankID, 10)}, ModuleAddressNameSplitter)) -} - -func NewGasTank( - id uint64, - provider sdk.AccAddress, - maxTxsCountPerConsumer uint64, - maxFeeUsagePerConsumer sdkmath.Int, - maxFeeUsagePerTx sdkmath.Int, - txsAllowed []string, - contractsAllowed []string, - feeDenom string, -) GasTank { - return GasTank{ - Id: id, - Provider: provider.String(), - Reserve: DeriveGasTankReserveAddress(id).String(), - IsActive: true, - MaxTxsCountPerConsumer: maxTxsCountPerConsumer, - MaxFeeUsagePerConsumer: maxFeeUsagePerConsumer, - MaxFeeUsagePerTx: maxFeeUsagePerTx, - TxsAllowed: RemoveDuplicates(txsAllowed), - ContractsAllowed: RemoveDuplicates(contractsAllowed), - AuthorizedActors: []string{}, - FeeDenom: feeDenom, - } -} - -func (gasTank GasTank) GetGasTankReserveAddress() sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(gasTank.Reserve) - if err != nil { - panic(err) - } - return addr -} - -func (gasTank GasTank) Validate() error { - if gasTank.Id == 0 { - return fmt.Errorf("pair id must not be 0") - } - if _, err := sdk.AccAddressFromBech32(gasTank.Provider); err != nil { - return fmt.Errorf("invalid provider address: %v", err) - } - if err := sdk.ValidateDenom(gasTank.FeeDenom); err != nil { - return fmt.Errorf("invalid fee denom: %w", err) - } - if gasTank.MaxTxsCountPerConsumer == 0 { - return fmt.Errorf("max tx count per consumer must not be 0") - } - if !gasTank.MaxFeeUsagePerTx.IsPositive() { - return fmt.Errorf("max_fee_usage_per_tx should be positive") - } - if !gasTank.MaxFeeUsagePerConsumer.IsPositive() { - return fmt.Errorf("max_fee_usage_per_consumer should be positive") - } - if len(gasTank.TxsAllowed) == 0 && len(gasTank.ContractsAllowed) == 0 { - return fmt.Errorf("atleast one tx or contract is required to initialize") - } - - return nil -} - -func NewGasConsumer( - consumer sdk.AccAddress, -) GasConsumer { - return GasConsumer{ - Consumer: consumer.String(), - Consumptions: []*ConsumptionDetail{}, - } -} - -func (gasConsumer GasConsumer) Validate() error { - if _, err := sdk.AccAddressFromBech32(gasConsumer.Consumer); err != nil { - return fmt.Errorf("invalid consumer address: %v", err) - } - return nil -} - -func NewTxGTIDs(tpoc string) TxGTIDs { - return TxGTIDs{ - TxPathOrContractAddress: tpoc, - GasTankIds: []uint64{}, - } -} - -func (txGTIDs TxGTIDs) Validate() error { - return nil -} diff --git a/x/gasless/types/gasless.pb.go b/x/gasless/types/gasless.pb.go deleted file mode 100644 index 594d9636d..000000000 --- a/x/gasless/types/gasless.pb.go +++ /dev/null @@ -1,2331 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/gasless/v1beta1/gasless.proto - -package types - -import ( - cosmossdk_io_math "cosmossdk.io/math" - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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 - -// AddressType enumerates the available types of a address. -type AddressType int32 - -const ( - // the 32 bytes length address type of ADR 028. - AddressType32Bytes AddressType = 0 - // the default 20 bytes length address type. - AddressType20Bytes AddressType = 1 -) - -var AddressType_name = map[int32]string{ - 0: "ADDRESS_TYPE_32_BYTES", - 1: "ADDRESS_TYPE_20_BYTES", -} - -var AddressType_value = map[string]int32{ - "ADDRESS_TYPE_32_BYTES": 0, - "ADDRESS_TYPE_20_BYTES": 1, -} - -func (x AddressType) String() string { - return proto.EnumName(AddressType_name, int32(x)) -} - -func (AddressType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a0a6c07135ead427, []int{0} -} - -type TxGTIDs struct { - TxPathOrContractAddress string `protobuf:"bytes,1,opt,name=tx_path_or_contract_address,json=txPathOrContractAddress,proto3" json:"tx_path_or_contract_address,omitempty"` - GasTankIds []uint64 `protobuf:"varint,2,rep,packed,name=gas_tank_ids,json=gasTankIds,proto3" json:"gas_tank_ids,omitempty"` -} - -func (m *TxGTIDs) Reset() { *m = TxGTIDs{} } -func (m *TxGTIDs) String() string { return proto.CompactTextString(m) } -func (*TxGTIDs) ProtoMessage() {} -func (*TxGTIDs) Descriptor() ([]byte, []int) { - return fileDescriptor_a0a6c07135ead427, []int{0} -} -func (m *TxGTIDs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxGTIDs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxGTIDs.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 *TxGTIDs) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxGTIDs.Merge(m, src) -} -func (m *TxGTIDs) XXX_Size() int { - return m.Size() -} -func (m *TxGTIDs) XXX_DiscardUnknown() { - xxx_messageInfo_TxGTIDs.DiscardUnknown(m) -} - -var xxx_messageInfo_TxGTIDs proto.InternalMessageInfo - -type GasTank struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Reserve string `protobuf:"bytes,3,opt,name=reserve,proto3" json:"reserve,omitempty"` - IsActive bool `protobuf:"varint,4,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` - MaxTxsCountPerConsumer uint64 `protobuf:"varint,5,opt,name=max_txs_count_per_consumer,json=maxTxsCountPerConsumer,proto3" json:"max_txs_count_per_consumer,omitempty"` - MaxFeeUsagePerConsumer cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=max_fee_usage_per_consumer,json=maxFeeUsagePerConsumer,proto3,customtype=cosmossdk.io/math.Int" json:"max_fee_usage_per_consumer"` - MaxFeeUsagePerTx cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=max_fee_usage_per_tx,json=maxFeeUsagePerTx,proto3,customtype=cosmossdk.io/math.Int" json:"max_fee_usage_per_tx"` - TxsAllowed []string `protobuf:"bytes,8,rep,name=txs_allowed,json=txsAllowed,proto3" json:"txs_allowed,omitempty"` - ContractsAllowed []string `protobuf:"bytes,9,rep,name=contracts_allowed,json=contractsAllowed,proto3" json:"contracts_allowed,omitempty"` - AuthorizedActors []string `protobuf:"bytes,10,rep,name=authorized_actors,json=authorizedActors,proto3" json:"authorized_actors,omitempty"` - FeeDenom string `protobuf:"bytes,11,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` -} - -func (m *GasTank) Reset() { *m = GasTank{} } -func (m *GasTank) String() string { return proto.CompactTextString(m) } -func (*GasTank) ProtoMessage() {} -func (*GasTank) Descriptor() ([]byte, []int) { - return fileDescriptor_a0a6c07135ead427, []int{1} -} -func (m *GasTank) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GasTank) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GasTank.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 *GasTank) XXX_Merge(src proto.Message) { - xxx_messageInfo_GasTank.Merge(m, src) -} -func (m *GasTank) XXX_Size() int { - return m.Size() -} -func (m *GasTank) XXX_DiscardUnknown() { - xxx_messageInfo_GasTank.DiscardUnknown(m) -} - -var xxx_messageInfo_GasTank proto.InternalMessageInfo - -type UsageDetail struct { - Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - GasConsumed cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=gas_consumed,json=gasConsumed,proto3,customtype=cosmossdk.io/math.Int" json:"gas_consumed"` -} - -func (m *UsageDetail) Reset() { *m = UsageDetail{} } -func (m *UsageDetail) String() string { return proto.CompactTextString(m) } -func (*UsageDetail) ProtoMessage() {} -func (*UsageDetail) Descriptor() ([]byte, []int) { - return fileDescriptor_a0a6c07135ead427, []int{2} -} -func (m *UsageDetail) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UsageDetail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UsageDetail.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 *UsageDetail) XXX_Merge(src proto.Message) { - xxx_messageInfo_UsageDetail.Merge(m, src) -} -func (m *UsageDetail) XXX_Size() int { - return m.Size() -} -func (m *UsageDetail) XXX_DiscardUnknown() { - xxx_messageInfo_UsageDetail.DiscardUnknown(m) -} - -var xxx_messageInfo_UsageDetail proto.InternalMessageInfo - -type UsageDetails struct { - UsageIdentifier string `protobuf:"bytes,1,opt,name=usage_identifier,json=usageIdentifier,proto3" json:"usage_identifier,omitempty"` - Details []*UsageDetail `protobuf:"bytes,2,rep,name=details,proto3" json:"details,omitempty"` -} - -func (m *UsageDetails) Reset() { *m = UsageDetails{} } -func (m *UsageDetails) String() string { return proto.CompactTextString(m) } -func (*UsageDetails) ProtoMessage() {} -func (*UsageDetails) Descriptor() ([]byte, []int) { - return fileDescriptor_a0a6c07135ead427, []int{3} -} -func (m *UsageDetails) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UsageDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UsageDetails.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 *UsageDetails) XXX_Merge(src proto.Message) { - xxx_messageInfo_UsageDetails.Merge(m, src) -} -func (m *UsageDetails) XXX_Size() int { - return m.Size() -} -func (m *UsageDetails) XXX_DiscardUnknown() { - xxx_messageInfo_UsageDetails.DiscardUnknown(m) -} - -var xxx_messageInfo_UsageDetails proto.InternalMessageInfo - -type Usage struct { - Txs []*UsageDetails `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` - Contracts []*UsageDetails `protobuf:"bytes,2,rep,name=contracts,proto3" json:"contracts,omitempty"` -} - -func (m *Usage) Reset() { *m = Usage{} } -func (m *Usage) String() string { return proto.CompactTextString(m) } -func (*Usage) ProtoMessage() {} -func (*Usage) Descriptor() ([]byte, []int) { - return fileDescriptor_a0a6c07135ead427, []int{4} -} -func (m *Usage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Usage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Usage.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 *Usage) XXX_Merge(src proto.Message) { - xxx_messageInfo_Usage.Merge(m, src) -} -func (m *Usage) XXX_Size() int { - return m.Size() -} -func (m *Usage) XXX_DiscardUnknown() { - xxx_messageInfo_Usage.DiscardUnknown(m) -} - -var xxx_messageInfo_Usage proto.InternalMessageInfo - -type ConsumptionDetail struct { - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` - IsBlocked bool `protobuf:"varint,2,opt,name=is_blocked,json=isBlocked,proto3" json:"is_blocked,omitempty"` - TotalTxsAllowed uint64 `protobuf:"varint,3,opt,name=total_txs_allowed,json=totalTxsAllowed,proto3" json:"total_txs_allowed,omitempty"` - TotalTxsMade uint64 `protobuf:"varint,4,opt,name=total_txs_made,json=totalTxsMade,proto3" json:"total_txs_made,omitempty"` - TotalFeeConsumptionAllowed cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=total_fee_consumption_allowed,json=totalFeeConsumptionAllowed,proto3,customtype=cosmossdk.io/math.Int" json:"total_fee_consumption_allowed"` - TotalFeesConsumed cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=total_fees_consumed,json=totalFeesConsumed,proto3,customtype=cosmossdk.io/math.Int" json:"total_fees_consumed"` - Usage *Usage `protobuf:"bytes,7,opt,name=usage,proto3" json:"usage,omitempty"` -} - -func (m *ConsumptionDetail) Reset() { *m = ConsumptionDetail{} } -func (m *ConsumptionDetail) String() string { return proto.CompactTextString(m) } -func (*ConsumptionDetail) ProtoMessage() {} -func (*ConsumptionDetail) Descriptor() ([]byte, []int) { - return fileDescriptor_a0a6c07135ead427, []int{5} -} -func (m *ConsumptionDetail) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConsumptionDetail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConsumptionDetail.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 *ConsumptionDetail) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsumptionDetail.Merge(m, src) -} -func (m *ConsumptionDetail) XXX_Size() int { - return m.Size() -} -func (m *ConsumptionDetail) XXX_DiscardUnknown() { - xxx_messageInfo_ConsumptionDetail.DiscardUnknown(m) -} - -var xxx_messageInfo_ConsumptionDetail proto.InternalMessageInfo - -type GasConsumer struct { - Consumer string `protobuf:"bytes,1,opt,name=consumer,proto3" json:"consumer,omitempty"` - Consumptions []*ConsumptionDetail `protobuf:"bytes,2,rep,name=consumptions,proto3" json:"consumptions,omitempty"` -} - -func (m *GasConsumer) Reset() { *m = GasConsumer{} } -func (m *GasConsumer) String() string { return proto.CompactTextString(m) } -func (*GasConsumer) ProtoMessage() {} -func (*GasConsumer) Descriptor() ([]byte, []int) { - return fileDescriptor_a0a6c07135ead427, []int{6} -} -func (m *GasConsumer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GasConsumer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GasConsumer.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 *GasConsumer) XXX_Merge(src proto.Message) { - xxx_messageInfo_GasConsumer.Merge(m, src) -} -func (m *GasConsumer) XXX_Size() int { - return m.Size() -} -func (m *GasConsumer) XXX_DiscardUnknown() { - xxx_messageInfo_GasConsumer.DiscardUnknown(m) -} - -var xxx_messageInfo_GasConsumer proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("comdex.gasless.v1beta1.AddressType", AddressType_name, AddressType_value) - proto.RegisterType((*TxGTIDs)(nil), "comdex.gasless.v1beta1.TxGTIDs") - proto.RegisterType((*GasTank)(nil), "comdex.gasless.v1beta1.GasTank") - proto.RegisterType((*UsageDetail)(nil), "comdex.gasless.v1beta1.UsageDetail") - proto.RegisterType((*UsageDetails)(nil), "comdex.gasless.v1beta1.UsageDetails") - proto.RegisterType((*Usage)(nil), "comdex.gasless.v1beta1.Usage") - proto.RegisterType((*ConsumptionDetail)(nil), "comdex.gasless.v1beta1.ConsumptionDetail") - proto.RegisterType((*GasConsumer)(nil), "comdex.gasless.v1beta1.GasConsumer") -} - -func init() { - proto.RegisterFile("comdex/gasless/v1beta1/gasless.proto", fileDescriptor_a0a6c07135ead427) -} - -var fileDescriptor_a0a6c07135ead427 = []byte{ - // 898 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0xc6, 0x4e, 0x6d, 0xbf, 0x8d, 0xda, 0x64, 0x68, 0xc3, 0xca, 0x55, 0x6c, 0xcb, 0xe4, - 0x90, 0x16, 0x61, 0x37, 0x8e, 0xc4, 0x01, 0x81, 0x84, 0x5d, 0xa7, 0x51, 0x0e, 0x51, 0xa3, 0xcd, - 0x72, 0x08, 0x97, 0x65, 0xec, 0x19, 0xaf, 0x47, 0xf1, 0x7a, 0xac, 0x9d, 0x71, 0xd8, 0x70, 0xe5, - 0x82, 0x7a, 0xaa, 0xc4, 0x99, 0x13, 0x7f, 0x26, 0xc7, 0x1e, 0x11, 0x87, 0x02, 0xc9, 0x8d, 0x5f, - 0x81, 0x66, 0x66, 0x77, 0xbd, 0x51, 0x80, 0xfa, 0xe6, 0x37, 0xef, 0xfb, 0xbe, 0x99, 0xf7, 0xde, - 0xf7, 0xd6, 0xb0, 0x3b, 0xe2, 0x21, 0xa1, 0x71, 0x27, 0xc0, 0x62, 0x4a, 0x85, 0xe8, 0x5c, 0xee, - 0x0f, 0xa9, 0xc4, 0xfb, 0x69, 0xdc, 0x9e, 0x47, 0x5c, 0x72, 0xb4, 0x6d, 0x50, 0xed, 0xf4, 0x34, - 0x41, 0xd5, 0x1e, 0x07, 0x3c, 0xe0, 0x1a, 0xd2, 0x51, 0xbf, 0x0c, 0xba, 0xd6, 0x08, 0x38, 0x0f, - 0xa6, 0xb4, 0xa3, 0xa3, 0xe1, 0x62, 0xdc, 0x91, 0x2c, 0xa4, 0x42, 0xe2, 0x70, 0x6e, 0x00, 0x2d, - 0x06, 0x65, 0x2f, 0x3e, 0xf2, 0x8e, 0x07, 0x02, 0x7d, 0x09, 0x4f, 0x65, 0xec, 0xcf, 0xb1, 0x9c, - 0xf8, 0x3c, 0xf2, 0x47, 0x7c, 0x26, 0x23, 0x3c, 0x92, 0x3e, 0x26, 0x24, 0xa2, 0x42, 0x38, 0x56, - 0xd3, 0xda, 0xab, 0xba, 0x1f, 0xcb, 0xf8, 0x14, 0xcb, 0xc9, 0xeb, 0xe8, 0x65, 0x92, 0xef, 0x99, - 0x34, 0x6a, 0xc2, 0x46, 0x80, 0x85, 0x2f, 0xf1, 0xec, 0xc2, 0x67, 0x44, 0x38, 0x6b, 0xcd, 0xe2, - 0x5e, 0xc9, 0x85, 0x00, 0x0b, 0x0f, 0xcf, 0x2e, 0x8e, 0x89, 0x68, 0xfd, 0x5d, 0x84, 0xf2, 0x91, - 0x09, 0xd1, 0x43, 0x58, 0x63, 0x44, 0x4b, 0x96, 0xdc, 0x35, 0x46, 0x50, 0x0d, 0x2a, 0xf3, 0x88, - 0x5f, 0x32, 0x42, 0x23, 0x67, 0x4d, 0x5f, 0x94, 0xc5, 0xc8, 0x81, 0x72, 0x44, 0x05, 0x8d, 0x2e, - 0xa9, 0x53, 0xd4, 0xa9, 0x34, 0x44, 0x4f, 0xa1, 0xca, 0x84, 0x8f, 0x47, 0x92, 0x5d, 0x52, 0xa7, - 0xd4, 0xb4, 0xf6, 0x2a, 0x6e, 0x85, 0x89, 0x9e, 0x8e, 0xd1, 0x17, 0x50, 0x0b, 0x71, 0xec, 0xcb, - 0x58, 0xf8, 0x23, 0xbe, 0x98, 0x49, 0x7f, 0x4e, 0x75, 0x55, 0x62, 0x11, 0xd2, 0xc8, 0x59, 0xd7, - 0x57, 0x6f, 0x87, 0x38, 0xf6, 0x62, 0xf1, 0x52, 0xe5, 0x4f, 0xa9, 0xaa, 0x49, 0x67, 0xd1, 0xb9, - 0xe1, 0x8e, 0x29, 0xf5, 0x17, 0x02, 0x07, 0xf4, 0x2e, 0xf7, 0x81, 0x7a, 0x45, 0x7f, 0xe7, 0xfa, - 0x7d, 0xa3, 0xf0, 0xfb, 0xfb, 0xc6, 0x93, 0x11, 0x17, 0x21, 0x17, 0x82, 0x5c, 0xb4, 0x19, 0xef, - 0x84, 0x58, 0x4e, 0xda, 0xc7, 0x33, 0xa9, 0xa5, 0x5f, 0x51, 0xfa, 0x8d, 0xa2, 0xe7, 0xa5, 0x4f, - 0xe0, 0xf1, 0x7d, 0x69, 0x19, 0x3b, 0xe5, 0x55, 0x44, 0x37, 0xef, 0x8a, 0x7a, 0x31, 0x6a, 0x80, - 0xad, 0x2a, 0xc4, 0xd3, 0x29, 0xff, 0x9e, 0x12, 0xa7, 0xd2, 0x2c, 0xee, 0x55, 0x5d, 0x90, 0xb1, - 0xe8, 0x99, 0x13, 0xf4, 0x29, 0x6c, 0xa5, 0xa3, 0x5c, 0xc2, 0xaa, 0x1a, 0xb6, 0x99, 0x25, 0x72, - 0x60, 0xbc, 0x90, 0x13, 0x1e, 0xb1, 0x1f, 0x28, 0x51, 0x8d, 0xe5, 0x91, 0x70, 0xc0, 0x80, 0x97, - 0x89, 0x9e, 0x3e, 0x57, 0xdd, 0x57, 0x55, 0x10, 0x3a, 0xe3, 0xa1, 0x63, 0x9b, 0xa1, 0x8d, 0x29, - 0x1d, 0xa8, 0xb8, 0xf5, 0xb3, 0x05, 0xb6, 0x7e, 0xe6, 0x80, 0x4a, 0xcc, 0xa6, 0xa8, 0x0f, 0xd5, - 0xcc, 0x7a, 0x7a, 0xee, 0x76, 0xb7, 0xd6, 0x36, 0xe6, 0x6c, 0xa7, 0xe6, 0x6c, 0x7b, 0x29, 0xa2, - 0x5f, 0x51, 0x7d, 0x78, 0xfb, 0x47, 0xc3, 0x72, 0x97, 0x34, 0xf4, 0xb5, 0xb1, 0x58, 0x32, 0x07, - 0x62, 0x8c, 0xf2, 0xa1, 0x96, 0xd9, 0x01, 0x16, 0x49, 0xf3, 0x49, 0x2b, 0x86, 0x8d, 0xdc, 0xa3, - 0x04, 0x7a, 0x06, 0x9b, 0x66, 0x08, 0x8c, 0xd0, 0x99, 0x64, 0x63, 0x46, 0xa3, 0xc4, 0xe7, 0x8f, - 0xf4, 0xf9, 0x71, 0x76, 0x8c, 0xbe, 0x82, 0x32, 0x31, 0x2c, 0x6d, 0x6d, 0xbb, 0xfb, 0x49, 0xfb, - 0xdf, 0x37, 0xb1, 0x9d, 0xbb, 0xc1, 0x4d, 0x39, 0xad, 0x1f, 0x2d, 0x58, 0xd7, 0x09, 0xf4, 0x39, - 0x14, 0x65, 0xac, 0xd6, 0x49, 0x89, 0xec, 0xae, 0x20, 0x22, 0x5c, 0x45, 0x50, 0x1d, 0xcc, 0xe6, - 0x95, 0x3c, 0x61, 0x35, 0xf6, 0x92, 0xd6, 0x7a, 0x53, 0x84, 0x2d, 0xd3, 0x8c, 0xb9, 0x64, 0x7c, - 0x96, 0xcc, 0xa6, 0x0e, 0x76, 0x6e, 0x75, 0x93, 0xad, 0xac, 0x66, 0x9b, 0x8b, 0x76, 0x00, 0x98, - 0xf0, 0x87, 0x53, 0x3e, 0xba, 0x48, 0xba, 0x5e, 0x71, 0xab, 0x4c, 0xf4, 0xcd, 0x01, 0x7a, 0x0e, - 0x5b, 0x92, 0x4b, 0x3c, 0xf5, 0xf3, 0x46, 0x2c, 0x6a, 0x91, 0x47, 0x3a, 0xe1, 0x2d, 0xdd, 0xb8, - 0x0b, 0x0f, 0x97, 0xd8, 0x10, 0x13, 0xb3, 0xb6, 0x25, 0x77, 0x23, 0x05, 0x9e, 0x60, 0x42, 0xd1, - 0x77, 0xb0, 0x63, 0x50, 0xca, 0x5f, 0xa3, 0xe5, 0x7b, 0x33, 0xf5, 0xf5, 0x55, 0x26, 0x5f, 0xd3, - 0x1a, 0xaf, 0x28, 0xcd, 0x55, 0x9c, 0xbe, 0xe3, 0x04, 0x3e, 0xca, 0x6e, 0xc8, 0x39, 0x6a, 0xa5, - 0xcd, 0xde, 0x4a, 0x75, 0x33, 0x5f, 0xa1, 0x03, 0x58, 0xd7, 0x7e, 0xd1, 0x5b, 0x6c, 0x77, 0x77, - 0xfe, 0x77, 0x2e, 0xae, 0xc1, 0xb6, 0x62, 0xb0, 0x8f, 0x32, 0x6f, 0x46, 0xea, 0x13, 0x98, 0x7d, - 0x61, 0x8c, 0x07, 0xb3, 0x18, 0x9d, 0xc0, 0x46, 0xae, 0x0d, 0xe9, 0xf8, 0x9f, 0xfd, 0xd7, 0x35, - 0xf7, 0x46, 0xec, 0xde, 0xa1, 0x3f, 0xbf, 0x02, 0x3b, 0xf9, 0x6c, 0x7b, 0x57, 0x73, 0x8a, 0xf6, - 0xe1, 0x49, 0x6f, 0x30, 0x70, 0x0f, 0xcf, 0xce, 0x7c, 0xef, 0xfc, 0xf4, 0xd0, 0x3f, 0xe8, 0xfa, - 0xfd, 0x73, 0xef, 0xf0, 0x6c, 0xb3, 0x50, 0xdb, 0x7e, 0xf3, 0x4b, 0x13, 0xe5, 0xb0, 0x07, 0xdd, - 0xfe, 0x95, 0xa4, 0xe2, 0x1e, 0xa5, 0xfb, 0x22, 0xa1, 0x58, 0xf7, 0x28, 0xdd, 0x17, 0x9a, 0x52, - 0x2b, 0xfd, 0xf4, 0x6b, 0xbd, 0xd0, 0x7f, 0x7d, 0xfd, 0x57, 0xbd, 0x70, 0x7d, 0x53, 0xb7, 0xde, - 0xdd, 0xd4, 0xad, 0x3f, 0x6f, 0xea, 0xd6, 0xdb, 0xdb, 0x7a, 0xe1, 0xdd, 0x6d, 0xbd, 0xf0, 0xdb, - 0x6d, 0xbd, 0xf0, 0xed, 0x7e, 0xc0, 0xe4, 0x64, 0x31, 0x54, 0x75, 0x75, 0x4c, 0x6d, 0x9f, 0xf1, - 0xf1, 0x98, 0x8d, 0x18, 0x9e, 0x26, 0x71, 0x67, 0xf9, 0xff, 0x28, 0xaf, 0xe6, 0x54, 0x0c, 0x1f, - 0xe8, 0xaf, 0xc7, 0xc1, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x2e, 0xbe, 0x6b, 0x3e, 0x07, - 0x00, 0x00, -} - -func (m *TxGTIDs) 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 *TxGTIDs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxGTIDs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GasTankIds) > 0 { - dAtA2 := make([]byte, len(m.GasTankIds)*10) - var j1 int - for _, num := range m.GasTankIds { - for num >= 1<<7 { - dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j1++ - } - dAtA2[j1] = uint8(num) - j1++ - } - i -= j1 - copy(dAtA[i:], dAtA2[:j1]) - i = encodeVarintGasless(dAtA, i, uint64(j1)) - i-- - dAtA[i] = 0x12 - } - if len(m.TxPathOrContractAddress) > 0 { - i -= len(m.TxPathOrContractAddress) - copy(dAtA[i:], m.TxPathOrContractAddress) - i = encodeVarintGasless(dAtA, i, uint64(len(m.TxPathOrContractAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GasTank) 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 *GasTank) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GasTank) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FeeDenom) > 0 { - i -= len(m.FeeDenom) - copy(dAtA[i:], m.FeeDenom) - i = encodeVarintGasless(dAtA, i, uint64(len(m.FeeDenom))) - i-- - dAtA[i] = 0x5a - } - if len(m.AuthorizedActors) > 0 { - for iNdEx := len(m.AuthorizedActors) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AuthorizedActors[iNdEx]) - copy(dAtA[i:], m.AuthorizedActors[iNdEx]) - i = encodeVarintGasless(dAtA, i, uint64(len(m.AuthorizedActors[iNdEx]))) - i-- - dAtA[i] = 0x52 - } - } - if len(m.ContractsAllowed) > 0 { - for iNdEx := len(m.ContractsAllowed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ContractsAllowed[iNdEx]) - copy(dAtA[i:], m.ContractsAllowed[iNdEx]) - i = encodeVarintGasless(dAtA, i, uint64(len(m.ContractsAllowed[iNdEx]))) - i-- - dAtA[i] = 0x4a - } - } - if len(m.TxsAllowed) > 0 { - for iNdEx := len(m.TxsAllowed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.TxsAllowed[iNdEx]) - copy(dAtA[i:], m.TxsAllowed[iNdEx]) - i = encodeVarintGasless(dAtA, i, uint64(len(m.TxsAllowed[iNdEx]))) - i-- - dAtA[i] = 0x42 - } - } - { - size := m.MaxFeeUsagePerTx.Size() - i -= size - if _, err := m.MaxFeeUsagePerTx.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - { - size := m.MaxFeeUsagePerConsumer.Size() - i -= size - if _, err := m.MaxFeeUsagePerConsumer.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - if m.MaxTxsCountPerConsumer != 0 { - i = encodeVarintGasless(dAtA, i, uint64(m.MaxTxsCountPerConsumer)) - i-- - dAtA[i] = 0x28 - } - if m.IsActive { - i-- - if m.IsActive { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.Reserve) > 0 { - i -= len(m.Reserve) - copy(dAtA[i:], m.Reserve) - i = encodeVarintGasless(dAtA, i, uint64(len(m.Reserve))) - i-- - dAtA[i] = 0x1a - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintGasless(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if m.Id != 0 { - i = encodeVarintGasless(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *UsageDetail) 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 *UsageDetail) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UsageDetail) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.GasConsumed.Size() - i -= size - if _, err := m.GasConsumed.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintGasless(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *UsageDetails) 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 *UsageDetails) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UsageDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Details) > 0 { - for iNdEx := len(m.Details) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Details[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.UsageIdentifier) > 0 { - i -= len(m.UsageIdentifier) - copy(dAtA[i:], m.UsageIdentifier) - i = encodeVarintGasless(dAtA, i, uint64(len(m.UsageIdentifier))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Usage) 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 *Usage) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Usage) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Contracts) > 0 { - for iNdEx := len(m.Contracts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Contracts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Txs) > 0 { - for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Txs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ConsumptionDetail) 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 *ConsumptionDetail) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConsumptionDetail) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Usage != nil { - { - size, err := m.Usage.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - { - size := m.TotalFeesConsumed.Size() - i -= size - if _, err := m.TotalFeesConsumed.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - { - size := m.TotalFeeConsumptionAllowed.Size() - i -= size - if _, err := m.TotalFeeConsumptionAllowed.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.TotalTxsMade != 0 { - i = encodeVarintGasless(dAtA, i, uint64(m.TotalTxsMade)) - i-- - dAtA[i] = 0x20 - } - if m.TotalTxsAllowed != 0 { - i = encodeVarintGasless(dAtA, i, uint64(m.TotalTxsAllowed)) - i-- - dAtA[i] = 0x18 - } - if m.IsBlocked { - i-- - if m.IsBlocked { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.GasTankId != 0 { - i = encodeVarintGasless(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *GasConsumer) 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 *GasConsumer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GasConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Consumptions) > 0 { - for iNdEx := len(m.Consumptions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Consumptions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGasless(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintGasless(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGasless(dAtA []byte, offset int, v uint64) int { - offset -= sovGasless(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *TxGTIDs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TxPathOrContractAddress) - if l > 0 { - n += 1 + l + sovGasless(uint64(l)) - } - if len(m.GasTankIds) > 0 { - l = 0 - for _, e := range m.GasTankIds { - l += sovGasless(uint64(e)) - } - n += 1 + sovGasless(uint64(l)) + l - } - return n -} - -func (m *GasTank) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovGasless(uint64(m.Id)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovGasless(uint64(l)) - } - l = len(m.Reserve) - if l > 0 { - n += 1 + l + sovGasless(uint64(l)) - } - if m.IsActive { - n += 2 - } - if m.MaxTxsCountPerConsumer != 0 { - n += 1 + sovGasless(uint64(m.MaxTxsCountPerConsumer)) - } - l = m.MaxFeeUsagePerConsumer.Size() - n += 1 + l + sovGasless(uint64(l)) - l = m.MaxFeeUsagePerTx.Size() - n += 1 + l + sovGasless(uint64(l)) - if len(m.TxsAllowed) > 0 { - for _, s := range m.TxsAllowed { - l = len(s) - n += 1 + l + sovGasless(uint64(l)) - } - } - if len(m.ContractsAllowed) > 0 { - for _, s := range m.ContractsAllowed { - l = len(s) - n += 1 + l + sovGasless(uint64(l)) - } - } - if len(m.AuthorizedActors) > 0 { - for _, s := range m.AuthorizedActors { - l = len(s) - n += 1 + l + sovGasless(uint64(l)) - } - } - l = len(m.FeeDenom) - if l > 0 { - n += 1 + l + sovGasless(uint64(l)) - } - return n -} - -func (m *UsageDetail) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) - n += 1 + l + sovGasless(uint64(l)) - l = m.GasConsumed.Size() - n += 1 + l + sovGasless(uint64(l)) - return n -} - -func (m *UsageDetails) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.UsageIdentifier) - if l > 0 { - n += 1 + l + sovGasless(uint64(l)) - } - if len(m.Details) > 0 { - for _, e := range m.Details { - l = e.Size() - n += 1 + l + sovGasless(uint64(l)) - } - } - return n -} - -func (m *Usage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Txs) > 0 { - for _, e := range m.Txs { - l = e.Size() - n += 1 + l + sovGasless(uint64(l)) - } - } - if len(m.Contracts) > 0 { - for _, e := range m.Contracts { - l = e.Size() - n += 1 + l + sovGasless(uint64(l)) - } - } - return n -} - -func (m *ConsumptionDetail) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovGasless(uint64(m.GasTankId)) - } - if m.IsBlocked { - n += 2 - } - if m.TotalTxsAllowed != 0 { - n += 1 + sovGasless(uint64(m.TotalTxsAllowed)) - } - if m.TotalTxsMade != 0 { - n += 1 + sovGasless(uint64(m.TotalTxsMade)) - } - l = m.TotalFeeConsumptionAllowed.Size() - n += 1 + l + sovGasless(uint64(l)) - l = m.TotalFeesConsumed.Size() - n += 1 + l + sovGasless(uint64(l)) - if m.Usage != nil { - l = m.Usage.Size() - n += 1 + l + sovGasless(uint64(l)) - } - return n -} - -func (m *GasConsumer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovGasless(uint64(l)) - } - if len(m.Consumptions) > 0 { - for _, e := range m.Consumptions { - l = e.Size() - n += 1 + l + sovGasless(uint64(l)) - } - } - return n -} - -func sovGasless(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGasless(x uint64) (n int) { - return sovGasless(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *TxGTIDs) 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 ErrIntOverflowGasless - } - 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: TxGTIDs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxGTIDs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxPathOrContractAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxPathOrContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GasTankIds = append(m.GasTankIds, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthGasless - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.GasTankIds) == 0 { - m.GasTankIds = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GasTankIds = append(m.GasTankIds, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankIds", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipGasless(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGasless - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GasTank) 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 ErrIntOverflowGasless - } - 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: GasTank: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GasTank: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reserve", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reserve = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsActive", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsActive = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxTxsCountPerConsumer", wireType) - } - m.MaxTxsCountPerConsumer = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxTxsCountPerConsumer |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxFeeUsagePerConsumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxFeeUsagePerConsumer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxFeeUsagePerTx", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxFeeUsagePerTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxsAllowed", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxsAllowed = append(m.TxsAllowed, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractsAllowed", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractsAllowed = append(m.ContractsAllowed, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorizedActors", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AuthorizedActors = append(m.AuthorizedActors, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FeeDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGasless(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGasless - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UsageDetail) 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 ErrIntOverflowGasless - } - 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: UsageDetail: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UsageDetail: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGasless - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasConsumed", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.GasConsumed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGasless(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGasless - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UsageDetails) 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 ErrIntOverflowGasless - } - 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: UsageDetails: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UsageDetails: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UsageIdentifier", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UsageIdentifier = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGasless - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Details = append(m.Details, &UsageDetail{}) - if err := m.Details[len(m.Details)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGasless(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGasless - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Usage) 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 ErrIntOverflowGasless - } - 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: Usage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Usage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Txs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGasless - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Txs = append(m.Txs, &UsageDetails{}) - if err := m.Txs[len(m.Txs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contracts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGasless - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contracts = append(m.Contracts, &UsageDetails{}) - if err := m.Contracts[len(m.Contracts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGasless(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGasless - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ConsumptionDetail) 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 ErrIntOverflowGasless - } - 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: ConsumptionDetail: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumptionDetail: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsBlocked", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsBlocked = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalTxsAllowed", wireType) - } - m.TotalTxsAllowed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalTxsAllowed |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalTxsMade", wireType) - } - m.TotalTxsMade = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalTxsMade |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalFeeConsumptionAllowed", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TotalFeeConsumptionAllowed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalFeesConsumed", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TotalFeesConsumed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGasless - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Usage == nil { - m.Usage = &Usage{} - } - if err := m.Usage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGasless(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGasless - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GasConsumer) 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 ErrIntOverflowGasless - } - 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: GasConsumer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GasConsumer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - 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 ErrInvalidLengthGasless - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumptions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGasless - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGasless - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGasless - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Consumptions = append(m.Consumptions, &ConsumptionDetail{}) - if err := m.Consumptions[len(m.Consumptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGasless(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGasless - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGasless(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, ErrIntOverflowGasless - } - 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, ErrIntOverflowGasless - } - 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, ErrIntOverflowGasless - } - 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, ErrInvalidLengthGasless - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGasless - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGasless - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGasless = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGasless = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGasless = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/gasless/types/genesis.go b/x/gasless/types/genesis.go deleted file mode 100644 index c483353cd..000000000 --- a/x/gasless/types/genesis.go +++ /dev/null @@ -1,40 +0,0 @@ -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) - } - - for _, txToTankIDs := range genState.TxToGasTankIds { - if err := txToTankIDs.Validate(); err != nil { - return fmt.Errorf("invalid txToTankIDs: %w", err) - } - } - - for _, tank := range genState.GasTanks { - if err := tank.Validate(); err != nil { - return fmt.Errorf("invalid tank: %w", err) - } - } - - for _, consumer := range genState.GasConsumers { - if err := consumer.Validate(); err != nil { - return fmt.Errorf("invalid consumer: %w", err) - } - } - - return nil -} diff --git a/x/gasless/types/genesis.pb.go b/x/gasless/types/genesis.pb.go deleted file mode 100644 index 4bd2c0fb6..000000000 --- a/x/gasless/types/genesis.pb.go +++ /dev/null @@ -1,518 +0,0 @@ -// 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/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the gasless module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - TxToGasTankIds []TxGTIDs `protobuf:"bytes,2,rep,name=tx_to_gas_tank_ids,json=txToGasTankIds,proto3" json:"tx_to_gas_tank_ids"` - LastGasTankId uint64 `protobuf:"varint,3,opt,name=last_gas_tank_id,json=lastGasTankId,proto3" json:"last_gas_tank_id,omitempty"` - GasTanks []GasTank `protobuf:"bytes,4,rep,name=gas_tanks,json=gasTanks,proto3" json:"gas_tanks"` - GasConsumers []GasConsumer `protobuf:"bytes,5,rep,name=gas_consumers,json=gasConsumers,proto3" json:"gas_consumers"` -} - -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{ - // 339 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xbf, 0x4e, 0x02, 0x41, - 0x10, 0x87, 0xef, 0x00, 0x89, 0x2e, 0x60, 0xcc, 0xc6, 0x98, 0x0b, 0xc5, 0x42, 0xc4, 0x44, 0x1a, - 0x6f, 0x03, 0xb6, 0x56, 0x68, 0x42, 0x68, 0xfc, 0x83, 0x57, 0xd9, 0x5c, 0x16, 0x58, 0xd6, 0x0b, - 0x70, 0x4b, 0x98, 0xc5, 0x9c, 0x6f, 0xe1, 0x63, 0x51, 0x52, 0x5a, 0x18, 0xa3, 0xf0, 0x22, 0xe6, - 0x6e, 0x17, 0xb1, 0xf0, 0xe8, 0x66, 0x26, 0xdf, 0x7c, 0xbf, 0x49, 0x06, 0x9d, 0xf5, 0xe5, 0x64, - 0xc0, 0x23, 0x2a, 0x18, 0x8c, 0x39, 0x00, 0x7d, 0x69, 0xf4, 0xb8, 0x62, 0x0d, 0x2a, 0x78, 0xc8, - 0x21, 0x00, 0x77, 0x3a, 0x93, 0x4a, 0xe2, 0x13, 0x4d, 0xb9, 0x86, 0x72, 0x0d, 0x55, 0x3e, 0x16, - 0x52, 0xc8, 0x04, 0xa1, 0x71, 0xa5, 0xe9, 0x72, 0x2d, 0xc5, 0x39, 0x65, 0x33, 0x36, 0x31, 0xca, - 0x72, 0x6a, 0xb0, 0x89, 0x48, 0xa8, 0xd3, 0x8f, 0x0c, 0x2a, 0xb6, 0xf5, 0x29, 0x8f, 0x8a, 0x29, - 0x8e, 0xaf, 0x50, 0x5e, 0x6b, 0x1c, 0xbb, 0x6a, 0xd7, 0x0b, 0x4d, 0xe2, 0xfe, 0x7f, 0x9a, 0x7b, - 0x9f, 0x50, 0xad, 0xdc, 0xe2, 0xb3, 0x62, 0x75, 0xcd, 0x0e, 0x7e, 0x40, 0x58, 0x45, 0xbe, 0x92, - 0xbe, 0x60, 0xe0, 0x2b, 0x16, 0x8e, 0xfc, 0x60, 0x00, 0x4e, 0xa6, 0x9a, 0xad, 0x17, 0x9a, 0x95, - 0x34, 0x93, 0x17, 0xb5, 0xbd, 0xce, 0xcd, 0x46, 0x75, 0xa8, 0x22, 0x4f, 0xb6, 0x19, 0x78, 0x2c, - 0x1c, 0x75, 0x06, 0x80, 0xcf, 0xd1, 0xd1, 0x98, 0x81, 0xfa, 0x6b, 0x74, 0xb2, 0x55, 0xbb, 0x9e, - 0xeb, 0x96, 0xe2, 0xf9, 0x2f, 0x89, 0x5b, 0xe8, 0x60, 0xc3, 0x80, 0x93, 0xdb, 0x1d, 0x69, 0xb6, - 0x4c, 0xe4, 0xbe, 0xd0, 0x2d, 0xe0, 0x5b, 0x54, 0x8a, 0x1d, 0x7d, 0x19, 0xc2, 0x7c, 0xc2, 0x67, - 0xe0, 0xec, 0x25, 0x9e, 0xda, 0x0e, 0xcf, 0xb5, 0x61, 0x8d, 0xab, 0x28, 0xb6, 0x23, 0x68, 0xdd, - 0x2d, 0xbe, 0x89, 0xb5, 0x58, 0x11, 0x7b, 0xb9, 0x22, 0xf6, 0xd7, 0x8a, 0xd8, 0x6f, 0x6b, 0x62, - 0x2d, 0xd7, 0xc4, 0x7a, 0x5f, 0x13, 0xeb, 0xa9, 0x21, 0x02, 0xf5, 0x3c, 0xef, 0xc5, 0x72, 0xaa, - 0x03, 0x2e, 0xe4, 0x70, 0x18, 0xf4, 0x03, 0x36, 0x36, 0x3d, 0xdd, 0xfe, 0x4f, 0xbd, 0x4e, 0x39, - 0xf4, 0xf2, 0xc9, 0xdb, 0x2e, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x96, 0x04, 0x19, 0x02, 0x57, - 0x02, 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 - if len(m.GasConsumers) > 0 { - for iNdEx := len(m.GasConsumers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasConsumers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.GasTanks) > 0 { - for iNdEx := len(m.GasTanks) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasTanks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.LastGasTankId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.LastGasTankId)) - i-- - dAtA[i] = 0x18 - } - if len(m.TxToGasTankIds) > 0 { - for iNdEx := len(m.TxToGasTankIds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TxToGasTankIds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - 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)) - if len(m.TxToGasTankIds) > 0 { - for _, e := range m.TxToGasTankIds { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if m.LastGasTankId != 0 { - n += 1 + sovGenesis(uint64(m.LastGasTankId)) - } - if len(m.GasTanks) > 0 { - for _, e := range m.GasTanks { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.GasConsumers) > 0 { - for _, e := range m.GasConsumers { - l = e.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 - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxToGasTankIds", 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 - } - m.TxToGasTankIds = append(m.TxToGasTankIds, TxGTIDs{}) - if err := m.TxToGasTankIds[len(m.TxToGasTankIds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastGasTankId", wireType) - } - m.LastGasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastGasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTanks", 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 - } - m.GasTanks = append(m.GasTanks, GasTank{}) - if err := m.GasTanks[len(m.GasTanks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasConsumers", 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 - } - m.GasConsumers = append(m.GasConsumers, GasConsumer{}) - if err := m.GasConsumers[len(m.GasConsumers)-1].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 deleted file mode 100644 index ac686edb0..000000000 --- a/x/gasless/types/gov.go +++ /dev/null @@ -1,3 +0,0 @@ -package types - -func init() {} diff --git a/x/gasless/types/gov.pb.go b/x/gasless/types/gov.pb.go deleted file mode 100644 index 301eaa24a..000000000 --- a/x/gasless/types/gov.pb.go +++ /dev/null @@ -1,38 +0,0 @@ -// 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/cosmos/gogoproto/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 deleted file mode 100644 index 472636113..000000000 --- a/x/gasless/types/keys.go +++ /dev/null @@ -1,66 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" -) - -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 -) - -var ( - TxGTIDsKeyPrefix = []byte{0xa0} - LastGasTankIDKey = []byte{0xa1} - GasTankKeyPrefix = []byte{0xa2} - GasConsumerKeyPrefix = []byte{0xa3} -) - -func GetTxGTIDsKey(txPathOrContractAddress string) []byte { - return append(TxGTIDsKeyPrefix, LengthPrefixString(txPathOrContractAddress)...) -} - -func GetAllTxGTIDsKey() []byte { - return TxGTIDsKeyPrefix -} - -func GetLastGasTankIDKey() []byte { - return LastGasTankIDKey -} - -func GetGasTankKey(gasTankID uint64) []byte { - return append(GasTankKeyPrefix, sdk.Uint64ToBigEndian(gasTankID)...) -} - -func GetAllGasTanksKey() []byte { - return GasTankKeyPrefix -} - -func GetGasConsumerKey(consumer sdk.AccAddress) []byte { - return append(GasConsumerKeyPrefix, address.MustLengthPrefix(consumer)...) -} - -func GetAllGasConsumersKey() []byte { - return GasConsumerKeyPrefix -} - -// LengthPrefixString returns length-prefixed bytes representation -// of a string. -func LengthPrefixString(s string) []byte { - bz := []byte(s) - bzLen := len(bz) - if bzLen == 0 { - return bz - } - return append([]byte{byte(bzLen)}, bz...) -} diff --git a/x/gasless/types/message_update_params.go b/x/gasless/types/message_update_params.go deleted file mode 100644 index 9c12198b2..000000000 --- a/x/gasless/types/message_update_params.go +++ /dev/null @@ -1,35 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var _ sdk.Msg = &MsgUpdateParams{} - -func (msg *MsgUpdateParams) Route() string { - return RouterKey -} - -func (msg *MsgUpdateParams) Type() string { - return "update-params" -} - -func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg *MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) -} - -func (msg *MsgUpdateParams) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { - return errorsmod.Wrap(err, "authority is invalid") - } - return nil -} diff --git a/x/gasless/types/msgs.go b/x/gasless/types/msgs.go deleted file mode 100644 index 864d75859..000000000 --- a/x/gasless/types/msgs.go +++ /dev/null @@ -1,375 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - errors "github.com/cosmos/cosmos-sdk/types/errors" -) - -var ( - _ sdk.Msg = (*MsgCreateGasTank)(nil) - _ sdk.Msg = (*MsgAuthorizeActors)(nil) - _ sdk.Msg = (*MsgUpdateGasTankStatus)(nil) - _ sdk.Msg = (*MsgUpdateGasTankConfig)(nil) - _ sdk.Msg = (*MsgBlockConsumer)(nil) - _ sdk.Msg = (*MsgUnblockConsumer)(nil) - _ sdk.Msg = (*MsgUpdateGasConsumerLimit)(nil) -) - -// Message types for the gasless module. -const ( - TypeMsgCreateGasTank = "create_gas_tank" - TypeMsgAuthorizeActors = "authorize_actors" - TypeMsgUpdateGasTankStatus = "update_gas_tank_status" - TypeMsgUpdateGasTankConfig = "update_gas_tank_config" - TypeMsgBlockConsumer = "block_consumer" - TypeMsgUnblockConsumer = "unblock_consumer" - TypeMsgUpdateGasConsumerLimit = "update_gas_consumer_limit" -) - -// NewMsgCreateGasTank returns a new MsgCreateGasTank. -func NewMsgCreateGasTank( - provider sdk.AccAddress, - feeDenom string, - maxFeeUsagePerTx sdkmath.Int, - maxTxsCountPerConsumer uint64, - maxFeeUsagePerConsumer sdkmath.Int, - txsAllowed []string, - contractsAllowed []string, - gasDeposit sdk.Coin, -) *MsgCreateGasTank { - return &MsgCreateGasTank{ - Provider: provider.String(), - FeeDenom: feeDenom, - MaxFeeUsagePerTx: maxFeeUsagePerTx, - MaxTxsCountPerConsumer: maxTxsCountPerConsumer, - MaxFeeUsagePerConsumer: maxFeeUsagePerConsumer, - TxsAllowed: txsAllowed, - ContractsAllowed: contractsAllowed, - GasDeposit: gasDeposit, - } -} - -func (msg MsgCreateGasTank) Route() string { return RouterKey } - -func (msg MsgCreateGasTank) Type() string { return TypeMsgCreateGasTank } - -func (msg MsgCreateGasTank) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - if err := sdk.ValidateDenom(msg.FeeDenom); err != nil { - return sdkerrors.Wrap(errors.ErrInvalidRequest, err.Error()) - } - if msg.FeeDenom != msg.GasDeposit.Denom { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "denom mismatch, fee denom and gas_deposit") - } - if msg.MaxTxsCountPerConsumer == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "max tx count per consumer must not be 0") - } - if !msg.MaxFeeUsagePerTx.IsPositive() { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "max_fee_usage_per_tx should be positive") - } - if !msg.MaxFeeUsagePerConsumer.IsPositive() { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "max_fee_usage_per_consumer should be positive") - } - if len(msg.TxsAllowed) == 0 && len(msg.ContractsAllowed) == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "atleast one tx or contract is required to initialize") - } - return nil -} - -func (msg MsgCreateGasTank) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgCreateGasTank) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Provider) - if err != nil { - panic(err) - } - return []sdk.AccAddress{addr} -} - -// NewMsgAuthorizeActors returns a new MsgAuthorizeActors. -func NewMsgAuthorizeActors( - gasTankID uint64, - provider sdk.AccAddress, - actors []sdk.AccAddress, -) *MsgAuthorizeActors { - authorizedActors := []string{} - for _, actor := range actors { - authorizedActors = append(authorizedActors, actor.String()) - } - return &MsgAuthorizeActors{ - GasTankId: gasTankID, - Provider: provider.String(), - Actors: authorizedActors, - } -} - -func (msg MsgAuthorizeActors) Route() string { return RouterKey } - -func (msg MsgAuthorizeActors) Type() string { return TypeMsgAuthorizeActors } - -func (msg MsgAuthorizeActors) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - if msg.GasTankId == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "gas tank id must not be 0") - } - - if len(msg.Actors) > 5 { - return sdkerrors.Wrapf(errors.ErrInvalidRequest, "only 5 actors can be authorized") - } - - for _, actor := range msg.Actors { - if _, err := sdk.AccAddressFromBech32(actor); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid actor address - %s : %v", actor, err) - } - } - return nil -} - -func (msg MsgAuthorizeActors) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgAuthorizeActors) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Provider) - if err != nil { - panic(err) - } - return []sdk.AccAddress{addr} -} - -// NewMsgUpdateGasTankStatus returns a new MsgUpdateGasTankStatus. -func NewMsgUpdateGasTankStatus( - gasTankID uint64, - provider sdk.AccAddress, -) *MsgUpdateGasTankStatus { - return &MsgUpdateGasTankStatus{ - GasTankId: gasTankID, - Provider: provider.String(), - } -} - -func (msg MsgUpdateGasTankStatus) Route() string { return RouterKey } - -func (msg MsgUpdateGasTankStatus) Type() string { return TypeMsgUpdateGasTankStatus } - -func (msg MsgUpdateGasTankStatus) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - if msg.GasTankId == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "gas tank id must not be 0") - } - return nil -} - -func (msg MsgUpdateGasTankStatus) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgUpdateGasTankStatus) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Provider) - if err != nil { - panic(err) - } - return []sdk.AccAddress{addr} -} - -// NewMsgUpdateGasTankConfig returns a new MsgUpdateGasTankConfig. -func NewMsgUpdateGasTankConfig( - gasTankID uint64, - provider sdk.AccAddress, - maxFeeUsagePerTx sdkmath.Int, - maxTxsCountPerConsumer uint64, - maxFeeUsagePerConsumer sdkmath.Int, - txsAllowed []string, - contractsAllowed []string, -) *MsgUpdateGasTankConfig { - return &MsgUpdateGasTankConfig{ - GasTankId: gasTankID, - Provider: provider.String(), - MaxFeeUsagePerTx: maxFeeUsagePerTx, - MaxTxsCountPerConsumer: maxTxsCountPerConsumer, - MaxFeeUsagePerConsumer: maxFeeUsagePerConsumer, - TxsAllowed: txsAllowed, - ContractsAllowed: contractsAllowed, - } -} - -func (msg MsgUpdateGasTankConfig) Route() string { return RouterKey } - -func (msg MsgUpdateGasTankConfig) Type() string { return TypeMsgUpdateGasTankConfig } - -func (msg MsgUpdateGasTankConfig) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - if msg.GasTankId == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "gas tank id must not be 0") - } - if msg.MaxTxsCountPerConsumer == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "max tx count per consumer must not be 0") - } - if !msg.MaxFeeUsagePerTx.IsPositive() { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "max_fee_usage_per_tx should be positive") - } - if !msg.MaxFeeUsagePerConsumer.IsPositive() { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "max_fee_usage_per_consumer should be positive") - } - if len(msg.TxsAllowed) == 0 && len(msg.ContractsAllowed) == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "atleast one tx or contract is required to initialize") - } - return nil -} - -func (msg MsgUpdateGasTankConfig) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgUpdateGasTankConfig) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Provider) - if err != nil { - panic(err) - } - return []sdk.AccAddress{addr} -} - -// NewMsgBlockConsumer returns a new MsgBlockConsumer. -func NewMsgBlockConsumer( - gasTankID uint64, - actor, consumer sdk.AccAddress, -) *MsgBlockConsumer { - return &MsgBlockConsumer{ - GasTankId: gasTankID, - Actor: actor.String(), - Consumer: consumer.String(), - } -} - -func (msg MsgBlockConsumer) Route() string { return RouterKey } - -func (msg MsgBlockConsumer) Type() string { return TypeMsgBlockConsumer } - -func (msg MsgBlockConsumer) ValidateBasic() error { - if msg.GasTankId == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "gas tank id must not be 0") - } - if _, err := sdk.AccAddressFromBech32(msg.Actor); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid actor address: %v", err) - } - if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid consumer address: %v", err) - } - return nil -} - -func (msg MsgBlockConsumer) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgBlockConsumer) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Actor) - if err != nil { - panic(err) - } - return []sdk.AccAddress{addr} -} - -// NewMsgUnblockConsumer returns a new MsgUnblockConsumer. -func NewMsgUnblockConsumer( - gasTankID uint64, - actor, consumer sdk.AccAddress, -) *MsgUnblockConsumer { - return &MsgUnblockConsumer{ - GasTankId: gasTankID, - Actor: actor.String(), - Consumer: consumer.String(), - } -} - -func (msg MsgUnblockConsumer) Route() string { return RouterKey } - -func (msg MsgUnblockConsumer) Type() string { return TypeMsgUnblockConsumer } - -func (msg MsgUnblockConsumer) ValidateBasic() error { - if msg.GasTankId == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "gas tank id must not be 0") - } - if _, err := sdk.AccAddressFromBech32(msg.Actor); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid consumer address: %v", err) - } - return nil -} - -func (msg MsgUnblockConsumer) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgUnblockConsumer) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Actor) - if err != nil { - panic(err) - } - return []sdk.AccAddress{addr} -} - -// NewMsgUpdateGasConsumerLimit returns a new MsgUpdateGasConsumerLimit. -func NewMsgUpdateGasConsumerLimit( - gasTankID uint64, - provider, consumer sdk.AccAddress, - totalTxsAllowed uint64, - totalFeeConsumptionAllowed sdkmath.Int, -) *MsgUpdateGasConsumerLimit { - return &MsgUpdateGasConsumerLimit{ - GasTankId: gasTankID, - Provider: provider.String(), - Consumer: consumer.String(), - TotalTxsAllowed: totalTxsAllowed, - TotalFeeConsumptionAllowed: totalFeeConsumptionAllowed, - } -} - -func (msg MsgUpdateGasConsumerLimit) Route() string { return RouterKey } - -func (msg MsgUpdateGasConsumerLimit) Type() string { return TypeMsgUpdateGasConsumerLimit } - -func (msg MsgUpdateGasConsumerLimit) ValidateBasic() error { - if msg.GasTankId == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "gas tank id must not be 0") - } - if _, err := sdk.AccAddressFromBech32(msg.Provider); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid provider address: %v", err) - } - if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { - return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid consumer address: %v", err) - } - if msg.TotalTxsAllowed == 0 { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "total txs allowed must not be 0") - } - if !msg.TotalFeeConsumptionAllowed.IsPositive() { - return sdkerrors.Wrap(errors.ErrInvalidRequest, "total fee consumption by consumer should be positive") - } - return nil -} - -func (msg MsgUpdateGasConsumerLimit) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgUpdateGasConsumerLimit) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Provider) - if err != nil { - panic(err) - } - return []sdk.AccAddress{addr} -} diff --git a/x/gasless/types/params.go b/x/gasless/types/params.go deleted file mode 100644 index b4ecd6b04..000000000 --- a/x/gasless/types/params.go +++ /dev/null @@ -1,117 +0,0 @@ -package types - -import ( - fmt "fmt" - - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -const ( - GasTankAddressPrefix = "GasTankAddress" - ModuleAddressNameSplitter = "|" - MaximumTankCreationLimit = uint64(10) - MaximumAuthorizedActorsLimit = 5 -) - -// gasless module's params default values -var ( - DefaultTankCreationLimit = uint64(5) - DefaultMinimumGasDeposit = sdk.NewCoins(sdk.NewCoin("ucmdx", sdkmath.NewInt(10_000_000))) - DefaultFeeBurningPercentage = sdkmath.NewInt(50) -) - -var ( - KeyTankCreationLimit = []byte("TankCreationLimit") - KeyMinimumGasDeposit = []byte("MinimumGasDeposit") - KeyFeeBurningPercentage = []byte("FeeBurningPercentage") -) - -var _ paramstypes.ParamSet = (*Params)(nil) - -func ParamKeyTable() paramstypes.KeyTable { - return paramstypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams(tankCreationLimit uint64, minGasDeposit sdk.Coins, feeBurningPercentage sdkmath.Int) Params { - return Params{ - TankCreationLimit: tankCreationLimit, - MinimumGasDeposit: minGasDeposit, - FeeBurningPercentage: feeBurningPercentage, - } -} - -// DefaultParams returns a default params for the liquidity module. -func DefaultParams() Params { - return NewParams(DefaultTankCreationLimit, DefaultMinimumGasDeposit, DefaultFeeBurningPercentage) -} - -// ParamSetPairs implements ParamSet. -func (params *Params) ParamSetPairs() paramstypes.ParamSetPairs { - return paramstypes.ParamSetPairs{ - paramstypes.NewParamSetPair(KeyTankCreationLimit, ¶ms.TankCreationLimit, validateTankCreationLimit), - paramstypes.NewParamSetPair(KeyMinimumGasDeposit, ¶ms.MinimumGasDeposit, validateMinimumGasDeposit), - paramstypes.NewParamSetPair(KeyFeeBurningPercentage, ¶ms.FeeBurningPercentage, validateFeeBurningPercentage), - } -} - -// Validate validates Params. -func (params Params) Validate() error { - for _, field := range []struct { - val interface{} - validateFunc func(i interface{}) error - }{ - {params.TankCreationLimit, validateTankCreationLimit}, - {params.MinimumGasDeposit, validateMinimumGasDeposit}, - } { - if err := field.validateFunc(field.val); err != nil { - return err - } - } - return nil -} - -func validateTankCreationLimit(i interface{}) error { - v, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v == 0 { - return fmt.Errorf("tank creation limit must be positive: %d", v) - } - - if v > MaximumTankCreationLimit { - return fmt.Errorf("maximum tank creation allowed limit is : %d", MaximumTankCreationLimit) - } - - return nil -} - -func validateMinimumGasDeposit(i interface{}) error { - v, ok := i.(sdk.Coins) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if err := v.Validate(); err != nil { - return fmt.Errorf("invalid minimum gas deposit fee: %w", err) - } - - return nil -} - -func validateFeeBurningPercentage(i interface{}) error { - v, ok := i.(sdkmath.Int) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v.IsNegative() { - return fmt.Errorf("fee burning percentage cannot be negative") - } - - return nil -} diff --git a/x/gasless/types/params.pb.go b/x/gasless/types/params.pb.go deleted file mode 100644 index 7fd9a5383..000000000 --- a/x/gasless/types/params.pb.go +++ /dev/null @@ -1,413 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/gasless/v1beta1/params.proto - -package types - -import ( - cosmossdk_io_math "cosmossdk.io/math" - fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the module. -type Params struct { - TankCreationLimit uint64 `protobuf:"varint,1,opt,name=tank_creation_limit,json=tankCreationLimit,proto3" json:"tank_creation_limit,omitempty"` - MinimumGasDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=minimum_gas_deposit,json=minimumGasDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"minimum_gas_deposit"` - FeeBurningPercentage cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=fee_burning_percentage,json=feeBurningPercentage,proto3,customtype=cosmossdk.io/math.Int" json:"fee_burning_percentage"` -} - -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{ - // 357 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xc1, 0x4e, 0xea, 0x40, - 0x18, 0x85, 0x5b, 0xb8, 0x21, 0xb9, 0xbd, 0x2b, 0x0a, 0x97, 0x20, 0x89, 0x03, 0xd1, 0x4d, 0x37, - 0xcc, 0x88, 0xbe, 0x41, 0x31, 0x31, 0x26, 0x26, 0x12, 0xdc, 0xb9, 0x69, 0xa6, 0xed, 0xb4, 0x4c, - 0x60, 0x66, 0x9a, 0xfe, 0x83, 0xd1, 0xf8, 0x06, 0xae, 0x7c, 0x0e, 0x9f, 0x84, 0x25, 0x4b, 0xe3, - 0x02, 0x15, 0x5e, 0xc4, 0xb4, 0x53, 0x31, 0xae, 0x66, 0x26, 0xe7, 0xfc, 0xe7, 0x3b, 0x99, 0xdf, - 0x39, 0x8e, 0x94, 0x88, 0xd9, 0x3d, 0x49, 0x29, 0x2c, 0x18, 0x00, 0xb9, 0x1b, 0x85, 0x4c, 0xd3, - 0x11, 0xc9, 0x68, 0x4e, 0x05, 0xe0, 0x2c, 0x57, 0x5a, 0xb9, 0x1d, 0x63, 0xc2, 0x95, 0x09, 0x57, - 0xa6, 0x5e, 0x3b, 0x55, 0xa9, 0x2a, 0x2d, 0xa4, 0xb8, 0x19, 0x77, 0x0f, 0x45, 0x0a, 0x84, 0x02, - 0x12, 0x52, 0x60, 0xfb, 0xbc, 0x48, 0x71, 0x69, 0xf4, 0xa3, 0xa7, 0x9a, 0xd3, 0x98, 0x94, 0xf1, - 0x2e, 0x76, 0x5a, 0x9a, 0xca, 0x79, 0x10, 0xe5, 0x8c, 0x6a, 0xae, 0x64, 0xb0, 0xe0, 0x82, 0xeb, - 0xae, 0x3d, 0xb0, 0xbd, 0x3f, 0xd3, 0x66, 0x21, 0x8d, 0x2b, 0xe5, 0xaa, 0x10, 0xdc, 0x47, 0xa7, - 0x25, 0xb8, 0xe4, 0x62, 0x29, 0x82, 0x94, 0x42, 0x10, 0xb3, 0x4c, 0x01, 0xd7, 0xdd, 0xda, 0xa0, - 0xee, 0xfd, 0x3b, 0x3d, 0xc0, 0x06, 0x8c, 0x0b, 0xf0, 0x77, 0x47, 0x3c, 0x56, 0x5c, 0xfa, 0x27, - 0xab, 0x4d, 0xdf, 0x7a, 0x79, 0xef, 0x7b, 0x29, 0xd7, 0xb3, 0x65, 0x88, 0x23, 0x25, 0x48, 0xd5, - 0xd2, 0x1c, 0x43, 0x88, 0xe7, 0x44, 0x3f, 0x64, 0x0c, 0xca, 0x01, 0x98, 0x36, 0x2b, 0xce, 0x05, - 0x85, 0x73, 0x43, 0x71, 0x6f, 0x9c, 0x4e, 0xc2, 0x58, 0x10, 0x2e, 0x73, 0xc9, 0x65, 0x1a, 0x64, - 0x2c, 0x8f, 0x98, 0xd4, 0x34, 0x65, 0xdd, 0xfa, 0xc0, 0xf6, 0xfe, 0xfa, 0x87, 0x05, 0xe4, 0x6d, - 0xd3, 0xff, 0x6f, 0x22, 0x21, 0x9e, 0x63, 0xae, 0x88, 0xa0, 0x7a, 0x86, 0x2f, 0xa5, 0x9e, 0xb6, - 0x13, 0xc6, 0x7c, 0x33, 0x3b, 0xd9, 0x8f, 0xfa, 0xd7, 0xab, 0x4f, 0x64, 0xad, 0xb6, 0xc8, 0x5e, - 0x6f, 0x91, 0xfd, 0xb1, 0x45, 0xf6, 0xf3, 0x0e, 0x59, 0xeb, 0x1d, 0xb2, 0x5e, 0x77, 0xc8, 0xba, - 0x1d, 0xfd, 0xea, 0x5b, 0xec, 0x60, 0xa8, 0x92, 0x84, 0x47, 0x9c, 0x2e, 0xaa, 0x37, 0xf9, 0x59, - 0x5d, 0x59, 0x3f, 0x6c, 0x94, 0x9f, 0x7c, 0xf6, 0x15, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xd9, 0x65, - 0xbe, 0xd9, 0x01, 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 - { - size := m.FeeBurningPercentage.Size() - i -= size - if _, err := m.FeeBurningPercentage.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.MinimumGasDeposit) > 0 { - for iNdEx := len(m.MinimumGasDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinimumGasDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.TankCreationLimit != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.TankCreationLimit)) - i-- - dAtA[i] = 0x8 - } - 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 - if m.TankCreationLimit != 0 { - n += 1 + sovParams(uint64(m.TankCreationLimit)) - } - if len(m.MinimumGasDeposit) > 0 { - for _, e := range m.MinimumGasDeposit { - l = e.Size() - n += 1 + l + sovParams(uint64(l)) - } - } - l = m.FeeBurningPercentage.Size() - n += 1 + l + sovParams(uint64(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 { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TankCreationLimit", wireType) - } - m.TankCreationLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TankCreationLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimumGasDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinimumGasDeposit = append(m.MinimumGasDeposit, types.Coin{}) - if err := m.MinimumGasDeposit[len(m.MinimumGasDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeBurningPercentage", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FeeBurningPercentage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - 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 deleted file mode 100644 index 5dd3f31ad..000000000 --- a/x/gasless/types/query.pb.go +++ /dev/null @@ -1,5265 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/gasless/v1beta1/query.proto - -package types - -import ( - context "context" - cosmossdk_io_math "cosmossdk.io/math" - fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" - query "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 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 (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// QueryMessagesAndContractsRequest is a request type for the Query/MessagesAndContracts RPC method. -type QueryMessagesAndContractsRequest struct { -} - -func (m *QueryMessagesAndContractsRequest) Reset() { *m = QueryMessagesAndContractsRequest{} } -func (m *QueryMessagesAndContractsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryMessagesAndContractsRequest) ProtoMessage() {} -func (*QueryMessagesAndContractsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{2} -} -func (m *QueryMessagesAndContractsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryMessagesAndContractsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryMessagesAndContractsRequest.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 *QueryMessagesAndContractsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryMessagesAndContractsRequest.Merge(m, src) -} -func (m *QueryMessagesAndContractsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryMessagesAndContractsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryMessagesAndContractsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryMessagesAndContractsRequest proto.InternalMessageInfo - -type ContractDetails struct { - CodeId uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - Lable string `protobuf:"bytes,3,opt,name=lable,proto3" json:"lable,omitempty"` -} - -func (m *ContractDetails) Reset() { *m = ContractDetails{} } -func (m *ContractDetails) String() string { return proto.CompactTextString(m) } -func (*ContractDetails) ProtoMessage() {} -func (*ContractDetails) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{3} -} -func (m *ContractDetails) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ContractDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ContractDetails.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 *ContractDetails) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContractDetails.Merge(m, src) -} -func (m *ContractDetails) XXX_Size() int { - return m.Size() -} -func (m *ContractDetails) XXX_DiscardUnknown() { - xxx_messageInfo_ContractDetails.DiscardUnknown(m) -} - -var xxx_messageInfo_ContractDetails proto.InternalMessageInfo - -func (m *ContractDetails) GetCodeId() uint64 { - if m != nil { - return m.CodeId - } - return 0 -} - -func (m *ContractDetails) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *ContractDetails) GetLable() string { - if m != nil { - return m.Lable - } - return "" -} - -// QueryMessagesAndContractsResponse is a response type for the Query/MessagesAndContracts RPC method. -type QueryMessagesAndContractsResponse struct { - Messages []string `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - Contracts []*ContractDetails `protobuf:"bytes,2,rep,name=contracts,proto3" json:"contracts,omitempty"` -} - -func (m *QueryMessagesAndContractsResponse) Reset() { *m = QueryMessagesAndContractsResponse{} } -func (m *QueryMessagesAndContractsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryMessagesAndContractsResponse) ProtoMessage() {} -func (*QueryMessagesAndContractsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{4} -} -func (m *QueryMessagesAndContractsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryMessagesAndContractsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryMessagesAndContractsResponse.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 *QueryMessagesAndContractsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryMessagesAndContractsResponse.Merge(m, src) -} -func (m *QueryMessagesAndContractsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryMessagesAndContractsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryMessagesAndContractsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryMessagesAndContractsResponse proto.InternalMessageInfo - -func (m *QueryMessagesAndContractsResponse) GetMessages() []string { - if m != nil { - return m.Messages - } - return nil -} - -func (m *QueryMessagesAndContractsResponse) GetContracts() []*ContractDetails { - if m != nil { - return m.Contracts - } - return nil -} - -type GasTankResponse struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Reserve string `protobuf:"bytes,3,opt,name=reserve,proto3" json:"reserve,omitempty"` - GasTankBalance types.Coin `protobuf:"bytes,4,opt,name=gas_tank_balance,json=gasTankBalance,proto3" json:"gas_tank_balance"` - IsActive bool `protobuf:"varint,5,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` - MaxTxsCountPerConsumer uint64 `protobuf:"varint,6,opt,name=max_txs_count_per_consumer,json=maxTxsCountPerConsumer,proto3" json:"max_txs_count_per_consumer,omitempty"` - MaxFeeUsagePerConsumer cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=max_fee_usage_per_consumer,json=maxFeeUsagePerConsumer,proto3,customtype=cosmossdk.io/math.Int" json:"max_fee_usage_per_consumer"` - MaxFeeUsagePerTx cosmossdk_io_math.Int `protobuf:"bytes,8,opt,name=max_fee_usage_per_tx,json=maxFeeUsagePerTx,proto3,customtype=cosmossdk.io/math.Int" json:"max_fee_usage_per_tx"` - TxsAllowed []string `protobuf:"bytes,9,rep,name=txs_allowed,json=txsAllowed,proto3" json:"txs_allowed,omitempty"` - ContractsAllowed []string `protobuf:"bytes,10,rep,name=contracts_allowed,json=contractsAllowed,proto3" json:"contracts_allowed,omitempty"` - AuthorizedActors []string `protobuf:"bytes,11,rep,name=authorized_actors,json=authorizedActors,proto3" json:"authorized_actors,omitempty"` - FeeDenom string `protobuf:"bytes,12,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` -} - -func (m *GasTankResponse) Reset() { *m = GasTankResponse{} } -func (m *GasTankResponse) String() string { return proto.CompactTextString(m) } -func (*GasTankResponse) ProtoMessage() {} -func (*GasTankResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{5} -} -func (m *GasTankResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GasTankResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GasTankResponse.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 *GasTankResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GasTankResponse.Merge(m, src) -} -func (m *GasTankResponse) XXX_Size() int { - return m.Size() -} -func (m *GasTankResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GasTankResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GasTankResponse proto.InternalMessageInfo - -func (m *GasTankResponse) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *GasTankResponse) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -func (m *GasTankResponse) GetReserve() string { - if m != nil { - return m.Reserve - } - return "" -} - -func (m *GasTankResponse) GetGasTankBalance() types.Coin { - if m != nil { - return m.GasTankBalance - } - return types.Coin{} -} - -func (m *GasTankResponse) GetIsActive() bool { - if m != nil { - return m.IsActive - } - return false -} - -func (m *GasTankResponse) GetMaxTxsCountPerConsumer() uint64 { - if m != nil { - return m.MaxTxsCountPerConsumer - } - return 0 -} - -func (m *GasTankResponse) GetTxsAllowed() []string { - if m != nil { - return m.TxsAllowed - } - return nil -} - -func (m *GasTankResponse) GetContractsAllowed() []string { - if m != nil { - return m.ContractsAllowed - } - return nil -} - -func (m *GasTankResponse) GetAuthorizedActors() []string { - if m != nil { - return m.AuthorizedActors - } - return nil -} - -func (m *GasTankResponse) GetFeeDenom() string { - if m != nil { - return m.FeeDenom - } - return "" -} - -// QueryGasTankRequest is a request type for the Query/GasTank RPC method. -type QueryGasTankRequest struct { - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` -} - -func (m *QueryGasTankRequest) Reset() { *m = QueryGasTankRequest{} } -func (m *QueryGasTankRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGasTankRequest) ProtoMessage() {} -func (*QueryGasTankRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{6} -} -func (m *QueryGasTankRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasTankRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasTankRequest.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 *QueryGasTankRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasTankRequest.Merge(m, src) -} -func (m *QueryGasTankRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGasTankRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasTankRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasTankRequest proto.InternalMessageInfo - -func (m *QueryGasTankRequest) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -// QueryGasTankResponse is a response type for the Query/GasTank RPC method. -type QueryGasTankResponse struct { - GasTank GasTankResponse `protobuf:"bytes,1,opt,name=gas_tank,json=gasTank,proto3" json:"gas_tank"` -} - -func (m *QueryGasTankResponse) Reset() { *m = QueryGasTankResponse{} } -func (m *QueryGasTankResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGasTankResponse) ProtoMessage() {} -func (*QueryGasTankResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{7} -} -func (m *QueryGasTankResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasTankResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasTankResponse.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 *QueryGasTankResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasTankResponse.Merge(m, src) -} -func (m *QueryGasTankResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGasTankResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasTankResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasTankResponse proto.InternalMessageInfo - -func (m *QueryGasTankResponse) GetGasTank() GasTankResponse { - if m != nil { - return m.GasTank - } - return GasTankResponse{} -} - -// QueryGasTanksRequest is a request type for the Query/GasTanks RPC method. -type QueryGasTanksRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryGasTanksRequest) Reset() { *m = QueryGasTanksRequest{} } -func (m *QueryGasTanksRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGasTanksRequest) ProtoMessage() {} -func (*QueryGasTanksRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{8} -} -func (m *QueryGasTanksRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasTanksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasTanksRequest.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 *QueryGasTanksRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasTanksRequest.Merge(m, src) -} -func (m *QueryGasTanksRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGasTanksRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasTanksRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasTanksRequest proto.InternalMessageInfo - -func (m *QueryGasTanksRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryGasTanksResponse is a response type for the Query/GasTanks RPC method. -type QueryGasTanksResponse struct { - GasTanks []GasTankResponse `protobuf:"bytes,1,rep,name=gas_tanks,json=gasTanks,proto3" json:"gas_tanks"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryGasTanksResponse) Reset() { *m = QueryGasTanksResponse{} } -func (m *QueryGasTanksResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGasTanksResponse) ProtoMessage() {} -func (*QueryGasTanksResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{9} -} -func (m *QueryGasTanksResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasTanksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasTanksResponse.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 *QueryGasTanksResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasTanksResponse.Merge(m, src) -} -func (m *QueryGasTanksResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGasTanksResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasTanksResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasTanksResponse proto.InternalMessageInfo - -func (m *QueryGasTanksResponse) GetGasTanks() []GasTankResponse { - if m != nil { - return m.GasTanks - } - return nil -} - -func (m *QueryGasTanksResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryGasTanksByProviderRequest is a request type for the Query/GasTanksByProvider RPC method. -type QueryGasTanksByProviderRequest struct { - Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` -} - -func (m *QueryGasTanksByProviderRequest) Reset() { *m = QueryGasTanksByProviderRequest{} } -func (m *QueryGasTanksByProviderRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGasTanksByProviderRequest) ProtoMessage() {} -func (*QueryGasTanksByProviderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{10} -} -func (m *QueryGasTanksByProviderRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasTanksByProviderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasTanksByProviderRequest.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 *QueryGasTanksByProviderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasTanksByProviderRequest.Merge(m, src) -} -func (m *QueryGasTanksByProviderRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGasTanksByProviderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasTanksByProviderRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasTanksByProviderRequest proto.InternalMessageInfo - -func (m *QueryGasTanksByProviderRequest) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -// QueryGasTanksByProviderResponse is a response type for the Query/GasTanksByProvider RPC method. -type QueryGasTanksByProviderResponse struct { - GasTanks []GasTankResponse `protobuf:"bytes,1,rep,name=gas_tanks,json=gasTanks,proto3" json:"gas_tanks"` -} - -func (m *QueryGasTanksByProviderResponse) Reset() { *m = QueryGasTanksByProviderResponse{} } -func (m *QueryGasTanksByProviderResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGasTanksByProviderResponse) ProtoMessage() {} -func (*QueryGasTanksByProviderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{11} -} -func (m *QueryGasTanksByProviderResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasTanksByProviderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasTanksByProviderResponse.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 *QueryGasTanksByProviderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasTanksByProviderResponse.Merge(m, src) -} -func (m *QueryGasTanksByProviderResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGasTanksByProviderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasTanksByProviderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasTanksByProviderResponse proto.InternalMessageInfo - -func (m *QueryGasTanksByProviderResponse) GetGasTanks() []GasTankResponse { - if m != nil { - return m.GasTanks - } - return nil -} - -// QueryGasConsumerRequest is a request type for the Query/GasConsumer RPC method. -type QueryGasConsumerRequest struct { - Consumer string `protobuf:"bytes,1,opt,name=consumer,proto3" json:"consumer,omitempty"` -} - -func (m *QueryGasConsumerRequest) Reset() { *m = QueryGasConsumerRequest{} } -func (m *QueryGasConsumerRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGasConsumerRequest) ProtoMessage() {} -func (*QueryGasConsumerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{12} -} -func (m *QueryGasConsumerRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasConsumerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasConsumerRequest.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 *QueryGasConsumerRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasConsumerRequest.Merge(m, src) -} -func (m *QueryGasConsumerRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGasConsumerRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasConsumerRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasConsumerRequest proto.InternalMessageInfo - -func (m *QueryGasConsumerRequest) GetConsumer() string { - if m != nil { - return m.Consumer - } - return "" -} - -// QueryGasConsumerResponse is a response type for the Query/GasConsumer RPC method. -type QueryGasConsumerResponse struct { - GasConsumer GasConsumer `protobuf:"bytes,1,opt,name=gas_consumer,json=gasConsumer,proto3" json:"gas_consumer"` -} - -func (m *QueryGasConsumerResponse) Reset() { *m = QueryGasConsumerResponse{} } -func (m *QueryGasConsumerResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGasConsumerResponse) ProtoMessage() {} -func (*QueryGasConsumerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{13} -} -func (m *QueryGasConsumerResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasConsumerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasConsumerResponse.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 *QueryGasConsumerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasConsumerResponse.Merge(m, src) -} -func (m *QueryGasConsumerResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGasConsumerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasConsumerResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasConsumerResponse proto.InternalMessageInfo - -func (m *QueryGasConsumerResponse) GetGasConsumer() GasConsumer { - if m != nil { - return m.GasConsumer - } - return GasConsumer{} -} - -// QueryGasConsumersRequest is a request type for the Query/GasConsumers RPC method. -type QueryGasConsumersRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryGasConsumersRequest) Reset() { *m = QueryGasConsumersRequest{} } -func (m *QueryGasConsumersRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGasConsumersRequest) ProtoMessage() {} -func (*QueryGasConsumersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{14} -} -func (m *QueryGasConsumersRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasConsumersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasConsumersRequest.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 *QueryGasConsumersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasConsumersRequest.Merge(m, src) -} -func (m *QueryGasConsumersRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGasConsumersRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasConsumersRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasConsumersRequest proto.InternalMessageInfo - -func (m *QueryGasConsumersRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryGasConsumersResponse is a response type for the Query/GasConsumers RPC method. -type QueryGasConsumersResponse struct { - GasConsumers []GasConsumer `protobuf:"bytes,1,rep,name=gas_consumers,json=gasConsumers,proto3" json:"gas_consumers"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryGasConsumersResponse) Reset() { *m = QueryGasConsumersResponse{} } -func (m *QueryGasConsumersResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGasConsumersResponse) ProtoMessage() {} -func (*QueryGasConsumersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{15} -} -func (m *QueryGasConsumersResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasConsumersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasConsumersResponse.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 *QueryGasConsumersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasConsumersResponse.Merge(m, src) -} -func (m *QueryGasConsumersResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGasConsumersResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasConsumersResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasConsumersResponse proto.InternalMessageInfo - -func (m *QueryGasConsumersResponse) GetGasConsumers() []GasConsumer { - if m != nil { - return m.GasConsumers - } - return nil -} - -func (m *QueryGasConsumersResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -type GasConsumersByGasTankIDResponse struct { - Consumer string `protobuf:"bytes,1,opt,name=consumer,proto3" json:"consumer,omitempty"` - IsBlocked bool `protobuf:"varint,2,opt,name=is_blocked,json=isBlocked,proto3" json:"is_blocked,omitempty"` - TotalTxsAllowed uint64 `protobuf:"varint,3,opt,name=total_txs_allowed,json=totalTxsAllowed,proto3" json:"total_txs_allowed,omitempty"` - TotalTxsMade uint64 `protobuf:"varint,4,opt,name=total_txs_made,json=totalTxsMade,proto3" json:"total_txs_made,omitempty"` - TotalFeeConsumptionAllowed types.Coin `protobuf:"bytes,5,opt,name=total_fee_consumption_allowed,json=totalFeeConsumptionAllowed,proto3" json:"total_fee_consumption_allowed"` - TotalFeesConsumed types.Coin `protobuf:"bytes,6,opt,name=total_fees_consumed,json=totalFeesConsumed,proto3" json:"total_fees_consumed"` - Usage *Usage `protobuf:"bytes,7,opt,name=usage,proto3" json:"usage,omitempty"` -} - -func (m *GasConsumersByGasTankIDResponse) Reset() { *m = GasConsumersByGasTankIDResponse{} } -func (m *GasConsumersByGasTankIDResponse) String() string { return proto.CompactTextString(m) } -func (*GasConsumersByGasTankIDResponse) ProtoMessage() {} -func (*GasConsumersByGasTankIDResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{16} -} -func (m *GasConsumersByGasTankIDResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GasConsumersByGasTankIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GasConsumersByGasTankIDResponse.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 *GasConsumersByGasTankIDResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GasConsumersByGasTankIDResponse.Merge(m, src) -} -func (m *GasConsumersByGasTankIDResponse) XXX_Size() int { - return m.Size() -} -func (m *GasConsumersByGasTankIDResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GasConsumersByGasTankIDResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GasConsumersByGasTankIDResponse proto.InternalMessageInfo - -func (m *GasConsumersByGasTankIDResponse) GetConsumer() string { - if m != nil { - return m.Consumer - } - return "" -} - -func (m *GasConsumersByGasTankIDResponse) GetIsBlocked() bool { - if m != nil { - return m.IsBlocked - } - return false -} - -func (m *GasConsumersByGasTankIDResponse) GetTotalTxsAllowed() uint64 { - if m != nil { - return m.TotalTxsAllowed - } - return 0 -} - -func (m *GasConsumersByGasTankIDResponse) GetTotalTxsMade() uint64 { - if m != nil { - return m.TotalTxsMade - } - return 0 -} - -func (m *GasConsumersByGasTankIDResponse) GetTotalFeeConsumptionAllowed() types.Coin { - if m != nil { - return m.TotalFeeConsumptionAllowed - } - return types.Coin{} -} - -func (m *GasConsumersByGasTankIDResponse) GetTotalFeesConsumed() types.Coin { - if m != nil { - return m.TotalFeesConsumed - } - return types.Coin{} -} - -func (m *GasConsumersByGasTankIDResponse) GetUsage() *Usage { - if m != nil { - return m.Usage - } - return nil -} - -// QueryGasConsumersByGasTankIDRequest is a request type for the Query/GasConsumersByGasTankID RPC method. -type QueryGasConsumersByGasTankIDRequest struct { - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` -} - -func (m *QueryGasConsumersByGasTankIDRequest) Reset() { *m = QueryGasConsumersByGasTankIDRequest{} } -func (m *QueryGasConsumersByGasTankIDRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGasConsumersByGasTankIDRequest) ProtoMessage() {} -func (*QueryGasConsumersByGasTankIDRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{17} -} -func (m *QueryGasConsumersByGasTankIDRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasConsumersByGasTankIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasConsumersByGasTankIDRequest.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 *QueryGasConsumersByGasTankIDRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasConsumersByGasTankIDRequest.Merge(m, src) -} -func (m *QueryGasConsumersByGasTankIDRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGasConsumersByGasTankIDRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasConsumersByGasTankIDRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasConsumersByGasTankIDRequest proto.InternalMessageInfo - -func (m *QueryGasConsumersByGasTankIDRequest) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -// QueryGasConsumersByGasTankIDResponse is a response type for the Query/GasConsumersByGasTankID RPC method. -type QueryGasConsumersByGasTankIDResponse struct { - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` - OverallFeesConsumed types.Coin `protobuf:"bytes,2,opt,name=overall_fees_consumed,json=overallFeesConsumed,proto3" json:"overall_fees_consumed"` - GasConsumers []GasConsumersByGasTankIDResponse `protobuf:"bytes,3,rep,name=gas_consumers,json=gasConsumers,proto3" json:"gas_consumers"` -} - -func (m *QueryGasConsumersByGasTankIDResponse) Reset() { *m = QueryGasConsumersByGasTankIDResponse{} } -func (m *QueryGasConsumersByGasTankIDResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGasConsumersByGasTankIDResponse) ProtoMessage() {} -func (*QueryGasConsumersByGasTankIDResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{18} -} -func (m *QueryGasConsumersByGasTankIDResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasConsumersByGasTankIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasConsumersByGasTankIDResponse.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 *QueryGasConsumersByGasTankIDResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasConsumersByGasTankIDResponse.Merge(m, src) -} -func (m *QueryGasConsumersByGasTankIDResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGasConsumersByGasTankIDResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasConsumersByGasTankIDResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasConsumersByGasTankIDResponse proto.InternalMessageInfo - -func (m *QueryGasConsumersByGasTankIDResponse) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -func (m *QueryGasConsumersByGasTankIDResponse) GetOverallFeesConsumed() types.Coin { - if m != nil { - return m.OverallFeesConsumed - } - return types.Coin{} -} - -func (m *QueryGasConsumersByGasTankIDResponse) GetGasConsumers() []GasConsumersByGasTankIDResponse { - if m != nil { - return m.GasConsumers - } - return nil -} - -type QueryGasTankIdsForAllTXC struct { -} - -func (m *QueryGasTankIdsForAllTXC) Reset() { *m = QueryGasTankIdsForAllTXC{} } -func (m *QueryGasTankIdsForAllTXC) String() string { return proto.CompactTextString(m) } -func (*QueryGasTankIdsForAllTXC) ProtoMessage() {} -func (*QueryGasTankIdsForAllTXC) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{19} -} -func (m *QueryGasTankIdsForAllTXC) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasTankIdsForAllTXC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasTankIdsForAllTXC.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 *QueryGasTankIdsForAllTXC) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasTankIdsForAllTXC.Merge(m, src) -} -func (m *QueryGasTankIdsForAllTXC) XXX_Size() int { - return m.Size() -} -func (m *QueryGasTankIdsForAllTXC) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasTankIdsForAllTXC.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasTankIdsForAllTXC proto.InternalMessageInfo - -type QueryGasTankIdsForAllTXCResponse struct { - TxToGtIds []*TxGTIDs `protobuf:"bytes,1,rep,name=tx_to_gt_ids,json=txToGtIds,proto3" json:"tx_to_gt_ids,omitempty"` -} - -func (m *QueryGasTankIdsForAllTXCResponse) Reset() { *m = QueryGasTankIdsForAllTXCResponse{} } -func (m *QueryGasTankIdsForAllTXCResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGasTankIdsForAllTXCResponse) ProtoMessage() {} -func (*QueryGasTankIdsForAllTXCResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b3f33915e66c7457, []int{20} -} -func (m *QueryGasTankIdsForAllTXCResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGasTankIdsForAllTXCResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGasTankIdsForAllTXCResponse.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 *QueryGasTankIdsForAllTXCResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGasTankIdsForAllTXCResponse.Merge(m, src) -} -func (m *QueryGasTankIdsForAllTXCResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGasTankIdsForAllTXCResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGasTankIdsForAllTXCResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGasTankIdsForAllTXCResponse proto.InternalMessageInfo - -func (m *QueryGasTankIdsForAllTXCResponse) GetTxToGtIds() []*TxGTIDs { - if m != nil { - return m.TxToGtIds - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "comdex.gasless.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "comdex.gasless.v1beta1.QueryParamsResponse") - proto.RegisterType((*QueryMessagesAndContractsRequest)(nil), "comdex.gasless.v1beta1.QueryMessagesAndContractsRequest") - proto.RegisterType((*ContractDetails)(nil), "comdex.gasless.v1beta1.ContractDetails") - proto.RegisterType((*QueryMessagesAndContractsResponse)(nil), "comdex.gasless.v1beta1.QueryMessagesAndContractsResponse") - proto.RegisterType((*GasTankResponse)(nil), "comdex.gasless.v1beta1.GasTankResponse") - proto.RegisterType((*QueryGasTankRequest)(nil), "comdex.gasless.v1beta1.QueryGasTankRequest") - proto.RegisterType((*QueryGasTankResponse)(nil), "comdex.gasless.v1beta1.QueryGasTankResponse") - proto.RegisterType((*QueryGasTanksRequest)(nil), "comdex.gasless.v1beta1.QueryGasTanksRequest") - proto.RegisterType((*QueryGasTanksResponse)(nil), "comdex.gasless.v1beta1.QueryGasTanksResponse") - proto.RegisterType((*QueryGasTanksByProviderRequest)(nil), "comdex.gasless.v1beta1.QueryGasTanksByProviderRequest") - proto.RegisterType((*QueryGasTanksByProviderResponse)(nil), "comdex.gasless.v1beta1.QueryGasTanksByProviderResponse") - proto.RegisterType((*QueryGasConsumerRequest)(nil), "comdex.gasless.v1beta1.QueryGasConsumerRequest") - proto.RegisterType((*QueryGasConsumerResponse)(nil), "comdex.gasless.v1beta1.QueryGasConsumerResponse") - proto.RegisterType((*QueryGasConsumersRequest)(nil), "comdex.gasless.v1beta1.QueryGasConsumersRequest") - proto.RegisterType((*QueryGasConsumersResponse)(nil), "comdex.gasless.v1beta1.QueryGasConsumersResponse") - proto.RegisterType((*GasConsumersByGasTankIDResponse)(nil), "comdex.gasless.v1beta1.GasConsumersByGasTankIDResponse") - proto.RegisterType((*QueryGasConsumersByGasTankIDRequest)(nil), "comdex.gasless.v1beta1.QueryGasConsumersByGasTankIDRequest") - proto.RegisterType((*QueryGasConsumersByGasTankIDResponse)(nil), "comdex.gasless.v1beta1.QueryGasConsumersByGasTankIDResponse") - proto.RegisterType((*QueryGasTankIdsForAllTXC)(nil), "comdex.gasless.v1beta1.QueryGasTankIdsForAllTXC") - proto.RegisterType((*QueryGasTankIdsForAllTXCResponse)(nil), "comdex.gasless.v1beta1.QueryGasTankIdsForAllTXCResponse") -} - -func init() { - proto.RegisterFile("comdex/gasless/v1beta1/query.proto", fileDescriptor_b3f33915e66c7457) -} - -var fileDescriptor_b3f33915e66c7457 = []byte{ - // 1447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcf, 0x73, 0xdb, 0xc4, - 0x17, 0x8f, 0xf2, 0xd3, 0x7e, 0xce, 0xb7, 0x3f, 0x36, 0x69, 0xab, 0xba, 0xdf, 0x38, 0xa9, 0x52, - 0x4a, 0x48, 0x5b, 0x9b, 0x24, 0xf4, 0x17, 0xe4, 0x40, 0x7e, 0x34, 0xc1, 0x40, 0xa1, 0xb8, 0x66, - 0x06, 0x7a, 0x40, 0xac, 0xa5, 0x8d, 0xa3, 0x89, 0xac, 0x75, 0xb5, 0x72, 0x70, 0xe9, 0xf4, 0xc2, - 0x81, 0x19, 0x2e, 0x0c, 0x33, 0x5c, 0x7a, 0xe2, 0x06, 0x27, 0x0e, 0x1c, 0xb8, 0x32, 0xc3, 0xb1, - 0xc7, 0x0e, 0x5c, 0x18, 0x0e, 0x1d, 0xa6, 0xe5, 0xcf, 0x60, 0x06, 0x46, 0xab, 0x5d, 0x59, 0xb2, - 0x2d, 0x47, 0xe9, 0xf4, 0xe6, 0xd5, 0xbe, 0xcf, 0x7b, 0x9f, 0xcf, 0xdb, 0xf7, 0xde, 0x6e, 0x02, - 0x9a, 0x41, 0x1b, 0x26, 0x69, 0x97, 0xea, 0x98, 0xd9, 0x84, 0xb1, 0xd2, 0xfe, 0x52, 0x8d, 0x78, - 0x78, 0xa9, 0x74, 0xb7, 0x45, 0xdc, 0x7b, 0xc5, 0xa6, 0x4b, 0x3d, 0x8a, 0x4e, 0x06, 0x36, 0x45, - 0x61, 0x53, 0x14, 0x36, 0xf9, 0xe9, 0x3a, 0xad, 0x53, 0x6e, 0x52, 0xf2, 0x7f, 0x05, 0xd6, 0xf9, - 0xff, 0xd7, 0x29, 0xad, 0xdb, 0xa4, 0x84, 0x9b, 0x56, 0x09, 0x3b, 0x0e, 0xf5, 0xb0, 0x67, 0x51, - 0x87, 0x89, 0xdd, 0xf9, 0x84, 0x78, 0x4d, 0xec, 0xe2, 0x86, 0x34, 0x3a, 0x97, 0x60, 0x24, 0x09, - 0x04, 0x56, 0x8b, 0x06, 0x65, 0x0d, 0xca, 0x4a, 0x35, 0xcc, 0x48, 0xc0, 0x37, 0xe2, 0xad, 0x6e, - 0x39, 0x3c, 0xae, 0xb0, 0x2d, 0x44, 0x6d, 0xa5, 0x95, 0x41, 0x2d, 0xb1, 0xaf, 0x4d, 0x03, 0xfa, - 0xc0, 0xf7, 0x70, 0x8b, 0xd3, 0xa8, 0x90, 0xbb, 0x2d, 0xc2, 0x3c, 0xed, 0x36, 0x4c, 0xc5, 0xbe, - 0xb2, 0x26, 0x75, 0x18, 0x41, 0xab, 0x30, 0x1e, 0xd0, 0x55, 0x95, 0x39, 0x65, 0x21, 0xb7, 0x5c, - 0x28, 0xf6, 0x4f, 0x50, 0x31, 0xc0, 0xad, 0x8f, 0x3e, 0x7a, 0x32, 0x3b, 0x54, 0x11, 0x18, 0x4d, - 0x83, 0x39, 0xee, 0xf4, 0x26, 0x61, 0x0c, 0xd7, 0x09, 0x5b, 0x73, 0xcc, 0x0d, 0xea, 0x78, 0x2e, - 0x36, 0xbc, 0x30, 0xf0, 0x1d, 0x38, 0x2a, 0xbf, 0x6d, 0x12, 0x0f, 0x5b, 0x36, 0x43, 0xa7, 0x60, - 0xc2, 0xa0, 0x26, 0xd1, 0x2d, 0x93, 0x47, 0x1d, 0xad, 0x8c, 0xfb, 0xcb, 0xb2, 0x89, 0x54, 0x98, - 0xc0, 0xa6, 0xe9, 0x12, 0xc6, 0xd4, 0xe1, 0x39, 0x65, 0x21, 0x5b, 0x91, 0x4b, 0x34, 0x0d, 0x63, - 0x36, 0xae, 0xd9, 0x44, 0x1d, 0xe1, 0xdf, 0x83, 0x85, 0xf6, 0xa5, 0x02, 0x67, 0x07, 0x10, 0x10, - 0x1a, 0xf3, 0x90, 0x69, 0x88, 0x7d, 0x55, 0x99, 0x1b, 0x59, 0xc8, 0x56, 0xc2, 0x35, 0xba, 0x01, - 0x59, 0x43, 0x02, 0xd4, 0xe1, 0xb9, 0x91, 0x85, 0xdc, 0xf2, 0xcb, 0x49, 0x29, 0xe8, 0x92, 0x51, - 0xe9, 0x20, 0xb5, 0x5f, 0x46, 0xe1, 0xe8, 0x36, 0x66, 0x55, 0xec, 0xec, 0x85, 0x61, 0x8f, 0xc0, - 0x70, 0x28, 0x70, 0xd8, 0x32, 0x7d, 0x1a, 0x4d, 0x97, 0xee, 0x5b, 0x26, 0x71, 0x85, 0xba, 0x70, - 0xed, 0x0b, 0x77, 0x09, 0x23, 0xee, 0xbe, 0x14, 0x28, 0x97, 0xa8, 0x0c, 0xc7, 0xea, 0x98, 0xe9, - 0x1e, 0x76, 0xf6, 0xf4, 0x1a, 0xb6, 0xb1, 0x63, 0x10, 0x75, 0x94, 0x1f, 0xd5, 0xe9, 0x62, 0x50, - 0x08, 0x45, 0xbf, 0x10, 0x22, 0x24, 0x2d, 0x47, 0x9c, 0xd2, 0x91, 0x7a, 0xc0, 0x68, 0x3d, 0x80, - 0xa1, 0x33, 0x90, 0xb5, 0x98, 0x8e, 0x0d, 0xcf, 0xda, 0x27, 0xea, 0xd8, 0x9c, 0xb2, 0x90, 0xa9, - 0x64, 0x2c, 0xb6, 0xc6, 0xd7, 0xe8, 0x75, 0xc8, 0x37, 0x70, 0x5b, 0xf7, 0xda, 0x4c, 0x37, 0x68, - 0xcb, 0xf1, 0xf4, 0x26, 0x71, 0x75, 0x83, 0x3a, 0xac, 0xd5, 0x20, 0xae, 0x3a, 0xce, 0x55, 0x9c, - 0x6c, 0xe0, 0x76, 0xb5, 0xcd, 0x36, 0xfc, 0xfd, 0x5b, 0xc4, 0xdd, 0x10, 0xbb, 0xe8, 0xe3, 0x00, - 0xbb, 0x43, 0x88, 0xde, 0xf2, 0xd3, 0x1a, 0xc7, 0x4e, 0xf8, 0x82, 0xd6, 0x67, 0x7c, 0x4a, 0x7f, - 0x3e, 0x99, 0x3d, 0x11, 0x90, 0x66, 0xe6, 0x5e, 0xd1, 0xa2, 0xa5, 0x06, 0xf6, 0x76, 0x8b, 0x65, - 0xc7, 0xe3, 0xae, 0xb7, 0x08, 0xf9, 0xd0, 0x87, 0x47, 0x5d, 0xdf, 0x84, 0xe9, 0x5e, 0xd7, 0x5e, - 0x5b, 0xcd, 0xa4, 0x71, 0x7a, 0x2c, 0xee, 0xb4, 0xda, 0x46, 0xb3, 0x90, 0xf3, 0x15, 0x62, 0xdb, - 0xa6, 0x9f, 0x11, 0x53, 0xcd, 0xf2, 0x6a, 0x00, 0xaf, 0xcd, 0xd6, 0x82, 0x2f, 0xe8, 0x02, 0x1c, - 0x0f, 0x4f, 0x35, 0x34, 0x03, 0x6e, 0x76, 0x2c, 0xdc, 0x88, 0x18, 0xe3, 0x96, 0xb7, 0x4b, 0x5d, - 0xeb, 0x73, 0x62, 0xfa, 0x89, 0xa5, 0x2e, 0x53, 0x73, 0x81, 0x71, 0x67, 0x63, 0x8d, 0x7f, 0xf7, - 0xb3, 0xef, 0xab, 0x30, 0x89, 0x43, 0x1b, 0xea, 0x64, 0x70, 0xfe, 0x3b, 0x84, 0x6c, 0xfa, 0x6b, - 0xed, 0xb2, 0xe8, 0xce, 0xb0, 0x86, 0x78, 0xef, 0xa0, 0x02, 0xe4, 0xc2, 0xc3, 0x0f, 0x6b, 0x29, - 0x2b, 0x8e, 0xb5, 0x6c, 0x6a, 0x9f, 0xc2, 0x74, 0x1c, 0x26, 0x4a, 0xef, 0x2d, 0xc8, 0x48, 0x9c, - 0xe8, 0xeb, 0xc4, 0xa2, 0xee, 0x82, 0x8a, 0xd2, 0x99, 0x10, 0x31, 0xb4, 0x4f, 0xe2, 0x11, 0x64, - 0x57, 0xa3, 0x2d, 0x80, 0xce, 0x60, 0x12, 0x31, 0xce, 0xc7, 0x0a, 0x32, 0x98, 0xba, 0x9d, 0xf1, - 0x51, 0x27, 0x02, 0x5b, 0x89, 0x20, 0xb5, 0x1f, 0x15, 0x38, 0xd1, 0x15, 0x40, 0x68, 0x78, 0x1b, - 0xb2, 0x52, 0x43, 0xd0, 0xb6, 0x87, 0x16, 0x91, 0x11, 0x22, 0x18, 0xda, 0x8e, 0xb1, 0x1d, 0x0e, - 0x33, 0x32, 0x98, 0x6d, 0xe0, 0x2c, 0x46, 0x77, 0x15, 0x0a, 0x31, 0xb6, 0xeb, 0xf7, 0x6e, 0x89, - 0x16, 0x96, 0x89, 0x89, 0x76, 0xb9, 0x12, 0xef, 0x72, 0xad, 0x01, 0xb3, 0x89, 0xe8, 0x17, 0xaf, - 0x5a, 0xbb, 0x0c, 0xa7, 0x64, 0x38, 0xd9, 0x4f, 0x11, 0x96, 0x61, 0x7f, 0x0a, 0x96, 0x72, 0xad, - 0xed, 0x82, 0xda, 0x0b, 0x13, 0xf4, 0xde, 0x85, 0x49, 0x9f, 0x5e, 0x0c, 0x9b, 0x5b, 0x9e, 0x1f, - 0xc0, 0x50, 0xba, 0x10, 0xec, 0xfc, 0x7a, 0x96, 0x9f, 0xb4, 0x5a, 0x6f, 0xa4, 0x17, 0x5e, 0x60, - 0x3f, 0x2b, 0x70, 0xba, 0x4f, 0x10, 0xa1, 0xe7, 0x3d, 0xf8, 0x5f, 0x54, 0x8f, 0x4c, 0xf9, 0x21, - 0x04, 0x4d, 0x46, 0x04, 0xbd, 0xc0, 0x42, 0x7b, 0x38, 0x02, 0xb3, 0x51, 0xc6, 0xeb, 0xb2, 0x68, - 0xca, 0x9b, 0xd1, 0x7b, 0x2d, 0xe9, 0x10, 0xd1, 0x0c, 0x80, 0xc5, 0xf4, 0x9a, 0x4d, 0x8d, 0x3d, - 0x62, 0x72, 0x22, 0x99, 0x4a, 0xd6, 0x62, 0xeb, 0xc1, 0x07, 0xb4, 0x08, 0xc7, 0x3d, 0xea, 0x61, - 0x5b, 0x8f, 0x4e, 0xc3, 0x11, 0x3e, 0x5e, 0x8e, 0xf2, 0x8d, 0x6a, 0x67, 0x24, 0x9e, 0x83, 0x23, - 0x1d, 0xdb, 0x06, 0x36, 0x83, 0xfb, 0x67, 0xb4, 0x32, 0x29, 0x0d, 0x6f, 0x62, 0x93, 0xa0, 0x1a, - 0xcc, 0x04, 0x56, 0xfe, 0x90, 0x0b, 0x68, 0x34, 0x7d, 0x25, 0xa1, 0xf7, 0xb1, 0x74, 0x97, 0x56, - 0x9e, 0x7b, 0xd9, 0x22, 0x64, 0xa3, 0xe3, 0x43, 0x32, 0x79, 0x1f, 0xa6, 0xc2, 0x18, 0xe1, 0xa1, - 0x99, 0xfc, 0x72, 0x4a, 0xe1, 0xf9, 0xb8, 0xf4, 0x2c, 0xb3, 0x6a, 0xa2, 0x15, 0x18, 0xe3, 0xb7, - 0x0a, 0xbf, 0xa3, 0x72, 0xcb, 0x33, 0x49, 0xc7, 0xce, 0x6f, 0x90, 0x4a, 0x60, 0xab, 0xdd, 0x80, - 0xf9, 0x9e, 0x82, 0x8a, 0x1d, 0x4f, 0xba, 0xd9, 0xfd, 0xaf, 0x02, 0xe7, 0x06, 0xfb, 0x11, 0xc7, - 0x7c, 0x80, 0x23, 0x74, 0x1b, 0x4e, 0xd0, 0x7d, 0xe2, 0x62, 0xbb, 0x3b, 0x2f, 0xc3, 0xe9, 0xf2, - 0x32, 0x25, 0xd0, 0xb1, 0xcc, 0xd4, 0xba, 0x1b, 0x63, 0x84, 0x37, 0xc6, 0xd5, 0x14, 0x8d, 0xd1, - 0x4f, 0x44, 0xbf, 0x66, 0xd1, 0xf2, 0x9d, 0xf6, 0x0f, 0xa4, 0xb0, 0x2d, 0xea, 0xae, 0xd9, 0x76, - 0xf5, 0xa3, 0x0d, 0xcd, 0x14, 0x2f, 0xcb, 0x3e, 0x7b, 0x61, 0x62, 0xde, 0x84, 0x49, 0xaf, 0xad, - 0x7b, 0x54, 0xaf, 0x7b, 0xba, 0x65, 0xca, 0xde, 0x9d, 0x4d, 0xa2, 0x58, 0x6d, 0x6f, 0x57, 0xcb, - 0x9b, 0xac, 0x92, 0xf5, 0xda, 0x55, 0xba, 0xed, 0x95, 0x4d, 0xb6, 0xfc, 0x4f, 0x0e, 0xc6, 0x78, - 0x18, 0xf4, 0x95, 0x02, 0xe3, 0xc1, 0x13, 0x17, 0x2d, 0x26, 0x39, 0xe8, 0x7d, 0x55, 0xe7, 0x2f, - 0xa4, 0xb2, 0x0d, 0xf8, 0x6a, 0xe7, 0xbf, 0xf8, 0xfd, 0xef, 0x6f, 0x87, 0xe7, 0x50, 0xa1, 0x34, - 0xf0, 0x0f, 0x07, 0xf4, 0x93, 0x02, 0xd3, 0xfd, 0x1e, 0xb4, 0xe8, 0xda, 0xc0, 0x68, 0x03, 0x1e, - 0xe1, 0xf9, 0xeb, 0xcf, 0x81, 0x14, 0xac, 0xe7, 0x39, 0xeb, 0x19, 0x74, 0x26, 0x89, 0x75, 0x03, - 0x1b, 0xe8, 0xa1, 0x02, 0x13, 0xe2, 0xa8, 0xd0, 0xe0, 0x9c, 0xc4, 0x5f, 0x38, 0xf9, 0x8b, 0xe9, - 0x8c, 0x05, 0x97, 0x65, 0xce, 0xe5, 0x22, 0x5a, 0x4c, 0xe2, 0xe2, 0x37, 0x49, 0xe9, 0x7e, 0xa4, - 0x5d, 0x1e, 0xa0, 0xaf, 0x15, 0xc8, 0xc8, 0x0b, 0x17, 0xa5, 0x0a, 0x17, 0x66, 0xed, 0x52, 0x4a, - 0x6b, 0xc1, 0xee, 0x25, 0xce, 0x6e, 0x16, 0xcd, 0x0c, 0x62, 0xc7, 0xd0, 0xaf, 0x0a, 0xa0, 0xde, - 0x17, 0x00, 0xba, 0x92, 0x2a, 0x58, 0xcf, 0x83, 0x23, 0x7f, 0xf5, 0xd0, 0x38, 0x41, 0xf7, 0x3a, - 0xa7, 0xbb, 0x82, 0x96, 0x12, 0xcb, 0x51, 0x20, 0x02, 0xde, 0xa5, 0xfb, 0x72, 0xfd, 0x00, 0x7d, - 0xaf, 0x40, 0x2e, 0xd2, 0xf1, 0xa8, 0x74, 0x10, 0x87, 0xae, 0xf7, 0x47, 0xfe, 0xd5, 0xf4, 0x00, - 0xc1, 0x76, 0x85, 0xb3, 0xbd, 0x84, 0x2e, 0x24, 0xb1, 0x95, 0xa3, 0xaa, 0x74, 0x5f, 0xfe, 0x7a, - 0x80, 0xbe, 0x53, 0x60, 0x32, 0x3a, 0x99, 0x50, 0xea, 0xb8, 0x61, 0x0d, 0x2c, 0x1d, 0x02, 0x21, - 0xa8, 0xbe, 0xc2, 0xa9, 0xce, 0xa3, 0xb3, 0x07, 0x51, 0x65, 0xe8, 0x37, 0x05, 0x4e, 0x25, 0x8c, - 0x4e, 0xf4, 0x46, 0xea, 0xc8, 0xbd, 0xb7, 0x4f, 0x7e, 0xf5, 0xf9, 0xc0, 0x42, 0xc1, 0x2a, 0x57, - 0x70, 0x05, 0xbd, 0x36, 0xb0, 0xcf, 0x42, 0x19, 0x5d, 0x1d, 0xf7, 0x83, 0x02, 0x53, 0x7d, 0xe6, - 0xf6, 0xc1, 0xc9, 0xef, 0x46, 0xe4, 0xaf, 0x1d, 0x16, 0x91, 0x7e, 0x6a, 0x79, 0x6d, 0x63, 0xfd, - 0x9d, 0x47, 0x4f, 0x0b, 0xca, 0xe3, 0xa7, 0x05, 0xe5, 0xaf, 0xa7, 0x05, 0xe5, 0x9b, 0x67, 0x85, - 0xa1, 0xc7, 0xcf, 0x0a, 0x43, 0x7f, 0x3c, 0x2b, 0x0c, 0xdd, 0x59, 0xaa, 0x5b, 0xde, 0x6e, 0xab, - 0xe6, 0x87, 0x17, 0x0e, 0x2e, 0xd1, 0x9d, 0x1d, 0xcb, 0xb0, 0xb0, 0x2d, 0x1d, 0x76, 0x5c, 0x7a, - 0xf7, 0x9a, 0x84, 0xd5, 0xc6, 0xf9, 0x7f, 0x5f, 0x56, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xcf, - 0x46, 0x85, 0x44, 0x86, 0x12, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Params returns parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // MessagesAndContracts return all cosmos.base.v1beta1.Msg messages and available contract details - MessagesAndContracts(ctx context.Context, in *QueryMessagesAndContractsRequest, opts ...grpc.CallOption) (*QueryMessagesAndContractsResponse, error) - // GasTank returns gas tank details - GasTank(ctx context.Context, in *QueryGasTankRequest, opts ...grpc.CallOption) (*QueryGasTankResponse, error) - // GasTanks return details of all the gas tanks - GasTanks(ctx context.Context, in *QueryGasTanksRequest, opts ...grpc.CallOption) (*QueryGasTanksResponse, error) - // GasTanksByProvider return details of all the gas tanks for the given provider - GasTanksByProvider(ctx context.Context, in *QueryGasTanksByProviderRequest, opts ...grpc.CallOption) (*QueryGasTanksByProviderResponse, error) - // GasConsumer returns gas consumer details - GasConsumer(ctx context.Context, in *QueryGasConsumerRequest, opts ...grpc.CallOption) (*QueryGasConsumerResponse, error) - // GasConsumers return details of all the gas consumers - GasConsumers(ctx context.Context, in *QueryGasConsumersRequest, opts ...grpc.CallOption) (*QueryGasConsumersResponse, error) - // GasConsumersByGasTankID return details of all the gas consumers for the given tank ID - GasConsumersByGasTankID(ctx context.Context, in *QueryGasConsumersByGasTankIDRequest, opts ...grpc.CallOption) (*QueryGasConsumersByGasTankIDResponse, error) - // GasTankIdsForAllTXC returns gas tanks ids with all available tx or contracts - GasTankIdsForAllTXC(ctx context.Context, in *QueryGasTankIdsForAllTXC, opts ...grpc.CallOption) (*QueryGasTankIdsForAllTXCResponse, 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 -} - -func (c *queryClient) MessagesAndContracts(ctx context.Context, in *QueryMessagesAndContractsRequest, opts ...grpc.CallOption) (*QueryMessagesAndContractsResponse, error) { - out := new(QueryMessagesAndContractsResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/MessagesAndContracts", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GasTank(ctx context.Context, in *QueryGasTankRequest, opts ...grpc.CallOption) (*QueryGasTankResponse, error) { - out := new(QueryGasTankResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/GasTank", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GasTanks(ctx context.Context, in *QueryGasTanksRequest, opts ...grpc.CallOption) (*QueryGasTanksResponse, error) { - out := new(QueryGasTanksResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/GasTanks", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GasTanksByProvider(ctx context.Context, in *QueryGasTanksByProviderRequest, opts ...grpc.CallOption) (*QueryGasTanksByProviderResponse, error) { - out := new(QueryGasTanksByProviderResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/GasTanksByProvider", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GasConsumer(ctx context.Context, in *QueryGasConsumerRequest, opts ...grpc.CallOption) (*QueryGasConsumerResponse, error) { - out := new(QueryGasConsumerResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/GasConsumer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GasConsumers(ctx context.Context, in *QueryGasConsumersRequest, opts ...grpc.CallOption) (*QueryGasConsumersResponse, error) { - out := new(QueryGasConsumersResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/GasConsumers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GasConsumersByGasTankID(ctx context.Context, in *QueryGasConsumersByGasTankIDRequest, opts ...grpc.CallOption) (*QueryGasConsumersByGasTankIDResponse, error) { - out := new(QueryGasConsumersByGasTankIDResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/GasConsumersByGasTankID", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GasTankIdsForAllTXC(ctx context.Context, in *QueryGasTankIdsForAllTXC, opts ...grpc.CallOption) (*QueryGasTankIdsForAllTXCResponse, error) { - out := new(QueryGasTankIdsForAllTXCResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Query/GasTankIdsForAllTXC", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Params returns parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // MessagesAndContracts return all cosmos.base.v1beta1.Msg messages and available contract details - MessagesAndContracts(context.Context, *QueryMessagesAndContractsRequest) (*QueryMessagesAndContractsResponse, error) - // GasTank returns gas tank details - GasTank(context.Context, *QueryGasTankRequest) (*QueryGasTankResponse, error) - // GasTanks return details of all the gas tanks - GasTanks(context.Context, *QueryGasTanksRequest) (*QueryGasTanksResponse, error) - // GasTanksByProvider return details of all the gas tanks for the given provider - GasTanksByProvider(context.Context, *QueryGasTanksByProviderRequest) (*QueryGasTanksByProviderResponse, error) - // GasConsumer returns gas consumer details - GasConsumer(context.Context, *QueryGasConsumerRequest) (*QueryGasConsumerResponse, error) - // GasConsumers return details of all the gas consumers - GasConsumers(context.Context, *QueryGasConsumersRequest) (*QueryGasConsumersResponse, error) - // GasConsumersByGasTankID return details of all the gas consumers for the given tank ID - GasConsumersByGasTankID(context.Context, *QueryGasConsumersByGasTankIDRequest) (*QueryGasConsumersByGasTankIDResponse, error) - // GasTankIdsForAllTXC returns gas tanks ids with all available tx or contracts - GasTankIdsForAllTXC(context.Context, *QueryGasTankIdsForAllTXC) (*QueryGasTankIdsForAllTXCResponse, 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 (*UnimplementedQueryServer) MessagesAndContracts(ctx context.Context, req *QueryMessagesAndContractsRequest) (*QueryMessagesAndContractsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MessagesAndContracts not implemented") -} -func (*UnimplementedQueryServer) GasTank(ctx context.Context, req *QueryGasTankRequest) (*QueryGasTankResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasTank not implemented") -} -func (*UnimplementedQueryServer) GasTanks(ctx context.Context, req *QueryGasTanksRequest) (*QueryGasTanksResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasTanks not implemented") -} -func (*UnimplementedQueryServer) GasTanksByProvider(ctx context.Context, req *QueryGasTanksByProviderRequest) (*QueryGasTanksByProviderResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasTanksByProvider not implemented") -} -func (*UnimplementedQueryServer) GasConsumer(ctx context.Context, req *QueryGasConsumerRequest) (*QueryGasConsumerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasConsumer not implemented") -} -func (*UnimplementedQueryServer) GasConsumers(ctx context.Context, req *QueryGasConsumersRequest) (*QueryGasConsumersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasConsumers not implemented") -} -func (*UnimplementedQueryServer) GasConsumersByGasTankID(ctx context.Context, req *QueryGasConsumersByGasTankIDRequest) (*QueryGasConsumersByGasTankIDResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasConsumersByGasTankID not implemented") -} -func (*UnimplementedQueryServer) GasTankIdsForAllTXC(ctx context.Context, req *QueryGasTankIdsForAllTXC) (*QueryGasTankIdsForAllTXCResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasTankIdsForAllTXC 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) -} - -func _Query_MessagesAndContracts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryMessagesAndContractsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).MessagesAndContracts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Query/MessagesAndContracts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).MessagesAndContracts(ctx, req.(*QueryMessagesAndContractsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GasTank_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGasTankRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasTank(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Query/GasTank", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasTank(ctx, req.(*QueryGasTankRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GasTanks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGasTanksRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasTanks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Query/GasTanks", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasTanks(ctx, req.(*QueryGasTanksRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GasTanksByProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGasTanksByProviderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasTanksByProvider(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Query/GasTanksByProvider", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasTanksByProvider(ctx, req.(*QueryGasTanksByProviderRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GasConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGasConsumerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasConsumer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Query/GasConsumer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasConsumer(ctx, req.(*QueryGasConsumerRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GasConsumers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGasConsumersRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasConsumers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Query/GasConsumers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasConsumers(ctx, req.(*QueryGasConsumersRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GasConsumersByGasTankID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGasConsumersByGasTankIDRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasConsumersByGasTankID(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Query/GasConsumersByGasTankID", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasConsumersByGasTankID(ctx, req.(*QueryGasConsumersByGasTankIDRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GasTankIdsForAllTXC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGasTankIdsForAllTXC) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasTankIdsForAllTXC(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Query/GasTankIdsForAllTXC", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasTankIdsForAllTXC(ctx, req.(*QueryGasTankIdsForAllTXC)) - } - 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, - }, - { - MethodName: "MessagesAndContracts", - Handler: _Query_MessagesAndContracts_Handler, - }, - { - MethodName: "GasTank", - Handler: _Query_GasTank_Handler, - }, - { - MethodName: "GasTanks", - Handler: _Query_GasTanks_Handler, - }, - { - MethodName: "GasTanksByProvider", - Handler: _Query_GasTanksByProvider_Handler, - }, - { - MethodName: "GasConsumer", - Handler: _Query_GasConsumer_Handler, - }, - { - MethodName: "GasConsumers", - Handler: _Query_GasConsumers_Handler, - }, - { - MethodName: "GasConsumersByGasTankID", - Handler: _Query_GasConsumersByGasTankID_Handler, - }, - { - MethodName: "GasTankIdsForAllTXC", - Handler: _Query_GasTankIdsForAllTXC_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 (m *QueryMessagesAndContractsRequest) 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 *QueryMessagesAndContractsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryMessagesAndContractsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ContractDetails) 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 *ContractDetails) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContractDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Lable) > 0 { - i -= len(m.Lable) - copy(dAtA[i:], m.Lable) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Lable))) - i-- - dAtA[i] = 0x1a - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if m.CodeId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryMessagesAndContractsResponse) 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 *QueryMessagesAndContractsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryMessagesAndContractsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Contracts) > 0 { - for iNdEx := len(m.Contracts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Contracts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Messages[iNdEx]) - copy(dAtA[i:], m.Messages[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Messages[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *GasTankResponse) 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 *GasTankResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GasTankResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FeeDenom) > 0 { - i -= len(m.FeeDenom) - copy(dAtA[i:], m.FeeDenom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.FeeDenom))) - i-- - dAtA[i] = 0x62 - } - if len(m.AuthorizedActors) > 0 { - for iNdEx := len(m.AuthorizedActors) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AuthorizedActors[iNdEx]) - copy(dAtA[i:], m.AuthorizedActors[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.AuthorizedActors[iNdEx]))) - i-- - dAtA[i] = 0x5a - } - } - if len(m.ContractsAllowed) > 0 { - for iNdEx := len(m.ContractsAllowed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ContractsAllowed[iNdEx]) - copy(dAtA[i:], m.ContractsAllowed[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractsAllowed[iNdEx]))) - i-- - dAtA[i] = 0x52 - } - } - if len(m.TxsAllowed) > 0 { - for iNdEx := len(m.TxsAllowed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.TxsAllowed[iNdEx]) - copy(dAtA[i:], m.TxsAllowed[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TxsAllowed[iNdEx]))) - i-- - dAtA[i] = 0x4a - } - } - { - size := m.MaxFeeUsagePerTx.Size() - i -= size - if _, err := m.MaxFeeUsagePerTx.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - { - size := m.MaxFeeUsagePerConsumer.Size() - i -= size - if _, err := m.MaxFeeUsagePerConsumer.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - if m.MaxTxsCountPerConsumer != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.MaxTxsCountPerConsumer)) - i-- - dAtA[i] = 0x30 - } - if m.IsActive { - i-- - if m.IsActive { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - { - size, err := m.GasTankBalance.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if len(m.Reserve) > 0 { - i -= len(m.Reserve) - copy(dAtA[i:], m.Reserve) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Reserve))) - i-- - dAtA[i] = 0x1a - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if m.Id != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryGasTankRequest) 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 *QueryGasTankRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasTankRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GasTankId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryGasTankResponse) 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 *QueryGasTankResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasTankResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.GasTank.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 (m *QueryGasTanksRequest) 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 *QueryGasTanksRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasTanksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.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 (m *QueryGasTanksResponse) 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 *QueryGasTanksResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasTanksResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.GasTanks) > 0 { - for iNdEx := len(m.GasTanks) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasTanks[iNdEx].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 (m *QueryGasTanksByProviderRequest) 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 *QueryGasTanksByProviderRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasTanksByProviderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGasTanksByProviderResponse) 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 *QueryGasTanksByProviderResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasTanksByProviderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GasTanks) > 0 { - for iNdEx := len(m.GasTanks) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasTanks[iNdEx].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 (m *QueryGasConsumerRequest) 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 *QueryGasConsumerRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasConsumerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGasConsumerResponse) 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 *QueryGasConsumerResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasConsumerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.GasConsumer.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 (m *QueryGasConsumersRequest) 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 *QueryGasConsumersRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasConsumersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.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 (m *QueryGasConsumersResponse) 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 *QueryGasConsumersResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasConsumersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.GasConsumers) > 0 { - for iNdEx := len(m.GasConsumers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasConsumers[iNdEx].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 (m *GasConsumersByGasTankIDResponse) 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 *GasConsumersByGasTankIDResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GasConsumersByGasTankIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Usage != nil { - { - size, err := m.Usage.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - { - size, err := m.TotalFeesConsumed.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - { - size, err := m.TotalFeeConsumptionAllowed.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.TotalTxsMade != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TotalTxsMade)) - i-- - dAtA[i] = 0x20 - } - if m.TotalTxsAllowed != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TotalTxsAllowed)) - i-- - dAtA[i] = 0x18 - } - if m.IsBlocked { - i-- - if m.IsBlocked { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGasConsumersByGasTankIDRequest) 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 *QueryGasConsumersByGasTankIDRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasConsumersByGasTankIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GasTankId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryGasConsumersByGasTankIDResponse) 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 *QueryGasConsumersByGasTankIDResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasConsumersByGasTankIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GasConsumers) > 0 { - for iNdEx := len(m.GasConsumers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasConsumers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - { - size, err := m.OverallFeesConsumed.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.GasTankId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryGasTankIdsForAllTXC) 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 *QueryGasTankIdsForAllTXC) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasTankIdsForAllTXC) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryGasTankIdsForAllTXCResponse) 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 *QueryGasTankIdsForAllTXCResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGasTankIdsForAllTXCResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TxToGtIds) > 0 { - for iNdEx := len(m.TxToGtIds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TxToGtIds[iNdEx].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 (m *QueryMessagesAndContractsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ContractDetails) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CodeId != 0 { - n += 1 + sovQuery(uint64(m.CodeId)) - } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Lable) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryMessagesAndContractsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Messages) > 0 { - for _, s := range m.Messages { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - if len(m.Contracts) > 0 { - for _, e := range m.Contracts { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *GasTankResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovQuery(uint64(m.Id)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Reserve) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = m.GasTankBalance.Size() - n += 1 + l + sovQuery(uint64(l)) - if m.IsActive { - n += 2 - } - if m.MaxTxsCountPerConsumer != 0 { - n += 1 + sovQuery(uint64(m.MaxTxsCountPerConsumer)) - } - l = m.MaxFeeUsagePerConsumer.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.MaxFeeUsagePerTx.Size() - n += 1 + l + sovQuery(uint64(l)) - if len(m.TxsAllowed) > 0 { - for _, s := range m.TxsAllowed { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - if len(m.ContractsAllowed) > 0 { - for _, s := range m.ContractsAllowed { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - if len(m.AuthorizedActors) > 0 { - for _, s := range m.AuthorizedActors { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - l = len(m.FeeDenom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGasTankRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovQuery(uint64(m.GasTankId)) - } - return n -} - -func (m *QueryGasTankResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.GasTank.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryGasTanksRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGasTanksResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.GasTanks) > 0 { - for _, e := range m.GasTanks { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGasTanksByProviderRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGasTanksByProviderResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.GasTanks) > 0 { - for _, e := range m.GasTanks { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryGasConsumerRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGasConsumerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.GasConsumer.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryGasConsumersRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGasConsumersResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.GasConsumers) > 0 { - for _, e := range m.GasConsumers { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *GasConsumersByGasTankIDResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.IsBlocked { - n += 2 - } - if m.TotalTxsAllowed != 0 { - n += 1 + sovQuery(uint64(m.TotalTxsAllowed)) - } - if m.TotalTxsMade != 0 { - n += 1 + sovQuery(uint64(m.TotalTxsMade)) - } - l = m.TotalFeeConsumptionAllowed.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.TotalFeesConsumed.Size() - n += 1 + l + sovQuery(uint64(l)) - if m.Usage != nil { - l = m.Usage.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGasConsumersByGasTankIDRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovQuery(uint64(m.GasTankId)) - } - return n -} - -func (m *QueryGasConsumersByGasTankIDResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovQuery(uint64(m.GasTankId)) - } - l = m.OverallFeesConsumed.Size() - n += 1 + l + sovQuery(uint64(l)) - if len(m.GasConsumers) > 0 { - for _, e := range m.GasConsumers { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryGasTankIdsForAllTXC) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryGasTankIdsForAllTXCResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.TxToGtIds) > 0 { - for _, e := range m.TxToGtIds { - l = e.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 (m *QueryMessagesAndContractsRequest) 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: QueryMessagesAndContractsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMessagesAndContractsRequest: 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 *ContractDetails) 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: ContractDetails: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContractDetails: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) - } - m.CodeId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CodeId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lable", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Lable = string(dAtA[iNdEx:postIndex]) - 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 (m *QueryMessagesAndContractsResponse) 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: QueryMessagesAndContractsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMessagesAndContractsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contracts", 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 - } - m.Contracts = append(m.Contracts, &ContractDetails{}) - if err := m.Contracts[len(m.Contracts)-1].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 (m *GasTankResponse) 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: GasTankResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GasTankResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reserve", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reserve = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankBalance", 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.GasTankBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsActive", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsActive = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxTxsCountPerConsumer", wireType) - } - m.MaxTxsCountPerConsumer = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxTxsCountPerConsumer |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxFeeUsagePerConsumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxFeeUsagePerConsumer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxFeeUsagePerTx", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxFeeUsagePerTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxsAllowed", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxsAllowed = append(m.TxsAllowed, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractsAllowed", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractsAllowed = append(m.ContractsAllowed, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorizedActors", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AuthorizedActors = append(m.AuthorizedActors, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FeeDenom = string(dAtA[iNdEx:postIndex]) - 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 (m *QueryGasTankRequest) 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: QueryGasTankRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasTankRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *QueryGasTankResponse) 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: QueryGasTankResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasTankResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTank", 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.GasTank.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 (m *QueryGasTanksRequest) 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: QueryGasTanksRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasTanksRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.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 (m *QueryGasTanksResponse) 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: QueryGasTanksResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasTanksResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTanks", 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 - } - m.GasTanks = append(m.GasTanks, GasTankResponse{}) - if err := m.GasTanks[len(m.GasTanks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.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 (m *QueryGasTanksByProviderRequest) 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: QueryGasTanksByProviderRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasTanksByProviderRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - 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 (m *QueryGasTanksByProviderResponse) 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: QueryGasTanksByProviderResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasTanksByProviderResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTanks", 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 - } - m.GasTanks = append(m.GasTanks, GasTankResponse{}) - if err := m.GasTanks[len(m.GasTanks)-1].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 (m *QueryGasConsumerRequest) 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: QueryGasConsumerRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasConsumerRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Consumer = string(dAtA[iNdEx:postIndex]) - 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 (m *QueryGasConsumerResponse) 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: QueryGasConsumerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasConsumerResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasConsumer", 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.GasConsumer.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 (m *QueryGasConsumersRequest) 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: QueryGasConsumersRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasConsumersRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.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 (m *QueryGasConsumersResponse) 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: QueryGasConsumersResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasConsumersResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasConsumers", 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 - } - m.GasConsumers = append(m.GasConsumers, GasConsumer{}) - if err := m.GasConsumers[len(m.GasConsumers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.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 (m *GasConsumersByGasTankIDResponse) 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: GasConsumersByGasTankIDResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GasConsumersByGasTankIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsBlocked", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsBlocked = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalTxsAllowed", wireType) - } - m.TotalTxsAllowed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalTxsAllowed |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalTxsMade", wireType) - } - m.TotalTxsMade = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalTxsMade |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalFeeConsumptionAllowed", 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.TotalFeeConsumptionAllowed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalFeesConsumed", 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.TotalFeesConsumed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Usage", 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 m.Usage == nil { - m.Usage = &Usage{} - } - if err := m.Usage.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 (m *QueryGasConsumersByGasTankIDRequest) 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: QueryGasConsumersByGasTankIDRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasConsumersByGasTankIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *QueryGasConsumersByGasTankIDResponse) 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: QueryGasConsumersByGasTankIDResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasConsumersByGasTankIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OverallFeesConsumed", 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.OverallFeesConsumed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasConsumers", 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 - } - m.GasConsumers = append(m.GasConsumers, GasConsumersByGasTankIDResponse{}) - if err := m.GasConsumers[len(m.GasConsumers)-1].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 (m *QueryGasTankIdsForAllTXC) 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: QueryGasTankIdsForAllTXC: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasTankIdsForAllTXC: 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 *QueryGasTankIdsForAllTXCResponse) 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: QueryGasTankIdsForAllTXCResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGasTankIdsForAllTXCResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxToGtIds", 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 - } - m.TxToGtIds = append(m.TxToGtIds, &TxGTIDs{}) - if err := m.TxToGtIds[len(m.TxToGtIds)-1].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 deleted file mode 100644 index a20f2849f..000000000 --- a/x/gasless/types/query.pb.gw.go +++ /dev/null @@ -1,853 +0,0 @@ -// 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 - -} - -func request_Query_MessagesAndContracts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryMessagesAndContractsRequest - var metadata runtime.ServerMetadata - - msg, err := client.MessagesAndContracts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_MessagesAndContracts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryMessagesAndContractsRequest - var metadata runtime.ServerMetadata - - msg, err := server.MessagesAndContracts(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_GasTank_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasTankRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["gas_tank_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "gas_tank_id") - } - - protoReq.GasTankId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "gas_tank_id", err) - } - - msg, err := client.GasTank(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GasTank_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasTankRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["gas_tank_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "gas_tank_id") - } - - protoReq.GasTankId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "gas_tank_id", err) - } - - msg, err := server.GasTank(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_GasTanks_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_GasTanks_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasTanksRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GasTanks_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GasTanks(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GasTanks_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasTanksRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GasTanks_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.GasTanks(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_GasTanksByProvider_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasTanksByProviderRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["provider"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider") - } - - protoReq.Provider, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider", err) - } - - msg, err := client.GasTanksByProvider(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GasTanksByProvider_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasTanksByProviderRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["provider"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider") - } - - protoReq.Provider, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider", err) - } - - msg, err := server.GasTanksByProvider(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_GasConsumer_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasConsumerRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["consumer"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer") - } - - protoReq.Consumer, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer", err) - } - - msg, err := client.GasConsumer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GasConsumer_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasConsumerRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["consumer"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer") - } - - protoReq.Consumer, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer", err) - } - - msg, err := server.GasConsumer(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_GasConsumers_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_GasConsumers_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasConsumersRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GasConsumers_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GasConsumers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GasConsumers_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasConsumersRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GasConsumers_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.GasConsumers(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_GasConsumersByGasTankID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasConsumersByGasTankIDRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["gas_tank_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "gas_tank_id") - } - - protoReq.GasTankId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "gas_tank_id", err) - } - - msg, err := client.GasConsumersByGasTankID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GasConsumersByGasTankID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasConsumersByGasTankIDRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["gas_tank_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "gas_tank_id") - } - - protoReq.GasTankId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "gas_tank_id", err) - } - - msg, err := server.GasConsumersByGasTankID(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_GasTankIdsForAllTXC_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasTankIdsForAllTXC - var metadata runtime.ServerMetadata - - msg, err := client.GasTankIdsForAllTXC(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GasTankIdsForAllTXC_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGasTankIdsForAllTXC - var metadata runtime.ServerMetadata - - msg, err := server.GasTankIdsForAllTXC(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()...) - - }) - - mux.Handle("GET", pattern_Query_MessagesAndContracts_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_MessagesAndContracts_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_MessagesAndContracts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasTank_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_GasTank_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_GasTank_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasTanks_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_GasTanks_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_GasTanks_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasTanksByProvider_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_GasTanksByProvider_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_GasTanksByProvider_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasConsumer_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_GasConsumer_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_GasConsumer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasConsumers_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_GasConsumers_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_GasConsumers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasConsumersByGasTankID_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_GasConsumersByGasTankID_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_GasConsumersByGasTankID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasTankIdsForAllTXC_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_GasTankIdsForAllTXC_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_GasTankIdsForAllTXC_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()...) - - }) - - mux.Handle("GET", pattern_Query_MessagesAndContracts_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_MessagesAndContracts_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_MessagesAndContracts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasTank_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_GasTank_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_GasTank_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasTanks_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_GasTanks_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_GasTanks_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasTanksByProvider_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_GasTanksByProvider_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_GasTanksByProvider_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasConsumer_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_GasConsumer_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_GasConsumer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasConsumers_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_GasConsumers_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_GasConsumers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasConsumersByGasTankID_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_GasConsumersByGasTankID_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_GasConsumersByGasTankID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GasTankIdsForAllTXC_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_GasTankIdsForAllTXC_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_GasTankIdsForAllTXC_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))) - - pattern_Query_MessagesAndContracts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"comdex", "gasless", "v1beta1", "mac"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GasTank_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"comdex", "gasless", "v1beta1", "tank", "gas_tank_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GasTanks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"comdex", "gasless", "v1beta1", "tanks"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GasTanksByProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 3}, []string{"comdex", "gasless", "v1beta1", "provider", "tanks"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GasConsumer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 3}, []string{"comdex", "gasless", "v1beta1", "consumer"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GasConsumers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"comdex", "gasless", "v1beta1", "consumers"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GasConsumersByGasTankID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"comdex", "gasless", "v1beta1", "tank", "consumers", "gas_tank_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GasTankIdsForAllTXC_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"comdex", "gasless", "v1beta1", "txc"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_MessagesAndContracts_0 = runtime.ForwardResponseMessage - - forward_Query_GasTank_0 = runtime.ForwardResponseMessage - - forward_Query_GasTanks_0 = runtime.ForwardResponseMessage - - forward_Query_GasTanksByProvider_0 = runtime.ForwardResponseMessage - - forward_Query_GasConsumer_0 = runtime.ForwardResponseMessage - - forward_Query_GasConsumers_0 = runtime.ForwardResponseMessage - - forward_Query_GasConsumersByGasTankID_0 = runtime.ForwardResponseMessage - - forward_Query_GasTankIdsForAllTXC_0 = runtime.ForwardResponseMessage -) diff --git a/x/gasless/types/tx.pb.go b/x/gasless/types/tx.pb.go deleted file mode 100644 index 7187c197d..000000000 --- a/x/gasless/types/tx.pb.go +++ /dev/null @@ -1,4047 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: comdex/gasless/v1beta1/tx.proto - -package types - -import ( - context "context" - cosmossdk_io_math "cosmossdk.io/math" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgCreateGasTank defines an SDK message for creating a new GasTank. -type MsgCreateGasTank struct { - // provider specifies the bech32-encoded address that is the gas provider. - Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` - // fee_denom specifies the denom of the gas deposit coin - FeeDenom string `protobuf:"bytes,2,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` - // max_fee_usage_per_tx specifies the maximum fee allowed for each tx - MaxFeeUsagePerTx cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=max_fee_usage_per_tx,json=maxFeeUsagePerTx,proto3,customtype=cosmossdk.io/math.Int" json:"max_fee_usage_per_tx"` - // max_txs_count_per_consumer specifies the number of txs allowed for each consumer - MaxTxsCountPerConsumer uint64 `protobuf:"varint,4,opt,name=max_txs_count_per_consumer,json=maxTxsCountPerConsumer,proto3" json:"max_txs_count_per_consumer,omitempty"` - // max_fee_usage_per_consumer specifies the maximum fee consumption allowed for each consumer - MaxFeeUsagePerConsumer cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=max_fee_usage_per_consumer,json=maxFeeUsagePerConsumer,proto3,customtype=cosmossdk.io/math.Int" json:"max_fee_usage_per_consumer"` - // txs_allowed specifies txs paths allowed to consume gas from the gas tank - TxsAllowed []string `protobuf:"bytes,6,rep,name=txs_allowed,json=txsAllowed,proto3" json:"txs_allowed,omitempty"` - // contracts_allowed specifies wasm contracts allowed to consume gas from the gas tank - ContractsAllowed []string `protobuf:"bytes,7,rep,name=contracts_allowed,json=contractsAllowed,proto3" json:"contracts_allowed,omitempty"` - // gas_deposit specifies the initial desposit in the gas tank - GasDeposit types.Coin `protobuf:"bytes,8,opt,name=gas_deposit,json=gasDeposit,proto3" json:"gas_deposit"` -} - -func (m *MsgCreateGasTank) Reset() { *m = MsgCreateGasTank{} } -func (m *MsgCreateGasTank) String() string { return proto.CompactTextString(m) } -func (*MsgCreateGasTank) ProtoMessage() {} -func (*MsgCreateGasTank) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{0} -} -func (m *MsgCreateGasTank) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateGasTank) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateGasTank.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 *MsgCreateGasTank) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateGasTank.Merge(m, src) -} -func (m *MsgCreateGasTank) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateGasTank) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateGasTank.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateGasTank proto.InternalMessageInfo - -func (m *MsgCreateGasTank) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -func (m *MsgCreateGasTank) GetFeeDenom() string { - if m != nil { - return m.FeeDenom - } - return "" -} - -func (m *MsgCreateGasTank) GetMaxTxsCountPerConsumer() uint64 { - if m != nil { - return m.MaxTxsCountPerConsumer - } - return 0 -} - -func (m *MsgCreateGasTank) GetTxsAllowed() []string { - if m != nil { - return m.TxsAllowed - } - return nil -} - -func (m *MsgCreateGasTank) GetContractsAllowed() []string { - if m != nil { - return m.ContractsAllowed - } - return nil -} - -func (m *MsgCreateGasTank) GetGasDeposit() types.Coin { - if m != nil { - return m.GasDeposit - } - return types.Coin{} -} - -type MsgCreateGasTankResponse struct { -} - -func (m *MsgCreateGasTankResponse) Reset() { *m = MsgCreateGasTankResponse{} } -func (m *MsgCreateGasTankResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateGasTankResponse) ProtoMessage() {} -func (*MsgCreateGasTankResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{1} -} -func (m *MsgCreateGasTankResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateGasTankResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateGasTankResponse.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 *MsgCreateGasTankResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateGasTankResponse.Merge(m, src) -} -func (m *MsgCreateGasTankResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateGasTankResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateGasTankResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateGasTankResponse proto.InternalMessageInfo - -// MsgAuthorizeActors defines the SDK message for authorizing accounts to take actions on provider's behalf -type MsgAuthorizeActors struct { - // gas_tank_id specifies the id of the gas tank - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` - // provider specifies the bech32-encoded address that is the gas provider. - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - // actors specifies the list of bech32-encoded address allowed to take actions - Actors []string `protobuf:"bytes,3,rep,name=actors,proto3" json:"actors,omitempty"` -} - -func (m *MsgAuthorizeActors) Reset() { *m = MsgAuthorizeActors{} } -func (m *MsgAuthorizeActors) String() string { return proto.CompactTextString(m) } -func (*MsgAuthorizeActors) ProtoMessage() {} -func (*MsgAuthorizeActors) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{2} -} -func (m *MsgAuthorizeActors) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAuthorizeActors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAuthorizeActors.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 *MsgAuthorizeActors) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAuthorizeActors.Merge(m, src) -} -func (m *MsgAuthorizeActors) XXX_Size() int { - return m.Size() -} -func (m *MsgAuthorizeActors) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAuthorizeActors.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAuthorizeActors proto.InternalMessageInfo - -func (m *MsgAuthorizeActors) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -func (m *MsgAuthorizeActors) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -func (m *MsgAuthorizeActors) GetActors() []string { - if m != nil { - return m.Actors - } - return nil -} - -type MsgAuthorizeActorsResponse struct { -} - -func (m *MsgAuthorizeActorsResponse) Reset() { *m = MsgAuthorizeActorsResponse{} } -func (m *MsgAuthorizeActorsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAuthorizeActorsResponse) ProtoMessage() {} -func (*MsgAuthorizeActorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{3} -} -func (m *MsgAuthorizeActorsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAuthorizeActorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAuthorizeActorsResponse.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 *MsgAuthorizeActorsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAuthorizeActorsResponse.Merge(m, src) -} -func (m *MsgAuthorizeActorsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAuthorizeActorsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAuthorizeActorsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAuthorizeActorsResponse proto.InternalMessageInfo - -// MsgUpdateGasTankStatus defines an SDK message for updating the status of gas tank. -type MsgUpdateGasTankStatus struct { - // gas_tank_id specifies the id of the gas tank - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` - // provider specifies the bech32-encoded address that is the gas provider. - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` -} - -func (m *MsgUpdateGasTankStatus) Reset() { *m = MsgUpdateGasTankStatus{} } -func (m *MsgUpdateGasTankStatus) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateGasTankStatus) ProtoMessage() {} -func (*MsgUpdateGasTankStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{4} -} -func (m *MsgUpdateGasTankStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateGasTankStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateGasTankStatus.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 *MsgUpdateGasTankStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateGasTankStatus.Merge(m, src) -} -func (m *MsgUpdateGasTankStatus) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateGasTankStatus) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateGasTankStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateGasTankStatus proto.InternalMessageInfo - -func (m *MsgUpdateGasTankStatus) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -func (m *MsgUpdateGasTankStatus) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -type MsgUpdateGasTankStatusResponse struct { -} - -func (m *MsgUpdateGasTankStatusResponse) Reset() { *m = MsgUpdateGasTankStatusResponse{} } -func (m *MsgUpdateGasTankStatusResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateGasTankStatusResponse) ProtoMessage() {} -func (*MsgUpdateGasTankStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{5} -} -func (m *MsgUpdateGasTankStatusResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateGasTankStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateGasTankStatusResponse.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 *MsgUpdateGasTankStatusResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateGasTankStatusResponse.Merge(m, src) -} -func (m *MsgUpdateGasTankStatusResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateGasTankStatusResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateGasTankStatusResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateGasTankStatusResponse proto.InternalMessageInfo - -// MsgUpdateGasTankConfig defines an SDK message for updating the configs of gas tank. -type MsgUpdateGasTankConfig struct { - // gas_tank_id specifies the id of the gas tank - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` - // provider specifies the bech32-encoded address that is the gas provider. - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - // max_fee_usage_per_tx specifies the maximum fee allowed for each tx - MaxFeeUsagePerTx cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=max_fee_usage_per_tx,json=maxFeeUsagePerTx,proto3,customtype=cosmossdk.io/math.Int" json:"max_fee_usage_per_tx"` - // max_txs_count_per_consumer specifies the number of txs allowed for each consumer - MaxTxsCountPerConsumer uint64 `protobuf:"varint,4,opt,name=max_txs_count_per_consumer,json=maxTxsCountPerConsumer,proto3" json:"max_txs_count_per_consumer,omitempty"` - // max_fee_usage_per_consumer specifies the maximum fee consumption allowed for each consumer - MaxFeeUsagePerConsumer cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=max_fee_usage_per_consumer,json=maxFeeUsagePerConsumer,proto3,customtype=cosmossdk.io/math.Int" json:"max_fee_usage_per_consumer"` - // txs_allowed specifies txs paths allowed to consume gas from the gas tank - TxsAllowed []string `protobuf:"bytes,6,rep,name=txs_allowed,json=txsAllowed,proto3" json:"txs_allowed,omitempty"` - // contracts_allowed specifies wasm contracts allowed to consume gas from the gas tank - ContractsAllowed []string `protobuf:"bytes,7,rep,name=contracts_allowed,json=contractsAllowed,proto3" json:"contracts_allowed,omitempty"` -} - -func (m *MsgUpdateGasTankConfig) Reset() { *m = MsgUpdateGasTankConfig{} } -func (m *MsgUpdateGasTankConfig) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateGasTankConfig) ProtoMessage() {} -func (*MsgUpdateGasTankConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{6} -} -func (m *MsgUpdateGasTankConfig) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateGasTankConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateGasTankConfig.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 *MsgUpdateGasTankConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateGasTankConfig.Merge(m, src) -} -func (m *MsgUpdateGasTankConfig) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateGasTankConfig) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateGasTankConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateGasTankConfig proto.InternalMessageInfo - -func (m *MsgUpdateGasTankConfig) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -func (m *MsgUpdateGasTankConfig) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -func (m *MsgUpdateGasTankConfig) GetMaxTxsCountPerConsumer() uint64 { - if m != nil { - return m.MaxTxsCountPerConsumer - } - return 0 -} - -func (m *MsgUpdateGasTankConfig) GetTxsAllowed() []string { - if m != nil { - return m.TxsAllowed - } - return nil -} - -func (m *MsgUpdateGasTankConfig) GetContractsAllowed() []string { - if m != nil { - return m.ContractsAllowed - } - return nil -} - -type MsgUpdateGasTankConfigResponse struct { -} - -func (m *MsgUpdateGasTankConfigResponse) Reset() { *m = MsgUpdateGasTankConfigResponse{} } -func (m *MsgUpdateGasTankConfigResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateGasTankConfigResponse) ProtoMessage() {} -func (*MsgUpdateGasTankConfigResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{7} -} -func (m *MsgUpdateGasTankConfigResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateGasTankConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateGasTankConfigResponse.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 *MsgUpdateGasTankConfigResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateGasTankConfigResponse.Merge(m, src) -} -func (m *MsgUpdateGasTankConfigResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateGasTankConfigResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateGasTankConfigResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateGasTankConfigResponse proto.InternalMessageInfo - -// MsgBlockConsumer defines an SDK message for blocking the suspected malicious consumer. -type MsgBlockConsumer struct { - // gas_tank_id specifies the id of the gas tank - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` - // actor specifies the bech32-encoded address that is the gas provider or authorized actor. - Actor string `protobuf:"bytes,2,opt,name=actor,proto3" json:"actor,omitempty"` - // consumer specifies the bech32-encoded address of a consumer. - Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` -} - -func (m *MsgBlockConsumer) Reset() { *m = MsgBlockConsumer{} } -func (m *MsgBlockConsumer) String() string { return proto.CompactTextString(m) } -func (*MsgBlockConsumer) ProtoMessage() {} -func (*MsgBlockConsumer) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{8} -} -func (m *MsgBlockConsumer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBlockConsumer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBlockConsumer.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 *MsgBlockConsumer) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBlockConsumer.Merge(m, src) -} -func (m *MsgBlockConsumer) XXX_Size() int { - return m.Size() -} -func (m *MsgBlockConsumer) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBlockConsumer.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBlockConsumer proto.InternalMessageInfo - -func (m *MsgBlockConsumer) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -func (m *MsgBlockConsumer) GetActor() string { - if m != nil { - return m.Actor - } - return "" -} - -func (m *MsgBlockConsumer) GetConsumer() string { - if m != nil { - return m.Consumer - } - return "" -} - -type MsgBlockConsumerResponse struct { -} - -func (m *MsgBlockConsumerResponse) Reset() { *m = MsgBlockConsumerResponse{} } -func (m *MsgBlockConsumerResponse) String() string { return proto.CompactTextString(m) } -func (*MsgBlockConsumerResponse) ProtoMessage() {} -func (*MsgBlockConsumerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{9} -} -func (m *MsgBlockConsumerResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBlockConsumerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBlockConsumerResponse.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 *MsgBlockConsumerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBlockConsumerResponse.Merge(m, src) -} -func (m *MsgBlockConsumerResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgBlockConsumerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBlockConsumerResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBlockConsumerResponse proto.InternalMessageInfo - -// MsgUnblockConsumer defines an SDK message for unblocking consumer. -type MsgUnblockConsumer struct { - // gas_tank_id specifies the id of the gas tank - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` - // actor specifies the bech32-encoded address that is the gas provider or authorized actor. - Actor string `protobuf:"bytes,2,opt,name=actor,proto3" json:"actor,omitempty"` - // consumer specifies the bech32-encoded address of a consumer. - Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` -} - -func (m *MsgUnblockConsumer) Reset() { *m = MsgUnblockConsumer{} } -func (m *MsgUnblockConsumer) String() string { return proto.CompactTextString(m) } -func (*MsgUnblockConsumer) ProtoMessage() {} -func (*MsgUnblockConsumer) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{10} -} -func (m *MsgUnblockConsumer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUnblockConsumer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUnblockConsumer.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 *MsgUnblockConsumer) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUnblockConsumer.Merge(m, src) -} -func (m *MsgUnblockConsumer) XXX_Size() int { - return m.Size() -} -func (m *MsgUnblockConsumer) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUnblockConsumer.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUnblockConsumer proto.InternalMessageInfo - -func (m *MsgUnblockConsumer) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -func (m *MsgUnblockConsumer) GetActor() string { - if m != nil { - return m.Actor - } - return "" -} - -func (m *MsgUnblockConsumer) GetConsumer() string { - if m != nil { - return m.Consumer - } - return "" -} - -type MsgUnblockConsumerResponse struct { -} - -func (m *MsgUnblockConsumerResponse) Reset() { *m = MsgUnblockConsumerResponse{} } -func (m *MsgUnblockConsumerResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUnblockConsumerResponse) ProtoMessage() {} -func (*MsgUnblockConsumerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{11} -} -func (m *MsgUnblockConsumerResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUnblockConsumerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUnblockConsumerResponse.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 *MsgUnblockConsumerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUnblockConsumerResponse.Merge(m, src) -} -func (m *MsgUnblockConsumerResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUnblockConsumerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUnblockConsumerResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUnblockConsumerResponse proto.InternalMessageInfo - -// MsgUpdateGasConsumerLimit defines an SDK message for updating the consumption limits of gas consumer. -type MsgUpdateGasConsumerLimit struct { - // gas_tank_id specifies the id of the gas tank - GasTankId uint64 `protobuf:"varint,1,opt,name=gas_tank_id,json=gasTankId,proto3" json:"gas_tank_id,omitempty"` - // provider specifies the bech32-encoded address that is the gas provider. - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - // consumer specifies the bech32-encoded address of a consumer. - Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` - // total_txs_allowed specifies the number of txs allowed for each consumer - TotalTxsAllowed uint64 `protobuf:"varint,4,opt,name=total_txs_allowed,json=totalTxsAllowed,proto3" json:"total_txs_allowed,omitempty"` - // total_fee_consumption_allowed specifies the maximum fee consumption allowed for each consumer - TotalFeeConsumptionAllowed cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=total_fee_consumption_allowed,json=totalFeeConsumptionAllowed,proto3,customtype=cosmossdk.io/math.Int" json:"total_fee_consumption_allowed"` -} - -func (m *MsgUpdateGasConsumerLimit) Reset() { *m = MsgUpdateGasConsumerLimit{} } -func (m *MsgUpdateGasConsumerLimit) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateGasConsumerLimit) ProtoMessage() {} -func (*MsgUpdateGasConsumerLimit) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{12} -} -func (m *MsgUpdateGasConsumerLimit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateGasConsumerLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateGasConsumerLimit.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 *MsgUpdateGasConsumerLimit) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateGasConsumerLimit.Merge(m, src) -} -func (m *MsgUpdateGasConsumerLimit) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateGasConsumerLimit) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateGasConsumerLimit.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateGasConsumerLimit proto.InternalMessageInfo - -func (m *MsgUpdateGasConsumerLimit) GetGasTankId() uint64 { - if m != nil { - return m.GasTankId - } - return 0 -} - -func (m *MsgUpdateGasConsumerLimit) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -func (m *MsgUpdateGasConsumerLimit) GetConsumer() string { - if m != nil { - return m.Consumer - } - return "" -} - -func (m *MsgUpdateGasConsumerLimit) GetTotalTxsAllowed() uint64 { - if m != nil { - return m.TotalTxsAllowed - } - return 0 -} - -type MsgUpdateGasConsumerLimitResponse struct { -} - -func (m *MsgUpdateGasConsumerLimitResponse) Reset() { *m = MsgUpdateGasConsumerLimitResponse{} } -func (m *MsgUpdateGasConsumerLimitResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateGasConsumerLimitResponse) ProtoMessage() {} -func (*MsgUpdateGasConsumerLimitResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{13} -} -func (m *MsgUpdateGasConsumerLimitResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateGasConsumerLimitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateGasConsumerLimitResponse.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 *MsgUpdateGasConsumerLimitResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateGasConsumerLimitResponse.Merge(m, src) -} -func (m *MsgUpdateGasConsumerLimitResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateGasConsumerLimitResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateGasConsumerLimitResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateGasConsumerLimitResponse proto.InternalMessageInfo - -// MsgUpdateParams is the MsgUpdateParams request type. -// -// Since: 0.47 -type MsgUpdateParams struct { - // authority is the address that controls the module (defaults to x/gov unless overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/gasless parameters to update. - // - // NOTE: All parameters must be supplied. - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` -} - -func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } -func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParams) ProtoMessage() {} -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{14} -} -func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParams.Merge(m, src) -} -func (m *MsgUpdateParams) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo - -func (m *MsgUpdateParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgUpdateParams) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: 0.47 -type MsgUpdateParamsResponse struct { -} - -func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } -func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_58c8d01c81a883a9, []int{15} -} -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) -} -func (m *MsgUpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateGasTank)(nil), "comdex.gasless.v1beta1.MsgCreateGasTank") - proto.RegisterType((*MsgCreateGasTankResponse)(nil), "comdex.gasless.v1beta1.MsgCreateGasTankResponse") - proto.RegisterType((*MsgAuthorizeActors)(nil), "comdex.gasless.v1beta1.MsgAuthorizeActors") - proto.RegisterType((*MsgAuthorizeActorsResponse)(nil), "comdex.gasless.v1beta1.MsgAuthorizeActorsResponse") - proto.RegisterType((*MsgUpdateGasTankStatus)(nil), "comdex.gasless.v1beta1.MsgUpdateGasTankStatus") - proto.RegisterType((*MsgUpdateGasTankStatusResponse)(nil), "comdex.gasless.v1beta1.MsgUpdateGasTankStatusResponse") - proto.RegisterType((*MsgUpdateGasTankConfig)(nil), "comdex.gasless.v1beta1.MsgUpdateGasTankConfig") - proto.RegisterType((*MsgUpdateGasTankConfigResponse)(nil), "comdex.gasless.v1beta1.MsgUpdateGasTankConfigResponse") - proto.RegisterType((*MsgBlockConsumer)(nil), "comdex.gasless.v1beta1.MsgBlockConsumer") - proto.RegisterType((*MsgBlockConsumerResponse)(nil), "comdex.gasless.v1beta1.MsgBlockConsumerResponse") - proto.RegisterType((*MsgUnblockConsumer)(nil), "comdex.gasless.v1beta1.MsgUnblockConsumer") - proto.RegisterType((*MsgUnblockConsumerResponse)(nil), "comdex.gasless.v1beta1.MsgUnblockConsumerResponse") - proto.RegisterType((*MsgUpdateGasConsumerLimit)(nil), "comdex.gasless.v1beta1.MsgUpdateGasConsumerLimit") - proto.RegisterType((*MsgUpdateGasConsumerLimitResponse)(nil), "comdex.gasless.v1beta1.MsgUpdateGasConsumerLimitResponse") - proto.RegisterType((*MsgUpdateParams)(nil), "comdex.gasless.v1beta1.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "comdex.gasless.v1beta1.MsgUpdateParamsResponse") -} - -func init() { proto.RegisterFile("comdex/gasless/v1beta1/tx.proto", fileDescriptor_58c8d01c81a883a9) } - -var fileDescriptor_58c8d01c81a883a9 = []byte{ - // 950 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x41, 0x6f, 0xe3, 0x44, - 0x14, 0xae, 0x9b, 0x6e, 0x77, 0xf3, 0x0a, 0xb4, 0x35, 0x21, 0xeb, 0x1a, 0xd6, 0x0d, 0xd9, 0x03, - 0x51, 0xd1, 0xda, 0xa4, 0x48, 0x2b, 0xb1, 0xe2, 0x40, 0x93, 0xd5, 0xa2, 0x15, 0x44, 0xaa, 0xb2, - 0xe9, 0x01, 0x2e, 0x66, 0x62, 0x4f, 0x1c, 0x2b, 0xb1, 0xc7, 0x78, 0x26, 0xc5, 0x8b, 0x04, 0x12, - 0x1c, 0x10, 0x47, 0x6e, 0xfc, 0x0d, 0x0e, 0x48, 0x9c, 0xb9, 0xed, 0x71, 0xc5, 0x09, 0x71, 0x58, - 0xa1, 0xf6, 0xc0, 0xdf, 0x40, 0xf6, 0x4c, 0x26, 0x6b, 0x6f, 0x92, 0x4d, 0x54, 0x71, 0xe3, 0xd2, - 0x66, 0xf2, 0xbe, 0xf7, 0xbe, 0x2f, 0xef, 0x7b, 0x7e, 0x63, 0x38, 0x74, 0x48, 0xe0, 0xe2, 0xc4, - 0xf2, 0x10, 0x1d, 0x63, 0x4a, 0xad, 0xf3, 0x66, 0x1f, 0x33, 0xd4, 0xb4, 0x58, 0x62, 0x46, 0x31, - 0x61, 0x44, 0xad, 0x72, 0x80, 0x29, 0x00, 0xa6, 0x00, 0xe8, 0xfb, 0x28, 0xf0, 0x43, 0x62, 0x65, - 0x7f, 0x39, 0x54, 0xbf, 0xe9, 0x10, 0x1a, 0x10, 0x6a, 0x05, 0xd4, 0xb3, 0xce, 0x9b, 0xe9, 0x3f, - 0x11, 0xa8, 0x78, 0xc4, 0x23, 0xd9, 0x47, 0x2b, 0xfd, 0x24, 0xbe, 0x35, 0x04, 0xbc, 0x8f, 0x28, - 0x96, 0xbc, 0x0e, 0xf1, 0x43, 0x11, 0x3f, 0xe0, 0x71, 0x9b, 0x27, 0xf2, 0x83, 0x08, 0xdd, 0x5e, - 0xa0, 0x3a, 0x42, 0x31, 0x0a, 0x04, 0xa8, 0xfe, 0x7b, 0x09, 0xf6, 0x3a, 0xd4, 0x6b, 0xc7, 0x18, - 0x31, 0xfc, 0x31, 0xa2, 0x3d, 0x14, 0x8e, 0x54, 0x1d, 0x6e, 0x44, 0x31, 0x39, 0xf7, 0x5d, 0x1c, - 0x6b, 0x4a, 0x4d, 0x69, 0x94, 0xbb, 0xf2, 0xac, 0xbe, 0x09, 0xe5, 0x01, 0xc6, 0xb6, 0x8b, 0x43, - 0x12, 0x68, 0x9b, 0x3c, 0x38, 0xc0, 0xf8, 0x7e, 0x7a, 0x56, 0x3b, 0x50, 0x09, 0x50, 0x62, 0xa7, - 0x80, 0x09, 0x45, 0x1e, 0xb6, 0x23, 0x1c, 0xdb, 0x2c, 0xd1, 0x4a, 0x29, 0xae, 0x75, 0xeb, 0xc9, - 0xb3, 0xc3, 0x8d, 0xbf, 0x9e, 0x1d, 0xbe, 0xc1, 0x65, 0x52, 0x77, 0x64, 0xfa, 0xc4, 0x0a, 0x10, - 0x1b, 0x9a, 0x0f, 0x43, 0xd6, 0xdd, 0x0b, 0x50, 0xf2, 0x00, 0xe3, 0xb3, 0x34, 0xf1, 0x14, 0xc7, - 0xbd, 0x44, 0xbd, 0x07, 0x7a, 0x5a, 0x8e, 0x25, 0xd4, 0x76, 0xc8, 0x24, 0x64, 0x59, 0x39, 0x87, - 0x84, 0x74, 0x12, 0xe0, 0x58, 0xdb, 0xaa, 0x29, 0x8d, 0xad, 0x6e, 0x35, 0x40, 0x49, 0x2f, 0xa1, - 0xed, 0x34, 0x7e, 0x8a, 0xe3, 0xb6, 0x88, 0xaa, 0x9f, 0xf1, 0xdc, 0xbc, 0x14, 0x99, 0x7b, 0x6d, - 0x15, 0x41, 0xd5, 0xbc, 0x20, 0x59, 0xfa, 0x10, 0x76, 0x52, 0x49, 0x68, 0x3c, 0x26, 0x5f, 0x61, - 0x57, 0xdb, 0xae, 0x95, 0x1a, 0xe5, 0x2e, 0xb0, 0x84, 0x9e, 0xf0, 0x6f, 0xd4, 0x77, 0x61, 0xdf, - 0x21, 0x21, 0x8b, 0x91, 0xc3, 0x66, 0xb0, 0xeb, 0x19, 0x6c, 0x4f, 0x06, 0xa6, 0xe0, 0x8f, 0x60, - 0xc7, 0x43, 0xd4, 0x76, 0x71, 0x44, 0xa8, 0xcf, 0xb4, 0x1b, 0x35, 0xa5, 0xb1, 0x73, 0x7c, 0x60, - 0x0a, 0x2b, 0x53, 0xdf, 0xa7, 0xe3, 0x64, 0xb6, 0x89, 0x1f, 0xb6, 0xb6, 0x52, 0xd1, 0x5d, 0xf0, - 0x10, 0xbd, 0xcf, 0x53, 0xea, 0x3a, 0x68, 0x45, 0x0b, 0xbb, 0x98, 0x46, 0x24, 0xa4, 0xb8, 0x3e, - 0x04, 0xb5, 0x43, 0xbd, 0x93, 0x09, 0x1b, 0x92, 0xd8, 0xff, 0x1a, 0x9f, 0x38, 0x8c, 0xc4, 0x54, - 0x35, 0x38, 0x27, 0x43, 0xe1, 0xc8, 0xf6, 0xdd, 0xcc, 0xe3, 0xad, 0x6e, 0xd9, 0xe3, 0xb9, 0x0f, - 0xdd, 0xdc, 0x00, 0x6c, 0x16, 0x06, 0xa0, 0x0a, 0xdb, 0x28, 0xab, 0xa2, 0x95, 0xb2, 0x5f, 0x24, - 0x4e, 0xf5, 0xb7, 0x40, 0x7f, 0x91, 0x49, 0xea, 0xe8, 0x41, 0xb5, 0x43, 0xbd, 0xb3, 0xc8, 0x9d, - 0x69, 0x7c, 0xc4, 0x10, 0x9b, 0x5c, 0x49, 0x4b, 0xbd, 0x06, 0xc6, 0xfc, 0xaa, 0x92, 0xf7, 0xc7, - 0xd2, 0x8b, 0xc4, 0x6d, 0x12, 0x0e, 0x7c, 0xef, 0x4a, 0x4d, 0xf8, 0x7f, 0xd0, 0xd7, 0x1e, 0xf4, - 0x79, 0x66, 0x71, 0x27, 0xa4, 0x59, 0x6e, 0xb6, 0x8b, 0x5a, 0x63, 0xe2, 0x8c, 0xa4, 0x86, 0x97, - 0xb9, 0x54, 0x81, 0x6b, 0xd9, 0x00, 0x0a, 0x8b, 0xf8, 0x21, 0xf5, 0x4e, 0xb6, 0xa0, 0xc4, 0xbd, - 0x9b, 0x9e, 0xc5, 0xe3, 0x92, 0x63, 0x91, 0x0a, 0x06, 0xd9, 0xe3, 0x72, 0x16, 0xf6, 0xff, 0x63, - 0x0d, 0xfc, 0x61, 0x29, 0xf0, 0x48, 0x15, 0xdf, 0x6d, 0xc2, 0xc1, 0xf3, 0xad, 0x9a, 0x02, 0x3e, - 0xf5, 0x03, 0x9f, 0x5d, 0x69, 0x6e, 0x97, 0x68, 0x52, 0x8f, 0x60, 0x9f, 0x11, 0x86, 0xc6, 0xf6, - 0xf3, 0x9e, 0xf3, 0xd9, 0xdb, 0xcd, 0x02, 0xbd, 0x99, 0xf1, 0x5f, 0xc0, 0x2d, 0x8e, 0x4d, 0xc7, - 0x8e, 0x57, 0x88, 0x98, 0x4f, 0x42, 0x99, 0xb7, 0xd2, 0xdc, 0xe9, 0x59, 0x8d, 0x07, 0x18, 0xb7, - 0x67, 0x15, 0xa6, 0xd3, 0x72, 0x1b, 0xde, 0x5e, 0xd8, 0x02, 0xd9, 0xa8, 0x9f, 0x15, 0xd8, 0x95, - 0xa8, 0xd3, 0xec, 0x5e, 0x53, 0xef, 0x42, 0x19, 0xf1, 0x25, 0xc4, 0x1e, 0xf3, 0xdb, 0xab, 0xa5, - 0xfd, 0xf1, 0xeb, 0x9d, 0x8a, 0x58, 0xa8, 0x27, 0xae, 0x1b, 0x63, 0x4a, 0x1f, 0xb1, 0xd8, 0x0f, - 0xbd, 0xee, 0x0c, 0xaa, 0x7e, 0x08, 0xdb, 0xfc, 0x66, 0xcc, 0x9a, 0xb6, 0x73, 0x6c, 0x98, 0xf3, - 0x2f, 0x75, 0x93, 0xf3, 0x88, 0x3d, 0x2c, 0x72, 0xee, 0xbd, 0xf6, 0xfd, 0x3f, 0xbf, 0x1c, 0xcd, - 0xaa, 0xd5, 0x0f, 0xe0, 0x66, 0x41, 0xd8, 0x54, 0xf4, 0xf1, 0x6f, 0xd7, 0xa1, 0xd4, 0xa1, 0x9e, - 0x3a, 0x82, 0x57, 0xf3, 0xd7, 0x6e, 0x63, 0x11, 0x63, 0x71, 0xbb, 0xeb, 0xef, 0xad, 0x8a, 0x9c, - 0x92, 0xaa, 0x5f, 0xc2, 0x6e, 0xf1, 0x12, 0x38, 0x5a, 0x52, 0xa4, 0x80, 0xd5, 0x8f, 0x57, 0xc7, - 0x4a, 0xca, 0x6f, 0xe0, 0xf5, 0x79, 0xfb, 0xde, 0x5c, 0x52, 0x6a, 0x0e, 0x5e, 0xbf, 0xbb, 0x1e, - 0x5e, 0xd2, 0x7f, 0x0b, 0x95, 0x39, 0xbb, 0x66, 0x0d, 0x7e, 0x9e, 0xb0, 0x3a, 0x7f, 0x7e, 0x99, - 0xa5, 0xf6, 0xe6, 0x37, 0xd9, 0x32, 0x7b, 0x73, 0xc8, 0xa5, 0xf6, 0xce, 0xdd, 0x5b, 0xa9, 0xbd, - 0xc5, 0xa5, 0xb5, 0xcc, 0xde, 0x02, 0x76, 0xa9, 0xbd, 0x0b, 0x96, 0x94, 0xfa, 0x83, 0x02, 0xd5, - 0x05, 0x1b, 0xaa, 0xb9, 0x4a, 0xcb, 0x72, 0x29, 0xfa, 0x07, 0x6b, 0xa7, 0x48, 0x21, 0x43, 0x78, - 0x25, 0xb7, 0x00, 0xde, 0x79, 0x69, 0x29, 0x0e, 0xd4, 0xad, 0x15, 0x81, 0x53, 0xa6, 0xd6, 0x27, - 0x4f, 0x2e, 0x0c, 0xe5, 0xe9, 0x85, 0xa1, 0xfc, 0x7d, 0x61, 0x28, 0x3f, 0x5d, 0x1a, 0x1b, 0x4f, - 0x2f, 0x8d, 0x8d, 0x3f, 0x2f, 0x8d, 0x8d, 0xcf, 0x9b, 0x9e, 0xcf, 0x86, 0x93, 0x7e, 0x5a, 0xd0, - 0xe2, 0x45, 0xef, 0x90, 0xc1, 0xc0, 0x77, 0x7c, 0x34, 0x16, 0x67, 0x6b, 0xf6, 0x22, 0xce, 0x1e, - 0x47, 0x98, 0xf6, 0xb7, 0xb3, 0x17, 0xf0, 0xf7, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x75, 0x0a, - 0xb1, 0x1c, 0x5d, 0x0c, 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 { - // CreateGasTank defines a method for creating a new gas tank - CreateGasTank(ctx context.Context, in *MsgCreateGasTank, opts ...grpc.CallOption) (*MsgCreateGasTankResponse, error) - // AuthorizeActors defines a method for authorizing accounts to take actions on provider's behalf - AuthorizeActors(ctx context.Context, in *MsgAuthorizeActors, opts ...grpc.CallOption) (*MsgAuthorizeActorsResponse, error) - // UpdateGasTankStatus defines a method for marking gas tank as active or inactive - UpdateGasTankStatus(ctx context.Context, in *MsgUpdateGasTankStatus, opts ...grpc.CallOption) (*MsgUpdateGasTankStatusResponse, error) - // UpdateGasTankConfigs defines a method for updating the configs of gas tank - UpdateGasTankConfigs(ctx context.Context, in *MsgUpdateGasTankConfig, opts ...grpc.CallOption) (*MsgUpdateGasTankConfigResponse, error) - // BlockConsumer defines a method for blocking a suspected malicious consumer - BlockConsumer(ctx context.Context, in *MsgBlockConsumer, opts ...grpc.CallOption) (*MsgBlockConsumerResponse, error) - // UnblockConsumer defines a method for unblocking consumer - UnblockConsumer(ctx context.Context, in *MsgUnblockConsumer, opts ...grpc.CallOption) (*MsgUnblockConsumerResponse, error) - // UpdateGasConsumerLimit defines a method for updating consumption limit of gas consumer - UpdateGasConsumerLimit(ctx context.Context, in *MsgUpdateGasConsumerLimit, opts ...grpc.CallOption) (*MsgUpdateGasConsumerLimitResponse, error) - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateGasTank(ctx context.Context, in *MsgCreateGasTank, opts ...grpc.CallOption) (*MsgCreateGasTankResponse, error) { - out := new(MsgCreateGasTankResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Msg/CreateGasTank", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) AuthorizeActors(ctx context.Context, in *MsgAuthorizeActors, opts ...grpc.CallOption) (*MsgAuthorizeActorsResponse, error) { - out := new(MsgAuthorizeActorsResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Msg/AuthorizeActors", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateGasTankStatus(ctx context.Context, in *MsgUpdateGasTankStatus, opts ...grpc.CallOption) (*MsgUpdateGasTankStatusResponse, error) { - out := new(MsgUpdateGasTankStatusResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Msg/UpdateGasTankStatus", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateGasTankConfigs(ctx context.Context, in *MsgUpdateGasTankConfig, opts ...grpc.CallOption) (*MsgUpdateGasTankConfigResponse, error) { - out := new(MsgUpdateGasTankConfigResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Msg/UpdateGasTankConfigs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) BlockConsumer(ctx context.Context, in *MsgBlockConsumer, opts ...grpc.CallOption) (*MsgBlockConsumerResponse, error) { - out := new(MsgBlockConsumerResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Msg/BlockConsumer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UnblockConsumer(ctx context.Context, in *MsgUnblockConsumer, opts ...grpc.CallOption) (*MsgUnblockConsumerResponse, error) { - out := new(MsgUnblockConsumerResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Msg/UnblockConsumer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateGasConsumerLimit(ctx context.Context, in *MsgUpdateGasConsumerLimit, opts ...grpc.CallOption) (*MsgUpdateGasConsumerLimitResponse, error) { - out := new(MsgUpdateGasConsumerLimitResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Msg/UpdateGasConsumerLimit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/comdex.gasless.v1beta1.Msg/UpdateParams", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // CreateGasTank defines a method for creating a new gas tank - CreateGasTank(context.Context, *MsgCreateGasTank) (*MsgCreateGasTankResponse, error) - // AuthorizeActors defines a method for authorizing accounts to take actions on provider's behalf - AuthorizeActors(context.Context, *MsgAuthorizeActors) (*MsgAuthorizeActorsResponse, error) - // UpdateGasTankStatus defines a method for marking gas tank as active or inactive - UpdateGasTankStatus(context.Context, *MsgUpdateGasTankStatus) (*MsgUpdateGasTankStatusResponse, error) - // UpdateGasTankConfigs defines a method for updating the configs of gas tank - UpdateGasTankConfigs(context.Context, *MsgUpdateGasTankConfig) (*MsgUpdateGasTankConfigResponse, error) - // BlockConsumer defines a method for blocking a suspected malicious consumer - BlockConsumer(context.Context, *MsgBlockConsumer) (*MsgBlockConsumerResponse, error) - // UnblockConsumer defines a method for unblocking consumer - UnblockConsumer(context.Context, *MsgUnblockConsumer) (*MsgUnblockConsumerResponse, error) - // UpdateGasConsumerLimit defines a method for updating consumption limit of gas consumer - UpdateGasConsumerLimit(context.Context, *MsgUpdateGasConsumerLimit) (*MsgUpdateGasConsumerLimitResponse, error) - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateGasTank(ctx context.Context, req *MsgCreateGasTank) (*MsgCreateGasTankResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateGasTank not implemented") -} -func (*UnimplementedMsgServer) AuthorizeActors(ctx context.Context, req *MsgAuthorizeActors) (*MsgAuthorizeActorsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthorizeActors not implemented") -} -func (*UnimplementedMsgServer) UpdateGasTankStatus(ctx context.Context, req *MsgUpdateGasTankStatus) (*MsgUpdateGasTankStatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateGasTankStatus not implemented") -} -func (*UnimplementedMsgServer) UpdateGasTankConfigs(ctx context.Context, req *MsgUpdateGasTankConfig) (*MsgUpdateGasTankConfigResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateGasTankConfigs not implemented") -} -func (*UnimplementedMsgServer) BlockConsumer(ctx context.Context, req *MsgBlockConsumer) (*MsgBlockConsumerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BlockConsumer not implemented") -} -func (*UnimplementedMsgServer) UnblockConsumer(ctx context.Context, req *MsgUnblockConsumer) (*MsgUnblockConsumerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UnblockConsumer not implemented") -} -func (*UnimplementedMsgServer) UpdateGasConsumerLimit(ctx context.Context, req *MsgUpdateGasConsumerLimit) (*MsgUpdateGasConsumerLimitResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateGasConsumerLimit not implemented") -} -func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateGasTank_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateGasTank) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateGasTank(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Msg/CreateGasTank", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateGasTank(ctx, req.(*MsgCreateGasTank)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_AuthorizeActors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAuthorizeActors) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AuthorizeActors(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Msg/AuthorizeActors", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AuthorizeActors(ctx, req.(*MsgAuthorizeActors)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateGasTankStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateGasTankStatus) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateGasTankStatus(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Msg/UpdateGasTankStatus", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateGasTankStatus(ctx, req.(*MsgUpdateGasTankStatus)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateGasTankConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateGasTankConfig) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateGasTankConfigs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Msg/UpdateGasTankConfigs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateGasTankConfigs(ctx, req.(*MsgUpdateGasTankConfig)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_BlockConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBlockConsumer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).BlockConsumer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Msg/BlockConsumer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).BlockConsumer(ctx, req.(*MsgBlockConsumer)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UnblockConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUnblockConsumer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UnblockConsumer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Msg/UnblockConsumer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UnblockConsumer(ctx, req.(*MsgUnblockConsumer)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateGasConsumerLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateGasConsumerLimit) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateGasConsumerLimit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Msg/UpdateGasConsumerLimit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateGasConsumerLimit(ctx, req.(*MsgUpdateGasConsumerLimit)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/comdex.gasless.v1beta1.Msg/UpdateParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "comdex.gasless.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateGasTank", - Handler: _Msg_CreateGasTank_Handler, - }, - { - MethodName: "AuthorizeActors", - Handler: _Msg_AuthorizeActors_Handler, - }, - { - MethodName: "UpdateGasTankStatus", - Handler: _Msg_UpdateGasTankStatus_Handler, - }, - { - MethodName: "UpdateGasTankConfigs", - Handler: _Msg_UpdateGasTankConfigs_Handler, - }, - { - MethodName: "BlockConsumer", - Handler: _Msg_BlockConsumer_Handler, - }, - { - MethodName: "UnblockConsumer", - Handler: _Msg_UnblockConsumer_Handler, - }, - { - MethodName: "UpdateGasConsumerLimit", - Handler: _Msg_UpdateGasConsumerLimit_Handler, - }, - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "comdex/gasless/v1beta1/tx.proto", -} - -func (m *MsgCreateGasTank) 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 *MsgCreateGasTank) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateGasTank) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.GasDeposit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - if len(m.ContractsAllowed) > 0 { - for iNdEx := len(m.ContractsAllowed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ContractsAllowed[iNdEx]) - copy(dAtA[i:], m.ContractsAllowed[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.ContractsAllowed[iNdEx]))) - i-- - dAtA[i] = 0x3a - } - } - if len(m.TxsAllowed) > 0 { - for iNdEx := len(m.TxsAllowed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.TxsAllowed[iNdEx]) - copy(dAtA[i:], m.TxsAllowed[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.TxsAllowed[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - { - size := m.MaxFeeUsagePerConsumer.Size() - i -= size - if _, err := m.MaxFeeUsagePerConsumer.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.MaxTxsCountPerConsumer != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.MaxTxsCountPerConsumer)) - i-- - dAtA[i] = 0x20 - } - { - size := m.MaxFeeUsagePerTx.Size() - i -= size - if _, err := m.MaxFeeUsagePerTx.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.FeeDenom) > 0 { - i -= len(m.FeeDenom) - copy(dAtA[i:], m.FeeDenom) - i = encodeVarintTx(dAtA, i, uint64(len(m.FeeDenom))) - i-- - dAtA[i] = 0x12 - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateGasTankResponse) 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 *MsgCreateGasTankResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateGasTankResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgAuthorizeActors) 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 *MsgAuthorizeActors) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAuthorizeActors) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Actors) > 0 { - for iNdEx := len(m.Actors) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Actors[iNdEx]) - copy(dAtA[i:], m.Actors[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Actors[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if m.GasTankId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgAuthorizeActorsResponse) 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 *MsgAuthorizeActorsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAuthorizeActorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateGasTankStatus) 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 *MsgUpdateGasTankStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateGasTankStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if m.GasTankId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateGasTankStatusResponse) 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 *MsgUpdateGasTankStatusResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateGasTankStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateGasTankConfig) 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 *MsgUpdateGasTankConfig) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateGasTankConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractsAllowed) > 0 { - for iNdEx := len(m.ContractsAllowed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ContractsAllowed[iNdEx]) - copy(dAtA[i:], m.ContractsAllowed[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.ContractsAllowed[iNdEx]))) - i-- - dAtA[i] = 0x3a - } - } - if len(m.TxsAllowed) > 0 { - for iNdEx := len(m.TxsAllowed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.TxsAllowed[iNdEx]) - copy(dAtA[i:], m.TxsAllowed[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.TxsAllowed[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - { - size := m.MaxFeeUsagePerConsumer.Size() - i -= size - if _, err := m.MaxFeeUsagePerConsumer.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.MaxTxsCountPerConsumer != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.MaxTxsCountPerConsumer)) - i-- - dAtA[i] = 0x20 - } - { - size := m.MaxFeeUsagePerTx.Size() - i -= size - if _, err := m.MaxFeeUsagePerTx.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if m.GasTankId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateGasTankConfigResponse) 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 *MsgUpdateGasTankConfigResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateGasTankConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgBlockConsumer) 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 *MsgBlockConsumer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBlockConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x1a - } - if len(m.Actor) > 0 { - i -= len(m.Actor) - copy(dAtA[i:], m.Actor) - i = encodeVarintTx(dAtA, i, uint64(len(m.Actor))) - i-- - dAtA[i] = 0x12 - } - if m.GasTankId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgBlockConsumerResponse) 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 *MsgBlockConsumerResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBlockConsumerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUnblockConsumer) 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 *MsgUnblockConsumer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUnblockConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x1a - } - if len(m.Actor) > 0 { - i -= len(m.Actor) - copy(dAtA[i:], m.Actor) - i = encodeVarintTx(dAtA, i, uint64(len(m.Actor))) - i-- - dAtA[i] = 0x12 - } - if m.GasTankId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgUnblockConsumerResponse) 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 *MsgUnblockConsumerResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUnblockConsumerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateGasConsumerLimit) 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 *MsgUpdateGasConsumerLimit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateGasConsumerLimit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.TotalFeeConsumptionAllowed.Size() - i -= size - if _, err := m.TotalFeeConsumptionAllowed.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.TotalTxsAllowed != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TotalTxsAllowed)) - i-- - dAtA[i] = 0x20 - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x1a - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if m.GasTankId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GasTankId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateGasConsumerLimitResponse) 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 *MsgUpdateGasConsumerLimitResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateGasConsumerLimitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParamsResponse) 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 *MsgCreateGasTank) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.FeeDenom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.MaxFeeUsagePerTx.Size() - n += 1 + l + sovTx(uint64(l)) - if m.MaxTxsCountPerConsumer != 0 { - n += 1 + sovTx(uint64(m.MaxTxsCountPerConsumer)) - } - l = m.MaxFeeUsagePerConsumer.Size() - n += 1 + l + sovTx(uint64(l)) - if len(m.TxsAllowed) > 0 { - for _, s := range m.TxsAllowed { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.ContractsAllowed) > 0 { - for _, s := range m.ContractsAllowed { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - l = m.GasDeposit.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgCreateGasTankResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgAuthorizeActors) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovTx(uint64(m.GasTankId)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Actors) > 0 { - for _, s := range m.Actors { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgAuthorizeActorsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateGasTankStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovTx(uint64(m.GasTankId)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgUpdateGasTankStatusResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateGasTankConfig) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovTx(uint64(m.GasTankId)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.MaxFeeUsagePerTx.Size() - n += 1 + l + sovTx(uint64(l)) - if m.MaxTxsCountPerConsumer != 0 { - n += 1 + sovTx(uint64(m.MaxTxsCountPerConsumer)) - } - l = m.MaxFeeUsagePerConsumer.Size() - n += 1 + l + sovTx(uint64(l)) - if len(m.TxsAllowed) > 0 { - for _, s := range m.TxsAllowed { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.ContractsAllowed) > 0 { - for _, s := range m.ContractsAllowed { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgUpdateGasTankConfigResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgBlockConsumer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovTx(uint64(m.GasTankId)) - } - l = len(m.Actor) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgBlockConsumerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUnblockConsumer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovTx(uint64(m.GasTankId)) - } - l = len(m.Actor) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgUnblockConsumerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateGasConsumerLimit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasTankId != 0 { - n += 1 + sovTx(uint64(m.GasTankId)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.TotalTxsAllowed != 0 { - n += 1 + sovTx(uint64(m.TotalTxsAllowed)) - } - l = m.TotalFeeConsumptionAllowed.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUpdateGasConsumerLimitResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUpdateParamsResponse) 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 *MsgCreateGasTank) 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: MsgCreateGasTank: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateGasTank: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", 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.FeeDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxFeeUsagePerTx", 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 - } - if err := m.MaxFeeUsagePerTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxTxsCountPerConsumer", wireType) - } - m.MaxTxsCountPerConsumer = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxTxsCountPerConsumer |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxFeeUsagePerConsumer", 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 - } - if err := m.MaxFeeUsagePerConsumer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxsAllowed", 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.TxsAllowed = append(m.TxsAllowed, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractsAllowed", 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.ContractsAllowed = append(m.ContractsAllowed, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasDeposit", 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.GasDeposit.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 *MsgCreateGasTankResponse) 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: MsgCreateGasTankResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateGasTankResponse: 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 *MsgAuthorizeActors) 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: MsgAuthorizeActors: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAuthorizeActors: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Actors", 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.Actors = append(m.Actors, string(dAtA[iNdEx:postIndex])) - 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 *MsgAuthorizeActorsResponse) 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: MsgAuthorizeActorsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAuthorizeActorsResponse: 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 *MsgUpdateGasTankStatus) 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: MsgUpdateGasTankStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateGasTankStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - 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 *MsgUpdateGasTankStatusResponse) 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: MsgUpdateGasTankStatusResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateGasTankStatusResponse: 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 *MsgUpdateGasTankConfig) 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: MsgUpdateGasTankConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateGasTankConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxFeeUsagePerTx", 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 - } - if err := m.MaxFeeUsagePerTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxTxsCountPerConsumer", wireType) - } - m.MaxTxsCountPerConsumer = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxTxsCountPerConsumer |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxFeeUsagePerConsumer", 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 - } - if err := m.MaxFeeUsagePerConsumer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxsAllowed", 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.TxsAllowed = append(m.TxsAllowed, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractsAllowed", 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.ContractsAllowed = append(m.ContractsAllowed, string(dAtA[iNdEx:postIndex])) - 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 *MsgUpdateGasTankConfigResponse) 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: MsgUpdateGasTankConfigResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateGasTankConfigResponse: 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 *MsgBlockConsumer) 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: MsgBlockConsumer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBlockConsumer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Actor", 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.Actor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) - 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 *MsgBlockConsumerResponse) 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: MsgBlockConsumerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBlockConsumerResponse: 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 *MsgUnblockConsumer) 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: MsgUnblockConsumer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUnblockConsumer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Actor", 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.Actor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) - 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 *MsgUnblockConsumerResponse) 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: MsgUnblockConsumerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUnblockConsumerResponse: 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 *MsgUpdateGasConsumerLimit) 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: MsgUpdateGasConsumerLimit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateGasConsumerLimit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasTankId", wireType) - } - m.GasTankId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasTankId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalTxsAllowed", wireType) - } - m.TotalTxsAllowed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalTxsAllowed |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalFeeConsumptionAllowed", 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 - } - if err := m.TotalFeeConsumptionAllowed.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 *MsgUpdateGasConsumerLimitResponse) 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: MsgUpdateGasConsumerLimitResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateGasConsumerLimitResponse: 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 *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: 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/gasless/types/utils.go b/x/gasless/types/utils.go deleted file mode 100644 index de3e7259e..000000000 --- a/x/gasless/types/utils.go +++ /dev/null @@ -1,127 +0,0 @@ -package types - -import ( - sdkmath "cosmossdk.io/math" - "github.com/cometbft/cometbft/crypto" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" -) - -// DeriveAddress derives an address with the given address length type, module name, and -// address derivation name. It is used to derive private plan gas tank address. -func DeriveAddress(addressType AddressType, moduleName, name string) sdk.AccAddress { - switch addressType { - case AddressType32Bytes: - return address.Module(moduleName, []byte(name)) - case AddressType20Bytes: - return sdk.AccAddress(crypto.AddressHash([]byte(moduleName + name))) - default: - return sdk.AccAddress{} - } -} - -func GetCoinByDenomFromCoins(denom string, coins sdk.Coins) (sdk.Coin, bool) { - for _, coin := range coins { - if coin.Denom == denom { - return coin, true - } - } - return sdk.Coin{}, false -} - -// ItemExists returns true if item exists in array else false . -func ItemExists(array []string, item string) bool { - for _, v := range array { - if v == item { - return true - } - } - return false -} - -func RemoveDuplicates(input []string) []string { - uniqueMap := make(map[string]bool) - for _, str := range input { - uniqueMap[str] = true - } - uniqueSlice := make([]string, 0, len(uniqueMap)) - for str := range uniqueMap { - uniqueSlice = append(uniqueSlice, str) - } - return uniqueSlice -} - -func RemoveDuplicatesUint64(list []uint64) []uint64 { - uniqueMap := make(map[uint64]bool) - var uniqueList []uint64 - for _, v := range list { - if !uniqueMap[v] { - uniqueMap[v] = true - uniqueList = append(uniqueList, v) - } - } - return uniqueList -} - -func RemoveValueFromListUint64(list []uint64, x uint64) []uint64 { - var newList []uint64 - for _, v := range list { - if v != x { - newList = append(newList, v) - } - } - return newList -} - -func ShiftToEndUint64(list []uint64, x uint64) []uint64 { - list = RemoveDuplicatesUint64(list) - var index int = -1 - for i, val := range list { - if val == x { - index = i - break - } - } - if index == -1 { - return list - } - list = append(list[:index], list[index+1:]...) - list = append(list, x) - return list -} - -func NewGasTankResponse(gasTank GasTank, balance sdk.Coin) GasTankResponse { - return GasTankResponse{ - Id: gasTank.Id, - Provider: gasTank.Provider, - Reserve: gasTank.Reserve, - GasTankBalance: balance, - IsActive: gasTank.IsActive, - MaxTxsCountPerConsumer: gasTank.MaxTxsCountPerConsumer, - MaxFeeUsagePerConsumer: gasTank.MaxFeeUsagePerConsumer, - MaxFeeUsagePerTx: gasTank.MaxFeeUsagePerTx, - TxsAllowed: gasTank.TxsAllowed, - ContractsAllowed: gasTank.ContractsAllowed, - AuthorizedActors: gasTank.AuthorizedActors, - FeeDenom: gasTank.FeeDenom, - } -} - -func NewConsumptionDetail( - gasTankID uint64, - totalTxsAllowed uint64, - totalFeeConsumptionAllowed sdkmath.Int, -) *ConsumptionDetail { - return &ConsumptionDetail{ - GasTankId: gasTankID, - IsBlocked: false, - TotalTxsAllowed: totalTxsAllowed, - TotalTxsMade: 0, - TotalFeeConsumptionAllowed: totalFeeConsumptionAllowed, - TotalFeesConsumed: sdk.ZeroInt(), - Usage: &Usage{ - Txs: []*UsageDetails{}, - Contracts: []*UsageDetails{}, - }, - } -} diff --git a/x/tokenfactory/README.md b/x/tokenfactory/README.md deleted file mode 100644 index c6dd45d7f..000000000 --- a/x/tokenfactory/README.md +++ /dev/null @@ -1,155 +0,0 @@ -# Token Factory - -The tokenfactory module allows any account to create a new token with -the name `factory/{creator address}/{subdenom}`. Because tokens are -namespaced by creator address, this allows token minting to be -permissionless, due to not needing to resolve name collisions. A single -account can create multiple denoms, by providing a unique subdenom for each -created denom. Once a denom is created, the original creator is given -"admin" privileges over the asset. This allows them to: - -- Mint their denom to any account -- Burn their denom from any account -- Create a transfer of their denom between any two accounts -- Change the admin. In the future, more admin capabilities may be added. Admins - can choose to share admin privileges with other accounts using the authz - module. The `ChangeAdmin` functionality, allows changing the master admin - account, or even setting it to `""`, meaning no account has admin privileges - of the asset. - -## Messages - -### CreateDenom - -Creates a denom of `factory/{creator address}/{subdenom}` given the denom creator -address and the subdenom. Subdenoms can contain `[a-zA-Z0-9./]`. - -```go -message MsgCreateDenom { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ]; -} -``` - -**State Modifications:** - -- Fund community pool with the denom creation fee from the creator address, set - in `Params`. -- Set `DenomMetaData` via bank keeper. -- Set `AuthorityMetadata` for the given denom to store the admin for the created - denom `factory/{creator address}/{subdenom}`. Admin is automatically set as the - Msg sender. -- Add denom to the `CreatorPrefixStore`, where a state of denoms created per - creator is kept. - -### Mint - -Minting of a specific denom is only allowed for the current admin. -Note, the current admin is defaulted to the creator of the denom. - -```go -message MsgMint { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - cosmos.base.v1beta1.Coin amount = 2 [ - (gogoproto.moretags) = "yaml:\"amount\"", - (gogoproto.nullable) = false - ]; -} -``` - -**State Modifications:** - -- Safety check the following - - Check that the denom minting is created via `tokenfactory` module - - Check that the sender of the message is the admin of the denom -- Mint designated amount of tokens for the denom via `bank` module - -### Burn - -Burning of a specific denom is only allowed for the current admin. -Note, the current admin is defaulted to the creator of the denom. - -```go -message MsgBurn { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - cosmos.base.v1beta1.Coin amount = 2 [ - (gogoproto.moretags) = "yaml:\"amount\"", - (gogoproto.nullable) = false - ]; -} -``` - -**State Modifications:** - -- Safety check the following - - Check that the denom minting is created via `tokenfactory` module - - Check that the sender of the message is the admin of the denom -- Burn designated amount of tokens for the denom via `bank` module - -### ChangeAdmin - -Change the admin of a denom. Note, this is only allowed to be called by the current admin of the denom. - -```go -message MsgChangeAdmin { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; - string newAdmin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; -} -``` - -### SetDenomMetadata - -Setting of metadata for a specific denom is only allowed for the admin of the denom. -It allows the overwriting of the denom metadata in the bank module. - -```go -message MsgChangeAdmin { - string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; - cosmos.bank.v1beta1.Metadata metadata = 2 [ (gogoproto.moretags) = "yaml:\"metadata\"", (gogoproto.nullable) = false ]; -} -``` - -**State Modifications:** - -- Check that sender of the message is the admin of denom -- Modify `AuthorityMetadata` state entry to change the admin of the denom - -## Expectations from the chain - -The chain's bech32 prefix for addresses can be at most 16 characters long. - -This comes from denoms having a 128 byte maximum length, enforced from the SDK, -and us setting longest_subdenom to be 44 bytes. - -A token factory token's denom is: `factory/{creator address}/{subdenom}` - -Splitting up into sub-components, this has: - -- `len(factory) = 7` -- `2 * len("/") = 2` -- `len(longest_subdenom)` -- `len(creator_address) = len(bech32(longest_addr_length, chain_addr_prefix))`. - -Longest addr length at the moment is `32 bytes`. Due to SDK error correction -settings, this means `len(bech32(32, chain_addr_prefix)) = len(chain_addr_prefix) + 1 + 58`. -Adding this all, we have a total length constraint of `128 = 7 + 2 + len(longest_subdenom) + len(longest_chain_addr_prefix) + 1 + 58`. -Therefore `len(longest_subdenom) + len(longest_chain_addr_prefix) = 128 - (7 + 2 + 1 + 58) = 60`. - -The choice between how we standardized the split these 60 bytes between maxes -from longest_subdenom and longest_chain_addr_prefix is somewhat arbitrary. -Considerations going into this: - -- Per [BIP-0173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32) - the technically longest HRP for a 32 byte address ('data field') is 31 bytes. - (Comes from encode(data) = 59 bytes, and max length = 90 bytes) -- subdenom should be at least 32 bytes so hashes can go into it -- longer subdenoms are very helpful for creating human readable denoms -- chain addresses should prefer being smaller. The longest HRP in cosmos to date is 11 bytes. (`persistence`) - -For explicitness, its currently set to `len(longest_subdenom) = 44` and `len(longest_chain_addr_prefix) = 16`. - -Please note, if the SDK increases the maximum length of a denom from 128 bytes, -these caps should increase. - -So please don't make code rely on these max lengths for parsing. diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go deleted file mode 100644 index 150caad90..000000000 --- a/x/tokenfactory/client/cli/query.go +++ /dev/null @@ -1,117 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd() *cobra.Command { - // Group tokenfactory queries under a subcommand - 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( - GetParams(), - GetCmdDenomAuthorityMetadata(), - GetCmdDenomsFromCreator(), - ) - - return cmd -} - -// GetParams returns the params for the module -func GetParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params [flags]", - Short: "Get the params for the x/tokenfactory module", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// GetCmdDenomAuthorityMetadata returns the authority metadata for a queried denom -func GetCmdDenomAuthorityMetadata() *cobra.Command { - cmd := &cobra.Command{ - Use: "denom-authority-metadata [denom] [flags]", - Short: "Get the authority metadata for a specific denom", - Args: cobra.ExactArgs(1), - 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.DenomAuthorityMetadata(cmd.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: args[0], - }) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// GetCmdDenomsFromCreator a command to get a list of all tokens created by a specific creator address -func GetCmdDenomsFromCreator() *cobra.Command { - cmd := &cobra.Command{ - Use: "denoms-from-creator [creator address] [flags]", - Short: "Returns a list of all tokens created by a specific creator address", - Args: cobra.ExactArgs(1), - 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.DenomsFromCreator(cmd.Context(), &types.QueryDenomsFromCreatorRequest{ - Creator: args[0], - }) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go deleted file mode 100644 index 29a973564..000000000 --- a/x/tokenfactory/client/cli/tx.go +++ /dev/null @@ -1,367 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - "strings" - - "github.com/spf13/cobra" - - "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" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - NewCreateDenomCmd(), - NewMintCmd(), - NewMintToCmd(), - NewBurnCmd(), - NewBurnFromCmd(), - NewForceTransferCmd(), - NewChangeAdminCmd(), - NewModifyDenomMetadataCmd(), - ) - - return cmd -} - -// NewCreateDenomCmd broadcast MsgCreateDenom -func NewCreateDenomCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-denom [subdenom] [flags]", - Short: "create a new denom from an account", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return err - } - - txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - - msg := types.NewMsgCreateDenom( - clientCtx.GetFromAddress().String(), - args[0], - ) - - return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// NewMintCmd broadcast MsgMint -func NewMintCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "mint [amount] [flags]", - Short: "Mint a denom to your address. Must have admin authority to do so.", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return err - } - - txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - - amount, err := sdk.ParseCoinNormalized(args[0]) - if err != nil { - return err - } - - msg := types.NewMsgMint( - clientCtx.GetFromAddress().String(), - amount, - ) - - return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// NewMintToCmd broadcast MsgMintTo -func NewMintToCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "mint-to [address] [amount] [flags]", - Short: "Mint a denom to an address. Must have admin authority to do so.", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return err - } - txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - - toAddr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - - amount, err := sdk.ParseCoinNormalized(args[1]) - if err != nil { - return err - } - - msg := types.NewMsgMintTo( - clientCtx.GetFromAddress().String(), - amount, - toAddr.String(), - ) - - return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// NewBurnCmd broadcast MsgBurn -func NewBurnCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "burn [amount] [flags]", - Short: "Burn tokens from an address. Must have admin authority to do so.", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return err - } - txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - - amount, err := sdk.ParseCoinNormalized(args[0]) - if err != nil { - return err - } - - msg := types.NewMsgBurn( - clientCtx.GetFromAddress().String(), - amount, - ) - - return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// NewBurnFromCmd broadcast MsgBurnFrom -func NewBurnFromCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "burn-from [address] [amount] [flags]", - Short: "Burn tokens from an address. Must have admin authority to do so.", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return err - } - txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - - fromAddr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - - amount, err := sdk.ParseCoinNormalized(args[1]) - if err != nil { - return err - } - - msg := types.NewMsgBurnFrom( - clientCtx.GetFromAddress().String(), - amount, - fromAddr.String(), - ) - - return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// NewForceTransferCmd broadcast MsgForceTransfer -func NewForceTransferCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "force-transfer [amount] [transfer-from-address] [transfer-to-address] [flags]", - Short: "Force transfer tokens from one address to another address. Must have admin authority to do so.", - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return err - } - txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - - amount, err := sdk.ParseCoinNormalized(args[0]) - if err != nil { - return err - } - - msg := types.NewMsgForceTransfer( - clientCtx.GetFromAddress().String(), - amount, - args[1], - args[2], - ) - - return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// NewChangeAdminCmd broadcast MsgChangeAdmin -func NewChangeAdminCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "change-admin [denom] [new-admin-address] [flags]", - Short: "Changes the admin address for a factory-created denom. Must have admin authority to do so.", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return err - } - txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - - msg := types.NewMsgChangeAdmin( - clientCtx.GetFromAddress().String(), - args[0], - args[1], - ) - - return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// NewModifyDenomMetadataCmd broadcast a Bank Metadata modification transaction -func NewModifyDenomMetadataCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "modify-metadata [denom] [ticker-symbol] [description] [exponent] [flags]", - Short: "Changes the base data for frontends to query the data of.", - Args: cobra.ExactArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return err - } - txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - - fullDenom, ticker, desc := args[0], strings.ToUpper(args[1]), args[2] - - if !strings.HasPrefix(fullDenom, "factory/") { - return fmt.Errorf("denom must start with factory/") - } - - if len(ticker) == 0 { - return fmt.Errorf("ticker cannot be empty") - } - - // Exponent Checks - exponent, err := strconv.ParseUint(args[3], 10, 32) - if err != nil { - return err - } - - bankMetadata := banktypes.Metadata{ - Description: desc, - Display: ticker, - Symbol: ticker, - Name: fullDenom, - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: fullDenom, - Exponent: 0, // must be 0 for the base denom - Aliases: []string{ticker}, - }, - { - Denom: ticker, - Exponent: uint32(exponent), - Aliases: []string{fullDenom}, - }, - }, - Base: fullDenom, - } - - msg := types.NewMsgSetDenomMetadata( - clientCtx.GetFromAddress().String(), - bankMetadata, - ) - - return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} diff --git a/x/tokenfactory/exported/exported.go b/x/tokenfactory/exported/exported.go deleted file mode 100644 index 000114e61..000000000 --- a/x/tokenfactory/exported/exported.go +++ /dev/null @@ -1,18 +0,0 @@ -package exported - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -type ( - ParamSet = paramtypes.ParamSet - - // Subspace defines an interface that implements the legacy x/params Subspace - // type. - // - // NOTE: This is used solely for migration of x/params managed parameters. - Subspace interface { - GetParamSet(ctx sdk.Context, ps ParamSet) - } -) diff --git a/x/tokenfactory/keeper/admins.go b/x/tokenfactory/keeper/admins.go deleted file mode 100644 index f50c3a453..000000000 --- a/x/tokenfactory/keeper/admins.go +++ /dev/null @@ -1,50 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/gogoproto/proto" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -// GetAuthorityMetadata returns the authority metadata for a specific denom -func (k Keeper) GetAuthorityMetadata(ctx sdk.Context, denom string) (types.DenomAuthorityMetadata, error) { - bz := k.GetDenomPrefixStore(ctx, denom).Get([]byte(types.DenomAuthorityMetadataKey)) - - metadata := types.DenomAuthorityMetadata{} - err := proto.Unmarshal(bz, &metadata) - if err != nil { - return types.DenomAuthorityMetadata{}, err - } - return metadata, nil -} - -// setAuthorityMetadata stores authority metadata for a specific denom -func (k Keeper) setAuthorityMetadata(ctx sdk.Context, denom string, metadata types.DenomAuthorityMetadata) error { - err := metadata.Validate() - if err != nil { - return err - } - - store := k.GetDenomPrefixStore(ctx, denom) - - bz, err := proto.Marshal(&metadata) - if err != nil { - return err - } - - store.Set([]byte(types.DenomAuthorityMetadataKey), bz) - return nil -} - -func (k Keeper) setAdmin(ctx sdk.Context, denom string, admin string) error { - metadata, err := k.GetAuthorityMetadata(ctx, denom) - if err != nil { - return err - } - - metadata.Admin = admin - - return k.setAuthorityMetadata(ctx, denom, metadata) -} diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go deleted file mode 100644 index b90fbf319..000000000 --- a/x/tokenfactory/keeper/admins_test.go +++ /dev/null @@ -1,526 +0,0 @@ -package keeper_test - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func (suite *KeeperTestSuite) TestAdminMsgs() { - addr0bal := int64(0) - addr1bal := int64(0) - - bankKeeper := suite.App.BankKeeper - - suite.CreateDefaultDenom() - // Make sure that the admin is set correctly - queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, - }) - suite.Require().NoError(err) - suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) - - // Test minting to admins own account - _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 10))) - addr0bal += 10 - suite.Require().NoError(err) - suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64() == addr0bal, bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) - - // Test minting to a different account - _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMintTo(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 10), suite.TestAccs[1].String())) - addr1bal += 10 - suite.Require().NoError(err) - suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom)) - - // Test force transferring - _, err = suite.msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), types.NewMsgForceTransfer(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 5), suite.TestAccs[1].String(), suite.TestAccs[0].String())) - addr1bal -= 5 - addr0bal += 5 - suite.Require().NoError(err) - suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64() == addr0bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) - suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom)) - - // Test burning from own account - _, err = suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 5))) - suite.Require().NoError(err) - suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal) - - // Test Change Admin - _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), types.NewMsgChangeAdmin(suite.TestAccs[0].String(), suite.defaultDenom, suite.TestAccs[1].String())) - suite.Require().NoError(err) - queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, - }) - suite.Require().NoError(err) - suite.Require().Equal(suite.TestAccs[1].String(), queryRes.AuthorityMetadata.Admin) - - // Make sure old admin can no longer do actions - _, err = suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 5))) - suite.Require().Error(err) - - // Make sure the new admin works - _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[1].String(), sdk.NewInt64Coin(suite.defaultDenom, 5))) - addr1bal += 5 - suite.Require().NoError(err) - suite.Require().True(bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal) - - // Try setting admin to empty - _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), types.NewMsgChangeAdmin(suite.TestAccs[1].String(), suite.defaultDenom, "")) - suite.Require().NoError(err) - queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, - }) - suite.Require().NoError(err) - suite.Require().Equal("", queryRes.AuthorityMetadata.Admin) -} - -// TestMintDenom ensures the following properties of the MintMessage: -// * No one can mint tokens for a denom that doesn't exist -// * Only the admin of a denom can mint tokens for it -// * The admin of a denom can mint tokens for it -func (suite *KeeperTestSuite) TestMintDenom() { - balances := make(map[string]int64) - for _, acc := range suite.TestAccs { - balances[acc.String()] = 0 - } - - // Create a denom - suite.CreateDefaultDenom() - - for _, tc := range []struct { - desc string - mintMsg types.MsgMint - expectPass bool - }{ - { - desc: "denom does not exist", - mintMsg: *types.NewMsgMint( - suite.TestAccs[0].String(), - sdk.NewInt64Coin("factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", 10), - ), - expectPass: false, - }, - { - desc: "mint is not by the admin", - mintMsg: *types.NewMsgMintTo( - suite.TestAccs[1].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - suite.TestAccs[0].String(), - ), - expectPass: false, - }, - { - desc: "success case - mint to self", - mintMsg: *types.NewMsgMint( - suite.TestAccs[0].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - ), - expectPass: true, - }, - { - desc: "success case - mint to another address", - mintMsg: *types.NewMsgMintTo( - suite.TestAccs[0].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - suite.TestAccs[1].String(), - ), - expectPass: true, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - tc := tc - _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), &tc.mintMsg) - if tc.expectPass { - suite.Require().NoError(err) - balances[tc.mintMsg.MintToAddress] += tc.mintMsg.Amount.Amount.Int64() - } else { - suite.Require().Error(err) - } - - mintToAddr, _ := sdk.AccAddressFromBech32(tc.mintMsg.MintToAddress) - bal := suite.App.BankKeeper.GetBalance(suite.Ctx, mintToAddr, suite.defaultDenom).Amount - suite.Require().Equal(bal.Int64(), balances[tc.mintMsg.MintToAddress]) - }) - } -} - -func (suite *KeeperTestSuite) TestBurnDenom() { - // Create a denom. - suite.CreateDefaultDenom() - - // mint 1000 default token for all testAccs - balances := make(map[string]int64) - for _, acc := range suite.TestAccs { - _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMintTo(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 1000), acc.String())) - suite.Require().NoError(err) - balances[acc.String()] = 1000 - } - - for _, tc := range []struct { - desc string - burnMsg types.MsgBurn - expectPass bool - }{ - { - desc: "denom does not exist", - burnMsg: *types.NewMsgBurn( - suite.TestAccs[0].String(), - sdk.NewInt64Coin("factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", 10), - ), - expectPass: false, - }, - { - desc: "burn is not by the admin", - burnMsg: *types.NewMsgBurnFrom( - suite.TestAccs[1].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - suite.TestAccs[0].String(), - ), - expectPass: false, - }, - { - desc: "burn more than balance", - burnMsg: *types.NewMsgBurn( - suite.TestAccs[0].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10000), - ), - expectPass: false, - }, - { - desc: "success case - burn from self", - burnMsg: *types.NewMsgBurn( - suite.TestAccs[0].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - ), - expectPass: true, - }, - { - desc: "success case - burn from another address", - burnMsg: *types.NewMsgBurnFrom( - suite.TestAccs[0].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - suite.TestAccs[1].String(), - ), - expectPass: true, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - tc := tc - _, err := suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), &tc.burnMsg) - if tc.expectPass { - suite.Require().NoError(err) - balances[tc.burnMsg.BurnFromAddress] -= tc.burnMsg.Amount.Amount.Int64() - } else { - suite.Require().Error(err) - } - - burnFromAddr, _ := sdk.AccAddressFromBech32(tc.burnMsg.BurnFromAddress) - bal := suite.App.BankKeeper.GetBalance(suite.Ctx, burnFromAddr, suite.defaultDenom).Amount - suite.Require().Equal(bal.Int64(), balances[tc.burnMsg.BurnFromAddress]) - }) - } -} - -func (suite *KeeperTestSuite) TestForceTransferDenom() { - // Create a denom. - suite.CreateDefaultDenom() - - // mint 1000 default token for all testAccs - balances := make(map[string]int64) - for _, acc := range suite.TestAccs { - _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMintTo(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 1000), acc.String())) - suite.Require().NoError(err) - balances[acc.String()] = 1000 - } - - for _, tc := range []struct { - desc string - forceTransferMsg types.MsgForceTransfer - expectPass bool - }{ - { - desc: "valid force transfer", - forceTransferMsg: *types.NewMsgForceTransfer( - suite.TestAccs[0].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - suite.TestAccs[1].String(), - suite.TestAccs[2].String(), - ), - expectPass: true, - }, - { - desc: "denom does not exist", - forceTransferMsg: *types.NewMsgForceTransfer( - suite.TestAccs[0].String(), - sdk.NewInt64Coin("factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", 10), - suite.TestAccs[1].String(), - suite.TestAccs[2].String(), - ), - expectPass: false, - }, - { - desc: "forceTransfer is not by the admin", - forceTransferMsg: *types.NewMsgForceTransfer( - suite.TestAccs[1].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10), - suite.TestAccs[1].String(), - suite.TestAccs[2].String(), - ), - expectPass: false, - }, - { - desc: "forceTransfer is greater than the balance of", - forceTransferMsg: *types.NewMsgForceTransfer( - suite.TestAccs[0].String(), - sdk.NewInt64Coin(suite.defaultDenom, 10000), - suite.TestAccs[1].String(), - suite.TestAccs[2].String(), - ), - expectPass: false, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - tc := tc - _, err := suite.msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), &tc.forceTransferMsg) - if tc.expectPass { - suite.Require().NoError(err) - - balances[tc.forceTransferMsg.TransferFromAddress] -= tc.forceTransferMsg.Amount.Amount.Int64() - balances[tc.forceTransferMsg.TransferToAddress] += tc.forceTransferMsg.Amount.Amount.Int64() - } else { - suite.Require().Error(err) - } - - fromAddr, err := sdk.AccAddressFromBech32(tc.forceTransferMsg.TransferFromAddress) - suite.Require().NoError(err) - fromBal := suite.App.BankKeeper.GetBalance(suite.Ctx, fromAddr, suite.defaultDenom).Amount - suite.Require().True(fromBal.Int64() == balances[tc.forceTransferMsg.TransferFromAddress]) - - toAddr, err := sdk.AccAddressFromBech32(tc.forceTransferMsg.TransferToAddress) - suite.Require().NoError(err) - toBal := suite.App.BankKeeper.GetBalance(suite.Ctx, toAddr, suite.defaultDenom).Amount - suite.Require().True(toBal.Int64() == balances[tc.forceTransferMsg.TransferToAddress]) - }) - } -} - -func (suite *KeeperTestSuite) TestChangeAdminDenom() { - for _, tc := range []struct { - desc string - msgChangeAdmin func(denom string) *types.MsgChangeAdmin - expectedChangeAdminPass bool - expectedAdminIndex int - msgMint func(denom string) *types.MsgMint - expectedMintPass bool - }{ - { - desc: "creator admin can't mint after setting to '' ", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[0].String(), denom, "") - }, - expectedChangeAdminPass: true, - expectedAdminIndex: -1, - msgMint: func(denom string) *types.MsgMint { - return types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(denom, 5)) - }, - expectedMintPass: false, - }, - { - desc: "non-admins can't change the existing admin", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[1].String(), denom, suite.TestAccs[2].String()) - }, - expectedChangeAdminPass: false, - expectedAdminIndex: 0, - }, - { - desc: "success change admin", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[0].String(), denom, suite.TestAccs[1].String()) - }, - expectedAdminIndex: 1, - expectedChangeAdminPass: true, - msgMint: func(denom string) *types.MsgMint { - return types.NewMsgMint(suite.TestAccs[1].String(), sdk.NewInt64Coin(denom, 5)) - }, - expectedMintPass: true, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - // setup test - suite.SetupTest() - - // Create a denom and mint - res, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().NoError(err) - - testDenom := res.GetNewTokenDenom() - - _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(testDenom, 10))) - suite.Require().NoError(err) - - _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), tc.msgChangeAdmin(testDenom)) - if tc.expectedChangeAdminPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - - queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: testDenom, - }) - suite.Require().NoError(err) - - // expectedAdminIndex with negative value is assumed as admin with value of "" - const emptyStringAdminIndexFlag = -1 - if tc.expectedAdminIndex == emptyStringAdminIndexFlag { - suite.Require().Equal("", queryRes.AuthorityMetadata.Admin) - } else { - suite.Require().Equal(suite.TestAccs[tc.expectedAdminIndex].String(), queryRes.AuthorityMetadata.Admin) - } - - // we test mint to test if admin authority is performed properly after admin change. - if tc.msgMint != nil { - _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), tc.msgMint(testDenom)) - if tc.expectedMintPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - } - }) - } -} - -func (suite *KeeperTestSuite) TestSetDenomMetaData() { - // setup test - suite.SetupTest() - suite.CreateDefaultDenom() - - for _, tc := range []struct { - desc string - msgSetDenomMetadata types.MsgSetDenomMetadata - expectedPass bool - }{ - { - desc: "successful set denom metadata", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: suite.defaultDenom, - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: suite.defaultDenom, - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: true, - }, - { - desc: "non existent factory denom name", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: fmt.Sprintf("factory/%s/litecoin", suite.TestAccs[0].String()), - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: fmt.Sprintf("factory/%s/litecoin", suite.TestAccs[0].String()), - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - { - desc: "non-factory denom", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: "uosmo", - Exponent: 0, - }, - { - Denom: "uosmoo", - Exponent: 6, - }, - }, - Base: "uosmo", - Display: "uosmoo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - { - desc: "wrong admin", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[1].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: suite.defaultDenom, - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: suite.defaultDenom, - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - { - desc: "invalid metadata (missing display denom unit)", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: suite.defaultDenom, - Exponent: 0, - }, - }, - Base: suite.defaultDenom, - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - tc := tc - bankKeeper := suite.App.BankKeeper - res, err := suite.msgServer.SetDenomMetadata(sdk.WrapSDKContext(suite.Ctx), &tc.msgSetDenomMetadata) - if tc.expectedPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) - - md, found := bankKeeper.GetDenomMetaData(suite.Ctx, suite.defaultDenom) - suite.Require().True(found) - suite.Require().Equal(tc.msgSetDenomMetadata.Metadata.Name, md.Name) - } else { - suite.Require().Error(err) - } - }) - } -} diff --git a/x/tokenfactory/keeper/bankactions.go b/x/tokenfactory/keeper/bankactions.go deleted file mode 100644 index 9d7f1cb99..000000000 --- a/x/tokenfactory/keeper/bankactions.go +++ /dev/null @@ -1,86 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func (k Keeper) mintTo(ctx sdk.Context, amount sdk.Coin, mintTo string) error { - // verify that denom is an x/tokenfactory denom - _, _, err := types.DeconstructDenom(amount.Denom) - if err != nil { - return err - } - - err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(amount)) - if err != nil { - return err - } - - addr, err := sdk.AccAddressFromBech32(mintTo) - if err != nil { - return err - } - - if k.bankKeeper.BlockedAddr(addr) { - return fmt.Errorf("failed to mint to blocked address: %s", addr) - } - - return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, - addr, - sdk.NewCoins(amount)) -} - -func (k Keeper) burnFrom(ctx sdk.Context, amount sdk.Coin, burnFrom string) error { - // verify that denom is an x/tokenfactory denom - _, _, err := types.DeconstructDenom(amount.Denom) - if err != nil { - return err - } - - addr, err := sdk.AccAddressFromBech32(burnFrom) - if err != nil { - return err - } - - if k.bankKeeper.BlockedAddr(addr) { - return fmt.Errorf("failed to burn from blocked address: %s", addr) - } - - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, - addr, - types.ModuleName, - sdk.NewCoins(amount)) - if err != nil { - return err - } - - return k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(amount)) -} - -func (k Keeper) forceTransfer(ctx sdk.Context, amount sdk.Coin, fromAddr string, toAddr string) error { - // verify that denom is an x/tokenfactory denom - _, _, err := types.DeconstructDenom(amount.Denom) - if err != nil { - return err - } - - fromSdkAddr, err := sdk.AccAddressFromBech32(fromAddr) - if err != nil { - return err - } - - toSdkAddr, err := sdk.AccAddressFromBech32(toAddr) - if err != nil { - return err - } - - if k.bankKeeper.BlockedAddr(toSdkAddr) { - return fmt.Errorf("failed to force transfer to blocked address: %s", toSdkAddr) - } - - return k.bankKeeper.SendCoins(ctx, fromSdkAddr, toSdkAddr, sdk.NewCoins(amount)) -} diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go deleted file mode 100644 index 2ec5af1da..000000000 --- a/x/tokenfactory/keeper/createdenom.go +++ /dev/null @@ -1,98 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -// ConvertToBaseToken converts a fee amount in a whitelisted fee token to the base fee token amount -func (k Keeper) CreateDenom(ctx sdk.Context, creatorAddr string, subdenom string) (newTokenDenom string, err error) { - denom, err := k.validateCreateDenom(ctx, creatorAddr, subdenom) - if err != nil { - return "", err - } - - err = k.chargeForCreateDenom(ctx, creatorAddr, subdenom) - if err != nil { - return "", err - } - - err = k.createDenomAfterValidation(ctx, creatorAddr, denom) - return denom, err -} - -// Runs CreateDenom logic after the charge and all denom validation has been handled. -// Made into a second function for genesis initialization. -func (k Keeper) createDenomAfterValidation(ctx sdk.Context, creatorAddr string, denom string) (err error) { - denomMetaData := banktypes.Metadata{ - DenomUnits: []*banktypes.DenomUnit{{ - Denom: denom, - Exponent: 0, - }}, - Base: denom, - // The following is necessary for x/bank denom validation - Display: denom, - Name: denom, - Symbol: denom, - } - - k.bankKeeper.SetDenomMetaData(ctx, denomMetaData) - - authorityMetadata := types.DenomAuthorityMetadata{ - Admin: creatorAddr, - } - err = k.setAuthorityMetadata(ctx, denom, authorityMetadata) - if err != nil { - return err - } - - k.addDenomFromCreator(ctx, creatorAddr, denom) - return nil -} - -func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr string, subdenom string) (newTokenDenom string, err error) { - // TODO: This was a nil key on Store issue. Removed as we are upgrading IBC versions now - // Temporary check until IBC bug is sorted out - // if k.bankKeeper.HasSupply(ctx, subdenom) { - // return "", fmt.Errorf("temporary error until IBC bug is sorted out, " + - // "can't create subdenoms that are the same as a native denom") - // } - - denom, err := types.GetTokenDenom(creatorAddr, subdenom) - if err != nil { - return "", err - } - - _, found := k.bankKeeper.GetDenomMetaData(ctx, denom) - if found { - return "", types.ErrDenomExists - } - - return denom, nil -} - -func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string, _ string) (err error) { - params := k.GetParams(ctx) - - // if DenomCreationFee is non-zero, transfer the tokens from the creator - // account to community pool - if params.DenomCreationFee != nil { - accAddr, err := sdk.AccAddressFromBech32(creatorAddr) - if err != nil { - return err - } - - if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil { - return err - } - } - - // if DenomCreationGasConsume is non-zero, consume the gas - if params.DenomCreationGasConsume != 0 { - ctx.GasMeter().ConsumeGas(params.DenomCreationGasConsume, "consume denom creation gas") - } - - return nil -} diff --git a/x/tokenfactory/keeper/createdenom_test.go b/x/tokenfactory/keeper/createdenom_test.go deleted file mode 100644 index 5cf7c254e..000000000 --- a/x/tokenfactory/keeper/createdenom_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package keeper_test - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func (suite *KeeperTestSuite) TestMsgCreateDenom() { - var ( - tokenFactoryKeeper = suite.App.TokenFactoryKeeper - bankKeeper = suite.App.BankKeeper - denomCreationFee = tokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee - ) - - // Get balance of acc 0 before creating a denom - preCreateBalance := bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], denomCreationFee[0].Denom) - - // Creating a denom should work - res, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().NoError(err) - suite.Require().NotEmpty(res.GetNewTokenDenom()) - - // Make sure that the admin is set correctly - queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: res.GetNewTokenDenom(), - }) - suite.Require().NoError(err) - suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) - - // Make sure that the denom is valid from the perspective of x/bank - bankQueryRes, err := suite.bankQueryClient.DenomMetadata(suite.Ctx.Context(), &banktypes.QueryDenomMetadataRequest{ - Denom: res.GetNewTokenDenom(), - }) - suite.Require().NoError(err) - suite.Require().NoError(bankQueryRes.Metadata.Validate()) - - // Make sure that creation fee was deducted - postCreateBalance := bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], tokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee[0].Denom) - suite.Require().True(preCreateBalance.Sub(postCreateBalance).IsEqual(denomCreationFee[0])) - - // Make sure that a second version of the same denom can't be recreated - _, err = suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().Error(err) - - // Creating a second denom should work - res, err = suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "litecoin")) - suite.Require().NoError(err) - suite.Require().NotEmpty(res.GetNewTokenDenom()) - - // Try querying all the denoms created by suite.TestAccs[0] - queryRes2, err := suite.queryClient.DenomsFromCreator(suite.Ctx.Context(), &types.QueryDenomsFromCreatorRequest{ - Creator: suite.TestAccs[0].String(), - }) - suite.Require().NoError(err) - suite.Require().Len(queryRes2.Denoms, 2) - - // Make sure that a second account can create a denom with the same subdenom - res, err = suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[1].String(), "bitcoin")) - suite.Require().NoError(err) - suite.Require().NotEmpty(res.GetNewTokenDenom()) - - // Make sure that an address with a "/" in it can't create denoms - _, err = suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom("osmosis.eth/creator", "bitcoin")) - suite.Require().Error(err) -} - -func (suite *KeeperTestSuite) TestCreateDenom() { - var ( - primaryDenom = types.DefaultParams().DenomCreationFee[0].Denom - secondaryDenom = "uaib" - defaultDenomCreationFee = types.Params{DenomCreationFee: sdk.NewCoins(sdk.NewCoin(primaryDenom, sdk.NewInt(50000000)))} - twoDenomCreationFee = types.Params{DenomCreationFee: sdk.NewCoins(sdk.NewCoin(primaryDenom, sdk.NewInt(50000000)), sdk.NewCoin(secondaryDenom, sdk.NewInt(50000000)))} - nilCreationFee = types.Params{DenomCreationFee: nil} - largeCreationFee = types.Params{DenomCreationFee: sdk.NewCoins(sdk.NewCoin(primaryDenom, sdk.NewInt(5000000000)))} - ) - - for _, tc := range []struct { - desc string - denomCreationFee types.Params - setup func() - subdenom string - valid bool - }{ - { - desc: "subdenom too long", - denomCreationFee: defaultDenomCreationFee, - subdenom: "assadsadsadasdasdsadsadsadsadsadsadsklkadaskkkdasdasedskhanhassyeunganassfnlksdflksafjlkasd", - valid: false, - }, - { - desc: "subdenom and creator pair already exists", - denomCreationFee: defaultDenomCreationFee, - setup: func() { - _, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().NoError(err) - }, - subdenom: "bitcoin", - valid: false, - }, - { - desc: "success case: defaultDenomCreationFee", - denomCreationFee: defaultDenomCreationFee, - subdenom: "evmos", - valid: true, - }, - { - desc: "success case: twoDenomCreationFee", - denomCreationFee: twoDenomCreationFee, - subdenom: "catcoin", - valid: true, - }, - { - desc: "success case: nilCreationFee", - denomCreationFee: nilCreationFee, - subdenom: "czcoin", - valid: true, - }, - { - desc: "account doesn't have enough to pay for denom creation fee", - denomCreationFee: largeCreationFee, - subdenom: "tooexpensive", - valid: false, - }, - { - desc: "subdenom having invalid characters", - denomCreationFee: defaultDenomCreationFee, - subdenom: "bit/***///&&&/coin", - valid: false, - }, - } { - suite.SetupTest() - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - if tc.setup != nil { - tc.setup() - } - tokenFactoryKeeper := suite.App.TokenFactoryKeeper - bankKeeper := suite.App.BankKeeper - // Set denom creation fee in params - if err := tokenFactoryKeeper.SetParams(suite.Ctx, tc.denomCreationFee); err != nil { - suite.Require().NoError(err) - } - denomCreationFee := tokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee - suite.Require().Equal(tc.denomCreationFee.DenomCreationFee, denomCreationFee) - - // note balance, create a tokenfactory denom, then note balance again - // preCreateBalance := bankKeeper.GetAllBalances(suite.Ctx, suite.TestAccs[0]) - preCreateBalance := bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], "stake") - res, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), tc.subdenom)) - // postCreateBalance := bankKeeper.GetAllBalances(suite.Ctx, suite.TestAccs[0]) - postCreateBalance := bankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], "stake") - if tc.valid { - suite.Require().NoError(err) - if denomCreationFee != nil { - suite.Require().True(preCreateBalance.Sub(postCreateBalance).IsEqual(denomCreationFee[0])) - } - - // Make sure that the admin is set correctly - queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: res.GetNewTokenDenom(), - }) - - suite.Require().NoError(err) - suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) - - } else { - suite.Require().Error(err) - // Ensure we don't charge if we expect an error - suite.Require().True(preCreateBalance.IsEqual(postCreateBalance)) - } - }) - } -} diff --git a/x/tokenfactory/keeper/creators.go b/x/tokenfactory/keeper/creators.go deleted file mode 100644 index d200c0603..000000000 --- a/x/tokenfactory/keeper/creators.go +++ /dev/null @@ -1,29 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k Keeper) addDenomFromCreator(ctx sdk.Context, creator, denom string) { - store := k.GetCreatorPrefixStore(ctx, creator) - store.Set([]byte(denom), []byte(denom)) -} - -func (k Keeper) GetDenomsFromCreator(ctx sdk.Context, creator string) []string { - store := k.GetCreatorPrefixStore(ctx, creator) - - iterator := store.Iterator(nil, nil) - defer iterator.Close() - - denoms := []string{} - for ; iterator.Valid(); iterator.Next() { - denoms = append(denoms, string(iterator.Key())) - } - return denoms -} - -func (k Keeper) GetAllDenomsIterator(ctx sdk.Context) sdk.Iterator { - return k.GetCreatorsPrefixStore(ctx).Iterator(nil, nil) -} - -// TODO: Get all denoms a user is the admin of currently diff --git a/x/tokenfactory/keeper/genesis.go b/x/tokenfactory/keeper/genesis.go deleted file mode 100644 index a1642f0d7..000000000 --- a/x/tokenfactory/keeper/genesis.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -// InitGenesis initializes the tokenfactory module's state from a provided genesis -// state. -func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { - k.CreateModuleAccount(ctx) - - if genState.Params.DenomCreationFee == nil { - genState.Params.DenomCreationFee = sdk.NewCoins() - } - if err := k.SetParams(ctx, genState.Params); err != nil { - panic(err) - } - - for _, genDenom := range genState.GetFactoryDenoms() { - creator, _, err := types.DeconstructDenom(genDenom.GetDenom()) - if err != nil { - panic(err) - } - err = k.createDenomAfterValidation(ctx, creator, genDenom.GetDenom()) - if err != nil { - panic(err) - } - err = k.setAuthorityMetadata(ctx, genDenom.GetDenom(), genDenom.GetAuthorityMetadata()) - if err != nil { - panic(err) - } - } -} - -// ExportGenesis returns the tokenfactory module's exported genesis. -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - genDenoms := []types.GenesisDenom{} - iterator := k.GetAllDenomsIterator(ctx) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - denom := string(iterator.Value()) - - authorityMetadata, err := k.GetAuthorityMetadata(ctx, denom) - if err != nil { - panic(err) - } - - genDenoms = append(genDenoms, types.GenesisDenom{ - Denom: denom, - AuthorityMetadata: authorityMetadata, - }) - } - - return &types.GenesisState{ - FactoryDenoms: genDenoms, - Params: k.GetParams(ctx), - } -} diff --git a/x/tokenfactory/keeper/genesis_test.go b/x/tokenfactory/keeper/genesis_test.go deleted file mode 100644 index 710deb593..000000000 --- a/x/tokenfactory/keeper/genesis_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package keeper_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func (suite *KeeperTestSuite) TestGenesis() { - genesisState := types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t", - }, - }, - { - Denom: "factory/cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t/diff-admin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t", - }, - }, - { - Denom: "factory/cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t/litecoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t", - }, - }, - }, - } - - suite.SetupTestForInitGenesis() - app := suite.App - - // Test both with bank denom metadata set, and not set. - for i, denom := range genesisState.FactoryDenoms { - // hacky, sets bank metadata to exist if i != 0, to cover both cases. - if i != 0 { - app.BankKeeper.SetDenomMetaData(suite.Ctx, banktypes.Metadata{Base: denom.GetDenom()}) - } - } - - if err := app.TokenFactoryKeeper.SetParams(suite.Ctx, types.Params{DenomCreationFee: sdk.Coins{sdk.NewInt64Coin("stake", 100)}}); err != nil { - panic(err) - } - app.TokenFactoryKeeper.InitGenesis(suite.Ctx, genesisState) - - // check that the module account is now initialized - tokenfactoryModuleAccount := app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - suite.Require().NotNil(tokenfactoryModuleAccount) - - exportedGenesis := app.TokenFactoryKeeper.ExportGenesis(suite.Ctx) - suite.Require().NotNil(exportedGenesis) - suite.Require().Equal(genesisState, *exportedGenesis) -} diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go deleted file mode 100644 index e32d5d172..000000000 --- a/x/tokenfactory/keeper/grpc_query.go +++ /dev/null @@ -1,35 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -var _ types.QueryServer = Keeper{} - -func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - params := k.GetParams(sdkCtx) - - return &types.QueryParamsResponse{Params: params}, nil -} - -func (k Keeper) DenomAuthorityMetadata(ctx context.Context, req *types.QueryDenomAuthorityMetadataRequest) (*types.QueryDenomAuthorityMetadataResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, req.GetDenom()) - if err != nil { - return nil, err - } - - return &types.QueryDenomAuthorityMetadataResponse{AuthorityMetadata: authorityMetadata}, nil -} - -func (k Keeper) DenomsFromCreator(ctx context.Context, req *types.QueryDenomsFromCreatorRequest) (*types.QueryDenomsFromCreatorResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - denoms := k.GetDenomsFromCreator(sdkCtx, req.GetCreator()) - return &types.QueryDenomsFromCreatorResponse{Denoms: denoms}, nil -} diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go deleted file mode 100644 index 6e765bd10..000000000 --- a/x/tokenfactory/keeper/keeper.go +++ /dev/null @@ -1,93 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - communityPoolKeeper types.CommunityPoolKeeper - - enabledCapabilities []string - - // the address capable of executing a MsgUpdateParams message. Typically, this - // should be the x/gov module account. - authority string - } -) - -// NewKeeper returns a new instance of the x/tokenfactory keeper -func NewKeeper( - cdc codec.BinaryCodec, - storeKey storetypes.StoreKey, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, - communityPoolKeeper types.CommunityPoolKeeper, - enabledCapabilities []string, - authority string, -) Keeper { - return Keeper{ - cdc: cdc, - storeKey: storeKey, - - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - communityPoolKeeper: communityPoolKeeper, - - enabledCapabilities: enabledCapabilities, - - authority: authority, - } -} - -// GetAuthority returns the x/mint module's authority. -func (k Keeper) GetAuthority() string { - return k.authority -} - -// Logger returns a logger for the x/tokenfactory module -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// GetDenomPrefixStore returns the substore for a specific denom -func (k Keeper) GetDenomPrefixStore(ctx sdk.Context, denom string) sdk.KVStore { - store := ctx.KVStore(k.storeKey) - return prefix.NewStore(store, types.GetDenomPrefixStore(denom)) -} - -// GetCreatorPrefixStore returns the substore for a specific creator address -func (k Keeper) GetCreatorPrefixStore(ctx sdk.Context, creator string) sdk.KVStore { - store := ctx.KVStore(k.storeKey) - return prefix.NewStore(store, types.GetCreatorPrefix(creator)) -} - -// GetCreatorsPrefixStore returns the substore that contains a list of creators -func (k Keeper) GetCreatorsPrefixStore(ctx sdk.Context) sdk.KVStore { - store := ctx.KVStore(k.storeKey) - return prefix.NewStore(store, types.GetCreatorsPrefix()) -} - -// CreateModuleAccount creates a module account with minting and burning capabilities -// This account isn't intended to store any coins, -// it purely mints and burns them on behalf of the admin of respective denoms, -// and sends to the relevant address. -func (k Keeper) CreateModuleAccount(ctx sdk.Context) { - moduleAcc := authtypes.NewEmptyModuleAccount(types.ModuleName, authtypes.Minter, authtypes.Burner) - k.accountKeeper.SetModuleAccount(ctx, moduleAcc) -} diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go deleted file mode 100644 index 84c8cf0cb..000000000 --- a/x/tokenfactory/keeper/keeper_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/comdex-official/comdex/app" - "github.com/comdex-official/comdex/x/tokenfactory/keeper" - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -type KeeperTestSuite struct { - app.KeeperTestHelper - - queryClient types.QueryClient - bankQueryClient banktypes.QueryClient - msgServer types.MsgServer - // defaultDenom is on the suite, as it depends on the creator test address. - defaultDenom string -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.Setup() - - // Fund every TestAcc with two denoms, one of which is the denom creation fee - fundAccsAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100)), sdk.NewCoin("uaib", sdk.NewInt(100000000))) - for _, acc := range suite.TestAccs { - suite.FundAcc(acc, fundAccsAmount) - } - - suite.queryClient = types.NewQueryClient(suite.QueryHelper) - suite.bankQueryClient = banktypes.NewQueryClient(suite.QueryHelper) - suite.msgServer = keeper.NewMsgServerImpl(suite.App.TokenFactoryKeeper) -} - -func (suite *KeeperTestSuite) CreateDefaultDenom() { - res, _ := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.defaultDenom = res.GetNewTokenDenom() -} - -func (suite *KeeperTestSuite) TestCreateModuleAccount() { - app := suite.App - - // remove module account - tokenfactoryModuleAccount := app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - app.AccountKeeper.RemoveAccount(suite.Ctx, tokenfactoryModuleAccount) - - // ensure module account was removed - suite.Ctx = app.BaseApp.NewContext(false, tmproto.Header{ChainID: "testing"}) - tokenfactoryModuleAccount = app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - suite.Require().Nil(tokenfactoryModuleAccount) - - // create module account - app.TokenFactoryKeeper.CreateModuleAccount(suite.Ctx) - - // check that the module account is now initialized - tokenfactoryModuleAccount = app.AccountKeeper.GetAccount(suite.Ctx, app.AccountKeeper.GetModuleAddress(types.ModuleName)) - suite.Require().NotNil(tokenfactoryModuleAccount) -} diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go deleted file mode 100644 index c504e8a89..000000000 --- a/x/tokenfactory/keeper/msg_server.go +++ /dev/null @@ -1,229 +0,0 @@ -package keeper - -import ( - "context" - - "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - "github.com/comdex-official/comdex/x/tokenfactory/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{} - -func (server msgServer) CreateDenom(goCtx context.Context, msg *types.MsgCreateDenom) (*types.MsgCreateDenomResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - denom, err := server.Keeper.CreateDenom(ctx, msg.Sender, msg.Subdenom) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeMsgCreateDenom, - sdk.NewAttribute(types.AttributeCreator, msg.Sender), - sdk.NewAttribute(types.AttributeNewTokenDenom, denom), - ), - }) - - return &types.MsgCreateDenomResponse{ - NewTokenDenom: denom, - }, nil -} - -func (server msgServer) Mint(goCtx context.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - // pay some extra gas cost to give a better error here. - _, denomExists := server.bankKeeper.GetDenomMetaData(ctx, msg.Amount.Denom) - if !denomExists { - return nil, types.ErrDenomDoesNotExist.Wrapf("denom: %s", msg.Amount.Denom) - } - - authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Amount.GetDenom()) - if err != nil { - return nil, err - } - - if msg.Sender != authorityMetadata.GetAdmin() { - return nil, types.ErrUnauthorized - } - - if msg.MintToAddress == "" { - msg.MintToAddress = msg.Sender - } - - err = server.Keeper.mintTo(ctx, msg.Amount, msg.MintToAddress) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeMsgMint, - sdk.NewAttribute(types.AttributeMintToAddress, msg.Sender), - sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()), - ), - }) - - return &types.MsgMintResponse{}, nil -} - -func (server msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Amount.GetDenom()) - if err != nil { - return nil, err - } - - if msg.Sender != authorityMetadata.GetAdmin() { - return nil, types.ErrUnauthorized - } - - if msg.BurnFromAddress == "" { - msg.BurnFromAddress = msg.Sender - } else if !types.IsCapabilityEnabled(server.Keeper.enabledCapabilities, types.EnableBurnFrom) { - return nil, types.ErrCapabilityNotEnabled - } - - err = server.Keeper.burnFrom(ctx, msg.Amount, msg.BurnFromAddress) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeMsgBurn, - sdk.NewAttribute(types.AttributeBurnFromAddress, msg.Sender), - sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()), - ), - }) - - return &types.MsgBurnResponse{}, nil -} - -func (server msgServer) ForceTransfer(goCtx context.Context, msg *types.MsgForceTransfer) (*types.MsgForceTransferResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if !types.IsCapabilityEnabled(server.Keeper.enabledCapabilities, types.EnableForceTransfer) { - return nil, types.ErrCapabilityNotEnabled - } - - authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Amount.GetDenom()) - if err != nil { - return nil, err - } - - if msg.Sender != authorityMetadata.GetAdmin() { - return nil, types.ErrUnauthorized - } - - err = server.Keeper.forceTransfer(ctx, msg.Amount, msg.TransferFromAddress, msg.TransferToAddress) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeMsgForceTransfer, - sdk.NewAttribute(types.AttributeTransferFromAddress, msg.TransferFromAddress), - sdk.NewAttribute(types.AttributeTransferToAddress, msg.TransferToAddress), - sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()), - ), - }) - - return &types.MsgForceTransferResponse{}, nil -} - -func (server msgServer) ChangeAdmin(goCtx context.Context, msg *types.MsgChangeAdmin) (*types.MsgChangeAdminResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Denom) - if err != nil { - return nil, err - } - - if msg.Sender != authorityMetadata.GetAdmin() { - return nil, types.ErrUnauthorized - } - - err = server.Keeper.setAdmin(ctx, msg.Denom, msg.NewAdmin) - if err != nil { - return nil, err - } - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeMsgChangeAdmin, - sdk.NewAttribute(types.AttributeDenom, msg.GetDenom()), - sdk.NewAttribute(types.AttributeNewAdmin, msg.NewAdmin), - ), - }) - - return &types.MsgChangeAdminResponse{}, nil -} - -func (server msgServer) SetDenomMetadata(goCtx context.Context, msg *types.MsgSetDenomMetadata) (*types.MsgSetDenomMetadataResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if !types.IsCapabilityEnabled(server.Keeper.enabledCapabilities, types.EnableSetMetadata) { - return nil, types.ErrCapabilityNotEnabled - } - - // Defense in depth validation of metadata - err := msg.Metadata.Validate() - if err != nil { - return nil, err - } - - authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Metadata.Base) - if err != nil { - return nil, err - } - - if msg.Sender != authorityMetadata.GetAdmin() { - return nil, types.ErrUnauthorized - } - - server.Keeper.bankKeeper.SetDenomMetaData(ctx, msg.Metadata) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeMsgSetDenomMetadata, - sdk.NewAttribute(types.AttributeDenom, msg.Metadata.Base), - sdk.NewAttribute(types.AttributeDenomMetadata, msg.Metadata.String()), - ), - }) - - return &types.MsgSetDenomMetadataResponse{}, nil -} - -func (server msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if server.authority != req.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", server.authority, req.Authority) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - if err := server.SetParams(ctx, req.Params); err != nil { - return nil, err - } - - return &types.MsgUpdateParamsResponse{}, nil -} diff --git a/x/tokenfactory/keeper/msg_server_test.go b/x/tokenfactory/keeper/msg_server_test.go deleted file mode 100644 index 3199079ac..000000000 --- a/x/tokenfactory/keeper/msg_server_test.go +++ /dev/null @@ -1,250 +0,0 @@ -package keeper_test - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -// TestMintDenomMsg tests TypeMsgMint message is emitted on a successful mint -func (suite *KeeperTestSuite) TestMintDenomMsg() { - // Create a denom - suite.CreateDefaultDenom() - - for _, tc := range []struct { - desc string - amount int64 - mintDenom string - admin string - valid bool - expectedMessageEvents int - }{ - { - desc: "denom does not exist", - amount: 10, - mintDenom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", - admin: suite.TestAccs[0].String(), - valid: false, - }, - { - desc: "success case", - amount: 10, - mintDenom: suite.defaultDenom, - admin: suite.TestAccs[0].String(), - valid: true, - expectedMessageEvents: 1, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Test mint message - suite.msgServer.Mint(sdk.WrapSDKContext(ctx), types.NewMsgMint(tc.admin, sdk.NewInt64Coin(tc.mintDenom, 10))) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgMint, tc.expectedMessageEvents) - }) - } -} - -// TestBurnDenomMsg tests TypeMsgBurn message is emitted on a successful burn -func (suite *KeeperTestSuite) TestBurnDenomMsg() { - // Create a denom. - suite.CreateDefaultDenom() - // mint 10 default token for testAcc[0] - suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 10))) //nolint:errcheck - - for _, tc := range []struct { - desc string - amount int64 - burnDenom string - admin string - valid bool - expectedMessageEvents int - }{ - { - desc: "denom does not exist", - burnDenom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/evmos", - admin: suite.TestAccs[0].String(), - valid: false, - }, - { - desc: "success case", - burnDenom: suite.defaultDenom, - admin: suite.TestAccs[0].String(), - valid: true, - expectedMessageEvents: 1, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Test burn message - suite.msgServer.Burn(sdk.WrapSDKContext(ctx), types.NewMsgBurn(tc.admin, sdk.NewInt64Coin(tc.burnDenom, 10))) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgBurn, tc.expectedMessageEvents) - }) - } -} - -// TestCreateDenomMsg tests TypeMsgCreateDenom message is emitted on a successful denom creation -func (suite *KeeperTestSuite) TestCreateDenomMsg() { - defaultDenomCreationFee := types.Params{DenomCreationFee: sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(50000000)))} - for _, tc := range []struct { - desc string - denomCreationFee types.Params - subdenom string - valid bool - expectedMessageEvents int - }{ - { - desc: "subdenom too long", - denomCreationFee: defaultDenomCreationFee, - subdenom: "assadsadsadasdasdsadsadsadsadsadsadsklkadaskkkdasdasedskhanhassyeunganassfnlksdflksafjlkasd", - valid: false, - }, - { - desc: "success case: defaultDenomCreationFee", - denomCreationFee: defaultDenomCreationFee, - subdenom: "evmos", - valid: true, - expectedMessageEvents: 1, - }, - } { - suite.SetupTest() - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - tokenFactoryKeeper := suite.App.TokenFactoryKeeper - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Set denom creation fee in params - if err := tokenFactoryKeeper.SetParams(suite.Ctx, tc.denomCreationFee); err != nil { - suite.Require().NoError(err) - } - // Test create denom message - suite.msgServer.CreateDenom(sdk.WrapSDKContext(ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), tc.subdenom)) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgCreateDenom, tc.expectedMessageEvents) - }) - } -} - -// TestChangeAdminDenomMsg tests TypeMsgChangeAdmin message is emitted on a successful admin change -func (suite *KeeperTestSuite) TestChangeAdminDenomMsg() { - for _, tc := range []struct { - desc string - msgChangeAdmin func(denom string) *types.MsgChangeAdmin - expectedChangeAdminPass bool - expectedAdminIndex int - msgMint func(denom string) *types.MsgMint - expectedMintPass bool - expectedMessageEvents int - }{ - { - desc: "non-admins can't change the existing admin", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[1].String(), denom, suite.TestAccs[2].String()) - }, - expectedChangeAdminPass: false, - expectedAdminIndex: 0, - }, - { - desc: "success change admin", - msgChangeAdmin: func(denom string) *types.MsgChangeAdmin { - return types.NewMsgChangeAdmin(suite.TestAccs[0].String(), denom, suite.TestAccs[1].String()) - }, - expectedAdminIndex: 1, - expectedChangeAdminPass: true, - expectedMessageEvents: 1, - msgMint: func(denom string) *types.MsgMint { - return types.NewMsgMint(suite.TestAccs[1].String(), sdk.NewInt64Coin(denom, 5)) - }, - expectedMintPass: true, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - // setup test - suite.SetupTest() - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Create a denom and mint - res, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().NoError(err) - testDenom := res.GetNewTokenDenom() - suite.msgServer.Mint(sdk.WrapSDKContext(ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(testDenom, 10))) //nolint:errcheck - // Test change admin message - suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(ctx), tc.msgChangeAdmin(testDenom)) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgChangeAdmin, tc.expectedMessageEvents) - }) - } -} - -// TestSetDenomMetaDataMsg tests TypeMsgSetDenomMetadata message is emitted on a successful denom metadata change -func (suite *KeeperTestSuite) TestSetDenomMetaDataMsg() { - // setup test - suite.SetupTest() - suite.CreateDefaultDenom() - - for _, tc := range []struct { - desc string - msgSetDenomMetadata types.MsgSetDenomMetadata - expectedPass bool - expectedMessageEvents int - }{ - { - desc: "successful set denom metadata", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: suite.defaultDenom, - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: suite.defaultDenom, - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: true, - expectedMessageEvents: 1, - }, - { - desc: "non existent factory denom name", - msgSetDenomMetadata: *types.NewMsgSetDenomMetadata(suite.TestAccs[0].String(), banktypes.Metadata{ - Description: "yeehaw", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: fmt.Sprintf("factory/%s/litecoin", suite.TestAccs[0].String()), - Exponent: 0, - }, - { - Denom: "uosmo", - Exponent: 6, - }, - }, - Base: fmt.Sprintf("factory/%s/litecoin", suite.TestAccs[0].String()), - Display: "uosmo", - Name: "OSMO", - Symbol: "OSMO", - }), - expectedPass: false, - }, - } { - suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - tc := tc - ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) - suite.Require().Equal(0, len(ctx.EventManager().Events())) - // Test set denom metadata message - suite.msgServer.SetDenomMetadata(sdk.WrapSDKContext(ctx), &tc.msgSetDenomMetadata) //nolint:errcheck - // Ensure current number and type of event is emitted - suite.AssertEventEmitted(ctx, types.TypeMsgSetDenomMetadata, tc.expectedMessageEvents) - }) - } -} diff --git a/x/tokenfactory/keeper/params.go b/x/tokenfactory/keeper/params.go deleted file mode 100644 index 021b472da..000000000 --- a/x/tokenfactory/keeper/params.go +++ /dev/null @@ -1,31 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -// GetParams returns the total set params. -func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ParamsKey) - if bz == nil { - return p - } - k.cdc.MustUnmarshal(bz, &p) - return p -} - -// SetParams sets the total set of params. -func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { - if err := p.Validate(); err != nil { - return err - } - - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&p) - store.Set(types.ParamsKey, bz) - - return nil -} diff --git a/x/tokenfactory/module.go b/x/tokenfactory/module.go deleted file mode 100644 index 9bf39ad55..000000000 --- a/x/tokenfactory/module.go +++ /dev/null @@ -1,232 +0,0 @@ -/* -The tokenfactory module allows any account to create a new token with -the name `factory/{creator address}/{subdenom}`. - -- Mint and burn user denom to and form any account -- Create a transfer of their denom between any two accounts -- Change the admin. In the future, more admin capabilities may be added. -*/ -package tokenfactory - -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" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/comdex-official/comdex/x/tokenfactory/client/cli" - "github.com/comdex-official/comdex/x/tokenfactory/exported" - "github.com/comdex-official/comdex/x/tokenfactory/keeper" - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ConsensusVersion defines the current x/tokenfactory module consensus version. -const ConsensusVersion = 1 - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct{} - -func NewAppModuleBasic() AppModuleBasic { - return AppModuleBasic{} -} - -// Name returns the x/tokenfactory module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -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 x/tokenfactory 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 x/tokenfactory 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 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) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) //nolint:errcheck -} - -// GetTxCmd returns the x/tokenfactory module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the x/tokenfactory 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 types.AccountKeeper - bankKeeper types.BankKeeper - - legacySubspace exported.Subspace -} - -func NewAppModule( - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, - - // legacySubspace is used solely for migration of x/params managed parameters - legacySubspace exported.Subspace, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - legacySubspace: legacySubspace, - } -} - -// Name returns the x/tokenfactory module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// QuerierRoute returns the x/tokenfactory 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(), am.keeper) -} - -// RegisterInvariants registers the x/tokenfactory module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the x/tokenfactory 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) - - am.keeper.InitGenesis(ctx, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the x/tokenfactory module's exported genesis state as raw -// JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { - return ConsensusVersion -} - -// BeginBlock executes all ABCI BeginBlock logic respective to the tokenfactory module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock executes all ABCI EndBlock logic respective to the tokenfactory module. It -// returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} - -// ___________________________________________________________________________ - -// AppModuleSimulationV2 functions - -// // GenerateGenesisState creates a randomized GenState of the tokenfactory module. -// func (am AppModule) SimulatorGenesisState(simState *module.SimulationState, s *simtypes.SimCtx) { -// tfDefaultGen := types.DefaultGenesis() -// tfDefaultGen.Params.DenomCreationFee = sdk.NewCoins(sdk.NewCoin(appparams.BondDenom, sdk.NewInt(10000000))) -// tfDefaultGenJson := simState.Cdc.MustMarshalJSON(tfDefaultGen) -// simState.GenState[types.ModuleName] = tfDefaultGenJson -// } - -// // WeightedOperations returns the all the lockup module operations with their respective weights. -// func (am AppModule) Actions() []simtypes.Action { -// return []simtypes.Action{ -// simtypes.NewMsgBasedAction("create token factory token", am.keeper, simulation.RandomMsgCreateDenom), -// simtypes.NewMsgBasedAction("mint token factory token", am.keeper, simulation.RandomMsgMintDenom), -// simtypes.NewMsgBasedAction("burn token factory token", am.keeper, simulation.RandomMsgBurnDenom), -// simtypes.NewMsgBasedAction("change admin token factory token", am.keeper, simulation.RandomMsgChangeAdmin), -// } -// } - -// ____________________________________________________________________________ - -// AppModuleSimulation functions -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - tokenfactoryGenesis := types.GenesisState{} - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&tokenfactoryGenesis) -} - -// GenerateGenesisState creates a randomized GenState of the bank module. -func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { - return nil -} - -// RegisterStoreDecoder registers a decoder for supply module's types -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - return operations -} diff --git a/x/tokenfactory/simulation/genesis.go b/x/tokenfactory/simulation/genesis.go deleted file mode 100644 index 2f4f23f91..000000000 --- a/x/tokenfactory/simulation/genesis.go +++ /dev/null @@ -1,26 +0,0 @@ -package simulation - -import ( - "math/rand" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func RandDenomCreationFeeParam(r *rand.Rand) sdk.Coins { - amount := r.Int63n(10_000_000) - return sdk.NewCoins(sdk.NewCoin("ucmdx", sdk.NewInt(amount))) -} - -func RandomizedGenState(simstate *module.SimulationState) { - tfGenesis := types.DefaultGenesis() - - _, err := simstate.Cdc.MarshalJSON(tfGenesis) - if err != nil { - panic(err) - } - - simstate.GenState[types.ModuleName] = simstate.Cdc.MustMarshalJSON(tfGenesis) -} diff --git a/x/tokenfactory/testhelpers/authz.go b/x/tokenfactory/testhelpers/authz.go deleted file mode 100644 index dfa78658e..000000000 --- a/x/tokenfactory/testhelpers/authz.go +++ /dev/null @@ -1,66 +0,0 @@ -package testhelpers - -import ( - "encoding/json" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "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/x/authz" -) - -var ( - Amino = codec.NewLegacyAmino() - AuthzModuleCdc = codec.NewAminoCodec(Amino) -) - -func init() { - cryptocodec.RegisterCrypto(Amino) - codec.RegisterEvidences(Amino) - sdk.RegisterLegacyAminoCodec(Amino) -} - -func TestMessageAuthzSerialization(t *testing.T, msg sdk.Msg) { - someDate := time.Date(1, 1, 1, 1, 1, 1, 1, time.UTC) - const ( - mockGranter string = "cosmos1abc" - mockGrantee string = "cosmos1xyz" - ) - - var ( - mockMsgGrant authz.MsgGrant - mockMsgRevoke authz.MsgRevoke - mockMsgExec authz.MsgExec - ) - - // Authz: Grant Msg - typeURL := sdk.MsgTypeURL(msg) - later := someDate.Add(time.Hour) - grant, err := authz.NewGrant(someDate, authz.NewGenericAuthorization(typeURL), &later) - require.NoError(t, err) - - msgGrant := authz.MsgGrant{Granter: mockGranter, Grantee: mockGrantee, Grant: grant} - msgGrantBytes := json.RawMessage(sdk.MustSortJSON(AuthzModuleCdc.MustMarshalJSON(&msgGrant))) - err = AuthzModuleCdc.UnmarshalJSON(msgGrantBytes, &mockMsgGrant) - require.NoError(t, err) - - // Authz: Revoke Msg - msgRevoke := authz.MsgRevoke{Granter: mockGranter, Grantee: mockGrantee, MsgTypeUrl: typeURL} - msgRevokeByte := json.RawMessage(sdk.MustSortJSON(AuthzModuleCdc.MustMarshalJSON(&msgRevoke))) - err = AuthzModuleCdc.UnmarshalJSON(msgRevokeByte, &mockMsgRevoke) - require.NoError(t, err) - - // Authz: Exec Msg - msgAny, err := cdctypes.NewAnyWithValue(msg) - require.NoError(t, err) - msgExec := authz.MsgExec{Grantee: mockGrantee, Msgs: []*cdctypes.Any{msgAny}} - execMsgByte := json.RawMessage(sdk.MustSortJSON(AuthzModuleCdc.MustMarshalJSON(&msgExec))) - err = AuthzModuleCdc.UnmarshalJSON(execMsgByte, &mockMsgExec) - require.NoError(t, err) - require.Equal(t, msgExec.Msgs[0].Value, mockMsgExec.Msgs[0].Value) -} diff --git a/x/tokenfactory/types/authorityMetadata.go b/x/tokenfactory/types/authorityMetadata.go deleted file mode 100644 index b45bffcab..000000000 --- a/x/tokenfactory/types/authorityMetadata.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (metadata DenomAuthorityMetadata) Validate() error { - if metadata.Admin != "" { - _, err := sdk.AccAddressFromBech32(metadata.Admin) - if err != nil { - return err - } - } - return nil -} diff --git a/x/tokenfactory/types/authorityMetadata.pb.go b/x/tokenfactory/types/authorityMetadata.pb.go deleted file mode 100644 index 650b25427..000000000 --- a/x/tokenfactory/types/authorityMetadata.pb.go +++ /dev/null @@ -1,352 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/tokenfactory/v1beta1/authorityMetadata.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// DenomAuthorityMetadata specifies metadata for addresses that have specific -// capabilities over a token factory denom. Right now there is only one Admin -// permission, but is planned to be extended to the future. -type DenomAuthorityMetadata struct { - // Can be empty for no admin, or a valid osmosis address - Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty" yaml:"admin"` -} - -func (m *DenomAuthorityMetadata) Reset() { *m = DenomAuthorityMetadata{} } -func (m *DenomAuthorityMetadata) String() string { return proto.CompactTextString(m) } -func (*DenomAuthorityMetadata) ProtoMessage() {} -func (*DenomAuthorityMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_99435de88ae175f7, []int{0} -} -func (m *DenomAuthorityMetadata) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DenomAuthorityMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DenomAuthorityMetadata.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 *DenomAuthorityMetadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_DenomAuthorityMetadata.Merge(m, src) -} -func (m *DenomAuthorityMetadata) XXX_Size() int { - return m.Size() -} -func (m *DenomAuthorityMetadata) XXX_DiscardUnknown() { - xxx_messageInfo_DenomAuthorityMetadata.DiscardUnknown(m) -} - -var xxx_messageInfo_DenomAuthorityMetadata proto.InternalMessageInfo - -func (m *DenomAuthorityMetadata) GetAdmin() string { - if m != nil { - return m.Admin - } - return "" -} - -func init() { - proto.RegisterType((*DenomAuthorityMetadata)(nil), "osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata") -} - -func init() { - proto.RegisterFile("osmosis/tokenfactory/v1beta1/authorityMetadata.proto", fileDescriptor_99435de88ae175f7) -} - -var fileDescriptor_99435de88ae175f7 = []byte{ - // 242 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xc9, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0x4b, 0x4b, 0x4c, 0x2e, 0xc9, 0x2f, 0xaa, - 0xd4, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x2c, 0x2d, 0xc9, 0xc8, 0x2f, 0xca, - 0x2c, 0xa9, 0xf4, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x92, 0x81, 0xea, 0xd2, 0x43, 0xd6, 0xa5, 0x07, 0xd5, 0x25, 0x25, 0x92, 0x9e, 0x9f, 0x9e, - 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0xc9, 0x25, 0x83, 0x35, 0xe9, 0x27, 0x25, 0x16, - 0xa7, 0xc2, 0x2d, 0x48, 0xce, 0xcf, 0xcc, 0x83, 0xc8, 0x2b, 0xb9, 0x71, 0x89, 0xb9, 0xa4, 0xe6, - 0xe5, 0xe7, 0x3a, 0xa2, 0xdb, 0x29, 0xa4, 0xc6, 0xc5, 0x9a, 0x98, 0x92, 0x9b, 0x99, 0x27, 0xc1, - 0xa8, 0xc0, 0xa8, 0xc1, 0xe9, 0x24, 0xf0, 0xe9, 0x9e, 0x3c, 0x4f, 0x65, 0x62, 0x6e, 0x8e, 0x95, - 0x12, 0x58, 0x58, 0x29, 0x08, 0x22, 0x6d, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xc0, 0x89, - 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, - 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x99, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, - 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x27, 0xe7, 0xe7, 0xa6, 0xa4, 0x56, 0xe8, 0xe6, 0xa7, 0xa5, 0x65, - 0x26, 0x67, 0x26, 0xe6, 0x40, 0xf9, 0xfa, 0x15, 0xa8, 0xe1, 0x50, 0x52, 0x59, 0x90, 0x5a, 0x9c, - 0xc4, 0x06, 0x76, 0xa0, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xd3, 0xf0, 0xb9, 0x2c, 0x01, - 0x00, 0x00, -} - -func (this *DenomAuthorityMetadata) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*DenomAuthorityMetadata) - if !ok { - that2, ok := that.(DenomAuthorityMetadata) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Admin != that1.Admin { - return false - } - return true -} -func (m *DenomAuthorityMetadata) 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 *DenomAuthorityMetadata) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DenomAuthorityMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Admin) > 0 { - i -= len(m.Admin) - copy(dAtA[i:], m.Admin) - i = encodeVarintAuthorityMetadata(dAtA, i, uint64(len(m.Admin))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintAuthorityMetadata(dAtA []byte, offset int, v uint64) int { - offset -= sovAuthorityMetadata(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *DenomAuthorityMetadata) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Admin) - if l > 0 { - n += 1 + l + sovAuthorityMetadata(uint64(l)) - } - return n -} - -func sovAuthorityMetadata(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAuthorityMetadata(x uint64) (n int) { - return sovAuthorityMetadata(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *DenomAuthorityMetadata) 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 ErrIntOverflowAuthorityMetadata - } - 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: DenomAuthorityMetadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DenomAuthorityMetadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuthorityMetadata - } - 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 ErrInvalidLengthAuthorityMetadata - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuthorityMetadata - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Admin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuthorityMetadata(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuthorityMetadata - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAuthorityMetadata(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, ErrIntOverflowAuthorityMetadata - } - 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, ErrIntOverflowAuthorityMetadata - } - 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, ErrIntOverflowAuthorityMetadata - } - 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, ErrInvalidLengthAuthorityMetadata - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAuthorityMetadata - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAuthorityMetadata - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAuthorityMetadata = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAuthorityMetadata = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAuthorityMetadata = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/tokenfactory/types/capabilities.go b/x/tokenfactory/types/capabilities.go deleted file mode 100644 index bda91c950..000000000 --- a/x/tokenfactory/types/capabilities.go +++ /dev/null @@ -1,21 +0,0 @@ -package types - -const ( - EnableSetMetadata = "enable_metadata" - EnableForceTransfer = "enable_force_transfer" - EnableBurnFrom = "enable_burn_from" -) - -func IsCapabilityEnabled(enabledCapabilities []string, capability string) bool { - if len(enabledCapabilities) == 0 { - return true - } - - for _, v := range enabledCapabilities { - if v == capability { - return true - } - } - - return false -} diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go deleted file mode 100644 index d7fa63bd4..000000000 --- a/x/tokenfactory/types/codec.go +++ /dev/null @@ -1,71 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" -) - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global erc20 module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding. - // - // The actual codec used for serialization should be provided to modules/erc20 and - // defined at the application level. - ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - - // AminoCdc is a amino codec created to support amino JSON compatible msgs. - AminoCdc = codec.NewAminoCodec(amino) -) - -const ( - // Amino names - createTFDenom = "osmosis/tokenfactory/create-denom" - mintTFDenom = "osmosis/tokenfactory/mint" - burnTFDenom = "osmosis/tokenfactory/burn" - forceTransferTFDenom = "osmosis/tokenfactory/force-transfer" - changeAdminTFDenom = "osmosis/tokenfactory/change-admin" - updateTFparams = "osmosis/tokenfactory/msg-update-params" -) - -// NOTE: This is required for the GetSignBytes function -func init() { - RegisterLegacyAminoCodec(amino) - - sdk.RegisterLegacyAminoCodec(amino) - // cryptocodec.RegisterCrypto(amino) - // codec.RegisterEvidences(amino) - - // Register all Amino interfaces and concrete types on the authz Amino codec - // so that this can later be used to properly serialize MsgGrant and MsgExec - // instances. - RegisterLegacyAminoCodec(authzcodec.Amino) - - amino.Seal() -} - -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgCreateDenom{}, - &MsgMint{}, - &MsgBurn{}, - &MsgForceTransfer{}, - &MsgChangeAdmin{}, - &MsgUpdateParams{}, - ) - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgCreateDenom{}, createTFDenom, nil) - cdc.RegisterConcrete(&MsgMint{}, mintTFDenom, nil) - cdc.RegisterConcrete(&MsgBurn{}, burnTFDenom, nil) - cdc.RegisterConcrete(&MsgForceTransfer{}, forceTransferTFDenom, nil) - cdc.RegisterConcrete(&MsgChangeAdmin{}, changeAdminTFDenom, nil) - cdc.RegisterConcrete(&MsgUpdateParams{}, updateTFparams, nil) -} diff --git a/x/tokenfactory/types/codec_test.go b/x/tokenfactory/types/codec_test.go deleted file mode 100644 index 7b826372c..000000000 --- a/x/tokenfactory/types/codec_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type CodecTestSuite struct { - suite.Suite -} - -func TestCodecSuite(t *testing.T) { - suite.Run(t, new(CodecTestSuite)) -} - -func (suite *CodecTestSuite) TestRegisterInterfaces() { - registry := codectypes.NewInterfaceRegistry() - registry.RegisterInterface(sdk.MsgInterfaceProtoName, (*sdk.Msg)(nil)) - RegisterInterfaces(registry) - - impls := registry.ListImplementations(sdk.MsgInterfaceProtoName) - suite.Require().Equal(7, len(impls)) - suite.Require().ElementsMatch([]string{ - "/osmosis.tokenfactory.v1beta1.MsgCreateDenom", - "/osmosis.tokenfactory.v1beta1.MsgMint", - "/osmosis.tokenfactory.v1beta1.MsgBurn", - "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", - "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", - "/osmosis.tokenfactory.v1beta1.MsgForceTransfer", - "/osmosis.tokenfactory.v1beta1.MsgUpdateParams", - }, impls) -} diff --git a/x/tokenfactory/types/denoms.go b/x/tokenfactory/types/denoms.go deleted file mode 100644 index a6fc4e084..000000000 --- a/x/tokenfactory/types/denoms.go +++ /dev/null @@ -1,69 +0,0 @@ -package types - -import ( - "strings" - - errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - ModuleDenomPrefix = "factory" - // See the TokenFactory readme for a derivation of these. - // TL;DR, MaxSubdenomLength + MaxHrpLength = 60 comes from SDK max denom length = 128 - // and the structure of tokenfactory denoms. - MaxSubdenomLength = 44 - MaxHrpLength = 16 - // MaxCreatorLength = 59 + MaxHrpLength - MaxCreatorLength = 59 + MaxHrpLength -) - -// GetTokenDenom constructs a denom string for tokens created by tokenfactory -// based on an input creator address and a subdenom -// The denom constructed is factory/{creator}/{subdenom} -func GetTokenDenom(creator, subdenom string) (string, error) { - if len(subdenom) > MaxSubdenomLength { - return "", ErrSubdenomTooLong - } - if len(creator) > MaxCreatorLength { - return "", ErrCreatorTooLong - } - if strings.Contains(creator, "/") { - return "", ErrInvalidCreator - } - denom := strings.Join([]string{ModuleDenomPrefix, creator, subdenom}, "/") - return denom, sdk.ValidateDenom(denom) -} - -// DeconstructDenom takes a token denom string and verifies that it is a valid -// denom of the tokenfactory module, and is of the form `factory/{creator}/{subdenom}` -// If valid, it returns the creator address and subdenom -func DeconstructDenom(denom string) (creator string, subdenom string, err error) { - err = sdk.ValidateDenom(denom) - if err != nil { - return "", "", err - } - - strParts := strings.Split(denom, "/") - if len(strParts) < 3 { - return "", "", errorsmod.Wrapf(ErrInvalidDenom, "not enough parts of denom %s", denom) - } - - if strParts[0] != ModuleDenomPrefix { - return "", "", errorsmod.Wrapf(ErrInvalidDenom, "denom prefix is incorrect. Is: %s. Should be: %s", strParts[0], ModuleDenomPrefix) - } - - creator = strParts[1] - creatorAddr, err := sdk.AccAddressFromBech32(creator) - if err != nil { - return "", "", errorsmod.Wrapf(ErrInvalidDenom, "Invalid creator address (%s)", err) - } - - // Handle the case where a denom has a slash in its subdenom. For example, - // when we did the split, we'd turn factory/accaddr/atomderivative/sikka into ["factory", "accaddr", "atomderivative", "sikka"] - // So we have to join [2:] with a "/" as the delimiter to get back the correct subdenom which should be "atomderivative/sikka" - subdenom = strings.Join(strParts[2:], "/") - - return creatorAddr.String(), subdenom, nil -} diff --git a/x/tokenfactory/types/denoms_test.go b/x/tokenfactory/types/denoms_test.go deleted file mode 100644 index f021d4214..000000000 --- a/x/tokenfactory/types/denoms_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func TestDeconstructDenom(t *testing.T) { - // Note: this seems to be used in osmosis to add some more checks (only 20 or 32 byte addresses), - // which is good, but not required for these tests as they make code less reuable - // appparams.SetAddressPrefixes() - - for _, tc := range []struct { - desc string - denom string - expectedSubdenom string - err error - }{ - { - desc: "empty is invalid", - denom: "", - err: types.ErrInvalidDenom, - }, - { - desc: "normal", - denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - expectedSubdenom: "bitcoin", - }, - { - desc: "multiple slashes in subdenom", - denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin/1", - expectedSubdenom: "bitcoin/1", - }, - { - desc: "no subdenom", - denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/", - expectedSubdenom: "", - }, - { - desc: "incorrect prefix", - denom: "ibc/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - err: types.ErrInvalidDenom, - }, - { - desc: "subdenom of only slashes", - denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/////", - expectedSubdenom: "////", - }, - { - desc: "too long name", - denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/adsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsf", - err: types.ErrInvalidDenom, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - expectedCreator := "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8" - creator, subdenom, err := types.DeconstructDenom(tc.denom) - if tc.err != nil { - require.ErrorContains(t, err, tc.err.Error()) - } else { - require.NoError(t, err) - require.Equal(t, expectedCreator, creator) - require.Equal(t, tc.expectedSubdenom, subdenom) - } - }) - } -} - -func TestGetTokenDenom(t *testing.T) { - // appparams.SetAddressPrefixes() - for _, tc := range []struct { - desc string - creator string - subdenom string - valid bool - }{ - { - desc: "normal", - creator: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - subdenom: "bitcoin", - valid: true, - }, - { - desc: "multiple slashes in subdenom", - creator: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - subdenom: "bitcoin/1", - valid: true, - }, - { - desc: "no subdenom", - creator: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - subdenom: "", - valid: true, - }, - { - desc: "subdenom of only slashes", - creator: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - subdenom: "/////", - valid: true, - }, - { - desc: "too long name", - creator: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - subdenom: "adsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsf", - valid: false, - }, - { - desc: "subdenom is exactly max length", - creator: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - subdenom: "bitcoinfsadfsdfeadfsafwefsefsefsdfsdafasefsf", - valid: true, - }, - { - desc: "creator is exactly max length", - creator: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8jhgjhgkhjklhkjhkjhgjhgjgjghelu", - subdenom: "bitcoin", - valid: true, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - _, err := types.GetTokenDenom(tc.creator, tc.subdenom) - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/tokenfactory/types/errors.go b/x/tokenfactory/types/errors.go deleted file mode 100644 index 5a3c587d0..000000000 --- a/x/tokenfactory/types/errors.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -// DONTCOVER - -import ( - fmt "fmt" - - errorsmod "cosmossdk.io/errors" -) - -// x/tokenfactory module sentinel errors -var ( - ErrDenomExists = errorsmod.Register(ModuleName, 2, "attempting to create a denom that already exists (has bank metadata)") - ErrUnauthorized = errorsmod.Register(ModuleName, 3, "unauthorized account") - ErrInvalidDenom = errorsmod.Register(ModuleName, 4, "invalid denom") - ErrInvalidCreator = errorsmod.Register(ModuleName, 5, "invalid creator") - ErrInvalidAuthorityMetadata = errorsmod.Register(ModuleName, 6, "invalid authority metadata") - ErrInvalidGenesis = errorsmod.Register(ModuleName, 7, "invalid genesis") - ErrSubdenomTooLong = errorsmod.Register(ModuleName, 8, fmt.Sprintf("subdenom too long, max length is %d bytes", MaxSubdenomLength)) - ErrCreatorTooLong = errorsmod.Register(ModuleName, 9, fmt.Sprintf("creator too long, max length is %d bytes", MaxCreatorLength)) - ErrDenomDoesNotExist = errorsmod.Register(ModuleName, 10, "denom does not exist") - ErrCapabilityNotEnabled = errorsmod.Register(ModuleName, 11, "this capability is not enabled on chain") -) diff --git a/x/tokenfactory/types/events.go b/x/tokenfactory/types/events.go deleted file mode 100644 index 602e06fab..000000000 --- a/x/tokenfactory/types/events.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -// event types -// -//nolint:gosec -const ( - AttributeAmount = "amount" - AttributeCreator = "creator" - AttributeSubdenom = "subdenom" - AttributeNewTokenDenom = "new_token_denom" - AttributeMintToAddress = "mint_to_address" - AttributeBurnFromAddress = "burn_from_address" - AttributeTransferFromAddress = "transfer_from_address" - AttributeTransferToAddress = "transfer_to_address" - AttributeDenom = "denom" - AttributeNewAdmin = "new_admin" - AttributeDenomMetadata = "denom_metadata" -) diff --git a/x/tokenfactory/types/expected_keepers.go b/x/tokenfactory/types/expected_keepers.go deleted file mode 100644 index ff3842327..000000000 --- a/x/tokenfactory/types/expected_keepers.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -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" -) - -type BankKeeper interface { - // Methods imported from bank should be defined here - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) - - HasSupply(ctx sdk.Context, denom string) bool - IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) - - 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 - 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 sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - - BlockedAddr(addr sdk.AccAddress) bool -} - -type AccountKeeper interface { - SetModuleAccount(ctx sdk.Context, macc authtypes.ModuleAccountI) - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI -} - -// CommunityPoolKeeper defines the contract needed to be fulfilled for community pool interactions. -type CommunityPoolKeeper interface { - FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error -} diff --git a/x/tokenfactory/types/genesis.go b/x/tokenfactory/types/genesis.go deleted file mode 100644 index 408dc5f9f..000000000 --- a/x/tokenfactory/types/genesis.go +++ /dev/null @@ -1,52 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// this line is used by starport scaffolding # genesis/types/import - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - FactoryDenoms: []GenesisDenom{}, - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - err := gs.Params.Validate() - if err != nil { - return err - } - - seenDenoms := map[string]bool{} - - for _, denom := range gs.GetFactoryDenoms() { - if seenDenoms[denom.GetDenom()] { - return errorsmod.Wrapf(ErrInvalidGenesis, "duplicate denom: %s", denom.GetDenom()) - } - seenDenoms[denom.GetDenom()] = true - - _, _, err := DeconstructDenom(denom.GetDenom()) - if err != nil { - return err - } - - if denom.AuthorityMetadata.Admin != "" { - _, err = sdk.AccAddressFromBech32(denom.AuthorityMetadata.Admin) - if err != nil { - return errorsmod.Wrapf(ErrInvalidAuthorityMetadata, "Invalid admin address (%s)", err) - } - } - } - - return nil -} diff --git a/x/tokenfactory/types/genesis.pb.go b/x/tokenfactory/types/genesis.pb.go deleted file mode 100644 index b14d37911..000000000 --- a/x/tokenfactory/types/genesis.pb.go +++ /dev/null @@ -1,650 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/tokenfactory/v1beta1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the tokenfactory module's genesis state. -type GenesisState struct { - // params defines the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - FactoryDenoms []GenesisDenom `protobuf:"bytes,2,rep,name=factory_denoms,json=factoryDenoms,proto3" json:"factory_denoms" yaml:"factory_denoms"` -} - -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_5749c3f71850298b, []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 (m *GenesisState) GetFactoryDenoms() []GenesisDenom { - if m != nil { - return m.FactoryDenoms - } - return nil -} - -// GenesisDenom defines a tokenfactory denom that is defined within genesis -// state. The structure contains DenomAuthorityMetadata which defines the -// denom's admin. -type GenesisDenom struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` - AuthorityMetadata DenomAuthorityMetadata `protobuf:"bytes,2,opt,name=authority_metadata,json=authorityMetadata,proto3" json:"authority_metadata" yaml:"authority_metadata"` -} - -func (m *GenesisDenom) Reset() { *m = GenesisDenom{} } -func (m *GenesisDenom) String() string { return proto.CompactTextString(m) } -func (*GenesisDenom) ProtoMessage() {} -func (*GenesisDenom) Descriptor() ([]byte, []int) { - return fileDescriptor_5749c3f71850298b, []int{1} -} -func (m *GenesisDenom) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisDenom.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 *GenesisDenom) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisDenom.Merge(m, src) -} -func (m *GenesisDenom) XXX_Size() int { - return m.Size() -} -func (m *GenesisDenom) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisDenom.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisDenom proto.InternalMessageInfo - -func (m *GenesisDenom) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *GenesisDenom) GetAuthorityMetadata() DenomAuthorityMetadata { - if m != nil { - return m.AuthorityMetadata - } - return DenomAuthorityMetadata{} -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "osmosis.tokenfactory.v1beta1.GenesisState") - proto.RegisterType((*GenesisDenom)(nil), "osmosis.tokenfactory.v1beta1.GenesisDenom") -} - -func init() { - proto.RegisterFile("osmosis/tokenfactory/v1beta1/genesis.proto", fileDescriptor_5749c3f71850298b) -} - -var fileDescriptor_5749c3f71850298b = []byte{ - // 369 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xca, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0x4b, 0x4b, 0x4c, 0x2e, 0xc9, 0x2f, 0xaa, - 0xd4, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, - 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x81, 0xaa, 0xd5, 0x43, 0x56, 0xab, 0x07, 0x55, - 0x2b, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0x99, 0xe0, - 0x35, 0x3f, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0xd2, 0x37, 0xb5, 0x24, 0x31, 0x25, - 0xb1, 0x24, 0x11, 0xaa, 0x4b, 0x13, 0xaf, 0xae, 0x82, 0xc4, 0xa2, 0xc4, 0x5c, 0xa8, 0xa3, 0x94, - 0x8e, 0x30, 0x72, 0xf1, 0xb8, 0x43, 0x9c, 0x19, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xc4, 0xc5, - 0x06, 0x51, 0x20, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xa4, 0xa2, 0x87, 0xcf, 0xd9, 0x7a, 0x01, - 0x60, 0xb5, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x75, 0x0a, 0x15, 0x70, 0xf1, 0x41, - 0xd5, 0xc5, 0xa7, 0xa4, 0xe6, 0xe5, 0xe7, 0x16, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x69, - 0xe1, 0x37, 0x0b, 0xea, 0x0e, 0x17, 0x90, 0x16, 0x27, 0x59, 0x90, 0x89, 0x9f, 0xee, 0xc9, 0x8b, - 0x56, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xa1, 0x9a, 0xa7, 0x14, 0xc4, 0x0b, 0x15, 0x70, 0x81, 0xf0, - 0x8f, 0x22, 0xbc, 0x01, 0x16, 0x11, 0x52, 0xe3, 0x62, 0x05, 0x2b, 0x05, 0xfb, 0x82, 0xd3, 0x49, - 0xe0, 0xd3, 0x3d, 0x79, 0x1e, 0x88, 0x49, 0x60, 0x61, 0xa5, 0x20, 0x88, 0xb4, 0x50, 0x1b, 0x23, - 0x97, 0x10, 0x3c, 0x18, 0xe3, 0x73, 0xa1, 0xe1, 0x28, 0xc1, 0x04, 0xf6, 0xbb, 0x09, 0x7e, 0xf7, - 0x82, 0x6d, 0x72, 0x44, 0x8f, 0x03, 0x27, 0x45, 0xa8, 0xcb, 0x25, 0x21, 0xf6, 0x61, 0x9a, 0xae, - 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0x05, 0x9c, 0x78, 0x24, - 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, - 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x59, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, - 0x72, 0x7e, 0xae, 0x7e, 0x72, 0x7e, 0x6e, 0x4a, 0x6a, 0x85, 0x6e, 0x7e, 0x5a, 0x5a, 0x66, 0x72, - 0x66, 0x62, 0x0e, 0x94, 0xaf, 0x5f, 0x81, 0x1a, 0xdf, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, - 0xe0, 0x78, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xda, 0x1d, 0x4a, 0x3f, 0xaa, 0x02, 0x00, - 0x00, -} - -func (this *GenesisDenom) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GenesisDenom) - if !ok { - that2, ok := that.(GenesisDenom) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Denom != that1.Denom { - return false - } - if !this.AuthorityMetadata.Equal(&that1.AuthorityMetadata) { - return false - } - return true -} -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 - if len(m.FactoryDenoms) > 0 { - for iNdEx := len(m.FactoryDenoms) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FactoryDenoms[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - 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 (m *GenesisDenom) 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 *GenesisDenom) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.AuthorityMetadata.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Denom))) - 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)) - if len(m.FactoryDenoms) > 0 { - for _, e := range m.FactoryDenoms { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func (m *GenesisDenom) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = m.AuthorityMetadata.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 - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FactoryDenoms", 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 - } - m.FactoryDenoms = append(m.FactoryDenoms, GenesisDenom{}) - if err := m.FactoryDenoms[len(m.FactoryDenoms)-1].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 (m *GenesisDenom) 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: GenesisDenom: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisDenom: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", 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.AuthorityMetadata.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/tokenfactory/types/genesis_test.go b/x/tokenfactory/types/genesis_test.go deleted file mode 100644 index 54feac154..000000000 --- a/x/tokenfactory/types/genesis_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -func TestGenesisState_Validate(t *testing.T) { - for _, tc := range []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8", - }, - }, - }, - }, - valid: true, - }, - { - desc: "different admin from creator", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "cosmos1ft6e5esdtdegnvcr3djd3ftk4kwpcr6jta8eyh", - }, - }, - }, - }, - valid: true, - }, - { - desc: "empty admin", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - }, - }, - valid: true, - }, - { - desc: "no admin", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - }, - }, - }, - valid: true, - }, - { - desc: "invalid admin", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "moose", - }, - }, - }, - }, - valid: false, - }, - { - desc: "multiple denoms", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/litecoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - }, - }, - valid: true, - }, - { - desc: "duplicate denoms", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - { - Denom: "factory/cosmos1t7egva48prqmzl59x5ngv4zx0dtrwewcdqdjr8/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - }, - }, - valid: false, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/tokenfactory/types/keys.go b/x/tokenfactory/types/keys.go deleted file mode 100644 index bb52b5dcb..000000000 --- a/x/tokenfactory/types/keys.go +++ /dev/null @@ -1,51 +0,0 @@ -package types - -import ( - "strings" -) - -var ParamsKey = []byte{0x00} - -const ( - // ModuleName defines the module name - ModuleName = "tokenfactory" - - // 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 - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_tokenfactory" -) - -// KeySeparator is used to combine parts of the keys in the store -const KeySeparator = "|" - -var ( - DenomAuthorityMetadataKey = "authoritymetadata" - DenomsPrefixKey = "denoms" - CreatorPrefixKey = "creator" - AdminPrefixKey = "admin" -) - -// GetDenomPrefixStore returns the store prefix where all the data associated with a specific denom -// is stored -func GetDenomPrefixStore(denom string) []byte { - return []byte(strings.Join([]string{DenomsPrefixKey, denom, ""}, KeySeparator)) -} - -// GetCreatorsPrefix returns the store prefix where the list of the denoms created by a specific -// creator are stored -func GetCreatorPrefix(creator string) []byte { - return []byte(strings.Join([]string{CreatorPrefixKey, creator, ""}, KeySeparator)) -} - -// GetCreatorsPrefix returns the store prefix where a list of all creator addresses are stored -func GetCreatorsPrefix() []byte { - return []byte(strings.Join([]string{CreatorPrefixKey, ""}, KeySeparator)) -} diff --git a/x/tokenfactory/types/msgs.go b/x/tokenfactory/types/msgs.go deleted file mode 100644 index 0a1dd5c24..000000000 --- a/x/tokenfactory/types/msgs.go +++ /dev/null @@ -1,300 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -const ( - TypeMsgCreateDenom = "create_denom" - TypeMsgMint = "tf_mint" - TypeMsgBurn = "tf_burn" - TypeMsgForceTransfer = "force_transfer" - TypeMsgChangeAdmin = "change_admin" - TypeMsgSetDenomMetadata = "set_denom_metadata" -) - -var _ sdk.Msg = &MsgCreateDenom{} - -// NewMsgCreateDenom creates a msg to create a new denom -func NewMsgCreateDenom(sender, subdenom string) *MsgCreateDenom { - return &MsgCreateDenom{ - Sender: sender, - Subdenom: subdenom, - } -} - -func (m MsgCreateDenom) Route() string { return RouterKey } -func (m MsgCreateDenom) Type() string { return TypeMsgCreateDenom } -func (m MsgCreateDenom) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - _, err = GetTokenDenom(m.Sender, m.Subdenom) - if err != nil { - return errorsmod.Wrap(ErrInvalidDenom, err.Error()) - } - - return nil -} - -func (m MsgCreateDenom) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgCreateDenom) GetSigners() []sdk.AccAddress { - sender, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{sender} -} - -var _ sdk.Msg = &MsgMint{} - -// NewMsgMint creates a message to mint tokens -func NewMsgMint(sender string, amount sdk.Coin) *MsgMint { - return &MsgMint{ - Sender: sender, - Amount: amount, - } -} - -func NewMsgMintTo(sender string, amount sdk.Coin, mintToAddress string) *MsgMint { - return &MsgMint{ - Sender: sender, - Amount: amount, - MintToAddress: mintToAddress, - } -} - -func (m MsgMint) Route() string { return RouterKey } -func (m MsgMint) Type() string { return TypeMsgMint } -func (m MsgMint) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - if m.MintToAddress != "" { - _, err = sdk.AccAddressFromBech32(m.MintToAddress) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid mint to address (%s)", err) - } - } - - if !m.Amount.IsValid() || m.Amount.Amount.Equal(sdk.ZeroInt()) { - return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) - } - - return nil -} - -func (m MsgMint) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgMint) GetSigners() []sdk.AccAddress { - sender, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{sender} -} - -var _ sdk.Msg = &MsgBurn{} - -// NewMsgBurn creates a message to burn tokens -func NewMsgBurn(sender string, amount sdk.Coin) *MsgBurn { - return &MsgBurn{ - Sender: sender, - Amount: amount, - } -} - -// NewMsgBurn creates a message to burn tokens -func NewMsgBurnFrom(sender string, amount sdk.Coin, burnFromAddress string) *MsgBurn { - return &MsgBurn{ - Sender: sender, - Amount: amount, - BurnFromAddress: burnFromAddress, - } -} - -func (m MsgBurn) Route() string { return RouterKey } -func (m MsgBurn) Type() string { return TypeMsgBurn } -func (m MsgBurn) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - if !m.Amount.IsValid() || m.Amount.Amount.Equal(sdk.ZeroInt()) { - return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) - } - - if m.BurnFromAddress != "" { - _, err = sdk.AccAddressFromBech32(m.BurnFromAddress) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid burn from address (%s)", err) - } - } - - return nil -} - -func (m MsgBurn) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgBurn) GetSigners() []sdk.AccAddress { - sender, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{sender} -} - -var _ sdk.Msg = &MsgForceTransfer{} - -// NewMsgForceTransfer creates a transfer funds from one account to another -func NewMsgForceTransfer(sender string, amount sdk.Coin, fromAddr, toAddr string) *MsgForceTransfer { - return &MsgForceTransfer{ - Sender: sender, - Amount: amount, - TransferFromAddress: fromAddr, - TransferToAddress: toAddr, - } -} - -func (m MsgForceTransfer) Route() string { return RouterKey } -func (m MsgForceTransfer) Type() string { return TypeMsgForceTransfer } -func (m MsgForceTransfer) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - _, err = sdk.AccAddressFromBech32(m.TransferFromAddress) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid from address (%s)", err) - } - _, err = sdk.AccAddressFromBech32(m.TransferToAddress) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid to address (%s)", err) - } - - if !m.Amount.IsValid() { - return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) - } - - return nil -} - -func (m MsgForceTransfer) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgForceTransfer) GetSigners() []sdk.AccAddress { - sender, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{sender} -} - -var _ sdk.Msg = &MsgChangeAdmin{} - -// NewMsgChangeAdmin creates a message to burn tokens -func NewMsgChangeAdmin(sender, denom, newAdmin string) *MsgChangeAdmin { - return &MsgChangeAdmin{ - Sender: sender, - Denom: denom, - NewAdmin: newAdmin, - } -} - -func (m MsgChangeAdmin) Route() string { return RouterKey } -func (m MsgChangeAdmin) Type() string { return TypeMsgChangeAdmin } -func (m MsgChangeAdmin) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - _, err = sdk.AccAddressFromBech32(m.NewAdmin) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) - } - - _, _, err = DeconstructDenom(m.Denom) - if err != nil { - return err - } - - return nil -} - -func (m MsgChangeAdmin) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgChangeAdmin) GetSigners() []sdk.AccAddress { - sender, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{sender} -} - -var _ sdk.Msg = &MsgSetDenomMetadata{} - -// NewMsgChangeAdmin creates a message to burn tokens -func NewMsgSetDenomMetadata(sender string, metadata banktypes.Metadata) *MsgSetDenomMetadata { - return &MsgSetDenomMetadata{ - Sender: sender, - Metadata: metadata, - } -} - -func (m MsgSetDenomMetadata) Route() string { return RouterKey } -func (m MsgSetDenomMetadata) Type() string { return TypeMsgSetDenomMetadata } -func (m MsgSetDenomMetadata) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - err = m.Metadata.Validate() - if err != nil { - return err - } - - _, _, err = DeconstructDenom(m.Metadata.Base) - if err != nil { - return err - } - - return nil -} - -func (m MsgSetDenomMetadata) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgSetDenomMetadata) GetSigners() []sdk.AccAddress { - sender, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{sender} -} - -var _ sdk.Msg = &MsgUpdateParams{} - -// GetSignBytes implements the LegacyMsg interface. -func (m MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -// GetSigners returns the expected signers for a MsgUpdateParams message. -func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(m.Authority) - return []sdk.AccAddress{addr} -} - -// ValidateBasic does a sanity check on the provided data. -func (m *MsgUpdateParams) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return errorsmod.Wrap(err, "invalid authority address") - } - - return m.Params.Validate() -} diff --git a/x/tokenfactory/types/msgs_test.go b/x/tokenfactory/types/msgs_test.go deleted file mode 100644 index 11d465856..000000000 --- a/x/tokenfactory/types/msgs_test.go +++ /dev/null @@ -1,452 +0,0 @@ -package types_test - -import ( - fmt "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cometbft/cometbft/crypto/ed25519" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/comdex-official/comdex/x/tokenfactory/testhelpers" - "github.com/comdex-official/comdex/x/tokenfactory/types" -) - -// Test authz serialize and de-serializes for tokenfactory msg. -func TestAuthzMsg(t *testing.T) { - t.Skip("TODO: figure out how to register authz interfaces for tests") - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()).String() - coin := sdk.NewCoin("denom", sdk.NewInt(1)) - - testCases := []struct { - name string - msg sdk.Msg - }{ - { - name: "MsgCreateDenom", - msg: &types.MsgCreateDenom{ - Sender: addr1, - Subdenom: "valoper1xyz", - }, - }, - { - name: "MsgBurn", - msg: &types.MsgBurn{ - Sender: addr1, - Amount: coin, - }, - }, - { - name: "MsgMint", - msg: &types.MsgMint{ - Sender: addr1, - Amount: coin, - }, - }, - { - name: "MsgChangeAdmin", - msg: &types.MsgChangeAdmin{ - Sender: addr1, - Denom: "denom", - NewAdmin: "osmo1q8tq5qhrhw6t970egemuuwywhlhpnmdmts6xnu", - }, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - testhelpers.TestMessageAuthzSerialization(t, tc.msg) - }) - } -} - -// TestMsgCreateDenom tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgCreateDenom(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - - // make a proper createDenom message - createMsg := func(after func(msg types.MsgCreateDenom) types.MsgCreateDenom) types.MsgCreateDenom { - properMsg := *types.NewMsgCreateDenom( - addr1.String(), - "bitcoin", - ) - - return after(properMsg) - } - - // validate createDenom message was created as intended - msg := createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { - return msg - }) - require.Equal(t, msg.Route(), types.RouterKey) - require.Equal(t, msg.Type(), "create_denom") - signers := msg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg types.MsgCreateDenom - expectPass bool - }{ - { - name: "proper msg", - msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { - return msg - }), - expectPass: true, - }, - { - name: "empty sender", - msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { - msg.Sender = "" - return msg - }), - expectPass: false, - }, - { - name: "invalid subdenom", - msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { - msg.Subdenom = "thissubdenomismuchtoolongasdkfjaasdfdsafsdlkfnmlksadmflksmdlfmlsakmfdsafasdfasdf" - return msg - }), - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg.ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg.ValidateBasic(), "test: %v", test.name) - } - } -} - -// TestMsgMint tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgMint(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - - // make a proper mint message - createMsg := func(after func(msg types.MsgMint) types.MsgMint) types.MsgMint { - properMsg := *types.NewMsgMint( - addr1.String(), - sdk.NewCoin("bitcoin", sdk.NewInt(500000000)), - ) - - return after(properMsg) - } - - // validate mint message was created as intended - msg := createMsg(func(msg types.MsgMint) types.MsgMint { - return msg - }) - require.Equal(t, msg.Route(), types.RouterKey) - require.Equal(t, msg.Type(), "tf_mint") - signers := msg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg types.MsgMint - expectPass bool - }{ - { - name: "proper msg", - msg: createMsg(func(msg types.MsgMint) types.MsgMint { - return msg - }), - expectPass: true, - }, - { - name: "empty sender", - msg: createMsg(func(msg types.MsgMint) types.MsgMint { - msg.Sender = "" - return msg - }), - expectPass: false, - }, - { - name: "zero amount", - msg: createMsg(func(msg types.MsgMint) types.MsgMint { - msg.Amount = sdk.NewCoin("bitcoin", sdk.ZeroInt()) - return msg - }), - expectPass: false, - }, - { - name: "negative amount", - msg: createMsg(func(msg types.MsgMint) types.MsgMint { - msg.Amount.Amount = sdk.NewInt(-10000000) - return msg - }), - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg.ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg.ValidateBasic(), "test: %v", test.name) - } - } -} - -// TestMsgBurn tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgBurn(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - - // make a proper burn message - baseMsg := types.NewMsgBurn( - addr1.String(), - sdk.NewCoin("bitcoin", sdk.NewInt(500000000)), - ) - - // validate burn message was created as intended - require.Equal(t, baseMsg.Route(), types.RouterKey) - require.Equal(t, baseMsg.Type(), "tf_burn") - signers := baseMsg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg func() *types.MsgBurn - expectPass bool - }{ - { - name: "proper msg", - msg: func() *types.MsgBurn { - msg := baseMsg - return msg - }, - expectPass: true, - }, - { - name: "empty sender", - msg: func() *types.MsgBurn { - msg := baseMsg - msg.Sender = "" - return msg - }, - expectPass: false, - }, - { - name: "zero amount", - msg: func() *types.MsgBurn { - msg := baseMsg - msg.Amount.Amount = sdk.ZeroInt() - return msg - }, - expectPass: false, - }, - { - name: "negative amount", - msg: func() *types.MsgBurn { - msg := baseMsg - msg.Amount.Amount = sdk.NewInt(-10000000) - return msg - }, - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) - } - } -} - -// TestMsgChangeAdmin tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgChangeAdmin(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - pk2 := ed25519.GenPrivKey().PubKey() - addr2 := sdk.AccAddress(pk2.Address()) - tokenFactoryDenom := fmt.Sprintf("factory/%s/bitcoin", addr1.String()) - - // make a proper changeAdmin message - baseMsg := types.NewMsgChangeAdmin( - addr1.String(), - tokenFactoryDenom, - addr2.String(), - ) - - // validate changeAdmin message was created as intended - require.Equal(t, baseMsg.Route(), types.RouterKey) - require.Equal(t, baseMsg.Type(), "change_admin") - signers := baseMsg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg func() *types.MsgChangeAdmin - expectPass bool - }{ - { - name: "proper msg", - msg: func() *types.MsgChangeAdmin { - msg := baseMsg - return msg - }, - expectPass: true, - }, - { - name: "empty sender", - msg: func() *types.MsgChangeAdmin { - msg := baseMsg - msg.Sender = "" - return msg - }, - expectPass: false, - }, - { - name: "empty newAdmin", - msg: func() *types.MsgChangeAdmin { - msg := baseMsg - msg.NewAdmin = "" - return msg - }, - expectPass: false, - }, - { - name: "invalid denom", - msg: func() *types.MsgChangeAdmin { - msg := baseMsg - msg.Denom = "bitcoin" - return msg - }, - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) - } - } -} - -// TestMsgSetDenomMetadata tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgSetDenomMetadata(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - tokenFactoryDenom := fmt.Sprintf("factory/%s/bitcoin", addr1.String()) - denomMetadata := banktypes.Metadata{ - Description: "nakamoto", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: tokenFactoryDenom, - Exponent: 0, - }, - { - Denom: "sats", - Exponent: 6, - }, - }, - Display: "sats", - Base: tokenFactoryDenom, - Name: "bitcoin", - Symbol: "BTC", - } - invalidDenomMetadata := banktypes.Metadata{ - Description: "nakamoto", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: "bitcoin", - Exponent: 0, - }, - { - Denom: "sats", - Exponent: 6, - }, - }, - Display: "sats", - Base: "bitcoin", - Name: "bitcoin", - Symbol: "BTC", - } - - // make a proper setDenomMetadata message - baseMsg := types.NewMsgSetDenomMetadata( - addr1.String(), - denomMetadata, - ) - - // validate setDenomMetadata message was created as intended - require.Equal(t, baseMsg.Route(), types.RouterKey) - require.Equal(t, baseMsg.Type(), "set_denom_metadata") - signers := baseMsg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg func() *types.MsgSetDenomMetadata - expectPass bool - }{ - { - name: "proper msg", - msg: func() *types.MsgSetDenomMetadata { - msg := baseMsg - return msg - }, - expectPass: true, - }, - { - name: "empty sender", - msg: func() *types.MsgSetDenomMetadata { - msg := baseMsg - msg.Sender = "" - return msg - }, - expectPass: false, - }, - { - name: "invalid metadata", - msg: func() *types.MsgSetDenomMetadata { - msg := baseMsg - msg.Metadata.Name = "" - return msg - }, - - expectPass: false, - }, - { - name: "invalid base", - msg: func() *types.MsgSetDenomMetadata { - msg := baseMsg - msg.Metadata = invalidDenomMetadata - return msg - }, - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) - } - } -} diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go deleted file mode 100644 index 5942c07ec..000000000 --- a/x/tokenfactory/types/params.go +++ /dev/null @@ -1,50 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func NewParams(denomCreationFee sdk.Coins) Params { - return Params{ - DenomCreationFee: denomCreationFee, - } -} - -// default tokenfactory module parameters. -func DefaultParams() Params { - return Params{ - DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 10_000_000)), - DenomCreationGasConsume: 2_000_000, - } -} - -// validate params. -func (p Params) Validate() error { - err := validateDenomCreationFee(p.DenomCreationFee) - - return err -} - -func validateDenomCreationFee(i interface{}) error { - v, ok := i.(sdk.Coins) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v.Validate() != nil { - return fmt.Errorf("invalid denom creation fee: %+v", i) - } - - return nil -} - -func validateDenomCreationFeeGasConsume(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go deleted file mode 100644 index d06024ac0..000000000 --- a/x/tokenfactory/types/params.pb.go +++ /dev/null @@ -1,383 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/tokenfactory/v1beta1/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the tokenfactory module. -type Params struct { - DenomCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=denom_creation_fee,json=denomCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"denom_creation_fee" yaml:"denom_creation_fee"` - // if denom_creation_fee is an empty array, then this field is used to add more gas consumption - // to the base cost. - // https://github.com/CosmWasm/token-factory/issues/11 - DenomCreationGasConsume uint64 `protobuf:"varint,2,opt,name=denom_creation_gas_consume,json=denomCreationGasConsume,proto3" json:"denom_creation_gas_consume,omitempty" yaml:"denom_creation_gas_consume"` -} - -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_cc8299d306f3ff47, []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 (m *Params) GetDenomCreationFee() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.DenomCreationFee - } - return nil -} - -func (m *Params) GetDenomCreationGasConsume() uint64 { - if m != nil { - return m.DenomCreationGasConsume - } - return 0 -} - -func init() { - proto.RegisterType((*Params)(nil), "osmosis.tokenfactory.v1beta1.Params") -} - -func init() { - proto.RegisterFile("osmosis/tokenfactory/v1beta1/params.proto", fileDescriptor_cc8299d306f3ff47) -} - -var fileDescriptor_cc8299d306f3ff47 = []byte{ - // 354 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xc1, 0x4e, 0xf2, 0x40, - 0x14, 0x85, 0x5b, 0xfe, 0x3f, 0x2c, 0xea, 0xc6, 0x34, 0x26, 0x02, 0x31, 0x2d, 0x76, 0x05, 0x0b, - 0xda, 0xa0, 0xc6, 0x85, 0x4b, 0x48, 0x74, 0x45, 0x42, 0x58, 0xba, 0x69, 0x6e, 0xdb, 0x69, 0x99, - 0xc0, 0xf4, 0x92, 0xce, 0x60, 0xe8, 0x23, 0xb8, 0x73, 0xe5, 0x43, 0xf8, 0x24, 0x2c, 0x59, 0xba, - 0xaa, 0x06, 0xde, 0x80, 0x27, 0x30, 0x4c, 0x47, 0x03, 0x6a, 0x5c, 0xb5, 0x37, 0xe7, 0x9c, 0x6f, - 0xce, 0x9d, 0x31, 0xda, 0xc8, 0x19, 0x72, 0xca, 0x3d, 0x81, 0x13, 0x92, 0xc6, 0x10, 0x0a, 0xcc, - 0x72, 0xef, 0xa1, 0x1b, 0x10, 0x01, 0x5d, 0x6f, 0x06, 0x19, 0x30, 0xee, 0xce, 0x32, 0x14, 0x68, - 0x9e, 0x29, 0xab, 0xbb, 0x6f, 0x75, 0x95, 0xb5, 0x71, 0x92, 0x60, 0x82, 0xd2, 0xe8, 0xed, 0xfe, - 0xca, 0x4c, 0xe3, 0xea, 0x4f, 0x3c, 0xcc, 0xc5, 0x18, 0x33, 0x2a, 0xf2, 0x01, 0x11, 0x10, 0x81, - 0x00, 0x95, 0xaa, 0x87, 0x32, 0xe6, 0x97, 0xb8, 0x72, 0x50, 0x92, 0x55, 0x4e, 0x5e, 0x00, 0x9c, - 0x7c, 0x71, 0x42, 0xa4, 0x69, 0xa9, 0x3b, 0x8f, 0x15, 0xa3, 0x3a, 0x94, 0xad, 0xcd, 0x67, 0xdd, - 0x30, 0x23, 0x92, 0x22, 0xf3, 0xc3, 0x8c, 0x80, 0xa0, 0x98, 0xfa, 0x31, 0x21, 0x35, 0xbd, 0xf9, - 0xaf, 0x75, 0x74, 0x51, 0x77, 0x15, 0x76, 0x07, 0xfa, 0x5c, 0xc2, 0xed, 0x23, 0x4d, 0x7b, 0x83, - 0x65, 0x61, 0x6b, 0xdb, 0xc2, 0xae, 0xe7, 0xc0, 0xa6, 0x37, 0xce, 0x4f, 0x84, 0xf3, 0xf2, 0x66, - 0xb7, 0x12, 0x2a, 0xc6, 0xf3, 0xc0, 0x0d, 0x91, 0xa9, 0x82, 0xea, 0xd3, 0xe1, 0xd1, 0xc4, 0x13, - 0xf9, 0x8c, 0x70, 0x49, 0xe3, 0xa3, 0x63, 0x09, 0xe8, 0xab, 0xfc, 0x2d, 0x21, 0x66, 0x6c, 0x34, - 0xbe, 0x41, 0x13, 0xe0, 0x7e, 0x88, 0x29, 0x9f, 0x33, 0x52, 0xab, 0x34, 0xf5, 0xd6, 0xff, 0x5e, - 0x7b, 0x59, 0xd8, 0xfa, 0xb6, 0xb0, 0xcf, 0x7f, 0x2d, 0xb1, 0xe7, 0x77, 0x46, 0xa7, 0x07, 0x07, - 0xdc, 0x01, 0xef, 0x97, 0x4a, 0x6f, 0xb8, 0x5c, 0x5b, 0xfa, 0x6a, 0x6d, 0xe9, 0xef, 0x6b, 0x4b, - 0x7f, 0xda, 0x58, 0xda, 0x6a, 0x63, 0x69, 0xaf, 0x1b, 0x4b, 0xbb, 0xbf, 0x3e, 0x68, 0xcf, 0x22, - 0xb2, 0xe8, 0x60, 0x1c, 0xd3, 0x90, 0xc2, 0x54, 0xcd, 0xde, 0xe2, 0xf0, 0xc9, 0xe4, 0x46, 0x41, - 0x55, 0x5e, 0xf2, 0xe5, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x12, 0x58, 0xd9, 0x36, 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.DenomCreationGasConsume != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.DenomCreationGasConsume)) - i-- - dAtA[i] = 0x10 - } - if len(m.DenomCreationFee) > 0 { - for iNdEx := len(m.DenomCreationFee) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DenomCreationFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - 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 - if len(m.DenomCreationFee) > 0 { - for _, e := range m.DenomCreationFee { - l = e.Size() - n += 1 + l + sovParams(uint64(l)) - } - } - if m.DenomCreationGasConsume != 0 { - n += 1 + sovParams(uint64(m.DenomCreationGasConsume)) - } - 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 { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomCreationFee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DenomCreationFee = append(m.DenomCreationFee, types.Coin{}) - if err := m.DenomCreationFee[len(m.DenomCreationFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomCreationGasConsume", wireType) - } - m.DenomCreationGasConsume = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DenomCreationGasConsume |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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/tokenfactory/types/params_legacy.go b/x/tokenfactory/types/params_legacy.go deleted file mode 100644 index 43c1f6f9a..000000000 --- a/x/tokenfactory/types/params_legacy.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -NOTE: Usage of x/params to manage parameters is deprecated in favor of x/gov -controlled execution of MsgUpdateParams messages. These types remains solely -for migration purposes and will be removed in a future release. -*/ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -// Parameter legacy store keys. -var ( - KeyDenomCreationFee = []byte("DenomCreationFee") - KeyDenomCreationGasConsume = []byte("DenomCreationGasConsume") -) - -// ParamTable for tokenfactory module. -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// Implements params.ParamSet. -// Deprecated: legacy code. Remove after v47 upgrade. -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyDenomCreationFee, &p.DenomCreationFee, validateDenomCreationFee), - paramtypes.NewParamSetPair(KeyDenomCreationGasConsume, &p.DenomCreationGasConsume, validateDenomCreationFeeGasConsume), - } -} diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go deleted file mode 100644 index 98ec51327..000000000 --- a/x/tokenfactory/types/query.pb.go +++ /dev/null @@ -1,1333 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/tokenfactory/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 the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params defines the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// QueryDenomAuthorityMetadataRequest defines the request structure for the -// DenomAuthorityMetadata gRPC query. -type QueryDenomAuthorityMetadataRequest struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` -} - -func (m *QueryDenomAuthorityMetadataRequest) Reset() { *m = QueryDenomAuthorityMetadataRequest{} } -func (m *QueryDenomAuthorityMetadataRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDenomAuthorityMetadataRequest) ProtoMessage() {} -func (*QueryDenomAuthorityMetadataRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{2} -} -func (m *QueryDenomAuthorityMetadataRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDenomAuthorityMetadataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDenomAuthorityMetadataRequest.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 *QueryDenomAuthorityMetadataRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDenomAuthorityMetadataRequest.Merge(m, src) -} -func (m *QueryDenomAuthorityMetadataRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDenomAuthorityMetadataRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDenomAuthorityMetadataRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDenomAuthorityMetadataRequest proto.InternalMessageInfo - -func (m *QueryDenomAuthorityMetadataRequest) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// QueryDenomAuthorityMetadataResponse defines the response structure for the -// DenomAuthorityMetadata gRPC query. -type QueryDenomAuthorityMetadataResponse struct { - AuthorityMetadata DenomAuthorityMetadata `protobuf:"bytes,1,opt,name=authority_metadata,json=authorityMetadata,proto3" json:"authority_metadata" yaml:"authority_metadata"` -} - -func (m *QueryDenomAuthorityMetadataResponse) Reset() { *m = QueryDenomAuthorityMetadataResponse{} } -func (m *QueryDenomAuthorityMetadataResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDenomAuthorityMetadataResponse) ProtoMessage() {} -func (*QueryDenomAuthorityMetadataResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{3} -} -func (m *QueryDenomAuthorityMetadataResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDenomAuthorityMetadataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDenomAuthorityMetadataResponse.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 *QueryDenomAuthorityMetadataResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDenomAuthorityMetadataResponse.Merge(m, src) -} -func (m *QueryDenomAuthorityMetadataResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDenomAuthorityMetadataResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDenomAuthorityMetadataResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDenomAuthorityMetadataResponse proto.InternalMessageInfo - -func (m *QueryDenomAuthorityMetadataResponse) GetAuthorityMetadata() DenomAuthorityMetadata { - if m != nil { - return m.AuthorityMetadata - } - return DenomAuthorityMetadata{} -} - -// QueryDenomsFromCreatorRequest defines the request structure for the -// DenomsFromCreator gRPC query. -type QueryDenomsFromCreatorRequest struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` -} - -func (m *QueryDenomsFromCreatorRequest) Reset() { *m = QueryDenomsFromCreatorRequest{} } -func (m *QueryDenomsFromCreatorRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDenomsFromCreatorRequest) ProtoMessage() {} -func (*QueryDenomsFromCreatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{4} -} -func (m *QueryDenomsFromCreatorRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDenomsFromCreatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDenomsFromCreatorRequest.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 *QueryDenomsFromCreatorRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDenomsFromCreatorRequest.Merge(m, src) -} -func (m *QueryDenomsFromCreatorRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDenomsFromCreatorRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDenomsFromCreatorRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDenomsFromCreatorRequest proto.InternalMessageInfo - -func (m *QueryDenomsFromCreatorRequest) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -// QueryDenomsFromCreatorRequest defines the response structure for the -// DenomsFromCreator gRPC query. -type QueryDenomsFromCreatorResponse struct { - Denoms []string `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms,omitempty" yaml:"denoms"` -} - -func (m *QueryDenomsFromCreatorResponse) Reset() { *m = QueryDenomsFromCreatorResponse{} } -func (m *QueryDenomsFromCreatorResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDenomsFromCreatorResponse) ProtoMessage() {} -func (*QueryDenomsFromCreatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{5} -} -func (m *QueryDenomsFromCreatorResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDenomsFromCreatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDenomsFromCreatorResponse.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 *QueryDenomsFromCreatorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDenomsFromCreatorResponse.Merge(m, src) -} -func (m *QueryDenomsFromCreatorResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDenomsFromCreatorResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDenomsFromCreatorResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDenomsFromCreatorResponse proto.InternalMessageInfo - -func (m *QueryDenomsFromCreatorResponse) GetDenoms() []string { - if m != nil { - return m.Denoms - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsResponse") - proto.RegisterType((*QueryDenomAuthorityMetadataRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest") - proto.RegisterType((*QueryDenomAuthorityMetadataResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse") - proto.RegisterType((*QueryDenomsFromCreatorRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest") - proto.RegisterType((*QueryDenomsFromCreatorResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse") -} - -func init() { - proto.RegisterFile("osmosis/tokenfactory/v1beta1/query.proto", fileDescriptor_6f22013ad0f72e3f) -} - -var fileDescriptor_6f22013ad0f72e3f = []byte{ - // 577 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0xa1, 0x0d, 0xea, 0xf2, 0x21, 0xb2, 0x54, 0x08, 0xa2, 0xe2, 0xc0, 0x52, 0x55, 0x29, - 0x2a, 0x5e, 0x52, 0x2a, 0x0e, 0x14, 0x04, 0x71, 0x11, 0x1c, 0xa0, 0x52, 0xf1, 0x0d, 0x2e, 0xd1, - 0xc6, 0xd9, 0xb8, 0x16, 0xb1, 0xc7, 0xf5, 0x6e, 0x50, 0xa3, 0xaa, 0x17, 0x0e, 0x9c, 0x91, 0x38, - 0xf2, 0x1f, 0xf8, 0x1d, 0x3d, 0x56, 0xea, 0x85, 0x53, 0x84, 0x92, 0x8a, 0x1f, 0x90, 0x5f, 0x80, - 0xb2, 0xbb, 0x2d, 0x2d, 0x09, 0x56, 0x80, 0x53, 0x36, 0xbb, 0xef, 0xbd, 0x79, 0x6f, 0x66, 0x64, - 0x54, 0x06, 0x11, 0x81, 0x08, 0x05, 0x95, 0xf0, 0x8e, 0xc7, 0x4d, 0xe6, 0x4b, 0x48, 0x3b, 0xf4, - 0x7d, 0xa5, 0xce, 0x25, 0xab, 0xd0, 0xad, 0x36, 0x4f, 0x3b, 0x4e, 0x92, 0x82, 0x04, 0x3c, 0x67, - 0x90, 0xce, 0x49, 0xa4, 0x63, 0x90, 0xc5, 0xd9, 0x00, 0x02, 0x50, 0x40, 0x3a, 0x3c, 0x69, 0x4e, - 0x71, 0x2e, 0x00, 0x08, 0x5a, 0x9c, 0xb2, 0x24, 0xa4, 0x2c, 0x8e, 0x41, 0x32, 0x19, 0x42, 0x2c, - 0xcc, 0xeb, 0x1d, 0x5f, 0x49, 0xd2, 0x3a, 0x13, 0x5c, 0x97, 0x3a, 0x2e, 0x9c, 0xb0, 0x20, 0x8c, - 0x15, 0xd8, 0x60, 0x57, 0x32, 0x7d, 0xb2, 0xb6, 0xdc, 0x84, 0x34, 0x94, 0x9d, 0x75, 0x2e, 0x59, - 0x83, 0x49, 0x66, 0x58, 0x8b, 0x99, 0xac, 0x84, 0xa5, 0x2c, 0x32, 0x66, 0xc8, 0x2c, 0xc2, 0xaf, - 0x87, 0x16, 0x36, 0xd4, 0xa5, 0xc7, 0xb7, 0xda, 0x5c, 0x48, 0xf2, 0x06, 0x5d, 0x39, 0x75, 0x2b, - 0x12, 0x88, 0x05, 0xc7, 0x2e, 0xca, 0x6b, 0xf2, 0x35, 0xeb, 0xa6, 0x55, 0x3e, 0xbf, 0x3c, 0xef, - 0x64, 0x35, 0xc7, 0xd1, 0x6c, 0x77, 0x6a, 0xaf, 0x5b, 0xca, 0x79, 0x86, 0x49, 0x5e, 0x21, 0xa2, - 0xa4, 0x9f, 0xf1, 0x18, 0xa2, 0xea, 0xef, 0x01, 0x8c, 0x01, 0xbc, 0x80, 0xa6, 0x1b, 0x43, 0x80, - 0x2a, 0x34, 0xe3, 0x5e, 0x1e, 0x74, 0x4b, 0x17, 0x3a, 0x2c, 0x6a, 0x3d, 0x24, 0xea, 0x9a, 0x78, - 0xfa, 0x99, 0x7c, 0xb5, 0xd0, 0xed, 0x4c, 0x39, 0xe3, 0xfc, 0xa3, 0x85, 0xf0, 0x71, 0xb7, 0x6a, - 0x91, 0x79, 0x36, 0x31, 0x56, 0xb2, 0x63, 0x8c, 0x97, 0x76, 0x6f, 0x0d, 0x63, 0x0d, 0xba, 0xa5, - 0xeb, 0xda, 0xd7, 0xa8, 0x3a, 0xf1, 0x0a, 0x23, 0x03, 0x22, 0xeb, 0xe8, 0xc6, 0x2f, 0xbf, 0xe2, - 0x79, 0x0a, 0xd1, 0x5a, 0xca, 0x99, 0x84, 0xf4, 0x28, 0xf9, 0x12, 0x3a, 0xe7, 0xeb, 0x1b, 0x93, - 0x1d, 0x0f, 0xba, 0xa5, 0x4b, 0xba, 0x86, 0x79, 0x20, 0xde, 0x11, 0x84, 0xbc, 0x44, 0xf6, 0x9f, - 0xe4, 0x4c, 0xf2, 0x45, 0x94, 0x57, 0xad, 0x1a, 0xce, 0xec, 0x6c, 0x79, 0xc6, 0x2d, 0x0c, 0xba, - 0xa5, 0x8b, 0x27, 0x5a, 0x29, 0x88, 0x67, 0x00, 0xcb, 0x87, 0x53, 0x68, 0x5a, 0xa9, 0xe1, 0x2f, - 0x16, 0xca, 0xeb, 0xe9, 0xe1, 0x7b, 0xd9, 0xcd, 0x19, 0x5d, 0x9e, 0x62, 0xe5, 0x2f, 0x18, 0xda, - 0x24, 0x59, 0xfa, 0x70, 0x70, 0xf8, 0xf9, 0xcc, 0x02, 0x9e, 0xa7, 0x13, 0x6c, 0x2e, 0xfe, 0x61, - 0xa1, 0xab, 0xe3, 0x87, 0x82, 0x9f, 0x4e, 0x50, 0x3b, 0x73, 0xf3, 0x8a, 0xd5, 0xff, 0x50, 0x30, - 0x69, 0x5e, 0xa8, 0x34, 0x55, 0xfc, 0x24, 0x3b, 0x8d, 0xee, 0x3a, 0xdd, 0x51, 0xbf, 0xbb, 0x74, - 0x74, 0x81, 0xf0, 0x81, 0x85, 0x0a, 0x23, 0x93, 0xc5, 0xab, 0x93, 0x3a, 0x1c, 0xb3, 0x5e, 0xc5, - 0x47, 0xff, 0x46, 0x36, 0xc9, 0xd6, 0x54, 0xb2, 0xc7, 0x78, 0x75, 0x92, 0x64, 0xb5, 0x66, 0x0a, - 0x51, 0xcd, 0x6c, 0x2a, 0xdd, 0x31, 0x87, 0x5d, 0x77, 0x63, 0xaf, 0x67, 0x5b, 0xfb, 0x3d, 0xdb, - 0xfa, 0xde, 0xb3, 0xad, 0x4f, 0x7d, 0x3b, 0xb7, 0xdf, 0xb7, 0x73, 0xdf, 0xfa, 0x76, 0xee, 0xed, - 0x83, 0x20, 0x94, 0x9b, 0xed, 0xba, 0xe3, 0x43, 0x44, 0x7d, 0x88, 0x1a, 0x7c, 0xfb, 0x2e, 0x34, - 0x9b, 0xa1, 0x1f, 0xb2, 0x96, 0xf9, 0x4f, 0xb7, 0x4f, 0x57, 0x94, 0x9d, 0x84, 0x8b, 0x7a, 0x5e, - 0x7d, 0xcb, 0xee, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x6b, 0xbf, 0x6a, 0xb1, 0xd6, 0x05, 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 defines a gRPC query method that returns the tokenfactory module's - // parameters. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // DenomAuthorityMetadata defines a gRPC query method for fetching - // DenomAuthorityMetadata for a particular denom. - DenomAuthorityMetadata(ctx context.Context, in *QueryDenomAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryDenomAuthorityMetadataResponse, error) - // DenomsFromCreator defines a gRPC query method for fetching all - // denominations created by a specific admin/creator. - DenomsFromCreator(ctx context.Context, in *QueryDenomsFromCreatorRequest, opts ...grpc.CallOption) (*QueryDenomsFromCreatorResponse, 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, "/osmosis.tokenfactory.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DenomAuthorityMetadata(ctx context.Context, in *QueryDenomAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryDenomAuthorityMetadataResponse, error) { - out := new(QueryDenomAuthorityMetadataResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DenomsFromCreator(ctx context.Context, in *QueryDenomsFromCreatorRequest, opts ...grpc.CallOption) (*QueryDenomsFromCreatorResponse, error) { - out := new(QueryDenomsFromCreatorResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Params defines a gRPC query method that returns the tokenfactory module's - // parameters. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // DenomAuthorityMetadata defines a gRPC query method for fetching - // DenomAuthorityMetadata for a particular denom. - DenomAuthorityMetadata(context.Context, *QueryDenomAuthorityMetadataRequest) (*QueryDenomAuthorityMetadataResponse, error) - // DenomsFromCreator defines a gRPC query method for fetching all - // denominations created by a specific admin/creator. - DenomsFromCreator(context.Context, *QueryDenomsFromCreatorRequest) (*QueryDenomsFromCreatorResponse, 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 (*UnimplementedQueryServer) DenomAuthorityMetadata(ctx context.Context, req *QueryDenomAuthorityMetadataRequest) (*QueryDenomAuthorityMetadataResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DenomAuthorityMetadata not implemented") -} -func (*UnimplementedQueryServer) DenomsFromCreator(ctx context.Context, req *QueryDenomsFromCreatorRequest) (*QueryDenomsFromCreatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DenomsFromCreator 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: "/osmosis.tokenfactory.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) -} - -func _Query_DenomAuthorityMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDenomAuthorityMetadataRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DenomAuthorityMetadata(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DenomAuthorityMetadata(ctx, req.(*QueryDenomAuthorityMetadataRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DenomsFromCreator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDenomsFromCreatorRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DenomsFromCreator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DenomsFromCreator(ctx, req.(*QueryDenomsFromCreatorRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "osmosis.tokenfactory.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "DenomAuthorityMetadata", - Handler: _Query_DenomAuthorityMetadata_Handler, - }, - { - MethodName: "DenomsFromCreator", - Handler: _Query_DenomsFromCreator_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "osmosis/tokenfactory/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 (m *QueryDenomAuthorityMetadataRequest) 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 *QueryDenomAuthorityMetadataRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDenomAuthorityMetadataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDenomAuthorityMetadataResponse) 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 *QueryDenomAuthorityMetadataResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDenomAuthorityMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.AuthorityMetadata.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 (m *QueryDenomsFromCreatorRequest) 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 *QueryDenomsFromCreatorRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDenomsFromCreatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDenomsFromCreatorResponse) 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 *QueryDenomsFromCreatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDenomsFromCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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 = encodeVarintQuery(dAtA, i, uint64(len(m.Denoms[iNdEx]))) - 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 (m *QueryDenomAuthorityMetadataRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDenomAuthorityMetadataResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.AuthorityMetadata.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryDenomsFromCreatorRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDenomsFromCreatorResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Denoms) > 0 { - for _, s := range m.Denoms { - l = len(s) - 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 (m *QueryDenomAuthorityMetadataRequest) 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: QueryDenomAuthorityMetadataRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomAuthorityMetadataRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - 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 (m *QueryDenomAuthorityMetadataResponse) 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: QueryDenomAuthorityMetadataResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", 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.AuthorityMetadata.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 (m *QueryDenomsFromCreatorRequest) 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: QueryDenomsFromCreatorRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - 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 (m *QueryDenomsFromCreatorResponse) 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: QueryDenomsFromCreatorResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) - 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/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go deleted file mode 100644 index 0b895e706..000000000 --- a/x/tokenfactory/types/query.pb.gw.go +++ /dev/null @@ -1,355 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: osmosis/tokenfactory/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 - -} - -func request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomAuthorityMetadataRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["denom"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") - } - - protoReq.Denom, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) - } - - msg, err := client.DenomAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomAuthorityMetadataRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["denom"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") - } - - protoReq.Denom, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) - } - - msg, err := server.DenomAuthorityMetadata(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomsFromCreatorRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["creator"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") - } - - protoReq.Creator, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) - } - - msg, err := client.DenomsFromCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomsFromCreatorRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["creator"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") - } - - protoReq.Creator, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) - } - - msg, err := server.DenomsFromCreator(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()...) - - }) - - mux.Handle("GET", pattern_Query_DenomAuthorityMetadata_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_DenomAuthorityMetadata_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_DenomAuthorityMetadata_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DenomsFromCreator_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_DenomsFromCreator_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_DenomsFromCreator_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()...) - - }) - - mux.Handle("GET", pattern_Query_DenomAuthorityMetadata_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_DenomAuthorityMetadata_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_DenomAuthorityMetadata_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DenomsFromCreator_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_DenomsFromCreator_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_DenomsFromCreator_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{"osmosis", "tokenfactory", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_DenomAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "authority_metadata"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_DenomsFromCreator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms_from_creator", "creator"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_DenomAuthorityMetadata_0 = runtime.ForwardResponseMessage - - forward_Query_DenomsFromCreator_0 = runtime.ForwardResponseMessage -) diff --git a/x/tokenfactory/types/tx.pb.go b/x/tokenfactory/types/tx.pb.go deleted file mode 100644 index 36b006ab6..000000000 --- a/x/tokenfactory/types/tx.pb.go +++ /dev/null @@ -1,3236 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/tokenfactory/v1beta1/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" - types1 "github.com/cosmos/cosmos-sdk/x/bank/types" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgCreateDenom defines the message structure for the CreateDenom gRPC service -// method. It allows an account to create a new denom. It requires a sender -// address and a sub denomination. The (sender_address, sub_denomination) tuple -// must be unique and cannot be re-used. -// -// The resulting denom created is defined as -// . The resulting denom's admin is -// originally set to be the creator, but this can be changed later. The token -// denom does not indicate the current admin. -type MsgCreateDenom struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - // subdenom can be up to 44 "alphanumeric" characters long. - Subdenom string `protobuf:"bytes,2,opt,name=subdenom,proto3" json:"subdenom,omitempty" yaml:"subdenom"` -} - -func (m *MsgCreateDenom) Reset() { *m = MsgCreateDenom{} } -func (m *MsgCreateDenom) String() string { return proto.CompactTextString(m) } -func (*MsgCreateDenom) ProtoMessage() {} -func (*MsgCreateDenom) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{0} -} -func (m *MsgCreateDenom) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateDenom.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 *MsgCreateDenom) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateDenom.Merge(m, src) -} -func (m *MsgCreateDenom) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateDenom) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateDenom.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateDenom proto.InternalMessageInfo - -func (m *MsgCreateDenom) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgCreateDenom) GetSubdenom() string { - if m != nil { - return m.Subdenom - } - return "" -} - -// MsgCreateDenomResponse is the return value of MsgCreateDenom -// It returns the full string of the newly created denom -type MsgCreateDenomResponse struct { - NewTokenDenom string `protobuf:"bytes,1,opt,name=new_token_denom,json=newTokenDenom,proto3" json:"new_token_denom,omitempty" yaml:"new_token_denom"` -} - -func (m *MsgCreateDenomResponse) Reset() { *m = MsgCreateDenomResponse{} } -func (m *MsgCreateDenomResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateDenomResponse) ProtoMessage() {} -func (*MsgCreateDenomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{1} -} -func (m *MsgCreateDenomResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateDenomResponse.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 *MsgCreateDenomResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateDenomResponse.Merge(m, src) -} -func (m *MsgCreateDenomResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateDenomResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateDenomResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateDenomResponse proto.InternalMessageInfo - -func (m *MsgCreateDenomResponse) GetNewTokenDenom() string { - if m != nil { - return m.NewTokenDenom - } - return "" -} - -// MsgMint is the sdk.Msg type for allowing an admin account to mint -// more of a token. For now, we only support minting to the sender account -type MsgMint struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` - MintToAddress string `protobuf:"bytes,3,opt,name=mintToAddress,proto3" json:"mintToAddress,omitempty" yaml:"mint_to_address"` -} - -func (m *MsgMint) Reset() { *m = MsgMint{} } -func (m *MsgMint) String() string { return proto.CompactTextString(m) } -func (*MsgMint) ProtoMessage() {} -func (*MsgMint) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{2} -} -func (m *MsgMint) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMint.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 *MsgMint) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMint.Merge(m, src) -} -func (m *MsgMint) XXX_Size() int { - return m.Size() -} -func (m *MsgMint) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMint.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMint proto.InternalMessageInfo - -func (m *MsgMint) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgMint) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -func (m *MsgMint) GetMintToAddress() string { - if m != nil { - return m.MintToAddress - } - return "" -} - -type MsgMintResponse struct { -} - -func (m *MsgMintResponse) Reset() { *m = MsgMintResponse{} } -func (m *MsgMintResponse) String() string { return proto.CompactTextString(m) } -func (*MsgMintResponse) ProtoMessage() {} -func (*MsgMintResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{3} -} -func (m *MsgMintResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintResponse.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 *MsgMintResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintResponse.Merge(m, src) -} -func (m *MsgMintResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgMintResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintResponse proto.InternalMessageInfo - -// MsgBurn is the sdk.Msg type for allowing an admin account to burn -// a token. For now, we only support burning from the sender account. -type MsgBurn struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` - BurnFromAddress string `protobuf:"bytes,3,opt,name=burnFromAddress,proto3" json:"burnFromAddress,omitempty" yaml:"burn_from_address"` -} - -func (m *MsgBurn) Reset() { *m = MsgBurn{} } -func (m *MsgBurn) String() string { return proto.CompactTextString(m) } -func (*MsgBurn) ProtoMessage() {} -func (*MsgBurn) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{4} -} -func (m *MsgBurn) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBurn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBurn.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 *MsgBurn) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBurn.Merge(m, src) -} -func (m *MsgBurn) XXX_Size() int { - return m.Size() -} -func (m *MsgBurn) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBurn.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBurn proto.InternalMessageInfo - -func (m *MsgBurn) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgBurn) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -func (m *MsgBurn) GetBurnFromAddress() string { - if m != nil { - return m.BurnFromAddress - } - return "" -} - -type MsgBurnResponse struct { -} - -func (m *MsgBurnResponse) Reset() { *m = MsgBurnResponse{} } -func (m *MsgBurnResponse) String() string { return proto.CompactTextString(m) } -func (*MsgBurnResponse) ProtoMessage() {} -func (*MsgBurnResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{5} -} -func (m *MsgBurnResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBurnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBurnResponse.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 *MsgBurnResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBurnResponse.Merge(m, src) -} -func (m *MsgBurnResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgBurnResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBurnResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBurnResponse proto.InternalMessageInfo - -// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign -// adminship of a denom to a new account -type MsgChangeAdmin struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` - NewAdmin string `protobuf:"bytes,3,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty" yaml:"new_admin"` -} - -func (m *MsgChangeAdmin) Reset() { *m = MsgChangeAdmin{} } -func (m *MsgChangeAdmin) String() string { return proto.CompactTextString(m) } -func (*MsgChangeAdmin) ProtoMessage() {} -func (*MsgChangeAdmin) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{6} -} -func (m *MsgChangeAdmin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgChangeAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgChangeAdmin.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 *MsgChangeAdmin) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgChangeAdmin.Merge(m, src) -} -func (m *MsgChangeAdmin) XXX_Size() int { - return m.Size() -} -func (m *MsgChangeAdmin) XXX_DiscardUnknown() { - xxx_messageInfo_MsgChangeAdmin.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgChangeAdmin proto.InternalMessageInfo - -func (m *MsgChangeAdmin) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgChangeAdmin) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *MsgChangeAdmin) GetNewAdmin() string { - if m != nil { - return m.NewAdmin - } - return "" -} - -// MsgChangeAdminResponse defines the response structure for an executed -// MsgChangeAdmin message. -type MsgChangeAdminResponse struct { -} - -func (m *MsgChangeAdminResponse) Reset() { *m = MsgChangeAdminResponse{} } -func (m *MsgChangeAdminResponse) String() string { return proto.CompactTextString(m) } -func (*MsgChangeAdminResponse) ProtoMessage() {} -func (*MsgChangeAdminResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{7} -} -func (m *MsgChangeAdminResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgChangeAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgChangeAdminResponse.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 *MsgChangeAdminResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgChangeAdminResponse.Merge(m, src) -} -func (m *MsgChangeAdminResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgChangeAdminResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgChangeAdminResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgChangeAdminResponse proto.InternalMessageInfo - -// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set -// the denom's bank metadata -type MsgSetDenomMetadata struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Metadata types1.Metadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata" yaml:"metadata"` -} - -func (m *MsgSetDenomMetadata) Reset() { *m = MsgSetDenomMetadata{} } -func (m *MsgSetDenomMetadata) String() string { return proto.CompactTextString(m) } -func (*MsgSetDenomMetadata) ProtoMessage() {} -func (*MsgSetDenomMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{8} -} -func (m *MsgSetDenomMetadata) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetDenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetDenomMetadata.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 *MsgSetDenomMetadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetDenomMetadata.Merge(m, src) -} -func (m *MsgSetDenomMetadata) XXX_Size() int { - return m.Size() -} -func (m *MsgSetDenomMetadata) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetDenomMetadata.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetDenomMetadata proto.InternalMessageInfo - -func (m *MsgSetDenomMetadata) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgSetDenomMetadata) GetMetadata() types1.Metadata { - if m != nil { - return m.Metadata - } - return types1.Metadata{} -} - -// MsgSetDenomMetadataResponse defines the response structure for an executed -// MsgSetDenomMetadata message. -type MsgSetDenomMetadataResponse struct { -} - -func (m *MsgSetDenomMetadataResponse) Reset() { *m = MsgSetDenomMetadataResponse{} } -func (m *MsgSetDenomMetadataResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSetDenomMetadataResponse) ProtoMessage() {} -func (*MsgSetDenomMetadataResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{9} -} -func (m *MsgSetDenomMetadataResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetDenomMetadataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetDenomMetadataResponse.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 *MsgSetDenomMetadataResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetDenomMetadataResponse.Merge(m, src) -} -func (m *MsgSetDenomMetadataResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSetDenomMetadataResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetDenomMetadataResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetDenomMetadataResponse proto.InternalMessageInfo - -type MsgForceTransfer struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` - TransferFromAddress string `protobuf:"bytes,3,opt,name=transferFromAddress,proto3" json:"transferFromAddress,omitempty" yaml:"transfer_from_address"` - TransferToAddress string `protobuf:"bytes,4,opt,name=transferToAddress,proto3" json:"transferToAddress,omitempty" yaml:"transfer_to_address"` -} - -func (m *MsgForceTransfer) Reset() { *m = MsgForceTransfer{} } -func (m *MsgForceTransfer) String() string { return proto.CompactTextString(m) } -func (*MsgForceTransfer) ProtoMessage() {} -func (*MsgForceTransfer) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{10} -} -func (m *MsgForceTransfer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgForceTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgForceTransfer.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 *MsgForceTransfer) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgForceTransfer.Merge(m, src) -} -func (m *MsgForceTransfer) XXX_Size() int { - return m.Size() -} -func (m *MsgForceTransfer) XXX_DiscardUnknown() { - xxx_messageInfo_MsgForceTransfer.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgForceTransfer proto.InternalMessageInfo - -func (m *MsgForceTransfer) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgForceTransfer) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -func (m *MsgForceTransfer) GetTransferFromAddress() string { - if m != nil { - return m.TransferFromAddress - } - return "" -} - -func (m *MsgForceTransfer) GetTransferToAddress() string { - if m != nil { - return m.TransferToAddress - } - return "" -} - -type MsgForceTransferResponse struct { -} - -func (m *MsgForceTransferResponse) Reset() { *m = MsgForceTransferResponse{} } -func (m *MsgForceTransferResponse) String() string { return proto.CompactTextString(m) } -func (*MsgForceTransferResponse) ProtoMessage() {} -func (*MsgForceTransferResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{11} -} -func (m *MsgForceTransferResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgForceTransferResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgForceTransferResponse.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 *MsgForceTransferResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgForceTransferResponse.Merge(m, src) -} -func (m *MsgForceTransferResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgForceTransferResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgForceTransferResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgForceTransferResponse proto.InternalMessageInfo - -// MsgUpdateParams is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 -type MsgUpdateParams struct { - // authority is the address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/mint parameters to update. - // - // NOTE: All parameters must be supplied. - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` -} - -func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } -func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParams) ProtoMessage() {} -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{12} -} -func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParams.Merge(m, src) -} -func (m *MsgUpdateParams) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo - -func (m *MsgUpdateParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgUpdateParams) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct { -} - -func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } -func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_283b6c9a90a846b4, []int{13} -} -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) -} -func (m *MsgUpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateDenom)(nil), "osmosis.tokenfactory.v1beta1.MsgCreateDenom") - proto.RegisterType((*MsgCreateDenomResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse") - proto.RegisterType((*MsgMint)(nil), "osmosis.tokenfactory.v1beta1.MsgMint") - proto.RegisterType((*MsgMintResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgMintResponse") - proto.RegisterType((*MsgBurn)(nil), "osmosis.tokenfactory.v1beta1.MsgBurn") - proto.RegisterType((*MsgBurnResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgBurnResponse") - proto.RegisterType((*MsgChangeAdmin)(nil), "osmosis.tokenfactory.v1beta1.MsgChangeAdmin") - proto.RegisterType((*MsgChangeAdminResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse") - proto.RegisterType((*MsgSetDenomMetadata)(nil), "osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata") - proto.RegisterType((*MsgSetDenomMetadataResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse") - proto.RegisterType((*MsgForceTransfer)(nil), "osmosis.tokenfactory.v1beta1.MsgForceTransfer") - proto.RegisterType((*MsgForceTransferResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgForceTransferResponse") - proto.RegisterType((*MsgUpdateParams)(nil), "osmosis.tokenfactory.v1beta1.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgUpdateParamsResponse") -} - -func init() { - proto.RegisterFile("osmosis/tokenfactory/v1beta1/tx.proto", fileDescriptor_283b6c9a90a846b4) -} - -var fileDescriptor_283b6c9a90a846b4 = []byte{ - // 877 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x6f, 0xdc, 0x44, - 0x14, 0x8f, 0xdb, 0xb0, 0x24, 0xd3, 0xa6, 0x49, 0x9c, 0xd0, 0x6c, 0x4c, 0x6a, 0x57, 0x23, 0x8a, - 0x28, 0x22, 0xb6, 0xb6, 0x40, 0x24, 0x7a, 0xa2, 0x2e, 0x8a, 0x38, 0xb0, 0x52, 0xe5, 0x86, 0x0b, - 0xaa, 0xb4, 0x9a, 0x5d, 0xcf, 0x3a, 0x56, 0xe2, 0x99, 0xc5, 0x33, 0xdb, 0x64, 0x6f, 0x88, 0x4f, - 0xc0, 0x01, 0x21, 0x71, 0xe0, 0x03, 0x70, 0xe3, 0xc0, 0x07, 0xe0, 0x84, 0x7a, 0xac, 0x38, 0x71, - 0xb2, 0x50, 0x72, 0xe0, 0xee, 0x4f, 0x50, 0x79, 0x66, 0xfc, 0x77, 0xab, 0xec, 0xee, 0x29, 0xa7, - 0xc4, 0x7e, 0xbf, 0xdf, 0x6f, 0xde, 0xef, 0xbd, 0x37, 0x6f, 0x0d, 0x1e, 0x50, 0x16, 0x51, 0x16, - 0x32, 0x87, 0xd3, 0x13, 0x4c, 0x86, 0x68, 0xc0, 0x69, 0x3c, 0x71, 0x5e, 0x76, 0xfa, 0x98, 0xa3, - 0x8e, 0xc3, 0xcf, 0xed, 0x51, 0x4c, 0x39, 0xd5, 0xf7, 0x14, 0xcc, 0xae, 0xc2, 0x6c, 0x05, 0x33, - 0xb6, 0x03, 0x1a, 0x50, 0x01, 0x74, 0xb2, 0xff, 0x24, 0xc7, 0x30, 0x07, 0x82, 0xe4, 0xf4, 0x11, - 0xc3, 0x85, 0xe2, 0x80, 0x86, 0x64, 0x2a, 0x4e, 0x4e, 0x8a, 0x78, 0xf6, 0xa0, 0xe2, 0x0f, 0xaf, - 0x4c, 0x6d, 0x84, 0x62, 0x14, 0x31, 0x05, 0xdd, 0x51, 0x52, 0x11, 0x0b, 0x9c, 0x97, 0x9d, 0xec, - 0x8f, 0x0a, 0xec, 0xca, 0x40, 0x4f, 0x26, 0x27, 0x1f, 0x64, 0x08, 0x9e, 0x82, 0x3b, 0x5d, 0x16, - 0x3c, 0x8d, 0x31, 0xe2, 0xf8, 0x2b, 0x4c, 0x68, 0xa4, 0x3f, 0x04, 0x2d, 0x86, 0x89, 0x8f, 0xe3, - 0xb6, 0x76, 0x5f, 0xfb, 0x68, 0xd5, 0xdd, 0x4c, 0x13, 0x6b, 0x6d, 0x82, 0xa2, 0xd3, 0xc7, 0x50, - 0xbe, 0x87, 0x9e, 0x02, 0xe8, 0x0e, 0x58, 0x61, 0xe3, 0xbe, 0x9f, 0xd1, 0xda, 0x37, 0x04, 0x78, - 0x2b, 0x4d, 0xac, 0x75, 0x05, 0x56, 0x11, 0xe8, 0x15, 0x20, 0xf8, 0x02, 0xdc, 0xad, 0x9f, 0xe6, - 0x61, 0x36, 0xa2, 0x84, 0x61, 0xdd, 0x05, 0xeb, 0x04, 0x9f, 0xf5, 0x84, 0xc9, 0x9e, 0x54, 0x94, - 0xc7, 0x1b, 0x69, 0x62, 0xdd, 0x95, 0x8a, 0x0d, 0x00, 0xf4, 0xd6, 0x08, 0x3e, 0x3b, 0xca, 0x5e, - 0x08, 0x2d, 0xf8, 0x97, 0x06, 0xde, 0xed, 0xb2, 0xa0, 0x1b, 0x12, 0xbe, 0x88, 0x8b, 0xaf, 0x41, - 0x0b, 0x45, 0x74, 0x4c, 0xb8, 0xf0, 0x70, 0xeb, 0xd1, 0xae, 0xad, 0x2a, 0x94, 0xb5, 0x2c, 0xef, - 0xae, 0xfd, 0x94, 0x86, 0xc4, 0x7d, 0xef, 0x55, 0x62, 0x2d, 0x95, 0x4a, 0x92, 0x06, 0x3d, 0xc5, - 0xd7, 0xbf, 0x04, 0x6b, 0x51, 0x48, 0xf8, 0x11, 0x7d, 0xe2, 0xfb, 0x31, 0x66, 0xac, 0x7d, 0xb3, - 0x69, 0x21, 0x0b, 0xf7, 0x38, 0xed, 0x21, 0x09, 0x80, 0x5e, 0x9d, 0x00, 0x37, 0xc1, 0xba, 0x72, - 0x90, 0x57, 0x06, 0xfe, 0x2d, 0x5d, 0xb9, 0xe3, 0x98, 0x5c, 0x8f, 0xab, 0x43, 0xb0, 0xde, 0x1f, - 0xc7, 0xe4, 0x30, 0xa6, 0x51, 0xdd, 0xd7, 0x5e, 0x9a, 0x58, 0x6d, 0xc9, 0xc9, 0x00, 0xbd, 0x61, - 0x4c, 0xa3, 0xd2, 0x59, 0x93, 0xa4, 0xbc, 0x65, 0x3e, 0x0a, 0x6f, 0xbf, 0x68, 0x72, 0xfc, 0x8e, - 0x11, 0x09, 0xf0, 0x13, 0x3f, 0x0a, 0x17, 0xb2, 0xf8, 0x21, 0x78, 0xa7, 0x3a, 0x7b, 0x1b, 0x69, - 0x62, 0xdd, 0x96, 0x48, 0x35, 0x1f, 0x32, 0xac, 0x77, 0xc0, 0x6a, 0x36, 0x3a, 0x28, 0xd3, 0x57, - 0xa9, 0x6f, 0xa7, 0x89, 0xb5, 0x51, 0x4e, 0x95, 0x08, 0x41, 0x6f, 0x85, 0xe0, 0x33, 0x91, 0x05, - 0x6c, 0xcb, 0x41, 0x2d, 0xf3, 0x2a, 0x52, 0xfe, 0x59, 0x03, 0x5b, 0x5d, 0x16, 0x3c, 0xc7, 0x5c, - 0x0c, 0x5d, 0x17, 0x73, 0xe4, 0x23, 0x8e, 0x16, 0xc9, 0xdb, 0x03, 0x2b, 0x91, 0xa2, 0xa9, 0xe6, - 0xdc, 0x2b, 0x9b, 0x43, 0x4e, 0x8a, 0xe6, 0xe4, 0xda, 0xee, 0x8e, 0x6a, 0x90, 0xba, 0x59, 0x39, - 0x19, 0x7a, 0x85, 0x0e, 0xbc, 0x07, 0xde, 0x7f, 0x4b, 0x56, 0x45, 0xd6, 0xbf, 0xdf, 0x00, 0x1b, - 0x5d, 0x16, 0x1c, 0xd2, 0x78, 0x80, 0x8f, 0x62, 0x44, 0xd8, 0x10, 0xc7, 0xd7, 0x33, 0x4d, 0x1e, - 0xd8, 0xe2, 0x2a, 0x81, 0xe9, 0x89, 0xba, 0x9f, 0x26, 0xd6, 0x9e, 0xe4, 0xe5, 0xa0, 0xc6, 0x54, - 0xbd, 0x8d, 0xac, 0x7f, 0x03, 0x36, 0xf3, 0xd7, 0xe5, 0xdd, 0x5b, 0x16, 0x8a, 0x66, 0x9a, 0x58, - 0x46, 0x43, 0xb1, 0x7a, 0xff, 0xa6, 0x89, 0xd0, 0x00, 0xed, 0x66, 0xa9, 0x8a, 0x3a, 0xfe, 0xa6, - 0x89, 0x21, 0xfe, 0x76, 0xe4, 0x23, 0x8e, 0x9f, 0x89, 0xe5, 0xab, 0x1f, 0x80, 0x55, 0x34, 0xe6, - 0xc7, 0x34, 0x0e, 0xf9, 0x44, 0x55, 0xb2, 0xfd, 0xcf, 0x9f, 0xfb, 0xdb, 0xaa, 0x42, 0x4a, 0xf6, - 0x39, 0x8f, 0x43, 0x12, 0x78, 0x25, 0x54, 0x77, 0x41, 0x4b, 0xae, 0x6f, 0x55, 0xd3, 0x0f, 0xec, - 0xab, 0x7e, 0x5e, 0x6c, 0x79, 0x9a, 0xbb, 0x9c, 0x95, 0xd7, 0x53, 0xcc, 0xc7, 0x77, 0x7e, 0xfc, - 0xff, 0x8f, 0x8f, 0x4b, 0x4d, 0xb8, 0x0b, 0x76, 0x1a, 0xe9, 0xe5, 0xa9, 0x3f, 0xfa, 0xb5, 0x05, - 0x6e, 0x76, 0x59, 0xa0, 0x7f, 0x0f, 0x6e, 0x55, 0xd7, 0xfd, 0x27, 0x57, 0x9f, 0x5a, 0x5f, 0xd7, - 0xc6, 0x67, 0x8b, 0xa0, 0x8b, 0xe5, 0xfe, 0x02, 0x2c, 0x8b, 0xa5, 0xfc, 0x60, 0x26, 0x3b, 0x83, - 0x19, 0xfb, 0x73, 0xc1, 0xaa, 0xea, 0x62, 0x39, 0xce, 0x56, 0xcf, 0x60, 0x73, 0xa8, 0x57, 0x57, - 0x94, 0x28, 0x57, 0x65, 0x3d, 0xcd, 0x51, 0xae, 0x12, 0x3d, 0x4f, 0xb9, 0xa6, 0x57, 0x8c, 0xfe, - 0x83, 0x06, 0x36, 0xa6, 0xf6, 0x4b, 0x67, 0xa6, 0x54, 0x93, 0x62, 0x7c, 0xb1, 0x30, 0xa5, 0x48, - 0xe1, 0x0c, 0xac, 0xd5, 0x77, 0x85, 0x3d, 0x53, 0xab, 0x86, 0x37, 0x0e, 0x16, 0xc3, 0x17, 0x07, - 0x73, 0x70, 0xbb, 0x76, 0xb9, 0x66, 0x77, 0xab, 0x0a, 0x37, 0x3e, 0x5f, 0x08, 0x9e, 0x9f, 0xea, - 0x3e, 0x7b, 0x75, 0x61, 0x6a, 0xaf, 0x2f, 0x4c, 0xed, 0xbf, 0x0b, 0x53, 0xfb, 0xe9, 0xd2, 0x5c, - 0x7a, 0x7d, 0x69, 0x2e, 0xfd, 0x7b, 0x69, 0x2e, 0x7d, 0x77, 0x10, 0x84, 0xfc, 0x78, 0xdc, 0xb7, - 0x07, 0x34, 0x72, 0x06, 0x34, 0xf2, 0xf1, 0xf9, 0x3e, 0x1d, 0x0e, 0xc3, 0x41, 0x88, 0x4e, 0xd5, - 0xb3, 0x73, 0x5e, 0xff, 0x34, 0xe3, 0x93, 0x11, 0x66, 0xfd, 0x96, 0xf8, 0xbc, 0xfa, 0xf4, 0x4d, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x43, 0x75, 0xcb, 0x05, 0x5a, 0x0a, 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 { - CreateDenom(ctx context.Context, in *MsgCreateDenom, opts ...grpc.CallOption) (*MsgCreateDenomResponse, error) - Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) - Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) - ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) - SetDenomMetadata(ctx context.Context, in *MsgSetDenomMetadata, opts ...grpc.CallOption) (*MsgSetDenomMetadataResponse, error) - ForceTransfer(ctx context.Context, in *MsgForceTransfer, opts ...grpc.CallOption) (*MsgForceTransferResponse, error) - // UpdateParams defines a governance operation for updating the x/mint module - // parameters. The authority is hard-coded to the x/gov module account. - // - // Since: cosmos-sdk 0.47 - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateDenom(ctx context.Context, in *MsgCreateDenom, opts ...grpc.CallOption) (*MsgCreateDenomResponse, error) { - out := new(MsgCreateDenomResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/CreateDenom", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) { - out := new(MsgMintResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/Mint", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) { - out := new(MsgBurnResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/Burn", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) { - out := new(MsgChangeAdminResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/ChangeAdmin", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) SetDenomMetadata(ctx context.Context, in *MsgSetDenomMetadata, opts ...grpc.CallOption) (*MsgSetDenomMetadataResponse, error) { - out := new(MsgSetDenomMetadataResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/SetDenomMetadata", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ForceTransfer(ctx context.Context, in *MsgForceTransfer, opts ...grpc.CallOption) (*MsgForceTransferResponse, error) { - out := new(MsgForceTransferResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/ForceTransfer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/UpdateParams", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - CreateDenom(context.Context, *MsgCreateDenom) (*MsgCreateDenomResponse, error) - Mint(context.Context, *MsgMint) (*MsgMintResponse, error) - Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) - ChangeAdmin(context.Context, *MsgChangeAdmin) (*MsgChangeAdminResponse, error) - SetDenomMetadata(context.Context, *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) - ForceTransfer(context.Context, *MsgForceTransfer) (*MsgForceTransferResponse, error) - // UpdateParams defines a governance operation for updating the x/mint module - // parameters. The authority is hard-coded to the x/gov module account. - // - // Since: cosmos-sdk 0.47 - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateDenom(ctx context.Context, req *MsgCreateDenom) (*MsgCreateDenomResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateDenom not implemented") -} -func (*UnimplementedMsgServer) Mint(ctx context.Context, req *MsgMint) (*MsgMintResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") -} -func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurnResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") -} -func (*UnimplementedMsgServer) ChangeAdmin(ctx context.Context, req *MsgChangeAdmin) (*MsgChangeAdminResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChangeAdmin not implemented") -} -func (*UnimplementedMsgServer) SetDenomMetadata(ctx context.Context, req *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetDenomMetadata not implemented") -} -func (*UnimplementedMsgServer) ForceTransfer(ctx context.Context, req *MsgForceTransfer) (*MsgForceTransferResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ForceTransfer not implemented") -} -func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateDenom) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateDenom(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/CreateDenom", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateDenom(ctx, req.(*MsgCreateDenom)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Mint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgMint) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Mint(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/Mint", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Mint(ctx, req.(*MsgMint)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBurn) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Burn(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/Burn", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Burn(ctx, req.(*MsgBurn)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ChangeAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgChangeAdmin) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ChangeAdmin(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/ChangeAdmin", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ChangeAdmin(ctx, req.(*MsgChangeAdmin)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_SetDenomMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSetDenomMetadata) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SetDenomMetadata(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/SetDenomMetadata", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SetDenomMetadata(ctx, req.(*MsgSetDenomMetadata)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ForceTransfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgForceTransfer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ForceTransfer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/ForceTransfer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ForceTransfer(ctx, req.(*MsgForceTransfer)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/UpdateParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "osmosis.tokenfactory.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateDenom", - Handler: _Msg_CreateDenom_Handler, - }, - { - MethodName: "Mint", - Handler: _Msg_Mint_Handler, - }, - { - MethodName: "Burn", - Handler: _Msg_Burn_Handler, - }, - { - MethodName: "ChangeAdmin", - Handler: _Msg_ChangeAdmin_Handler, - }, - { - MethodName: "SetDenomMetadata", - Handler: _Msg_SetDenomMetadata_Handler, - }, - { - MethodName: "ForceTransfer", - Handler: _Msg_ForceTransfer_Handler, - }, - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "osmosis/tokenfactory/v1beta1/tx.proto", -} - -func (m *MsgCreateDenom) 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 *MsgCreateDenom) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Subdenom) > 0 { - i -= len(m.Subdenom) - copy(dAtA[i:], m.Subdenom) - i = encodeVarintTx(dAtA, i, uint64(len(m.Subdenom))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateDenomResponse) 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 *MsgCreateDenomResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NewTokenDenom) > 0 { - i -= len(m.NewTokenDenom) - copy(dAtA[i:], m.NewTokenDenom) - i = encodeVarintTx(dAtA, i, uint64(len(m.NewTokenDenom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgMint) 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 *MsgMint) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMint) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MintToAddress) > 0 { - i -= len(m.MintToAddress) - copy(dAtA[i:], m.MintToAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.MintToAddress))) - i-- - dAtA[i] = 0x1a - } - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgMintResponse) 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 *MsgMintResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMintResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgBurn) 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 *MsgBurn) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBurn) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BurnFromAddress) > 0 { - i -= len(m.BurnFromAddress) - copy(dAtA[i:], m.BurnFromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.BurnFromAddress))) - i-- - dAtA[i] = 0x1a - } - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgBurnResponse) 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 *MsgBurnResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBurnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgChangeAdmin) 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 *MsgChangeAdmin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgChangeAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NewAdmin) > 0 { - i -= len(m.NewAdmin) - copy(dAtA[i:], m.NewAdmin) - i = encodeVarintTx(dAtA, i, uint64(len(m.NewAdmin))) - i-- - dAtA[i] = 0x1a - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgChangeAdminResponse) 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 *MsgChangeAdminResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgChangeAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgSetDenomMetadata) 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 *MsgSetDenomMetadata) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetDenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgSetDenomMetadataResponse) 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 *MsgSetDenomMetadataResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetDenomMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgForceTransfer) 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 *MsgForceTransfer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgForceTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TransferToAddress) > 0 { - i -= len(m.TransferToAddress) - copy(dAtA[i:], m.TransferToAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.TransferToAddress))) - i-- - dAtA[i] = 0x22 - } - if len(m.TransferFromAddress) > 0 { - i -= len(m.TransferFromAddress) - copy(dAtA[i:], m.TransferFromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.TransferFromAddress))) - i-- - dAtA[i] = 0x1a - } - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgForceTransferResponse) 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 *MsgForceTransferResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgForceTransferResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParamsResponse) 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 *MsgCreateDenom) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Subdenom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgCreateDenomResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NewTokenDenom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgMint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.MintToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgMintResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgBurn) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.BurnFromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgBurnResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgChangeAdmin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NewAdmin) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgChangeAdminResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgSetDenomMetadata) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Metadata.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgSetDenomMetadataResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgForceTransfer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.TransferFromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.TransferToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgForceTransferResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUpdateParamsResponse) 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 *MsgCreateDenom) 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: MsgCreateDenom: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateDenom: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subdenom", 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.Subdenom = string(dAtA[iNdEx:postIndex]) - 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 *MsgCreateDenomResponse) 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: MsgCreateDenomResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewTokenDenom", 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.NewTokenDenom = string(dAtA[iNdEx:postIndex]) - 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 *MsgMint) 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: MsgMint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MintToAddress", 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.MintToAddress = string(dAtA[iNdEx:postIndex]) - 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 *MsgMintResponse) 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: MsgMintResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintResponse: 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 *MsgBurn) 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: MsgBurn: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurn: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnFromAddress", 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.BurnFromAddress = string(dAtA[iNdEx:postIndex]) - 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 *MsgBurnResponse) 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: MsgBurnResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnResponse: 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 *MsgChangeAdmin) 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: MsgChangeAdmin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeAdmin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", 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.NewAdmin = string(dAtA[iNdEx:postIndex]) - 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 *MsgChangeAdminResponse) 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: MsgChangeAdminResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeAdminResponse: 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 *MsgSetDenomMetadata) 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: MsgSetDenomMetadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetDenomMetadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", 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.Metadata.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 *MsgSetDenomMetadataResponse) 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: MsgSetDenomMetadataResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetDenomMetadataResponse: 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 *MsgForceTransfer) 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: MsgForceTransfer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgForceTransfer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransferFromAddress", 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.TransferFromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransferToAddress", 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.TransferToAddress = string(dAtA[iNdEx:postIndex]) - 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 *MsgForceTransferResponse) 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: MsgForceTransferResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgForceTransferResponse: 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 *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: 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") -)