diff --git a/.github/workflows/cd-internal-testnet.yml b/.github/workflows/cd-internal-testnet.yml index 5cf04a23..ed06faf4 100644 --- a/.github/workflows/cd-internal-testnet.yml +++ b/.github/workflows/cd-internal-testnet.yml @@ -1,5 +1,6 @@ name: Continuous Deployment (Internal Testnet) # run after every successful CI job of new commits to the master branch +# if deploy version or config has changed on: workflow_run: workflows: [Continuous Integration (Kava Master)] @@ -7,6 +8,23 @@ on: - completed jobs: + changed_files: + runs-on: ubuntu-latest + # define output for first job forwarding output of changedInternalTestnetConfig job + outputs: + changedInternalTestnetConfig: ${{ steps.changed-internal-testnet-config.outputs.any_changed }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + - name: Get all changed internal testnet files + id: changed-internal-testnet-config + uses: tj-actions/changed-files@v42 + with: + # Avoid using single or double quotes for multiline patterns + files: | + ci/env/kava-internal-testnet/** + # in order: # enter standby (prevents autoscaling group from killing node during deploy) # stop kava @@ -14,8 +32,9 @@ jobs: # download updated binary and genesis # reset application database state (only done on internal testnet) reset-chain-to-zero-state: + needs: [changed_files] # only start cd pipeline if last ci run was successful - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event.workflow_run.conclusion == 'success' && needs.changed_files.outputs.changedInternalTestnetConfig == 'true' }} uses: ./.github/workflows/cd-reset-internal-testnet.yml with: aws-region: us-east-1 diff --git a/CHANGELOG.md b/CHANGELOG.md index e9e3469b..73e11a52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ - (cdp) [#1818] Add module param and logic for running x/cdp begin blocker every `n` blocks - (cli) [#1804] Add `rocksdb compact` command for manual DB compaction of state or blockstore. - (cosmos-sdk) [#1811] Upgrades app to cosmos-sdk v0.47.7 +- (validator-vesting) [#1832] Add grpc query service to replace removed legacy querier +- (incentive) [#1836] Update x/incentive cli to use grpc query client +- (ibc) [#1839] Add ibc packet forward middleware for ibc transfers ## [v0.25.0] @@ -324,6 +327,9 @@ the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.38.4/CHANGELOG.md). - [#257](https://github.com/Kava-Labs/kava/pulls/257) Include scripts to run large-scale simulations remotely using aws-batch +[#1839]: https://github.com/Kava-Labs/kava/pull/1839 +[#1836]: https://github.com/Kava-Labs/kava/pull/1836 +[#1832]: https://github.com/Kava-Labs/kava/pull/1832 [#1811]: https://github.com/Kava-Labs/kava/pull/1811 [#1804]: https://github.com/Kava-Labs/kava/pull/1804 [#1785]: https://github.com/Kava-Labs/kava/pull/1785 diff --git a/app/app.go b/app/app.go index af963dc2..563ac76b 100644 --- a/app/app.go +++ b/app/app.go @@ -79,6 +79,9 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward" + packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" @@ -86,7 +89,7 @@ import ( ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" + ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" @@ -199,6 +202,7 @@ var ( ibc.AppModuleBasic{}, ibctm.AppModuleBasic{}, solomachine.AppModuleBasic{}, + packetforward.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, authzmodule.AppModuleBasic{}, @@ -307,6 +311,7 @@ type App struct { crisisKeeper crisiskeeper.Keeper slashingKeeper slashingkeeper.Keeper ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + packetForwardKeeper *packetforwardkeeper.Keeper evmKeeper *evmkeeper.Keeper evmutilKeeper evmutilkeeper.Keeper feeMarketKeeper feemarketkeeper.Keeper @@ -375,7 +380,7 @@ func NewApp( keys := sdk.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, - distrtypes.StoreKey, slashingtypes.StoreKey, + distrtypes.StoreKey, slashingtypes.StoreKey, packetforwardtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, evmtypes.StoreKey, feemarkettypes.StoreKey, authzkeeper.StoreKey, @@ -429,6 +434,7 @@ func NewApp( savingsSubspace := app.paramsKeeper.Subspace(savingstypes.ModuleName) ibcSubspace := app.paramsKeeper.Subspace(ibcexported.ModuleName) ibctransferSubspace := app.paramsKeeper.Subspace(ibctransfertypes.ModuleName) + packetforwardSubspace := app.paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable()) feemarketSubspace := app.paramsKeeper.Subspace(feemarkettypes.ModuleName) evmSubspace := app.paramsKeeper.Subspace(evmtypes.ModuleName) evmutilSubspace := app.paramsKeeper.Subspace(evmutiltypes.ModuleName) @@ -551,23 +557,49 @@ func NewApp( app.evmutilKeeper.SetEvmKeeper(app.evmKeeper) + // It's important to note that the PFM Keeper must be initialized before the Transfer Keeper + app.packetForwardKeeper = packetforwardkeeper.NewKeeper( + appCodec, + keys[packetforwardtypes.StoreKey], + nil, // will be zero-value here, reference is set later on with SetTransferKeeper. + app.ibcKeeper.ChannelKeeper, + app.distrKeeper, + app.bankKeeper, + app.ibcKeeper.ChannelKeeper, + govAuthAddrStr, + ) + app.transferKeeper = ibctransferkeeper.NewKeeper( appCodec, keys[ibctransfertypes.StoreKey], ibctransferSubspace, - app.ibcKeeper.ChannelKeeper, + app.packetForwardKeeper, app.ibcKeeper.ChannelKeeper, &app.ibcKeeper.PortKeeper, app.accountKeeper, app.bankKeeper, scopedTransferKeeper, ) + app.packetForwardKeeper.SetTransferKeeper(app.transferKeeper) transferModule := transfer.NewAppModule(app.transferKeeper) - transferIBCModule := transfer.NewIBCModule(app.transferKeeper) + + // allow ibc packet forwarding for ibc transfers. + // transfer stack contains (from top to bottom): + // - Packet Forward Middleware + // - Transfer + var transferStack ibcporttypes.IBCModule + transferStack = transfer.NewIBCModule(app.transferKeeper) + transferStack = packetforward.NewIBCMiddleware( + transferStack, + app.packetForwardKeeper, + 0, // retries on timeout + packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, + packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, + ) // Create static IBC router, add transfer route, then set and seal it - ibcRouter := porttypes.NewRouter() - ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule) + ibcRouter := ibcporttypes.NewRouter() + ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack) app.ibcKeeper.SetRouter(ibcRouter) app.auctionKeeper = auctionkeeper.NewKeeper( @@ -789,6 +821,7 @@ func NewApp( slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper, slashingSubspace), consensus.NewAppModule(appCodec, app.consensusParamsKeeper), ibc.NewAppModule(app.ibcKeeper), + packetforward.NewAppModule(app.packetForwardKeeper, packetforwardSubspace), evm.NewAppModule(app.evmKeeper, app.accountKeeper), feemarket.NewAppModule(app.feeMarketKeeper, feemarketSubspace), upgrade.NewAppModule(&app.upgradeKeeper), @@ -870,6 +903,7 @@ func NewApp( earntypes.ModuleName, routertypes.ModuleName, consensusparamtypes.ModuleName, + packetforwardtypes.ModuleName, ) // Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list. @@ -914,6 +948,7 @@ func NewApp( communitytypes.ModuleName, metricstypes.ModuleName, consensusparamtypes.ModuleName, + packetforwardtypes.ModuleName, ) // Warning: Some init genesis methods must run before others. Ensure the dependencies are understood before modifying this list @@ -956,6 +991,7 @@ func NewApp( routertypes.ModuleName, metricstypes.ModuleName, consensusparamtypes.ModuleName, + packetforwardtypes.ModuleName, crisistypes.ModuleName, // runs the invariants at genesis, should run after other modules ) diff --git a/ci/env/kava-internal-testnet/genesis.json b/ci/env/kava-internal-testnet/genesis.json index 14f953d5..4ffe47c7 100644 --- a/ci/env/kava-internal-testnet/genesis.json +++ b/ci/env/kava-internal-testnet/genesis.json @@ -582,6 +582,10 @@ "denom": "erc20/axelar/wbtc", "amount": "1000000000" }, + { + "denom": "erc20/tether/usdt", + "amount": "100000000000" + }, { "denom": "hard", "amount": "1000000000" diff --git a/ci/env/kava-protonet/genesis.json b/ci/env/kava-protonet/genesis.json index 2454e3fe..f252771c 100644 --- a/ci/env/kava-protonet/genesis.json +++ b/ci/env/kava-protonet/genesis.json @@ -3000,6 +3000,12 @@ } }, "params": null, + "packetfowardmiddleware": { + "params": { + "fee_percentage": "0.000000000000000000" + }, + "in_flight_packets": {} + }, "pricefeed": { "params": { "markets": [ diff --git a/cmd/kava/cmd/app.go b/cmd/kava/cmd/app.go index fe5efa7b..b4bf2c80 100644 --- a/cmd/kava/cmd/app.go +++ b/cmd/kava/cmd/app.go @@ -31,6 +31,7 @@ import ( const ( flagMempoolEnableAuth = "mempool.enable-authentication" flagMempoolAuthAddresses = "mempool.authorized-addresses" + flagSkipLoadLatest = "skip-load-latest" ) // appCreator holds functions used by the sdk server to control the kava app. @@ -101,10 +102,15 @@ func (ac appCreator) newApp( chainID = appGenesis.ChainID } + skipLoadLatest := false + if appOpts.Get(flagSkipLoadLatest) != nil { + skipLoadLatest = cast.ToBool(appOpts.Get(flagSkipLoadLatest)) + } + return app.NewApp( logger, db, homeDir, traceStore, ac.encodingConfig, app.Options{ - SkipLoadLatest: false, + SkipLoadLatest: skipLoadLatest, SkipUpgradeHeights: skipUpgradeHeights, SkipGenesisInvariants: cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)), InvariantCheckPeriod: cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), diff --git a/cmd/kava/cmd/shard.go b/cmd/kava/cmd/shard.go index 215c2d82..942cd206 100644 --- a/cmd/kava/cmd/shard.go +++ b/cmd/kava/cmd/shard.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/kava-labs/kava/app" "github.com/spf13/cobra" dbm "github.com/cometbft/cometbft-db" @@ -23,9 +24,11 @@ import ( ) const ( - flagShardStartBlock = "start" - flagShardEndBlock = "end" - flagShardOnlyAppState = "only-app-state" + flagShardStartBlock = "start" + flagShardEndBlock = "end" + flagShardOnlyAppState = "only-app-state" + flagShardForceAppVersion = "force-app-version" + flagShardOnlyCometbftState = "only-cometbft-state" // TODO: --preserve flag for creating & operating on a copy? // allow using -1 to mean "latest" (perform no rollbacks) @@ -34,7 +37,7 @@ const ( func newShardCmd(opts ethermintserver.StartOptions) *cobra.Command { cmd := &cobra.Command{ - Use: "shard --home --start --end [--only-app-state]", + Use: "shard --home --start --end [--only-app-state] [--only-cometbft-state] [--force-app-version ]", Short: "Strip all blocks from the database outside of a given range", Long: `shard opens a local kava home directory's databases and removes all blocks outside a range defined by --start and --end. The range is inclusive of the end block. @@ -42,8 +45,14 @@ It works by first rolling back the latest state to the block before the end bloc Setting the end block to -1 signals to keep the latest block (no rollbacks). +The application.db can be loaded at a particular height via the --force-app-version option. This is useful if the sharding process is prematurely terminated while the application.db is being sharded. + The --only-app-state flag can be used to skip the pruning of the blockstore and cometbft state. This matches the functionality of the cosmos-sdk's "prune" command. Note that rolled back blocks will still affect all stores. +Similarly, the --only-cometbft-state flag skips pruning app state. This can be useful if the shard command is prematurely terminated during the shard process. + +The shard command only flags the iavl tree nodes for deletion. Actual removal from the databases will be performed when each database is compacted. + WARNING: this is a destructive action.`, Example: `Create a 1M block data shard (keeps blocks kava 1,000,000 to 2,000,000) $ kava shard --home path/to/.kava --start 1000000 --end 2000000 @@ -54,7 +63,9 @@ $ kava shard --home path/to/.kava --start 5000000 --end -1 Prune first 1M blocks _without_ affecting blockstore or cometBFT state: $ kava shard --home path/to/.kava --start 1000000 --end -1 --only-app-state`, RunE: func(cmd *cobra.Command, args []string) error { - // read & validate flags + ////////////////////////// + // parse & validate flags + ////////////////////////// startBlock, err := cmd.Flags().GetInt64(flagShardStartBlock) if err != nil { return err @@ -70,16 +81,23 @@ $ kava shard --home path/to/.kava --start 1000000 --end -1 --only-app-state`, if err != nil { return err } + forceAppVersion, err := cmd.Flags().GetInt64(flagShardForceAppVersion) + if err != nil { + return err + } + onlyCometbftState, err := cmd.Flags().GetBool(flagShardOnlyCometbftState) + if err != nil { + return err + } clientCtx := client.GetClientContextFromCmd(cmd) ctx := server.GetServerContextFromCmd(cmd) ctx.Config.SetRoot(clientCtx.HomeDir) - ////////////////////////////// - // Rollback state to endBlock - ////////////////////////////// - + //////////////////////// + // manage db connection + //////////////////////// // connect to database db, err := opts.DBOpener(ctx.Viper, clientCtx.HomeDir, server.GetAppDBBackend(ctx.Viper)) if err != nil { @@ -93,109 +111,59 @@ $ kava shard --home path/to/.kava --start 1000000 --end -1 --only-app-state`, } }() + /////////////////// + // load multistore + /////////////////// + // create app in order to load the multistore + // skip loading the latest version so the desired height can be manually loaded + ctx.Viper.Set("skip-load-latest", true) + + app := opts.AppCreator(ctx.Logger, db, nil, ctx.Viper).(*app.App) + if forceAppVersion == shardEndBlockLatest { + if err := app.LoadLatestVersion(); err != nil { + return err + } + } else { + if err := app.LoadVersion(forceAppVersion); err != nil { + return err + } + } // get the multistore - app := opts.AppCreator(ctx.Logger, db, nil, ctx.Viper) cms := app.CommitMultiStore() multistore, ok := cms.(*rootmulti.Store) if !ok { return fmt.Errorf("only sharding of rootmulti.Store type is supported") } - // handle desired endblock being latest - latest := multistore.LatestVersion() - fmt.Printf("latest height: %d\n", latest) - if endBlock == shardEndBlockLatest { - endBlock = latest - } - shardSize := endBlock - startBlock + 1 - - // error if requesting block range the database does not have - if endBlock > latest { - return fmt.Errorf("data does not contain end block (%d): latest version is %d", endBlock, latest) - } - - fmt.Printf("pruning data in %s down to heights %d - %d (%d blocks)\n", clientCtx.HomeDir, startBlock, endBlock, shardSize) - - // set pruning options to prevent no-ops from `PruneStores` - multistore.SetPruning(pruningtypes.PruningOptions{KeepRecent: uint64(shardSize), Interval: 0}) - - // rollback application state - if err = multistore.RollbackToVersion(endBlock); err != nil { - return fmt.Errorf("failed to rollback application state: %s", err) + //////////////////////// + // shard application.db + //////////////////////// + if !onlyCometbftState { + if err := shardApplicationDb(multistore, startBlock, endBlock); err != nil { + return err + } + } else { + fmt.Printf("[%s] skipping sharding of application.db\n", flagShardOnlyCometbftState) } + ////////////////////////////////// + // shard blockstore.db & state.db + ////////////////////////////////// // open block store & cometbft state blockStore, stateStore, err := openCometBftDbs(ctx.Config) if err != nil { return fmt.Errorf("failed to open cometbft dbs: %s", err) } - // prep for outputting progress repeatedly to same line - needsRollback := endBlock < latest - progress := "rolling back blockstore & cometbft state to height %d" - numChars := len(fmt.Sprintf(progress, latest)) - clearLine := fmt.Sprintf("\r%s\r", strings.Repeat(" ", numChars)) - printRollbackProgress := func(h int64) { - fmt.Print(clearLine) - fmt.Printf(progress, h) - } - - // rollback tendermint db - height := latest - for height > endBlock { - printRollbackProgress(height - 1) - height, _, err = tmstate.Rollback(blockStore, stateStore, true) - if err != nil { - return fmt.Errorf("failed to rollback tendermint state: %w", err) - } - } - - if needsRollback { - fmt.Println() - } else { - fmt.Printf("latest store height is already %d\n", latest) - } - - ////////////////////////////// - // Prune blocks to startBlock - ////////////////////////////// - - // enumerate all heights to prune - pruneHeights := make([]int64, 0, latest-shardSize) - for i := int64(1); i < startBlock; i++ { - pruneHeights = append(pruneHeights, i) - } - - if len(pruneHeights) > 0 { - // prune application state - fmt.Printf("pruning application state to height %d\n", startBlock) - if err := multistore.PruneStores(true, pruneHeights); err != nil { - return fmt.Errorf("failed to prune application state: %s", err) - } - } - - // get starting block of block store - baseBlock := blockStore.Base() - - // only prune if data exists, otherwise blockStore.PruneBlocks will panic - if !onlyAppState && baseBlock < startBlock { - // prune block store - fmt.Printf("pruning block store from %d - %d\n", baseBlock, startBlock) - if _, err := blockStore.PruneBlocks(startBlock); err != nil { - return fmt.Errorf("failed to prune block store (retainHeight=%d): %s", startBlock, err) - } - - // prune cometbft state - fmt.Printf("pruning cometbft state from %d - %d\n", baseBlock, startBlock) - if err := stateStore.PruneStates(baseBlock, startBlock); err != nil { - return fmt.Errorf("failed to prune cometbft state store (%d - %d): %s", baseBlock, startBlock, err) + if !onlyAppState { + if err := shardCometBftDbs(blockStore, stateStore, startBlock, endBlock); err != nil { + return err } } else { - fmt.Printf("blockstore and cometbft state begins at block %d\n", baseBlock) + fmt.Printf("[%s] skipping sharding of blockstore.db and state.db\n", flagShardOnlyAppState) + fmt.Printf("blockstore contains blocks %d - %d\n", blockStore.Base(), blockStore.Height()) } - // TODO: db compaction - return nil }, } @@ -204,10 +172,130 @@ $ kava shard --home path/to/.kava --start 1000000 --end -1 --only-app-state`, cmd.Flags().Int64(flagShardStartBlock, 1, "Start block of data shard (inclusive)") cmd.Flags().Int64(flagShardEndBlock, 0, "End block of data shard (inclusive)") cmd.Flags().Bool(flagShardOnlyAppState, false, "Skip pruning of blockstore & cometbft state") + cmd.Flags().Bool(flagShardOnlyCometbftState, false, "Skip pruning of application state") + cmd.Flags().Int64(flagShardForceAppVersion, shardEndBlockLatest, "Instead of loading latest, force set the version of the multistore that is loaded") return cmd } +// shardApplicationDb prunes the multistore up to startBlock and rolls it back to endBlock +func shardApplicationDb(multistore *rootmulti.Store, startBlock, endBlock int64) error { + ////////////////////////////// + // Rollback state to endBlock + ////////////////////////////// + // handle desired endblock being latest + latest := multistore.LastCommitID().Version + if latest == 0 { + return fmt.Errorf("failed to find latest height >0") + } + fmt.Printf("latest height: %d\n", latest) + if endBlock == shardEndBlockLatest { + endBlock = latest + } + shardSize := endBlock - startBlock + 1 + + // error if requesting block range the database does not have + if endBlock > latest { + return fmt.Errorf("data does not contain end block (%d): latest version is %d", endBlock, latest) + } + + fmt.Printf("pruning data down to heights %d - %d (%d blocks)\n", startBlock, endBlock, shardSize) + + // set pruning options to prevent no-ops from `PruneStores` + multistore.SetPruning(pruningtypes.PruningOptions{KeepRecent: uint64(shardSize), Interval: 0}) + + // rollback application state + if err := multistore.RollbackToVersion(endBlock); err != nil { + return fmt.Errorf("failed to rollback application state: %s", err) + } + + ////////////////////////////// + // Prune blocks to startBlock + ////////////////////////////// + // enumerate all heights to prune + pruneHeights := make([]int64, 0, latest-shardSize) + for i := int64(1); i < startBlock; i++ { + pruneHeights = append(pruneHeights, i) + } + + if len(pruneHeights) > 0 { + // prune application state + fmt.Printf("pruning application state to height %d\n", startBlock) + if err := multistore.PruneStores(true, pruneHeights); err != nil { + return fmt.Errorf("failed to prune application state: %s", err) + } + } + + return nil +} + +// shardCometBftDbs shrinks blockstore.db & state.db down to the desired block range +func shardCometBftDbs(blockStore *store.BlockStore, stateStore tmstate.Store, startBlock, endBlock int64) error { + var err error + latest := blockStore.Height() + if endBlock == shardEndBlockLatest { + endBlock = latest + } + + ////////////////////////////// + // Rollback state to endBlock + ////////////////////////////// + // prep for outputting progress repeatedly to same line + needsRollback := endBlock < latest + progress := "rolling back blockstore & cometbft state to height %d" + numChars := len(fmt.Sprintf(progress, latest)) + clearLine := fmt.Sprintf("\r%s\r", strings.Repeat(" ", numChars)) + printRollbackProgress := func(h int64) { + fmt.Print(clearLine) + fmt.Printf(progress, h) + } + + // rollback tendermint db + height := latest + for height > endBlock { + beforeRollbackHeight := height + printRollbackProgress(height - 1) + height, _, err = tmstate.Rollback(blockStore, stateStore, true) + if err != nil { + return fmt.Errorf("failed to rollback cometbft state: %w", err) + } + if beforeRollbackHeight == height { + return fmt.Errorf("attempting to rollback cometbft state height %d failed (no rollback performed)", height) + } + } + + if needsRollback { + fmt.Println() + } else { + fmt.Printf("latest store height is already %d\n", latest) + } + + ////////////////////////////// + // Prune blocks to startBlock + ////////////////////////////// + // get starting block of block store + baseBlock := blockStore.Base() + + // only prune if data exists, otherwise blockStore.PruneBlocks will panic + if baseBlock < startBlock { + // prune block store + fmt.Printf("pruning block store from %d - %d\n", baseBlock, startBlock) + if _, err := blockStore.PruneBlocks(startBlock); err != nil { + return fmt.Errorf("failed to prune block store (retainHeight=%d): %s", startBlock, err) + } + + // prune cometbft state + fmt.Printf("pruning cometbft state from %d - %d\n", baseBlock, startBlock) + if err := stateStore.PruneStates(baseBlock, startBlock); err != nil { + return fmt.Errorf("failed to prune cometbft state store (%d - %d): %s", baseBlock, startBlock, err) + } + } else { + fmt.Printf("blockstore and cometbft state begins at block %d\n", baseBlock) + } + + return nil +} + // inspired by https://github.com/Kava-Labs/cometbft/blob/277b0853db3f67865a55aa1c54f59790b5f591be/node/node.go#L234 func openCometBftDbs(config *tmconfig.Config) (blockStore *store.BlockStore, stateStore tmstate.Store, err error) { dbProvider := node.DefaultDBProvider diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 82b35968..eb95d96a 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -580,6 +580,24 @@ - [Msg](#kava.swap.v1beta1.Msg) +- [kava/validatorvesting/v1beta1/query.proto](#kava/validatorvesting/v1beta1/query.proto) + - [QueryCirculatingSupplyHARDRequest](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyHARDRequest) + - [QueryCirculatingSupplyHARDResponse](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyHARDResponse) + - [QueryCirculatingSupplyRequest](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyRequest) + - [QueryCirculatingSupplyResponse](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyResponse) + - [QueryCirculatingSupplySWPRequest](#kava.validatorvesting.v1beta1.QueryCirculatingSupplySWPRequest) + - [QueryCirculatingSupplySWPResponse](#kava.validatorvesting.v1beta1.QueryCirculatingSupplySWPResponse) + - [QueryCirculatingSupplyUSDXRequest](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyUSDXRequest) + - [QueryCirculatingSupplyUSDXResponse](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyUSDXResponse) + - [QueryTotalSupplyHARDRequest](#kava.validatorvesting.v1beta1.QueryTotalSupplyHARDRequest) + - [QueryTotalSupplyHARDResponse](#kava.validatorvesting.v1beta1.QueryTotalSupplyHARDResponse) + - [QueryTotalSupplyRequest](#kava.validatorvesting.v1beta1.QueryTotalSupplyRequest) + - [QueryTotalSupplyResponse](#kava.validatorvesting.v1beta1.QueryTotalSupplyResponse) + - [QueryTotalSupplyUSDXRequest](#kava.validatorvesting.v1beta1.QueryTotalSupplyUSDXRequest) + - [QueryTotalSupplyUSDXResponse](#kava.validatorvesting.v1beta1.QueryTotalSupplyUSDXResponse) + + - [Query](#kava.validatorvesting.v1beta1.Query) + - [Scalar Value Types](#scalar-value-types) @@ -7861,6 +7879,213 @@ Msg defines the swap Msg service. + +

Top

+ +## kava/validatorvesting/v1beta1/query.proto + + + + + +### QueryCirculatingSupplyHARDRequest +QueryCirculatingSupplyHARDRequest is the request type for the Query/CirculatingSupplyHARD RPC method + + + + + + + + +### QueryCirculatingSupplyHARDResponse +QueryCirculatingSupplyHARDResponse is the response type for the Query/CirculatingSupplyHARD RPC method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `amount` | [string](#string) | | | + + + + + + + + +### QueryCirculatingSupplyRequest +QueryCirculatingSupplyRequest is the request type for the Query/CirculatingSupply RPC method + + + + + + + + +### QueryCirculatingSupplyResponse +QueryCirculatingSupplyResponse is the response type for the Query/CirculatingSupply RPC method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `amount` | [string](#string) | | | + + + + + + + + +### QueryCirculatingSupplySWPRequest +QueryCirculatingSupplySWPRequest is the request type for the Query/CirculatingSupplySWP RPC method + + + + + + + + +### QueryCirculatingSupplySWPResponse +QueryCirculatingSupplySWPResponse is the response type for the Query/CirculatingSupplySWP RPC method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `amount` | [string](#string) | | | + + + + + + + + +### QueryCirculatingSupplyUSDXRequest +QueryCirculatingSupplyUSDXRequest is the request type for the Query/CirculatingSupplyUSDX RPC method + + + + + + + + +### QueryCirculatingSupplyUSDXResponse +QueryCirculatingSupplyUSDXResponse is the response type for the Query/CirculatingSupplyUSDX RPC method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `amount` | [string](#string) | | | + + + + + + + + +### QueryTotalSupplyHARDRequest +QueryTotalSupplyHARDRequest is the request type for the Query/TotalSupplyHARD RPC method + + + + + + + + +### QueryTotalSupplyHARDResponse +QueryTotalSupplyHARDResponse is the response type for the Query/TotalSupplyHARD RPC method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `amount` | [string](#string) | | | + + + + + + + + +### QueryTotalSupplyRequest +QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC method + + + + + + + + +### QueryTotalSupplyResponse +QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `amount` | [string](#string) | | | + + + + + + + + +### QueryTotalSupplyUSDXRequest +QueryTotalSupplyUSDXRequest is the request type for the Query/TotalSupplyUSDX RPC method + + + + + + + + +### QueryTotalSupplyUSDXResponse +QueryTotalSupplyUSDXResponse is the response type for the Query/TotalSupplyUSDX RPC method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `amount` | [string](#string) | | | + + + + + + + + + + + + + + +### Query +Query defines the gRPC querier service for validator-vesting module + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `CirculatingSupply` | [QueryCirculatingSupplyRequest](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyRequest) | [QueryCirculatingSupplyResponse](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyResponse) | CirculatingSupply returns the total amount of kava tokens in circulation | GET|/kava/validator-vesting/v1beta1/circulating_supply| +| `TotalSupply` | [QueryTotalSupplyRequest](#kava.validatorvesting.v1beta1.QueryTotalSupplyRequest) | [QueryTotalSupplyResponse](#kava.validatorvesting.v1beta1.QueryTotalSupplyResponse) | TotalSupply returns the total amount of kava tokens | GET|/kava/validator-vesting/v1beta1/total_supply| +| `CirculatingSupplyHARD` | [QueryCirculatingSupplyHARDRequest](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyHARDRequest) | [QueryCirculatingSupplyHARDResponse](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyHARDResponse) | CirculatingSupplyHARD returns the total amount of hard tokens in circulation | GET|/kava/validator-vesting/v1beta1/circulating_supply_hard| +| `CirculatingSupplyUSDX` | [QueryCirculatingSupplyUSDXRequest](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyUSDXRequest) | [QueryCirculatingSupplyUSDXResponse](#kava.validatorvesting.v1beta1.QueryCirculatingSupplyUSDXResponse) | CirculatingSupplyUSDX returns the total amount of usdx tokens in circulation | GET|/kava/validator-vesting/v1beta1/circulating_supply_usdx| +| `CirculatingSupplySWP` | [QueryCirculatingSupplySWPRequest](#kava.validatorvesting.v1beta1.QueryCirculatingSupplySWPRequest) | [QueryCirculatingSupplySWPResponse](#kava.validatorvesting.v1beta1.QueryCirculatingSupplySWPResponse) | CirculatingSupplySWP returns the total amount of swp tokens in circulation | GET|/kava/validator-vesting/v1beta1/circulating_supply_swp| +| `TotalSupplyHARD` | [QueryTotalSupplyHARDRequest](#kava.validatorvesting.v1beta1.QueryTotalSupplyHARDRequest) | [QueryTotalSupplyHARDResponse](#kava.validatorvesting.v1beta1.QueryTotalSupplyHARDResponse) | TotalSupplyHARD returns the total amount of hard tokens | GET|/kava/validator-vesting/v1beta1/total_supply_hard| +| `TotalSupplyUSDX` | [QueryTotalSupplyUSDXRequest](#kava.validatorvesting.v1beta1.QueryTotalSupplyUSDXRequest) | [QueryTotalSupplyUSDXResponse](#kava.validatorvesting.v1beta1.QueryTotalSupplyUSDXResponse) | TotalSupplyUSDX returns the total amount of usdx tokens | GET|/kava/validator-vesting/v1beta1/total_supply_usdx| + + + + + ## Scalar Value Types | .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | diff --git a/go.mod b/go.mod index a7bebac3..65ff4e0f 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/cosmos/cosmos-sdk v0.47.7 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.10 + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.2 github.com/cosmos/ibc-go/v7 v7.3.1 github.com/ethereum/go-ethereum v1.10.26 github.com/evmos/ethermint v0.21.0 @@ -133,6 +134,7 @@ require ( github.com/holiman/uint256 v1.2.1 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/huin/goupnp v1.0.3 // indirect + github.com/iancoleman/orderedmap v0.2.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect diff --git a/go.sum b/go.sum index 545843fa..64474a2b 100644 --- a/go.sum +++ b/go.sum @@ -416,6 +416,8 @@ github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoK github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.2 h1:6zjj+yIpMbCTRI2eJ2fXuflElENs3mrUSLH/TSWL8fk= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.2/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s= github.com/cosmos/ibc-go/v7 v7.3.1 h1:bil1IjnHdyWDASFYKfwdRiNtFP6WK3osW7QFEAgU4I8= github.com/cosmos/ibc-go/v7 v7.3.1/go.mod h1:wvx4pPBofe5ZdMNV3OFRxSI4auEP5Qfqf8JXLLNV04g= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -813,6 +815,8 @@ github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA= +github.com/iancoleman/orderedmap v0.2.0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= @@ -1292,6 +1296,8 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU= +go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= diff --git a/proto/kava/validatorvesting/v1beta1/query.proto b/proto/kava/validatorvesting/v1beta1/query.proto new file mode 100644 index 00000000..406c0713 --- /dev/null +++ b/proto/kava/validatorvesting/v1beta1/query.proto @@ -0,0 +1,131 @@ +syntax = "proto3"; +package kava.validatorvesting.v1beta1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/kava-labs/kava/x/validator-vesting/types"; +option (gogoproto.goproto_getters_all) = false; + +// Query defines the gRPC querier service for validator-vesting module +service Query { + // CirculatingSupply returns the total amount of kava tokens in circulation + rpc CirculatingSupply(QueryCirculatingSupplyRequest) returns (QueryCirculatingSupplyResponse) { + option (google.api.http).get = "/kava/validator-vesting/v1beta1/circulating_supply"; + } + + // TotalSupply returns the total amount of kava tokens + rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { + option (google.api.http).get = "/kava/validator-vesting/v1beta1/total_supply"; + } + + // CirculatingSupplyHARD returns the total amount of hard tokens in circulation + rpc CirculatingSupplyHARD(QueryCirculatingSupplyHARDRequest) returns (QueryCirculatingSupplyHARDResponse) { + option (google.api.http).get = "/kava/validator-vesting/v1beta1/circulating_supply_hard"; + } + + // CirculatingSupplyUSDX returns the total amount of usdx tokens in circulation + rpc CirculatingSupplyUSDX(QueryCirculatingSupplyUSDXRequest) returns (QueryCirculatingSupplyUSDXResponse) { + option (google.api.http).get = "/kava/validator-vesting/v1beta1/circulating_supply_usdx"; + } + + // CirculatingSupplySWP returns the total amount of swp tokens in circulation + rpc CirculatingSupplySWP(QueryCirculatingSupplySWPRequest) returns (QueryCirculatingSupplySWPResponse) { + option (google.api.http).get = "/kava/validator-vesting/v1beta1/circulating_supply_swp"; + } + + // TotalSupplyHARD returns the total amount of hard tokens + rpc TotalSupplyHARD(QueryTotalSupplyHARDRequest) returns (QueryTotalSupplyHARDResponse) { + option (google.api.http).get = "/kava/validator-vesting/v1beta1/total_supply_hard"; + } + + // TotalSupplyUSDX returns the total amount of usdx tokens + rpc TotalSupplyUSDX(QueryTotalSupplyUSDXRequest) returns (QueryTotalSupplyUSDXResponse) { + option (google.api.http).get = "/kava/validator-vesting/v1beta1/total_supply_usdx"; + } +} + +// QueryCirculatingSupplyRequest is the request type for the Query/CirculatingSupply RPC method +message QueryCirculatingSupplyRequest {} + +// QueryCirculatingSupplyResponse is the response type for the Query/CirculatingSupply RPC method +message QueryCirculatingSupplyResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC method +message QueryTotalSupplyRequest {} + +// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method +message QueryTotalSupplyResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryCirculatingSupplyHARDRequest is the request type for the Query/CirculatingSupplyHARD RPC method +message QueryCirculatingSupplyHARDRequest {} + +// QueryCirculatingSupplyHARDResponse is the response type for the Query/CirculatingSupplyHARD RPC method +message QueryCirculatingSupplyHARDResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryCirculatingSupplyUSDXRequest is the request type for the Query/CirculatingSupplyUSDX RPC method +message QueryCirculatingSupplyUSDXRequest {} + +// QueryCirculatingSupplyUSDXResponse is the response type for the Query/CirculatingSupplyUSDX RPC method +message QueryCirculatingSupplyUSDXResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryCirculatingSupplySWPRequest is the request type for the Query/CirculatingSupplySWP RPC method +message QueryCirculatingSupplySWPRequest {} + +// QueryCirculatingSupplySWPResponse is the response type for the Query/CirculatingSupplySWP RPC method +message QueryCirculatingSupplySWPResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryTotalSupplyHARDRequest is the request type for the Query/TotalSupplyHARD RPC method +message QueryTotalSupplyHARDRequest {} + +// QueryTotalSupplyHARDResponse is the response type for the Query/TotalSupplyHARD RPC method +message QueryTotalSupplyHARDResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryTotalSupplyUSDXRequest is the request type for the Query/TotalSupplyUSDX RPC method +message QueryTotalSupplyUSDXRequest {} + +// QueryTotalSupplyUSDXResponse is the response type for the Query/TotalSupplyUSDX RPC method +message QueryTotalSupplyUSDXResponse { + string amount = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} diff --git a/x/auction/client/common/query.go b/x/auction/client/common/query.go deleted file mode 100644 index f3bf6339..00000000 --- a/x/auction/client/common/query.go +++ /dev/null @@ -1,95 +0,0 @@ -package common - -import ( - "fmt" - "strings" - - errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - - "github.com/kava-labs/kava/x/auction/types" -) - -const ( - defaultPage = 1 - defaultLimit = 100 -) - -// QueryAuctionByID returns an auction from state if present or falls back to searching old blocks -func QueryAuctionByID(cliCtx client.Context, cdc *codec.Codec, queryRoute string, auctionID uint64) (types.Auction, int64, error) { - bz, err := cliCtx.LegacyAmino.MarshalJSON(types.NewQueryAuctionParams(auctionID)) - if err != nil { - return nil, 0, err - } - - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryGetAuction), bz) - - if err == nil { - var auction types.Auction - cliCtx.LegacyAmino.MustUnmarshalJSON(res, &auction) - - return auction, height, nil - } - - if err != nil && !strings.Contains(err.Error(), "auction not found") { - return nil, 0, err - } - - res, height, err = cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryNextAuctionID), nil) - if err != nil { - return nil, 0, err - } - - var nextAuctionID uint64 - cliCtx.LegacyAmino.MustUnmarshalJSON(res, &nextAuctionID) - - if auctionID >= nextAuctionID { - return nil, 0, errorsmod.Wrapf(types.ErrAuctionNotFound, "%d", auctionID) - } - - events := []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, "place_bid"), - fmt.Sprintf("%s.%s='%s'", types.EventTypeAuctionBid, types.AttributeKeyAuctionID, []byte(fmt.Sprintf("%d", auctionID))), - } - - // if the auction is closed, query for previous bid transactions - // note, will only fetch a maximum of 100 bids, so if an auction had more than that this - // query may fail to retreive the final state of the auction - searchResult, err := authtx.QueryTxsByEvents(cliCtx, events, defaultPage, defaultLimit, "") - if err != nil { - return nil, 0, err - } - - maxHeight := int64(0) - found := false - - for _, info := range searchResult.Txs { - for _, msg := range info.GetTx().GetMsgs() { - _, ok := msg.(*types.MsgPlaceBid) - if ok { - found = true - if info.Height > maxHeight { - maxHeight = info.Height - } - } - } - } - - if !found { - return nil, 0, errorsmod.Wrapf(types.ErrAuctionNotFound, "%d", auctionID) - } - - queryCLIContext := cliCtx.WithHeight(maxHeight) - res, height, err = queryCLIContext.QueryWithData(fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryGetAuction), bz) - if err != nil { - return nil, 0, err - } - - // Decode and print results - var auction types.Auction - cliCtx.LegacyAmino.MustUnmarshalJSON(res, &auction) - return auction, height, nil -} diff --git a/x/auction/types/querier.go b/x/auction/types/querier.go deleted file mode 100644 index a409de2d..00000000 --- a/x/auction/types/querier.go +++ /dev/null @@ -1,67 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // QueryGetAuction is the query path for querying one auction - QueryGetAuction = "auction" - // QueryGetAuctions is the query path for querying all auctions - QueryGetAuctions = "auctions" - // QueryGetParams is the query path for querying the global auction params - QueryGetParams = "params" - // QueryNextAuctionID is the query path for querying the id of the next auction - QueryNextAuctionID = "next-auction-id" -) - -// QueryAuctionParams params for query /auction/auction -type QueryAuctionParams struct { - AuctionID uint64 -} - -// NewQueryAuctionParams returns a new QueryAuctionParams -func NewQueryAuctionParams(id uint64) QueryAuctionParams { - return QueryAuctionParams{ - AuctionID: id, - } -} - -// QueryAllAuctionParams is the params for an auctions query -type QueryAllAuctionParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Type string `json:"type" yaml:"type"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` - Denom string `json:"denom" yaml:"denom"` - Phase string `json:"phase" yaml:"phase"` -} - -// NewQueryAllAuctionParams creates a new QueryAllAuctionParams -func NewQueryAllAuctionParams(page, limit int, aucType, aucDenom, aucPhase string, aucOwner sdk.AccAddress) QueryAllAuctionParams { - return QueryAllAuctionParams{ - Page: page, - Limit: limit, - Type: aucType, - Owner: aucOwner, - Denom: aucDenom, - Phase: aucPhase, - } -} - -// AuctionWithPhase augmented type for collateral auctions which includes auction phase for querying -type AuctionWithPhase struct { - Auction Auction `json:"auction" yaml:"auction"` - - Type string `json:"type" yaml:"type"` - Phase string `json:"phase" yaml:"phase"` -} - -// NewAuctionWithPhase returns new AuctionWithPhase -func NewAuctionWithPhase(a Auction) AuctionWithPhase { - return AuctionWithPhase{ - Auction: a, - Type: a.GetType(), - Phase: a.GetPhase(), - } -} diff --git a/x/bep3/types/querier.go b/x/bep3/types/querier.go deleted file mode 100644 index 63fa418d..00000000 --- a/x/bep3/types/querier.go +++ /dev/null @@ -1,83 +0,0 @@ -package types - -import ( - tmbytes "github.com/cometbft/cometbft/libs/bytes" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // QueryGetAssetSupply command for getting info about an asset's supply - QueryGetAssetSupply = "supply" - // QueryGetAssetSupplies command for getting a list of asset supplies - QueryGetAssetSupplies = "supplies" - // QueryGetAtomicSwap command for getting info about an atomic swap - QueryGetAtomicSwap = "swap" - // QueryGetAtomicSwaps command for getting a list of atomic swaps - QueryGetAtomicSwaps = "swaps" - // QueryGetParams command for getting module params - QueryGetParams = "parameters" -) - -// Legacy querier requests - -// QueryAssetSupply contains the params for query 'custom/bep3/supply' -type QueryAssetSupply struct { - Denom string `json:"denom" yaml:"denom"` -} - -// NewQueryAssetSupply creates a new QueryAssetSupply -func NewQueryAssetSupply(denom string) QueryAssetSupply { - return QueryAssetSupply{ - Denom: denom, - } -} - -// QueryAssetSupplies contains the params for an AssetSupplies query -type QueryAssetSupplies struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` -} - -// NewQueryAssetSupplies creates a new QueryAssetSupplies -func NewQueryAssetSupplies(page int, limit int) QueryAssetSupplies { - return QueryAssetSupplies{ - Page: page, - Limit: limit, - } -} - -// QueryAtomicSwapByID contains the params for query 'custom/bep3/swap' -type QueryAtomicSwapByID struct { - SwapID tmbytes.HexBytes `json:"swap_id" yaml:"swap_id"` -} - -// NewQueryAtomicSwapByID creates a new QueryAtomicSwapByID -func NewQueryAtomicSwapByID(swapBytes tmbytes.HexBytes) QueryAtomicSwapByID { - return QueryAtomicSwapByID{ - SwapID: swapBytes, - } -} - -// QueryAtomicSwaps contains the params for an AtomicSwaps query -type QueryAtomicSwaps struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Involve sdk.AccAddress `json:"involve" yaml:"involve"` - Expiration uint64 `json:"expiration" yaml:"expiration"` - Status SwapStatus `json:"status" yaml:"status"` - Direction SwapDirection `json:"direction" yaml:"direction"` -} - -// NewQueryAtomicSwaps creates a new instance of QueryAtomicSwaps -func NewQueryAtomicSwaps(page, limit int, involve sdk.AccAddress, expiration uint64, - status SwapStatus, direction SwapDirection, -) QueryAtomicSwaps { - return QueryAtomicSwaps{ - Page: page, - Limit: limit, - Involve: involve, - Expiration: expiration, - Status: status, - Direction: direction, - } -} diff --git a/x/cdp/types/querier.go b/x/cdp/types/querier.go index 0144ca89..f3e6a69b 100644 --- a/x/cdp/types/querier.go +++ b/x/cdp/types/querier.go @@ -4,36 +4,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// Querier routes for the cdp module -const ( - QueryGetCdp = "cdp" - QueryGetCdps = "cdps" - QueryGetCdpDeposits = "deposits" - QueryGetCdpsByCollateralization = "ratio" // legacy query, maintained for REST API - QueryGetCdpsByCollateralType = "collateralType" // legacy query, maintained for REST API - QueryGetParams = "params" - QueryGetAccounts = "accounts" - QueryGetTotalPrincipal = "totalPrincipal" - QueryGetTotalCollateral = "totalCollateral" - RestOwner = "owner" - RestCollateralType = "collateral-type" - RestRatio = "ratio" -) - -// QueryCdpParams params for query /cdp/cdp -type QueryCdpParams struct { - CollateralType string // get CDPs with this collateral type - Owner sdk.AccAddress // get CDPs belonging to this owner -} - -// NewQueryCdpParams returns QueryCdpParams -func NewQueryCdpParams(owner sdk.AccAddress, collateralType string) QueryCdpParams { - return QueryCdpParams{ - Owner: owner, - CollateralType: collateralType, - } -} - // QueryCdpsParams is the params for a filtered CDP query type QueryCdpsParams struct { Page int `json:"page" yaml:"page"` @@ -55,67 +25,3 @@ func NewQueryCdpsParams(page, limit int, collateralType string, owner sdk.AccAdd Ratio: ratio, } } - -// QueryCdpDeposits params for query /cdp/deposits -type QueryCdpDeposits struct { - CollateralType string // get CDPs with this collateral type - Owner sdk.AccAddress // get CDPs belonging to this owner -} - -// NewQueryCdpDeposits returns QueryCdpDeposits -func NewQueryCdpDeposits(owner sdk.AccAddress, collateralType string) QueryCdpDeposits { - return QueryCdpDeposits{ - Owner: owner, - CollateralType: collateralType, - } -} - -// QueryCdpsByCollateralTypeParams params for query /cdp/cdps/{denom} -type QueryCdpsByCollateralTypeParams struct { - CollateralType string // get CDPs with this collateral type -} - -// NewQueryCdpsByCollateralTypeParams returns QueryCdpsByCollateralTypeParams -func NewQueryCdpsByCollateralTypeParams(collateralType string) QueryCdpsByCollateralTypeParams { - return QueryCdpsByCollateralTypeParams{ - CollateralType: collateralType, - } -} - -// QueryCdpsByRatioParams params for query /cdp/cdps/ratio -type QueryCdpsByRatioParams struct { - CollateralType string - Ratio sdk.Dec // get CDPs below this collateral:debt ratio -} - -// NewQueryCdpsByRatioParams returns QueryCdpsByRatioParams -func NewQueryCdpsByRatioParams(collateralType string, ratio sdk.Dec) QueryCdpsByRatioParams { - return QueryCdpsByRatioParams{ - CollateralType: collateralType, - Ratio: ratio, - } -} - -// QueryGetTotalPrincipalParams params for query /cdp/totalPrincipal -type QueryGetTotalPrincipalParams struct { - CollateralType string -} - -// NewQueryGetTotalPrincipalParams returns QueryGetTotalPrincipalParams -func NewQueryGetTotalPrincipalParams(collateralType string) QueryGetTotalPrincipalParams { - return QueryGetTotalPrincipalParams{ - CollateralType: collateralType, - } -} - -// QueryGetTotalCollateralParams params for query /cdp/totalCollateral -type QueryGetTotalCollateralParams struct { - CollateralType string -} - -// NewQueryGetTotalCollateralParams returns QueryGetTotalCollateralParams -func NewQueryGetTotalCollateralParams(collateralType string) QueryGetTotalCollateralParams { - return QueryGetTotalCollateralParams{ - CollateralType: collateralType, - } -} diff --git a/x/committee/client/common/query.go b/x/committee/client/common/query.go index b8ef61d6..5efe31da 100644 --- a/x/committee/client/common/query.go +++ b/x/committee/client/common/query.go @@ -1,14 +1,9 @@ package common import ( - "context" "fmt" - "strings" - "time" - errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" @@ -62,99 +57,3 @@ func QueryProposer(cliCtx client.Context, proposalID uint64) (Proposer, error) { return Proposer{}, fmt.Errorf("failed to find the proposer for proposalID %d", proposalID) } - -// QueryProposalByID returns a proposal from state if present or fallbacks to searching old blocks -func QueryProposalByID(cliCtx client.Context, cdc *codec.LegacyAmino, queryRoute string, proposalID uint64) (*types.Proposal, int64, error) { - bz, err := cdc.MarshalJSON(types.NewQueryProposalParams(proposalID)) - if err != nil { - return nil, 0, err - } - - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryProposal), bz) - - if err == nil { - var proposal types.Proposal - cdc.MustUnmarshalJSON(res, &proposal) - - return &proposal, height, nil - } - - // NOTE: !errors.Is(err, types.ErrUnknownProposal) does not work here - if err != nil && !strings.Contains(err.Error(), "proposal not found") { - return nil, 0, err - } - - res, height, err = cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryNextProposalID), nil) - if err != nil { - return nil, 0, err - } - - var nextProposalID uint64 - cdc.MustUnmarshalJSON(res, &nextProposalID) - - if proposalID >= nextProposalID { - return nil, 0, errorsmod.Wrapf(types.ErrUnknownProposal, "%d", proposalID) - } - - events := []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgSubmitProposal), - fmt.Sprintf("%s.%s='%s'", types.EventTypeProposalSubmit, types.AttributeKeyProposalID, []byte(fmt.Sprintf("%d", proposalID))), - } - - searchResult, err := authtx.QueryTxsByEvents(cliCtx, events, defaultPage, defaultLimit, "") - if err != nil { - return nil, 0, err - } - - for _, info := range searchResult.Txs { - for _, msg := range info.GetTx().GetMsgs() { - if subMsg, ok := msg.(*types.MsgSubmitProposal); ok { - deadline, err := calculateDeadline(cliCtx, cdc, queryRoute, subMsg.CommitteeID, info.Height) - if err != nil { - return nil, 0, err - } - proposal, err := types.NewProposal(subMsg.GetPubProposal(), proposalID, subMsg.CommitteeID, deadline) - if err != nil { - return nil, 0, err - } - return &proposal, height, nil - } - } - } - - return nil, 0, errorsmod.Wrapf(types.ErrUnknownProposal, "%d", proposalID) -} - -// calculateDeadline returns the proposal deadline for a committee and block height -func calculateDeadline(cliCtx client.Context, cdc *codec.LegacyAmino, queryRoute string, committeeID uint64, blockHeight int64) (time.Time, error) { - var deadline time.Time - - bz, err := cdc.MarshalJSON(types.NewQueryCommitteeParams(committeeID)) - if err != nil { - return deadline, err - } - - res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryCommittee), bz) - if err != nil { - return deadline, err - } - - var committee types.Committee - err = cdc.UnmarshalJSON(res, &committee) - if err != nil { - return deadline, err - } - - node, err := cliCtx.GetNode() - if err != nil { - return deadline, err - } - - resultBlock, err := node.Block(context.Background(), &blockHeight) - if err != nil { - return deadline, err - } - - deadline = resultBlock.Block.Header.Time.Add(committee.GetProposalDuration()) - return deadline, nil -} diff --git a/x/committee/types/querier.go b/x/committee/types/querier.go deleted file mode 100644 index 29970036..00000000 --- a/x/committee/types/querier.go +++ /dev/null @@ -1,62 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// Query endpoints supported by the Querier -const ( - QueryCommittees = "committees" - QueryCommittee = "committee" - QueryProposals = "proposals" - QueryProposal = "proposal" - QueryNextProposalID = "next-proposal-id" - QueryVotes = "votes" - QueryVote = "vote" - QueryTally = "tally" - QueryRawParams = "raw_params" -) - -type QueryCommitteeParams struct { - CommitteeID uint64 `json:"committee_id" yaml:"committee_id"` -} - -func NewQueryCommitteeParams(committeeID uint64) QueryCommitteeParams { - return QueryCommitteeParams{ - CommitteeID: committeeID, - } -} - -type QueryProposalParams struct { - ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` -} - -func NewQueryProposalParams(proposalID uint64) QueryProposalParams { - return QueryProposalParams{ - ProposalID: proposalID, - } -} - -type QueryVoteParams struct { - ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` - Voter sdk.AccAddress `json:"voter" yaml:"voter"` -} - -func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams { - return QueryVoteParams{ - ProposalID: proposalID, - Voter: voter, - } -} - -type QueryRawParamsParams struct { - Subspace string - Key string -} - -func NewQueryRawParamsParams(subspace, key string) QueryRawParamsParams { - return QueryRawParamsParams{ - Subspace: subspace, - Key: key, - } -} diff --git a/x/hard/types/querier.go b/x/hard/types/querier.go deleted file mode 100644 index c515cf0d..00000000 --- a/x/hard/types/querier.go +++ /dev/null @@ -1,200 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// Querier routes for the hard module -const ( - QueryGetParams = "params" - QueryGetModuleAccounts = "accounts" - QueryGetDeposits = "deposits" - QueryGetUnsyncedDeposits = "unsynced-deposits" - QueryGetTotalDeposited = "total-deposited" - QueryGetBorrows = "borrows" - QueryGetUnsyncedBorrows = "unsynced-borrows" - QueryGetTotalBorrowed = "total-borrowed" - QueryGetInterestRate = "interest-rate" - QueryGetReserves = "reserves" - QueryGetInterestFactors = "interest-factors" -) - -// QueryDepositsParams is the params for a filtered deposit query -type QueryDepositsParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Denom string `json:"denom" yaml:"denom"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` -} - -// NewQueryDepositsParams creates a new QueryDepositsParams -func NewQueryDepositsParams(page, limit int, denom string, owner sdk.AccAddress) QueryDepositsParams { - return QueryDepositsParams{ - Page: page, - Limit: limit, - Denom: denom, - Owner: owner, - } -} - -// QueryUnsyncedDepositsParams is the params for a filtered unsynced deposit query. -type QueryUnsyncedDepositsParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Denom string `json:"denom" yaml:"denom"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` -} - -// NewQueryUnsyncedDepositsParams creates a new QueryUnsyncedDepositsParams -func NewQueryUnsyncedDepositsParams(page, limit int, denom string, owner sdk.AccAddress) QueryUnsyncedDepositsParams { - return QueryUnsyncedDepositsParams{ - Page: page, - Limit: limit, - Denom: denom, - Owner: owner, - } -} - -// QueryAccountParams is the params for a filtered module account query -type QueryAccountParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Name string `json:"name" yaml:"name"` -} - -// NewQueryAccountParams returns QueryAccountParams -func NewQueryAccountParams(page, limit int, name string) QueryAccountParams { - return QueryAccountParams{ - Page: page, - Limit: limit, - Name: name, - } -} - -// ModAccountWithCoins includes the module account with its coins -type ModAccountWithCoins struct { - Account authtypes.ModuleAccountI `json:"account" yaml:"account"` - Coins sdk.Coins `json:"coins" yaml:"coins"` -} - -// QueryBorrowsParams is the params for a filtered borrows query -type QueryBorrowsParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` - Denom string `json:"denom" yaml:"denom"` -} - -// NewQueryBorrowsParams creates a new QueryBorrowsParams -func NewQueryBorrowsParams(page, limit int, owner sdk.AccAddress, denom string) QueryBorrowsParams { - return QueryBorrowsParams{ - Page: page, - Limit: limit, - Owner: owner, - Denom: denom, - } -} - -// QueryUnsyncedBorrowsParams is the params for a filtered unsynced borrows query -type QueryUnsyncedBorrowsParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` - Denom string `json:"denom" yaml:"denom"` -} - -// NewQueryUnsyncedBorrowsParams creates a new QueryUnsyncedBorrowsParams -func NewQueryUnsyncedBorrowsParams(page, limit int, owner sdk.AccAddress, denom string) QueryUnsyncedBorrowsParams { - return QueryUnsyncedBorrowsParams{ - Page: page, - Limit: limit, - Owner: owner, - Denom: denom, - } -} - -// QueryTotalBorrowedParams is the params for a filtered total borrowed coins query -type QueryTotalBorrowedParams struct { - Denom string `json:"denom" yaml:"denom"` -} - -// NewQueryTotalBorrowedParams creates a new QueryTotalBorrowedParams -func NewQueryTotalBorrowedParams(denom string) QueryTotalBorrowedParams { - return QueryTotalBorrowedParams{ - Denom: denom, - } -} - -// QueryTotalDepositedParams is the params for a filtered total deposited coins query -type QueryTotalDepositedParams struct { - Denom string `json:"denom" yaml:"denom"` -} - -// NewQueryTotalDepositedParams creates a new QueryTotalDepositedParams -func NewQueryTotalDepositedParams(denom string) QueryTotalDepositedParams { - return QueryTotalDepositedParams{ - Denom: denom, - } -} - -// QueryInterestRateParams is the params for a filtered interest rate query -type QueryInterestRateParams struct { - Denom string `json:"denom" yaml:"denom"` -} - -// NewQueryInterestRateParams creates a new QueryInterestRateParams -func NewQueryInterestRateParams(denom string) QueryInterestRateParams { - return QueryInterestRateParams{ - Denom: denom, - } -} - -// NewMoneyMarketInterestRate returns a new instance of MoneyMarketInterestRate -func NewMoneyMarketInterestRate(denom string, supplyInterestRate, borrowInterestRate sdk.Dec) MoneyMarketInterestRate { - return MoneyMarketInterestRate{ - Denom: denom, - SupplyInterestRate: supplyInterestRate.String(), - BorrowInterestRate: borrowInterestRate.String(), - } -} - -// MoneyMarketInterestRates is a slice of MoneyMarketInterestRate -type MoneyMarketInterestRates []MoneyMarketInterestRate - -// QueryReservesParams is the params for a filtered reserves query -type QueryReservesParams struct { - Denom string `json:"denom" yaml:"denom"` -} - -// NewQueryReservesParams creates a new QueryReservesParams -func NewQueryReservesParams(denom string) QueryReservesParams { - return QueryReservesParams{ - Denom: denom, - } -} - -// QueryInterestFactorsParams is the params for a filtered interest factors query -type QueryInterestFactorsParams struct { - Denom string `json:"denom" yaml:"denom"` -} - -// NewQueryInterestFactorsParams creates a new QueryInterestFactorsParams -func NewQueryInterestFactorsParams(denom string) QueryInterestFactorsParams { - return QueryInterestFactorsParams{ - Denom: denom, - } -} - -// NewInterestFactor returns a new instance of InterestFactor -func NewInterestFactor(denom string, supplyInterestFactor, borrowInterestFactor sdk.Dec) InterestFactor { - return InterestFactor{ - Denom: denom, - SupplyInterestFactor: supplyInterestFactor.String(), - BorrowInterestFactor: borrowInterestFactor.String(), - } -} - -// InterestFactors is a slice of InterestFactor -type InterestFactors []InterestFactor diff --git a/x/hard/types/query.go b/x/hard/types/query.go new file mode 100644 index 00000000..ef91d134 --- /dev/null +++ b/x/hard/types/query.go @@ -0,0 +1,7 @@ +package types + +// MoneyMarketInterestRates is a slice of MoneyMarketInterestRate +type MoneyMarketInterestRates []MoneyMarketInterestRate + +// InterestFactors is a slice of InterestFactor +type InterestFactors []InterestFactor diff --git a/x/incentive/client/cli/query.go b/x/incentive/client/cli/query.go index 6963edab..96bc7526 100644 --- a/x/incentive/client/cli/query.go +++ b/x/incentive/client/cli/query.go @@ -1,6 +1,7 @@ package cli import ( + "context" "fmt" "strings" @@ -11,6 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/types" ) @@ -19,16 +21,16 @@ const ( flagType = "type" flagUnsynced = "unsynced" flagDenom = "denom" - - typeDelegator = "delegator" - typeHard = "hard" - typeUSDXMinting = "usdx-minting" - typeSwap = "swap" - typeSavings = "savings" - typeEarn = "earn" ) -var rewardTypes = []string{typeDelegator, typeHard, typeUSDXMinting, typeSwap, typeEarn} +var rewardTypes = []string{ + keeper.RewardTypeHard, + keeper.RewardTypeUSDXMinting, + keeper.RewardTypeDelegator, + keeper.RewardTypeSwap, + keeper.RewardTypeSavings, + keeper.RewardTypeEarn, +} // GetQueryCmd returns the cli query commands for the incentive module func GetQueryCmd() *cobra.Command { @@ -41,6 +43,7 @@ func GetQueryCmd() *cobra.Command { queryParamsCmd(), queryRewardsCmd(), queryRewardFactorsCmd(), + queryApyCmd(), } for _, cmd := range cmds { @@ -79,8 +82,6 @@ func queryRewardsCmd() *cobra.Command { return err } - page, _ := cmd.Flags().GetInt(flags.FlagPage) - limit, _ := cmd.Flags().GetInt(flags.FlagLimit) strOwner, _ := cmd.Flags().GetString(flagOwner) strType, _ := cmd.Flags().GetString(flagType) boolUnsynced, _ := cmd.Flags().GetBool(flagUnsynced) @@ -93,109 +94,18 @@ func queryRewardsCmd() *cobra.Command { } } - switch strings.ToLower(strType) { - case typeHard: - params := types.NewQueryRewardsParams(page, limit, owner, boolUnsynced) - claims, err := executeHardRewardsQuery(cliCtx, params) - if err != nil { - return err - } - return cliCtx.PrintObjectLegacy(claims) - case typeUSDXMinting: - params := types.NewQueryRewardsParams(page, limit, owner, boolUnsynced) - claims, err := executeUSDXMintingRewardsQuery(cliCtx, params) - if err != nil { - return err - } - return cliCtx.PrintObjectLegacy(claims) - case typeDelegator: - params := types.NewQueryRewardsParams(page, limit, owner, boolUnsynced) - claims, err := executeDelegatorRewardsQuery(cliCtx, params) - if err != nil { - return err - } - return cliCtx.PrintObjectLegacy(claims) - case typeSwap: - params := types.NewQueryRewardsParams(page, limit, owner, boolUnsynced) - claims, err := executeSwapRewardsQuery(cliCtx, params) - if err != nil { - return err - } - return cliCtx.PrintObjectLegacy(claims) - case typeSavings: - params := types.NewQueryRewardsParams(page, limit, owner, boolUnsynced) - claims, err := executeSavingsRewardsQuery(cliCtx, params) - if err != nil { - return err - } - return cliCtx.PrintObjectLegacy(claims) - case typeEarn: - params := types.NewQueryRewardsParams(page, limit, owner, boolUnsynced) - claims, err := executeEarnRewardsQuery(cliCtx, params) - if err != nil { - return err - } - return cliCtx.PrintObjectLegacy(claims) - default: - params := types.NewQueryRewardsParams(page, limit, owner, boolUnsynced) - - hardClaims, err := executeHardRewardsQuery(cliCtx, params) - if err != nil { - return err - } - usdxMintingClaims, err := executeUSDXMintingRewardsQuery(cliCtx, params) - if err != nil { - return err - } - delegatorClaims, err := executeDelegatorRewardsQuery(cliCtx, params) - if err != nil { - return err - } - swapClaims, err := executeSwapRewardsQuery(cliCtx, params) - if err != nil { - return err - } - savingsClaims, err := executeSavingsRewardsQuery(cliCtx, params) - if err != nil { - return err - } - earnClaims, err := executeEarnRewardsQuery(cliCtx, params) - if err != nil { - return err - } - - if len(hardClaims) > 0 { - if err := cliCtx.PrintObjectLegacy(hardClaims); err != nil { - return err - } - } - if len(usdxMintingClaims) > 0 { - if err := cliCtx.PrintObjectLegacy(usdxMintingClaims); err != nil { - return err - } - } - if len(delegatorClaims) > 0 { - if err := cliCtx.PrintObjectLegacy(delegatorClaims); err != nil { - return err - } - } - if len(swapClaims) > 0 { - if err := cliCtx.PrintObjectLegacy(swapClaims); err != nil { - return err - } - } - if len(savingsClaims) > 0 { - if err := cliCtx.PrintObjectLegacy(savingsClaims); err != nil { - return err - } - } - if len(earnClaims) > 0 { - if err := cliCtx.PrintObjectLegacy(earnClaims); err != nil { - return err - } - } + rewardType := strings.ToLower(strType) + queryClient := types.NewQueryClient(cliCtx) + request := types.QueryRewardsRequest{ + RewardType: rewardType, + Owner: owner.String(), + Unsynchronized: boolUnsynced, } - return nil + rewards, err := queryClient.Rewards(context.Background(), &request) + if err != nil { + return err + } + return cliCtx.PrintProto(rewards) }, } cmd.Flags().String(flagOwner, "", "(optional) filter by owner address") @@ -218,20 +128,12 @@ func queryParamsCmd() *cobra.Command { return err } - // Query - route := fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetParams) - res, height, err := cliCtx.QueryWithData(route, nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var params types.Params - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, ¶ms); err != nil { - return fmt.Errorf("failed to unmarshal params: %w", err) - } - return cliCtx.PrintObjectLegacy(params) + return cliCtx.PrintProto(res) }, } } @@ -248,154 +150,36 @@ func queryRewardFactorsCmd() *cobra.Command { return err } - // Execute query - route := fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetRewardFactors) - res, height, err := cliCtx.QueryWithData(route, nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.RewardFactors(context.Background(), &types.QueryRewardFactorsRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var response types.QueryGetRewardFactorsResponse - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &response); err != nil { - return fmt.Errorf("failed to unmarshal reward factors: %w", err) - } - return cliCtx.PrintObjectLegacy(response) + return cliCtx.PrintProto(res) }, } cmd.Flags().String(flagDenom, "", "(optional) filter reward factors by denom") return cmd } -func executeHardRewardsQuery(cliCtx client.Context, params types.QueryRewardsParams) (types.HardLiquidityProviderClaims, error) { - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - return types.HardLiquidityProviderClaims{}, err +func queryApyCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "apy", + Short: "queries incentive reward apy for a reward", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + cliCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.Apy(context.Background(), &types.QueryApyRequest{}) + if err != nil { + return err + } + return cliCtx.PrintProto(res) + }, } - - route := fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetHardRewards) - res, height, err := cliCtx.QueryWithData(route, bz) - if err != nil { - return types.HardLiquidityProviderClaims{}, err - } - - cliCtx = cliCtx.WithHeight(height) - - var claims types.HardLiquidityProviderClaims - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &claims); err != nil { - return types.HardLiquidityProviderClaims{}, fmt.Errorf("failed to unmarshal claims: %w", err) - } - - return claims, nil -} - -func executeUSDXMintingRewardsQuery(cliCtx client.Context, params types.QueryRewardsParams) (types.USDXMintingClaims, error) { - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - return types.USDXMintingClaims{}, err - } - - route := fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetUSDXMintingRewards) - res, height, err := cliCtx.QueryWithData(route, bz) - if err != nil { - return types.USDXMintingClaims{}, err - } - - cliCtx = cliCtx.WithHeight(height) - - var claims types.USDXMintingClaims - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &claims); err != nil { - return types.USDXMintingClaims{}, fmt.Errorf("failed to unmarshal claims: %w", err) - } - - return claims, nil -} - -func executeDelegatorRewardsQuery(cliCtx client.Context, params types.QueryRewardsParams) (types.DelegatorClaims, error) { - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - return types.DelegatorClaims{}, err - } - - route := fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetDelegatorRewards) - res, height, err := cliCtx.QueryWithData(route, bz) - if err != nil { - return types.DelegatorClaims{}, err - } - - cliCtx = cliCtx.WithHeight(height) - - var claims types.DelegatorClaims - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &claims); err != nil { - return types.DelegatorClaims{}, fmt.Errorf("failed to unmarshal claims: %w", err) - } - - return claims, nil -} - -func executeSwapRewardsQuery(cliCtx client.Context, params types.QueryRewardsParams) (types.SwapClaims, error) { - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - return types.SwapClaims{}, err - } - - route := fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetSwapRewards) - res, height, err := cliCtx.QueryWithData(route, bz) - if err != nil { - return types.SwapClaims{}, err - } - - cliCtx = cliCtx.WithHeight(height) - - var claims types.SwapClaims - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &claims); err != nil { - return types.SwapClaims{}, fmt.Errorf("failed to unmarshal claims: %w", err) - } - - return claims, nil -} - -func executeSavingsRewardsQuery(cliCtx client.Context, params types.QueryRewardsParams) (types.SavingsClaims, error) { - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - return types.SavingsClaims{}, err - } - - route := fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetSavingsRewards) - res, height, err := cliCtx.QueryWithData(route, bz) - if err != nil { - return types.SavingsClaims{}, err - } - - cliCtx = cliCtx.WithHeight(height) - - var claims types.SavingsClaims - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &claims); err != nil { - return types.SavingsClaims{}, fmt.Errorf("failed to unmarshal claims: %w", err) - } - - return claims, nil -} - -func executeEarnRewardsQuery(cliCtx client.Context, params types.QueryRewardsParams) (types.EarnClaims, error) { - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - return types.EarnClaims{}, err - } - - route := fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetEarnRewards) - res, height, err := cliCtx.QueryWithData(route, bz) - if err != nil { - return types.EarnClaims{}, err - } - - cliCtx = cliCtx.WithHeight(height) - - var claims types.EarnClaims - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &claims); err != nil { - return types.EarnClaims{}, fmt.Errorf("failed to unmarshal claims: %w", err) - } - - return claims, nil + return cmd } diff --git a/x/incentive/types/querier.go b/x/incentive/types/querier.go deleted file mode 100644 index de78529a..00000000 --- a/x/incentive/types/querier.go +++ /dev/null @@ -1,79 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// Querier routes for the incentive module -const ( - QueryGetHardRewards = "hard-rewards" - QueryGetUSDXMintingRewards = "usdx-minting-rewards" - QueryGetDelegatorRewards = "delegator-rewards" - QueryGetSwapRewards = "swap-rewards" - QueryGetSavingsRewards = "savings-rewards" - QueryGetEarnRewards = "earn-rewards" - QueryGetRewardFactors = "reward-factors" - QueryGetParams = "parameters" - QueryGetAPYs = "apys" - - RestClaimCollateralType = "collateral_type" - RestClaimOwner = "owner" - RestClaimType = "type" - RestUnsynced = "unsynced" -) - -// QueryRewardsParams params for query /incentive/rewards/ -type QueryRewardsParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` - Unsynchronized bool `json:"unsynchronized" yaml:"unsynchronized"` -} - -// NewQueryRewardsParams returns QueryRewardsParams -func NewQueryRewardsParams(page, limit int, owner sdk.AccAddress, unsynchronized bool) QueryRewardsParams { - return QueryRewardsParams{ - Page: page, - Limit: limit, - Owner: owner, - Unsynchronized: unsynchronized, - } -} - -// QueryGetRewardFactorsResponse holds the response to a reward factor query -type QueryGetRewardFactorsResponse struct { - USDXMintingRewardFactors RewardIndexes `json:"usdx_minting_reward_factors" yaml:"usdx_minting_reward_factors"` - HardSupplyRewardFactors MultiRewardIndexes `json:"hard_supply_reward_factors" yaml:"hard_supply_reward_factors"` - HardBorrowRewardFactors MultiRewardIndexes `json:"hard_borrow_reward_factors" yaml:"hard_borrow_reward_factors"` - DelegatorRewardFactors MultiRewardIndexes `json:"delegator_reward_factors" yaml:"delegator_reward_factors"` - SwapRewardFactors MultiRewardIndexes `json:"swap_reward_factors" yaml:"swap_reward_factors"` - SavingsRewardFactors MultiRewardIndexes `json:"savings_reward_factors" yaml:"savings_reward_factors"` - EarnRewardFactors MultiRewardIndexes `json:"earn_reward_factors" yaml:"earn_reward_factors"` -} - -// NewQueryGetRewardFactorsResponse returns a new instance of QueryAllRewardFactorsResponse -func NewQueryGetRewardFactorsResponse(usdxMintingFactors RewardIndexes, supplyFactors, - hardBorrowFactors, delegatorFactors, swapFactors, savingsFactors, earnFactors MultiRewardIndexes, -) QueryGetRewardFactorsResponse { - return QueryGetRewardFactorsResponse{ - USDXMintingRewardFactors: usdxMintingFactors, - HardSupplyRewardFactors: supplyFactors, - HardBorrowRewardFactors: hardBorrowFactors, - DelegatorRewardFactors: delegatorFactors, - SwapRewardFactors: swapFactors, - SavingsRewardFactors: savingsFactors, - EarnRewardFactors: earnFactors, - } -} - -// QueryGetAPYsResponse holds the response to a APY query -type QueryGetAPYsResponse struct { - Earn []Apy `json:"earn" yaml:"earn"` -} - -// NewQueryGetAPYsResponse returns a new instance of QueryGetAPYsResponse -func NewQueryGetAPYsResponse(earn []Apy) QueryGetAPYsResponse { - return QueryGetAPYsResponse{ - Earn: earn, - } -} diff --git a/x/issuance/types/querier.go b/x/issuance/types/querier.go deleted file mode 100644 index fb22ef75..00000000 --- a/x/issuance/types/querier.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -// Querier routes for the issuance module -const ( - QueryGetParams = "parameters" - QueryGetAsset = "asset" -) - -// QueryAssetParams params for querying an asset by denom -type QueryAssetParams struct { - Denom string `json:"denom" yaml:"denom"` -} diff --git a/x/kavadist/types/querier.go b/x/kavadist/types/querier.go deleted file mode 100644 index ae86202b..00000000 --- a/x/kavadist/types/querier.go +++ /dev/null @@ -1,7 +0,0 @@ -package types - -// Querier routes for the kavadist module -const ( - QueryGetParams = "params" - QueryGetBalance = "balance" -) diff --git a/x/pricefeed/types/querier.go b/x/pricefeed/types/querier.go deleted file mode 100644 index 0991fae3..00000000 --- a/x/pricefeed/types/querier.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -// price Takes an [assetcode] and returns CurrentPrice for that asset -// pricefeed Takes an [assetcode] and returns the raw []PostedPrice for that asset -// assets Returns []Assets in the pricefeed system - -const ( - // QueryGetParams command for params query - QueryGetParams = "parameters" - // QueryMarkets command for assets query - QueryMarkets = "markets" - // QueryOracles command for oracles query - QueryOracles = "oracles" - // QueryRawPrices command for raw price queries - QueryRawPrices = "rawprices" - // QueryPrice command for price queries - QueryPrice = "price" - // QueryPrices command for quering all prices - QueryPrices = "prices" -) - -// QueryWithMarketIDParams fields for querying information from a specific market -type QueryWithMarketIDParams struct { - MarketID string -} - -// NewQueryWithMarketIDParams creates a new instance of QueryWithMarketIDParams -func NewQueryWithMarketIDParams(marketID string) QueryWithMarketIDParams { - return QueryWithMarketIDParams{ - MarketID: marketID, - } -} diff --git a/x/swap/types/querier.go b/x/swap/types/querier.go deleted file mode 100644 index fb52ac4c..00000000 --- a/x/swap/types/querier.go +++ /dev/null @@ -1,84 +0,0 @@ -package types - -import ( - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// Querier routes for the swap module -const ( - QueryGetParams = "params" - QueryGetDeposits = "deposits" - QueryGetPool = "pool" - QueryGetPools = "pools" -) - -// QueryDepositsParams is the params for a filtered deposits query -type QueryDepositsParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` - Pool string `json:"pool" yaml:"pool"` -} - -// NewQueryDepositsParams creates a new QueryDepositsParams -func NewQueryDepositsParams(page, limit int, owner sdk.AccAddress, pool string) QueryDepositsParams { - return QueryDepositsParams{ - Page: page, - Limit: limit, - Owner: owner, - Pool: pool, - } -} - -// DepositsQueryResult contains the result of a deposits query -type DepositsQueryResult struct { - Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` - PoolID string `json:"pool_id" yaml:"pool_id"` - SharesOwned sdkmath.Int `json:"shares_owned" yaml:"shares_owned"` - SharesValue sdk.Coins `json:"shares_value" yaml:"shares_value"` -} - -// NewDepositsQueryResult creates a new DepositsQueryResult -func NewDepositsQueryResult(shareRecord ShareRecord, sharesValue sdk.Coins) DepositsQueryResult { - return DepositsQueryResult{ - Depositor: shareRecord.Depositor, - PoolID: shareRecord.PoolID, - SharesOwned: shareRecord.SharesOwned, - SharesValue: sharesValue, - } -} - -// DepositsQueryResults is a slice of DepositsQueryResult -type DepositsQueryResults []DepositsQueryResult - -// QueryPoolParams is the params for a pool query -type QueryPoolParams struct { - Pool string `json:"pool" yaml:"pool"` -} - -// NewQueryPoolParams creates a new QueryPoolParams -func NewQueryPoolParams(pool string) QueryPoolParams { - return QueryPoolParams{ - Pool: pool, - } -} - -// PoolStatsQueryResult contains the result of a pool query -type PoolStatsQueryResult struct { - Name string `json:"name" yaml:"name"` - Coins sdk.Coins `json:"coins" yaml:"coins"` - TotalShares sdkmath.Int `json:"total_shares" yaml:"total_shares"` -} - -// NewPoolStatsQueryResult creates a new PoolStatsQueryResult -func NewPoolStatsQueryResult(name string, coins sdk.Coins, totalShares sdkmath.Int) PoolStatsQueryResult { - return PoolStatsQueryResult{ - Name: name, - Coins: coins, - TotalShares: totalShares, - } -} - -// PoolStatsQueryResults is a slice of PoolStatsQueryResult -type PoolStatsQueryResults []PoolStatsQueryResult diff --git a/x/validator-vesting/client/cli/query.go b/x/validator-vesting/client/cli/query.go index baafa84f..748d21b2 100644 --- a/x/validator-vesting/client/cli/query.go +++ b/x/validator-vesting/client/cli/query.go @@ -1,7 +1,7 @@ package cli import ( - "fmt" + "context" "github.com/spf13/cobra" @@ -48,19 +48,12 @@ func queryCirculatingSupply() *cobra.Command { return err } - // Query - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCirculatingSupply), nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.CirculatingSupply(context.Background(), &types.QueryCirculatingSupplyRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var out int64 - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &out); err != nil { - return fmt.Errorf("failed to unmarshal supply: %w", err) - } - return cliCtx.PrintObjectLegacy(out) + return cliCtx.PrintString(res.Amount.String()) }, } } @@ -76,20 +69,12 @@ func queryTotalSupply() *cobra.Command { if err != nil { return err } - - // Query - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryTotalSupply), nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.TotalSupply(context.Background(), &types.QueryTotalSupplyRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var out int64 - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &out); err != nil { - return fmt.Errorf("failed to unmarshal supply: %w", err) - } - return cliCtx.PrintObjectLegacy(out) + return cliCtx.PrintString(res.Amount.String()) }, } } @@ -106,19 +91,12 @@ func queryCirculatingSupplyHARD() *cobra.Command { return err } - // Query - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCirculatingSupplyHARD), nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.CirculatingSupplyHARD(context.Background(), &types.QueryCirculatingSupplyHARDRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var out int64 - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &out); err != nil { - return fmt.Errorf("failed to unmarshal supply: %w", err) - } - return cliCtx.PrintObjectLegacy(out) + return cliCtx.PrintString(res.Amount.String()) }, } } @@ -135,19 +113,12 @@ func queryCirculatingSupplyUSDX() *cobra.Command { return err } - // Query - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCirculatingSupplyUSDX), nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.CirculatingSupplyUSDX(context.Background(), &types.QueryCirculatingSupplyUSDXRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var out int64 - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &out); err != nil { - return fmt.Errorf("failed to unmarshal supply: %w", err) - } - return cliCtx.PrintObjectLegacy(out) + return cliCtx.PrintString(res.Amount.String()) }, } } @@ -164,19 +135,12 @@ func queryCirculatingSupplySWP() *cobra.Command { return err } - // Query - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCirculatingSupplySWP), nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.CirculatingSupplySWP(context.Background(), &types.QueryCirculatingSupplySWPRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var out int64 - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &out); err != nil { - return fmt.Errorf("failed to unmarshal supply: %w", err) - } - return cliCtx.PrintObjectLegacy(out) + return cliCtx.PrintString(res.Amount.String()) }, } } @@ -193,19 +157,12 @@ func queryTotalSupplyHARD() *cobra.Command { return err } - // Query - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryTotalSupplyHARD), nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.TotalSupplyHARD(context.Background(), &types.QueryTotalSupplyHARDRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var out int64 - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &out); err != nil { - return fmt.Errorf("failed to unmarshal supply: %w", err) - } - return cliCtx.PrintObjectLegacy(out) + return cliCtx.PrintString(res.Amount.String()) }, } } @@ -222,19 +179,12 @@ func queryTotalSupplyUSDX() *cobra.Command { return err } - // Query - res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryTotalSupplyUSDX), nil) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.TotalSupplyUSDX(context.Background(), &types.QueryTotalSupplyUSDXRequest{}) if err != nil { return err } - cliCtx = cliCtx.WithHeight(height) - - // Decode and print results - var out int64 - if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &out); err != nil { - return fmt.Errorf("failed to unmarshal supply: %w", err) - } - return cliCtx.PrintObjectLegacy(out) + return cliCtx.PrintString(res.Amount.String()) }, } } diff --git a/x/validator-vesting/client/rest/query.go b/x/validator-vesting/client/rest/query.go index 6be01aab..005546ec 100644 --- a/x/validator-vesting/client/rest/query.go +++ b/x/validator-vesting/client/rest/query.go @@ -1,6 +1,7 @@ package rest import ( + "context" "encoding/json" "fmt" "net/http" @@ -25,37 +26,18 @@ func registerQueryRoutes(cliCtx client.Context, r *mux.Router) { func getTotalSupplyHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } - params := types.NewBaseQueryParams(page, limit) - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to marshal query params: %s", err)) - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryTotalSupply) - res, _, err := cliCtx.QueryWithData(route, bz) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.TotalSupply(context.Background(), &types.QueryTotalSupplyRequest{}) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - var totalSupply int64 - err = cliCtx.LegacyAmino.UnmarshalJSON(res, &totalSupply) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - resBytes, err := json.Marshal(totalSupply) + resBytes, err := json.Marshal(res.Amount.Int64()) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -66,38 +48,18 @@ func getTotalSupplyHandlerFn(cliCtx client.Context) http.HandlerFunc { func getCirculatingSupplyHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } - params := types.NewBaseQueryParams(page, limit) - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to marshal query params: %s", err)) - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCirculatingSupply) - res, _, err := cliCtx.QueryWithData(route, bz) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.CirculatingSupply(context.Background(), &types.QueryCirculatingSupplyRequest{}) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - - var circSupply int64 - err = cliCtx.LegacyAmino.UnmarshalJSON(res, &circSupply) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - resBytes, err := json.Marshal(circSupply) + resBytes, err := json.Marshal(res.Amount.Int64()) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -108,38 +70,18 @@ func getCirculatingSupplyHandlerFn(cliCtx client.Context) http.HandlerFunc { func getCirculatingSupplyHARDHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } - params := types.NewBaseQueryParams(page, limit) - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to marshal query params: %s", err)) - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCirculatingSupplyHARD) - res, _, err := cliCtx.QueryWithData(route, bz) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.CirculatingSupplyHARD(context.Background(), &types.QueryCirculatingSupplyHARDRequest{}) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - - var circSupply int64 - err = cliCtx.LegacyAmino.UnmarshalJSON(res, &circSupply) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - resBytes, err := json.Marshal(circSupply) + resBytes, err := json.Marshal(res.Amount.Int64()) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -150,38 +92,18 @@ func getCirculatingSupplyHARDHandlerFn(cliCtx client.Context) http.HandlerFunc { func getCirculatingSupplyUSDXHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } - params := types.NewBaseQueryParams(page, limit) - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to marshal query params: %s", err)) - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCirculatingSupplyUSDX) - res, _, err := cliCtx.QueryWithData(route, bz) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.CirculatingSupplyUSDX(context.Background(), &types.QueryCirculatingSupplyUSDXRequest{}) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - - var circSupply int64 - err = cliCtx.LegacyAmino.UnmarshalJSON(res, &circSupply) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - resBytes, err := json.Marshal(circSupply) + resBytes, err := json.Marshal(res.Amount.Int64()) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -192,38 +114,18 @@ func getCirculatingSupplyUSDXHandlerFn(cliCtx client.Context) http.HandlerFunc { func getCirculatingSupplySWPHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } - params := types.NewBaseQueryParams(page, limit) - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to marshal query params: %s", err)) - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCirculatingSupplySWP) - res, _, err := cliCtx.QueryWithData(route, bz) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.CirculatingSupplySWP(context.Background(), &types.QueryCirculatingSupplySWPRequest{}) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - - var circSupply int64 - err = cliCtx.LegacyAmino.UnmarshalJSON(res, &circSupply) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - resBytes, err := json.Marshal(circSupply) + resBytes, err := json.Marshal(res.Amount.Int64()) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -234,37 +136,18 @@ func getCirculatingSupplySWPHandlerFn(cliCtx client.Context) http.HandlerFunc { func getTotalSupplyHARDHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } - params := types.NewBaseQueryParams(page, limit) - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to marshal query params: %s", err)) - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryTotalSupplyHARD) - res, _, err := cliCtx.QueryWithData(route, bz) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.TotalSupplyHARD(context.Background(), &types.QueryTotalSupplyHARDRequest{}) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - var totalSupply int64 - err = cliCtx.LegacyAmino.UnmarshalJSON(res, &totalSupply) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - resBytes, err := json.Marshal(totalSupply) + resBytes, err := json.Marshal(res.Amount.Int64()) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -275,37 +158,18 @@ func getTotalSupplyHARDHandlerFn(cliCtx client.Context) http.HandlerFunc { func getTotalSupplyUSDXHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } - params := types.NewBaseQueryParams(page, limit) - bz, err := cliCtx.LegacyAmino.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to marshal query params: %s", err)) - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryTotalSupplyUSDX) - res, _, err := cliCtx.QueryWithData(route, bz) + queryClient := types.NewQueryClient(cliCtx) + res, err := queryClient.TotalSupplyUSDX(context.Background(), &types.QueryTotalSupplyUSDXRequest{}) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - var totalSupply int64 - err = cliCtx.LegacyAmino.UnmarshalJSON(res, &totalSupply) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - resBytes, err := json.Marshal(totalSupply) + resBytes, err := json.Marshal(res.Amount.Int64()) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return diff --git a/x/validator-vesting/keeper/grpc_query.go b/x/validator-vesting/keeper/grpc_query.go new file mode 100644 index 00000000..c633638f --- /dev/null +++ b/x/validator-vesting/keeper/grpc_query.go @@ -0,0 +1,358 @@ +package keeper + +import ( + "context" + "time" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/validator-vesting/types" +) + +type queryServer struct { + bk types.BankKeeper +} + +var _ types.QueryServer = queryServer{} + +// NewQueryServerImpl creates a new server for handling gRPC queries. +func NewQueryServerImpl(bk types.BankKeeper) types.QueryServer { + return &queryServer{bk: bk} +} + +// CirculatingSupply implements the gRPC service handler for querying the circulating supply of the kava token. +func (s queryServer) CirculatingSupply(c context.Context, req *types.QueryCirculatingSupplyRequest) (*types. + QueryCirculatingSupplyResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + totalSupply := s.bk.GetSupply(ctx, "ukava").Amount + supplyInt := getCirculatingSupply(ctx.BlockTime(), totalSupply) + return &types.QueryCirculatingSupplyResponse{ + Amount: supplyInt, + }, nil +} + +// TotalSupply returns the total amount of ukava tokens +func (s queryServer) TotalSupply(c context.Context, req *types.QueryTotalSupplyRequest) (*types.QueryTotalSupplyResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + totalSupply := s.bk.GetSupply(ctx, "ukava").Amount + supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + return &types.QueryTotalSupplyResponse{ + Amount: supplyInt, + }, nil +} + +// CirculatingSupplyHARD returns the total amount of hard tokens in circulation +func (s queryServer) CirculatingSupplyHARD(c context.Context, req *types.QueryCirculatingSupplyHARDRequest) (*types.QueryCirculatingSupplyHARDResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + supplyIncreaseDates := []time.Time{ + time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), // + 30,000,000 *** Year ONE *** + time.Date(2020, 11, 15, 14, 0, 0, 0, time.UTC), // + 5,000,000 + time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), // + 5,000,000 + time.Date(2021, 1, 15, 14, 0, 0, 0, time.UTC), // + 7,708,334 + time.Date(2021, 2, 15, 14, 0, 0, 0, time.UTC), // + 3,333,333 + time.Date(2021, 3, 15, 14, 0, 0, 0, time.UTC), // + 3,333,333 + time.Date(2021, 4, 15, 14, 0, 0, 0, time.UTC), // + 6,875,000 + time.Date(2021, 5, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2021, 6, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2021, 7, 15, 14, 0, 0, 0, time.UTC), // + 6,875,000 + time.Date(2021, 8, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2021, 9, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 *** Year ONE *** + time.Date(2021, 10, 15, 14, 0, 0, 0, time.UTC), // + 13,541,667 *** Year TWO *** + time.Date(2021, 11, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2021, 12, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2022, 1, 15, 14, 0, 0, 0, time.UTC), // + 8,541,667 + time.Date(2022, 2, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2022, 3, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2022, 4, 15, 14, 0, 0, 0, time.UTC), // + 8,541,667 + time.Date(2022, 5, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2022, 6, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2022, 7, 15, 14, 0, 0, 0, time.UTC), // + 8,541,667 + time.Date(2022, 8, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2022, 9, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 *** Year TWO *** + time.Date(2022, 10, 15, 14, 0, 0, 0, time.UTC), // + 8,541,667 *** Year THREE *** + time.Date(2022, 11, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2022, 12, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2023, 1, 15, 14, 0, 0, 0, time.UTC), // + 4,166,667 + time.Date(2023, 2, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2023, 3, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2023, 4, 15, 14, 0, 0, 0, time.UTC), // + 4,166,667 + time.Date(2023, 5, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2023, 6, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2023, 7, 15, 14, 0, 0, 0, time.UTC), // + 4,166,667 + time.Date(2023, 8, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 + time.Date(2023, 9, 15, 14, 0, 0, 0, time.UTC), // + 2,500,000 *** Year THREE *** + time.Date(2023, 10, 15, 14, 0, 0, 0, time.UTC), // + 3,333,334 *** Year FOUR *** + time.Date(2023, 11, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2023, 12, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 1, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 2, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 3, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 4, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 5, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 6, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 7, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 8, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 + time.Date(2024, 9, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 *** Year FOUR *** + } + + circSupply := sdk.ZeroInt() + blockTime := ctx.BlockTime() + switch { + case blockTime.Before(supplyIncreaseDates[0]): + circSupply = sdkmath.NewInt(0) + case blockTime.After(supplyIncreaseDates[0]) && blockTime.Before(supplyIncreaseDates[1]) || blockTime.Equal(supplyIncreaseDates[0]): + circSupply = sdkmath.NewInt(30000000) // Start year ONE + case blockTime.After(supplyIncreaseDates[1]) && blockTime.Before(supplyIncreaseDates[2]) || blockTime.Equal(supplyIncreaseDates[1]): + circSupply = sdkmath.NewInt(35000000) + case blockTime.After(supplyIncreaseDates[2]) && blockTime.Before(supplyIncreaseDates[3]) || blockTime.Equal(supplyIncreaseDates[2]): + circSupply = sdkmath.NewInt(40000000) + case blockTime.After(supplyIncreaseDates[3]) && blockTime.Before(supplyIncreaseDates[4]) || blockTime.Equal(supplyIncreaseDates[3]): + circSupply = sdkmath.NewInt(47708334) + case blockTime.After(supplyIncreaseDates[4]) && blockTime.Before(supplyIncreaseDates[5]) || blockTime.Equal(supplyIncreaseDates[4]): + circSupply = sdkmath.NewInt(51041667) + case blockTime.After(supplyIncreaseDates[5]) && blockTime.Before(supplyIncreaseDates[6]) || blockTime.Equal(supplyIncreaseDates[5]): + circSupply = sdkmath.NewInt(54375000) + case blockTime.After(supplyIncreaseDates[6]) && blockTime.Before(supplyIncreaseDates[7]) || blockTime.Equal(supplyIncreaseDates[6]): + circSupply = sdkmath.NewInt(61250000) + case blockTime.After(supplyIncreaseDates[7]) && blockTime.Before(supplyIncreaseDates[8]) || blockTime.Equal(supplyIncreaseDates[7]): + circSupply = sdkmath.NewInt(63750000) + case blockTime.After(supplyIncreaseDates[8]) && blockTime.Before(supplyIncreaseDates[9]) || blockTime.Equal(supplyIncreaseDates[8]): + circSupply = sdkmath.NewInt(66250000) + case blockTime.After(supplyIncreaseDates[9]) && blockTime.Before(supplyIncreaseDates[10]) || blockTime.Equal(supplyIncreaseDates[9]): + circSupply = sdkmath.NewInt(73125000) + case blockTime.After(supplyIncreaseDates[10]) && blockTime.Before(supplyIncreaseDates[11]) || blockTime.Equal(supplyIncreaseDates[10]): + circSupply = sdkmath.NewInt(75625000) + case blockTime.After(supplyIncreaseDates[11]) && blockTime.Before(supplyIncreaseDates[12]) || blockTime.Equal(supplyIncreaseDates[11]): + circSupply = sdkmath.NewInt(78125000) // End year ONE + case blockTime.After(supplyIncreaseDates[12]) && blockTime.Before(supplyIncreaseDates[13]) || blockTime.Equal(supplyIncreaseDates[12]): + circSupply = sdkmath.NewInt(91666667) // Start year TWO + case blockTime.After(supplyIncreaseDates[13]) && blockTime.Before(supplyIncreaseDates[14]) || blockTime.Equal(supplyIncreaseDates[13]): + circSupply = sdkmath.NewInt(94166667) + case blockTime.After(supplyIncreaseDates[14]) && blockTime.Before(supplyIncreaseDates[15]) || blockTime.Equal(supplyIncreaseDates[14]): + circSupply = sdkmath.NewInt(96666667) + case blockTime.After(supplyIncreaseDates[15]) && blockTime.Before(supplyIncreaseDates[16]) || blockTime.Equal(supplyIncreaseDates[15]): + circSupply = sdkmath.NewInt(105208334) + case blockTime.After(supplyIncreaseDates[16]) && blockTime.Before(supplyIncreaseDates[17]) || blockTime.Equal(supplyIncreaseDates[16]): + circSupply = sdkmath.NewInt(107708334) + case blockTime.After(supplyIncreaseDates[17]) && blockTime.Before(supplyIncreaseDates[18]) || blockTime.Equal(supplyIncreaseDates[17]): + circSupply = sdkmath.NewInt(110208334) + case blockTime.After(supplyIncreaseDates[18]) && blockTime.Before(supplyIncreaseDates[19]) || blockTime.Equal(supplyIncreaseDates[18]): + circSupply = sdkmath.NewInt(118750000) + case blockTime.After(supplyIncreaseDates[19]) && blockTime.Before(supplyIncreaseDates[20]) || blockTime.Equal(supplyIncreaseDates[19]): + circSupply = sdkmath.NewInt(121250000) + case blockTime.After(supplyIncreaseDates[20]) && blockTime.Before(supplyIncreaseDates[21]) || blockTime.Equal(supplyIncreaseDates[20]): + circSupply = sdkmath.NewInt(123750000) + case blockTime.After(supplyIncreaseDates[21]) && blockTime.Before(supplyIncreaseDates[22]) || blockTime.Equal(supplyIncreaseDates[21]): + circSupply = sdkmath.NewInt(132291668) + case blockTime.After(supplyIncreaseDates[22]) && blockTime.Before(supplyIncreaseDates[23]) || blockTime.Equal(supplyIncreaseDates[22]): + circSupply = sdkmath.NewInt(134791668) + case blockTime.After(supplyIncreaseDates[23]) && blockTime.Before(supplyIncreaseDates[24]) || blockTime.Equal(supplyIncreaseDates[23]): + circSupply = sdkmath.NewInt(137291668) // End year TWO + case blockTime.After(supplyIncreaseDates[24]) && blockTime.Before(supplyIncreaseDates[25]) || blockTime.Equal(supplyIncreaseDates[24]): + circSupply = sdkmath.NewInt(145833335) // Start year THREE + case blockTime.After(supplyIncreaseDates[25]) && blockTime.Before(supplyIncreaseDates[26]) || blockTime.Equal(supplyIncreaseDates[25]): + circSupply = sdkmath.NewInt(148333335) + case blockTime.After(supplyIncreaseDates[26]) && blockTime.Before(supplyIncreaseDates[27]) || blockTime.Equal(supplyIncreaseDates[26]): + circSupply = sdkmath.NewInt(150833335) + case blockTime.After(supplyIncreaseDates[27]) && blockTime.Before(supplyIncreaseDates[28]) || blockTime.Equal(supplyIncreaseDates[27]): + circSupply = sdkmath.NewInt(155000000) + case blockTime.After(supplyIncreaseDates[28]) && blockTime.Before(supplyIncreaseDates[29]) || blockTime.Equal(supplyIncreaseDates[28]): + circSupply = sdkmath.NewInt(157500000) + case blockTime.After(supplyIncreaseDates[29]) && blockTime.Before(supplyIncreaseDates[30]) || blockTime.Equal(supplyIncreaseDates[29]): + circSupply = sdkmath.NewInt(160000000) + case blockTime.After(supplyIncreaseDates[30]) && blockTime.Before(supplyIncreaseDates[31]) || blockTime.Equal(supplyIncreaseDates[30]): + circSupply = sdkmath.NewInt(164166669) + case blockTime.After(supplyIncreaseDates[31]) && blockTime.Before(supplyIncreaseDates[32]) || blockTime.Equal(supplyIncreaseDates[31]): + circSupply = sdkmath.NewInt(166666669) + case blockTime.After(supplyIncreaseDates[32]) && blockTime.Before(supplyIncreaseDates[33]) || blockTime.Equal(supplyIncreaseDates[32]): + circSupply = sdkmath.NewInt(169166669) + case blockTime.After(supplyIncreaseDates[33]) && blockTime.Before(supplyIncreaseDates[34]) || blockTime.Equal(supplyIncreaseDates[33]): + circSupply = sdkmath.NewInt(173333336) + case blockTime.After(supplyIncreaseDates[34]) && blockTime.Before(supplyIncreaseDates[35]) || blockTime.Equal(supplyIncreaseDates[34]): + circSupply = sdkmath.NewInt(175833336) + case blockTime.After(supplyIncreaseDates[35]) && blockTime.Before(supplyIncreaseDates[36]) || blockTime.Equal(supplyIncreaseDates[35]): + circSupply = sdkmath.NewInt(178333336) // End year THREE + case blockTime.After(supplyIncreaseDates[36]) && blockTime.Before(supplyIncreaseDates[37]) || blockTime.Equal(supplyIncreaseDates[36]): + circSupply = sdkmath.NewInt(181666670) // Start year FOUR + case blockTime.After(supplyIncreaseDates[37]) && blockTime.Before(supplyIncreaseDates[38]) || blockTime.Equal(supplyIncreaseDates[37]): + circSupply = sdkmath.NewInt(183333337) + case blockTime.After(supplyIncreaseDates[38]) && blockTime.Before(supplyIncreaseDates[39]) || blockTime.Equal(supplyIncreaseDates[38]): + circSupply = sdkmath.NewInt(185000000) + case blockTime.After(supplyIncreaseDates[39]) && blockTime.Before(supplyIncreaseDates[40]) || blockTime.Equal(supplyIncreaseDates[39]): + circSupply = sdkmath.NewInt(186666670) + case blockTime.After(supplyIncreaseDates[40]) && blockTime.Before(supplyIncreaseDates[41]) || blockTime.Equal(supplyIncreaseDates[40]): + circSupply = sdkmath.NewInt(188333338) + case blockTime.After(supplyIncreaseDates[41]) && blockTime.Before(supplyIncreaseDates[42]) || blockTime.Equal(supplyIncreaseDates[41]): + circSupply = sdkmath.NewInt(190000000) + case blockTime.After(supplyIncreaseDates[42]) && blockTime.Before(supplyIncreaseDates[43]) || blockTime.Equal(supplyIncreaseDates[42]): + circSupply = sdkmath.NewInt(191666670) + case blockTime.After(supplyIncreaseDates[43]) && blockTime.Before(supplyIncreaseDates[44]) || blockTime.Equal(supplyIncreaseDates[43]): + circSupply = sdkmath.NewInt(193333339) + case blockTime.After(supplyIncreaseDates[44]) && blockTime.Before(supplyIncreaseDates[45]) || blockTime.Equal(supplyIncreaseDates[44]): + circSupply = sdkmath.NewInt(195000000) + case blockTime.After(supplyIncreaseDates[45]) && blockTime.Before(supplyIncreaseDates[46]) || blockTime.Equal(supplyIncreaseDates[45]): + circSupply = sdkmath.NewInt(196666670) + case blockTime.After(supplyIncreaseDates[46]) && blockTime.Before(supplyIncreaseDates[47]) || blockTime.Equal(supplyIncreaseDates[46]): + circSupply = sdkmath.NewInt(198333340) + case blockTime.After(supplyIncreaseDates[47]) && blockTime.Before(supplyIncreaseDates[48]) || blockTime.Equal(supplyIncreaseDates[47]): + circSupply = sdkmath.NewInt(200000000) // End year FOUR + default: + circSupply = sdkmath.NewInt(200000000) + } + + return &types.QueryCirculatingSupplyHARDResponse{ + Amount: circSupply, + }, nil +} + +// CirculatingSupplyUSDX returns the total amount of usdx tokens in circulation +func (s queryServer) CirculatingSupplyUSDX(c context.Context, req *types.QueryCirculatingSupplyUSDXRequest) (*types.QueryCirculatingSupplyUSDXResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + totalSupply := s.bk.GetSupply(ctx, "usdx").Amount + supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + return &types.QueryCirculatingSupplyUSDXResponse{ + Amount: supplyInt, + }, nil +} + +// CirculatingSupplySWP returns the total amount of swp tokens in circulation +func (s queryServer) CirculatingSupplySWP(c context.Context, req *types.QueryCirculatingSupplySWPRequest) (*types.QueryCirculatingSupplySWPResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + // Start values + year := 2021 + month := 8 + + var supplyIncreaseDates []time.Time + + // Add month times for 4 years + for i := 0; i < 12*4; i++ { + // Always day 30 unless it's Feb + day := 30 + if month == 2 { + day = 28 + } + + date := time.Date(year, time.Month(month), day, 15 /* hour */, 0, 0, 0, time.UTC) + supplyIncreaseDates = append(supplyIncreaseDates, date) + + // Update year and month + if month == 12 { + month = 1 + year += 1 + } else { + month += 1 + } + } + + // Repeated tokens released + teamSwp := int64(4_687_500) + treasurySwp := int64(5_859_375) + monthlyStakersSwp := int64(520_833) + monthlyLPIncentivesSwp := int64(2_343_750) + + // []{Ecosystem, Team, Treasury, Kava Stakers, LP Incentives} + scheduleAmounts := [][]int64{ + {12_500_000, 0, 15_625_000, monthlyStakersSwp, monthlyLPIncentivesSwp}, // *** Year ONE *** + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 1 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 2 + {0, 0, treasurySwp, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 3 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 4 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 5 + {0, 0, treasurySwp, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 6 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 7 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 8 + {0, 0, treasurySwp, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 9 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 10 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 11 + {0, 18_750_000, treasurySwp, monthlyStakersSwp, monthlyLPIncentivesSwp}, // *** Year TWO *** + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 13 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 14 + {0, teamSwp, treasurySwp, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 15 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 16 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 17 + {0, teamSwp, treasurySwp, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 18 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 19 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 20 + {0, teamSwp, treasurySwp, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 21 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 22 + {0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}, // 23 + {0, teamSwp, treasurySwp, monthlyStakersSwp, monthlyLPIncentivesSwp}, // *** Year THREE *** + } + + // Months 25-47 are the same + for i := 0; i < 23; i++ { + scheduleAmounts = append(scheduleAmounts, []int64{0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}) + } + + circSupply := sdk.ZeroInt() + blockTime := ctx.BlockTime() + + for i := 0; i < len(scheduleAmounts); i++ { + if blockTime.Before(supplyIncreaseDates[i]) { + break + } + + // Sum up each category of token release + monthTotal := int64(0) + for _, val := range scheduleAmounts[i] { + monthTotal += val + } + + circSupply = circSupply.Add(sdkmath.NewInt(monthTotal)) + } + + return &types.QueryCirculatingSupplySWPResponse{ + Amount: circSupply, + }, nil +} + +// TotalSupplyHARD returns the total amount of hard tokens +func (s queryServer) TotalSupplyHARD(c context.Context, req *types.QueryTotalSupplyHARDRequest) (*types.QueryTotalSupplyHARDResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + totalSupply := s.bk.GetSupply(ctx, "hard").Amount + supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + return &types.QueryTotalSupplyHARDResponse{ + Amount: supplyInt, + }, nil +} + +// TotalSupplyUSDX returns the total amount of usdx tokens +func (s queryServer) TotalSupplyUSDX(c context.Context, req *types.QueryTotalSupplyUSDXRequest) (*types.QueryTotalSupplyUSDXResponse, error) { + // USDX total supply is the circulating supply + rsp, err := s.CirculatingSupplyUSDX(c, &types.QueryCirculatingSupplyUSDXRequest{}) + if err != nil { + return nil, err + } + return &types.QueryTotalSupplyUSDXResponse{ + Amount: rsp.Amount, + }, nil +} + +func getCirculatingSupply(blockTime time.Time, totalSupply sdkmath.Int) sdkmath.Int { + vestingDates := []time.Time{ + time.Date(2022, 2, 5, 14, 0, 0, 0, time.UTC), + time.Date(2022, 5, 5, 14, 0, 0, 0, time.UTC), + time.Date(2022, 8, 5, 14, 0, 0, 0, time.UTC), + time.Date(2022, 11, 5, 14, 0, 0, 0, time.UTC), + } + + switch { + case blockTime.Before(vestingDates[0]): + return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(9937500000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + case blockTime.After(vestingDates[0]) && blockTime.Before(vestingDates[1]) || blockTime.Equal(vestingDates[0]): + return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(7453125000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + case blockTime.After(vestingDates[1]) && blockTime.Before(vestingDates[2]) || blockTime.Equal(vestingDates[1]): + return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(4968750000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + case blockTime.After(vestingDates[2]) && blockTime.Before(vestingDates[3]) || blockTime.Equal(vestingDates[2]): + return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(2484375000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + default: + // align with total supply calculation and truncate int here instead of round + return sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + } +} diff --git a/x/validator-vesting/keeper/grpc_query_test.go b/x/validator-vesting/keeper/grpc_query_test.go new file mode 100644 index 00000000..b6c22c0e --- /dev/null +++ b/x/validator-vesting/keeper/grpc_query_test.go @@ -0,0 +1,116 @@ +package keeper_test + +import ( + "context" + "testing" + "time" + + sdkmath "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/validator-vesting/keeper" + "github.com/kava-labs/kava/x/validator-vesting/types" +) + +type grpcQueryTestSuite struct { + suite.Suite + app app.TestApp + ctx sdk.Context + queryClient types.QueryClient + bk *mockBankKeeper +} + +type mockBankKeeper struct { + supply sdk.Coin +} + +func (m *mockBankKeeper) SetSupply(ctx sdk.Context, denom string, amt sdkmath.Int) { + m.supply = sdk.NewCoin(denom, amt) +} + +func (m *mockBankKeeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin { + return m.supply +} + +func (suite *grpcQueryTestSuite) SetupTest() { + testTime := time.Date(2024, 2, 29, 12, 00, 00, 00, time.UTC) + tApp := app.NewTestApp() + ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: testTime}) + suite.app = tApp + suite.ctx = ctx + suite.bk = &mockBankKeeper{} + suite.queryClient = suite.queryClientWithBlockTime(testTime) +} + +func TestGrpcQueryTestSuite(t *testing.T) { + suite.Run(t, new(grpcQueryTestSuite)) +} + +func (suite *grpcQueryTestSuite) TestCirculatingSupply() { + suite.Run("vesting period supply", func() { + suite.bk.SetSupply(suite.ctx, "ukava", sdkmath.NewInt(2_500_000_000_000)) + lastVestingPeriod := time.Date(2022, 8, 5, 24, 0, 0, 0, time.UTC) + queryClient := suite.queryClientWithBlockTime(lastVestingPeriod) + res, err := queryClient.CirculatingSupply(context.Background(), &types.QueryCirculatingSupplyRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(sdkmath.NewInt(15_625), res.Amount) + }) + + suite.Run("supply after last vesting period", func() { + suite.bk.SetSupply(suite.ctx, "ukava", sdkmath.NewInt(100_000_000)) + res, err := suite.queryClient.CirculatingSupply(context.Background(), &types.QueryCirculatingSupplyRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(sdkmath.NewInt(100), res.Amount) + }) +} + +func (suite *grpcQueryTestSuite) TestTotalSupply() { + suite.bk.SetSupply(suite.ctx, "ukava", sdkmath.NewInt(100_000_000)) + res, err := suite.queryClient.TotalSupply(context.Background(), &types.QueryTotalSupplyRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(sdkmath.NewInt(100), res.Amount) +} + +func (suite *grpcQueryTestSuite) TestCirculatingSupplyHARD() { + res, err := suite.queryClient.CirculatingSupplyHARD(context.Background(), &types.QueryCirculatingSupplyHARDRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(sdkmath.NewInt(188333338), res.Amount) +} + +func (suite *grpcQueryTestSuite) TestCirculatingSupplyUSDX() { + suite.bk.SetSupply(suite.ctx, "usdx", sdkmath.NewInt(150_000_000)) + res, err := suite.queryClient.CirculatingSupplyUSDX(context.Background(), &types.QueryCirculatingSupplyUSDXRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(sdkmath.NewInt(150), res.Amount) +} + +func (suite *grpcQueryTestSuite) TestCirculatingSupplySWP() { + res, err := suite.queryClient.CirculatingSupplySWP(suite.ctx, &types.QueryCirculatingSupplySWPRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(sdkmath.NewInt(201302073), res.Amount) +} + +func (suite *grpcQueryTestSuite) TestTotalSupplyHARD() { + suite.bk.SetSupply(suite.ctx, "hard", sdkmath.NewInt(150_000_000)) + res, err := suite.queryClient.TotalSupplyHARD(context.Background(), &types.QueryTotalSupplyHARDRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(sdkmath.NewInt(150), res.Amount) +} + +func (suite *grpcQueryTestSuite) TestTotalSupplyUSDX() { + suite.bk.SetSupply(suite.ctx, "usdx", sdkmath.NewInt(150_000_000)) + res, err := suite.queryClient.TotalSupplyUSDX(context.Background(), &types.QueryTotalSupplyUSDXRequest{}) + suite.Require().NoError(err) + suite.Require().Equal(sdkmath.NewInt(150), res.Amount) +} + +func (suite *grpcQueryTestSuite) queryClientWithBlockTime(blockTime time.Time) types.QueryClient { + ctx := suite.ctx.WithBlockTime(blockTime) + queryHelper := baseapp.NewQueryServerTestHelper(ctx, suite.app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, keeper.NewQueryServerImpl(suite.bk)) + return types.NewQueryClient(queryHelper) +} diff --git a/x/validator-vesting/module.go b/x/validator-vesting/module.go index eb4c73aa..39fa0c61 100644 --- a/x/validator-vesting/module.go +++ b/x/validator-vesting/module.go @@ -1,6 +1,7 @@ package validator_vesting import ( + "context" "encoding/json" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -15,6 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/kava-labs/kava/x/validator-vesting/client/cli" + "github.com/kava-labs/kava/x/validator-vesting/keeper" "github.com/kava-labs/kava/x/validator-vesting/types" ) @@ -54,7 +56,11 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for validator-vesting module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} +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 validator-vesting module's root tx command. func (a AppModuleBasic) GetTxCmd() *cobra.Command { return nil } @@ -90,7 +96,9 @@ func (am AppModule) Name() string { // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) {} +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.bankKeeper)) +} // RegisterInvariants registers validator-vesting module's invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} diff --git a/x/validator-vesting/types/querier.go b/x/validator-vesting/types/querier.go deleted file mode 100644 index 465435f3..00000000 --- a/x/validator-vesting/types/querier.go +++ /dev/null @@ -1,26 +0,0 @@ -package types - -// Querier routes for the validator vesting module -const ( - QueryCirculatingSupply = "circulating-supply" - QueryTotalSupply = "total-supply" - QueryCirculatingSupplyHARD = "circulating-supply-hard" - QueryCirculatingSupplyUSDX = "circulating-supply-usdx" - QueryCirculatingSupplySWP = "circulating-supply-swp" - QueryTotalSupplyHARD = "total-supply-hard" - QueryTotalSupplyUSDX = "total-supply-usdx" -) - -// BaseQueryParams defines the parameters necessary for querying for all Evidence. -type BaseQueryParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` -} - -// NewBaseQueryParams returns a new BaseQueryParams -func NewBaseQueryParams(page, limit int) BaseQueryParams { - return BaseQueryParams{ - Page: page, - Limit: limit, - } -} diff --git a/x/validator-vesting/types/query.pb.go b/x/validator-vesting/types/query.pb.go new file mode 100644 index 00000000..b8a8442d --- /dev/null +++ b/x/validator-vesting/types/query.pb.go @@ -0,0 +1,2503 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kava/validatorvesting/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "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 + +// QueryCirculatingSupplyRequest is the request type for the Query/CirculatingSupply RPC method +type QueryCirculatingSupplyRequest struct { +} + +func (m *QueryCirculatingSupplyRequest) Reset() { *m = QueryCirculatingSupplyRequest{} } +func (m *QueryCirculatingSupplyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplyRequest) ProtoMessage() {} +func (*QueryCirculatingSupplyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{0} +} +func (m *QueryCirculatingSupplyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplyRequest.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 *QueryCirculatingSupplyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplyRequest.Merge(m, src) +} +func (m *QueryCirculatingSupplyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplyRequest proto.InternalMessageInfo + +// QueryCirculatingSupplyResponse is the response type for the Query/CirculatingSupply RPC method +type QueryCirculatingSupplyResponse struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QueryCirculatingSupplyResponse) Reset() { *m = QueryCirculatingSupplyResponse{} } +func (m *QueryCirculatingSupplyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplyResponse) ProtoMessage() {} +func (*QueryCirculatingSupplyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{1} +} +func (m *QueryCirculatingSupplyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplyResponse.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 *QueryCirculatingSupplyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplyResponse.Merge(m, src) +} +func (m *QueryCirculatingSupplyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplyResponse proto.InternalMessageInfo + +// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC method +type QueryTotalSupplyRequest struct { +} + +func (m *QueryTotalSupplyRequest) Reset() { *m = QueryTotalSupplyRequest{} } +func (m *QueryTotalSupplyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSupplyRequest) ProtoMessage() {} +func (*QueryTotalSupplyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{2} +} +func (m *QueryTotalSupplyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSupplyRequest.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 *QueryTotalSupplyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSupplyRequest.Merge(m, src) +} +func (m *QueryTotalSupplyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSupplyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo + +// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method +type QueryTotalSupplyResponse struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} } +func (m *QueryTotalSupplyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSupplyResponse) ProtoMessage() {} +func (*QueryTotalSupplyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{3} +} +func (m *QueryTotalSupplyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSupplyResponse.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 *QueryTotalSupplyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSupplyResponse.Merge(m, src) +} +func (m *QueryTotalSupplyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSupplyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSupplyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSupplyResponse proto.InternalMessageInfo + +// QueryCirculatingSupplyHARDRequest is the request type for the Query/CirculatingSupplyHARD RPC method +type QueryCirculatingSupplyHARDRequest struct { +} + +func (m *QueryCirculatingSupplyHARDRequest) Reset() { *m = QueryCirculatingSupplyHARDRequest{} } +func (m *QueryCirculatingSupplyHARDRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplyHARDRequest) ProtoMessage() {} +func (*QueryCirculatingSupplyHARDRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{4} +} +func (m *QueryCirculatingSupplyHARDRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplyHARDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplyHARDRequest.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 *QueryCirculatingSupplyHARDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplyHARDRequest.Merge(m, src) +} +func (m *QueryCirculatingSupplyHARDRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplyHARDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplyHARDRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplyHARDRequest proto.InternalMessageInfo + +// QueryCirculatingSupplyHARDResponse is the response type for the Query/CirculatingSupplyHARD RPC method +type QueryCirculatingSupplyHARDResponse struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QueryCirculatingSupplyHARDResponse) Reset() { *m = QueryCirculatingSupplyHARDResponse{} } +func (m *QueryCirculatingSupplyHARDResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplyHARDResponse) ProtoMessage() {} +func (*QueryCirculatingSupplyHARDResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{5} +} +func (m *QueryCirculatingSupplyHARDResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplyHARDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplyHARDResponse.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 *QueryCirculatingSupplyHARDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplyHARDResponse.Merge(m, src) +} +func (m *QueryCirculatingSupplyHARDResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplyHARDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplyHARDResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplyHARDResponse proto.InternalMessageInfo + +// QueryCirculatingSupplyUSDXRequest is the request type for the Query/CirculatingSupplyUSDX RPC method +type QueryCirculatingSupplyUSDXRequest struct { +} + +func (m *QueryCirculatingSupplyUSDXRequest) Reset() { *m = QueryCirculatingSupplyUSDXRequest{} } +func (m *QueryCirculatingSupplyUSDXRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplyUSDXRequest) ProtoMessage() {} +func (*QueryCirculatingSupplyUSDXRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{6} +} +func (m *QueryCirculatingSupplyUSDXRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplyUSDXRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplyUSDXRequest.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 *QueryCirculatingSupplyUSDXRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplyUSDXRequest.Merge(m, src) +} +func (m *QueryCirculatingSupplyUSDXRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplyUSDXRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplyUSDXRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplyUSDXRequest proto.InternalMessageInfo + +// QueryCirculatingSupplyUSDXResponse is the response type for the Query/CirculatingSupplyUSDX RPC method +type QueryCirculatingSupplyUSDXResponse struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QueryCirculatingSupplyUSDXResponse) Reset() { *m = QueryCirculatingSupplyUSDXResponse{} } +func (m *QueryCirculatingSupplyUSDXResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplyUSDXResponse) ProtoMessage() {} +func (*QueryCirculatingSupplyUSDXResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{7} +} +func (m *QueryCirculatingSupplyUSDXResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplyUSDXResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplyUSDXResponse.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 *QueryCirculatingSupplyUSDXResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplyUSDXResponse.Merge(m, src) +} +func (m *QueryCirculatingSupplyUSDXResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplyUSDXResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplyUSDXResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplyUSDXResponse proto.InternalMessageInfo + +// QueryCirculatingSupplySWPRequest is the request type for the Query/CirculatingSupplySWP RPC method +type QueryCirculatingSupplySWPRequest struct { +} + +func (m *QueryCirculatingSupplySWPRequest) Reset() { *m = QueryCirculatingSupplySWPRequest{} } +func (m *QueryCirculatingSupplySWPRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplySWPRequest) ProtoMessage() {} +func (*QueryCirculatingSupplySWPRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{8} +} +func (m *QueryCirculatingSupplySWPRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplySWPRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplySWPRequest.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 *QueryCirculatingSupplySWPRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplySWPRequest.Merge(m, src) +} +func (m *QueryCirculatingSupplySWPRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplySWPRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplySWPRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplySWPRequest proto.InternalMessageInfo + +// QueryCirculatingSupplySWPResponse is the response type for the Query/CirculatingSupplySWP RPC method +type QueryCirculatingSupplySWPResponse struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QueryCirculatingSupplySWPResponse) Reset() { *m = QueryCirculatingSupplySWPResponse{} } +func (m *QueryCirculatingSupplySWPResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplySWPResponse) ProtoMessage() {} +func (*QueryCirculatingSupplySWPResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{9} +} +func (m *QueryCirculatingSupplySWPResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplySWPResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplySWPResponse.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 *QueryCirculatingSupplySWPResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplySWPResponse.Merge(m, src) +} +func (m *QueryCirculatingSupplySWPResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplySWPResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplySWPResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplySWPResponse proto.InternalMessageInfo + +// QueryTotalSupplyHARDRequest is the request type for the Query/TotalSupplyHARD RPC method +type QueryTotalSupplyHARDRequest struct { +} + +func (m *QueryTotalSupplyHARDRequest) Reset() { *m = QueryTotalSupplyHARDRequest{} } +func (m *QueryTotalSupplyHARDRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSupplyHARDRequest) ProtoMessage() {} +func (*QueryTotalSupplyHARDRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{10} +} +func (m *QueryTotalSupplyHARDRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSupplyHARDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSupplyHARDRequest.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 *QueryTotalSupplyHARDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSupplyHARDRequest.Merge(m, src) +} +func (m *QueryTotalSupplyHARDRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSupplyHARDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSupplyHARDRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSupplyHARDRequest proto.InternalMessageInfo + +// QueryTotalSupplyHARDResponse is the response type for the Query/TotalSupplyHARD RPC method +type QueryTotalSupplyHARDResponse struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QueryTotalSupplyHARDResponse) Reset() { *m = QueryTotalSupplyHARDResponse{} } +func (m *QueryTotalSupplyHARDResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSupplyHARDResponse) ProtoMessage() {} +func (*QueryTotalSupplyHARDResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{11} +} +func (m *QueryTotalSupplyHARDResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSupplyHARDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSupplyHARDResponse.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 *QueryTotalSupplyHARDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSupplyHARDResponse.Merge(m, src) +} +func (m *QueryTotalSupplyHARDResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSupplyHARDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSupplyHARDResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSupplyHARDResponse proto.InternalMessageInfo + +// QueryTotalSupplyUSDXRequest is the request type for the Query/TotalSupplyUSDX RPC method +type QueryTotalSupplyUSDXRequest struct { +} + +func (m *QueryTotalSupplyUSDXRequest) Reset() { *m = QueryTotalSupplyUSDXRequest{} } +func (m *QueryTotalSupplyUSDXRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSupplyUSDXRequest) ProtoMessage() {} +func (*QueryTotalSupplyUSDXRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{12} +} +func (m *QueryTotalSupplyUSDXRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSupplyUSDXRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSupplyUSDXRequest.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 *QueryTotalSupplyUSDXRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSupplyUSDXRequest.Merge(m, src) +} +func (m *QueryTotalSupplyUSDXRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSupplyUSDXRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSupplyUSDXRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSupplyUSDXRequest proto.InternalMessageInfo + +// QueryTotalSupplyUSDXResponse is the response type for the Query/TotalSupplyUSDX RPC method +type QueryTotalSupplyUSDXResponse struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QueryTotalSupplyUSDXResponse) Reset() { *m = QueryTotalSupplyUSDXResponse{} } +func (m *QueryTotalSupplyUSDXResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSupplyUSDXResponse) ProtoMessage() {} +func (*QueryTotalSupplyUSDXResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2198ebff70588a65, []int{13} +} +func (m *QueryTotalSupplyUSDXResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSupplyUSDXResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSupplyUSDXResponse.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 *QueryTotalSupplyUSDXResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSupplyUSDXResponse.Merge(m, src) +} +func (m *QueryTotalSupplyUSDXResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSupplyUSDXResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSupplyUSDXResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSupplyUSDXResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*QueryCirculatingSupplyRequest)(nil), "kava.validatorvesting.v1beta1.QueryCirculatingSupplyRequest") + proto.RegisterType((*QueryCirculatingSupplyResponse)(nil), "kava.validatorvesting.v1beta1.QueryCirculatingSupplyResponse") + proto.RegisterType((*QueryTotalSupplyRequest)(nil), "kava.validatorvesting.v1beta1.QueryTotalSupplyRequest") + proto.RegisterType((*QueryTotalSupplyResponse)(nil), "kava.validatorvesting.v1beta1.QueryTotalSupplyResponse") + proto.RegisterType((*QueryCirculatingSupplyHARDRequest)(nil), "kava.validatorvesting.v1beta1.QueryCirculatingSupplyHARDRequest") + proto.RegisterType((*QueryCirculatingSupplyHARDResponse)(nil), "kava.validatorvesting.v1beta1.QueryCirculatingSupplyHARDResponse") + proto.RegisterType((*QueryCirculatingSupplyUSDXRequest)(nil), "kava.validatorvesting.v1beta1.QueryCirculatingSupplyUSDXRequest") + proto.RegisterType((*QueryCirculatingSupplyUSDXResponse)(nil), "kava.validatorvesting.v1beta1.QueryCirculatingSupplyUSDXResponse") + proto.RegisterType((*QueryCirculatingSupplySWPRequest)(nil), "kava.validatorvesting.v1beta1.QueryCirculatingSupplySWPRequest") + proto.RegisterType((*QueryCirculatingSupplySWPResponse)(nil), "kava.validatorvesting.v1beta1.QueryCirculatingSupplySWPResponse") + proto.RegisterType((*QueryTotalSupplyHARDRequest)(nil), "kava.validatorvesting.v1beta1.QueryTotalSupplyHARDRequest") + proto.RegisterType((*QueryTotalSupplyHARDResponse)(nil), "kava.validatorvesting.v1beta1.QueryTotalSupplyHARDResponse") + proto.RegisterType((*QueryTotalSupplyUSDXRequest)(nil), "kava.validatorvesting.v1beta1.QueryTotalSupplyUSDXRequest") + proto.RegisterType((*QueryTotalSupplyUSDXResponse)(nil), "kava.validatorvesting.v1beta1.QueryTotalSupplyUSDXResponse") +} + +func init() { + proto.RegisterFile("kava/validatorvesting/v1beta1/query.proto", fileDescriptor_2198ebff70588a65) +} + +var fileDescriptor_2198ebff70588a65 = []byte{ + // 619 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x96, 0xcb, 0x6e, 0xd3, 0x4c, + 0x14, 0xc7, 0x33, 0x9f, 0xf4, 0x55, 0x62, 0xba, 0x40, 0x8c, 0x8a, 0x68, 0x4d, 0xe3, 0x14, 0x23, + 0x21, 0x90, 0x88, 0xad, 0x34, 0x55, 0x4b, 0x2f, 0xd0, 0x0b, 0x5d, 0xd0, 0x1d, 0x4d, 0x8a, 0x40, + 0x6c, 0xa2, 0x49, 0x62, 0xb9, 0x56, 0x1d, 0x8f, 0xeb, 0x19, 0x9b, 0x86, 0x25, 0x4f, 0x80, 0xc4, + 0xab, 0x74, 0xc3, 0x03, 0x20, 0x65, 0xc1, 0xa2, 0x82, 0x0d, 0x20, 0x51, 0x41, 0xc2, 0x83, 0x20, + 0x8f, 0x27, 0xaa, 0xeb, 0xb8, 0x29, 0x76, 0x14, 0x58, 0x25, 0xb1, 0xcf, 0xe5, 0xf7, 0xf7, 0x39, + 0xf3, 0x77, 0xe0, 0xbd, 0x03, 0xec, 0x63, 0xcd, 0xc7, 0x96, 0xd9, 0xc4, 0x8c, 0xb8, 0xbe, 0x4e, + 0x99, 0x69, 0x1b, 0x9a, 0x5f, 0xaa, 0xeb, 0x0c, 0x97, 0xb4, 0x43, 0x4f, 0x77, 0xdb, 0xaa, 0xe3, + 0x12, 0x46, 0x50, 0x3e, 0x08, 0x55, 0xe3, 0xa1, 0xaa, 0x08, 0x95, 0x66, 0x1a, 0x84, 0xb6, 0x08, + 0xad, 0xf1, 0x60, 0x2d, 0xfc, 0x11, 0x66, 0x4a, 0x53, 0x06, 0x31, 0x48, 0x78, 0x3d, 0xf8, 0x26, + 0xae, 0xce, 0x1a, 0x84, 0x18, 0x96, 0xae, 0x61, 0xc7, 0xd4, 0xb0, 0x6d, 0x13, 0x86, 0x99, 0x49, + 0x6c, 0x91, 0xa3, 0x14, 0x60, 0x7e, 0x37, 0x68, 0xfe, 0xd8, 0x74, 0x1b, 0x9e, 0x85, 0x83, 0x56, + 0x55, 0xcf, 0x71, 0xac, 0x76, 0x45, 0x3f, 0xf4, 0x74, 0xca, 0x14, 0x1f, 0xca, 0x17, 0x05, 0x50, + 0x87, 0xd8, 0x54, 0x47, 0x7b, 0x70, 0x02, 0xb7, 0x88, 0x67, 0xb3, 0x69, 0x30, 0x07, 0xee, 0x5e, + 0xd9, 0x5a, 0xeb, 0x9c, 0x16, 0x72, 0xdf, 0x4e, 0x0b, 0x77, 0x0c, 0x93, 0xed, 0x7b, 0x75, 0xb5, + 0x41, 0x5a, 0x82, 0x53, 0x7c, 0x14, 0x69, 0xf3, 0x40, 0x63, 0x6d, 0x47, 0xa7, 0xea, 0x8e, 0xcd, + 0x3e, 0x1d, 0x17, 0xa1, 0x90, 0xb1, 0x63, 0xb3, 0x8a, 0xa8, 0xa5, 0xcc, 0xc0, 0x1b, 0xbc, 0xef, + 0x1e, 0x61, 0xd8, 0x3a, 0x8f, 0xe4, 0xc0, 0xe9, 0xc1, 0x5b, 0x63, 0x85, 0xb9, 0x0d, 0x6f, 0x25, + 0x3f, 0x84, 0x27, 0x9b, 0x95, 0xed, 0x3e, 0xd6, 0x6b, 0xa8, 0x0c, 0x0b, 0xfa, 0x37, 0x80, 0xcf, + 0xaa, 0xdb, 0x2f, 0x2e, 0x05, 0x0c, 0x83, 0xc6, 0x0a, 0xa8, 0xc0, 0xb9, 0xe4, 0xde, 0xd5, 0xe7, + 0x4f, 0xfb, 0x7c, 0xed, 0x8b, 0x44, 0xf0, 0x98, 0xb1, 0xe2, 0xe5, 0xe1, 0xcd, 0xf8, 0x4a, 0x45, + 0x47, 0xcb, 0xe0, 0x6c, 0xf2, 0xed, 0xbf, 0x0d, 0x15, 0x1d, 0x67, 0x02, 0xd4, 0xf8, 0x07, 0x39, + 0xff, 0x7e, 0x12, 0xfe, 0xcf, 0xdb, 0xa2, 0x8f, 0x00, 0x5e, 0x1b, 0x18, 0x15, 0x5a, 0x53, 0x87, + 0xfa, 0x97, 0x3a, 0xd4, 0x6d, 0xa4, 0x87, 0x19, 0xb3, 0x43, 0xc9, 0xca, 0xca, 0x9b, 0xcf, 0xbf, + 0xde, 0xfd, 0xb7, 0x80, 0xe6, 0xb5, 0xf3, 0x7e, 0x5b, 0x8c, 0x1b, 0x6e, 0xe3, 0xac, 0x44, 0x8d, + 0x86, 0xe0, 0xc7, 0x00, 0x4e, 0x46, 0x1e, 0x25, 0x5a, 0xfc, 0x13, 0x94, 0x41, 0x77, 0x92, 0x96, + 0x52, 0xe7, 0x09, 0xf8, 0x05, 0x0e, 0xaf, 0xa2, 0xfb, 0x97, 0xc1, 0xb3, 0x20, 0xb9, 0x8f, 0xfd, + 0x1d, 0xc0, 0xeb, 0x89, 0x8e, 0x83, 0x36, 0x32, 0x3d, 0xcb, 0xc8, 0xda, 0x4b, 0x9b, 0x23, 0x54, + 0x10, 0xa2, 0xd6, 0xb9, 0xa8, 0x65, 0xb4, 0x94, 0x7e, 0x22, 0xb5, 0x7d, 0xec, 0x36, 0x93, 0xf5, + 0x05, 0x7b, 0x9e, 0x51, 0x5f, 0xe4, 0x04, 0x65, 0xd4, 0x17, 0x3d, 0x64, 0x23, 0xe9, 0xf3, 0x68, + 0xf3, 0x08, 0x7d, 0x05, 0x70, 0x2a, 0xc9, 0xf0, 0xd0, 0x7a, 0x26, 0xb8, 0x33, 0x3b, 0x95, 0x36, + 0xb2, 0x17, 0x10, 0xe2, 0x1e, 0x71, 0x71, 0x0f, 0xd0, 0x62, 0x06, 0x71, 0xf4, 0x95, 0x83, 0x3e, + 0x00, 0x78, 0x35, 0x66, 0x99, 0x68, 0x25, 0xe5, 0xf1, 0x88, 0xee, 0xe3, 0x6a, 0xa6, 0x5c, 0x21, + 0x66, 0x99, 0x8b, 0x29, 0xa3, 0x52, 0x9a, 0xe3, 0x15, 0xee, 0x60, 0x4c, 0x07, 0xdf, 0xbe, 0xb4, + 0x3a, 0xa2, 0x7b, 0xb7, 0x9a, 0x29, 0x77, 0x24, 0x1d, 0xc1, 0xae, 0x6d, 0xed, 0x76, 0x7e, 0xca, + 0xb9, 0x4e, 0x57, 0x06, 0x27, 0x5d, 0x19, 0xfc, 0xe8, 0xca, 0xe0, 0x6d, 0x4f, 0xce, 0x9d, 0xf4, + 0xe4, 0xdc, 0x97, 0x9e, 0x9c, 0x7b, 0x59, 0x8e, 0xbc, 0x17, 0x82, 0xd2, 0x45, 0x0b, 0xd7, 0x69, + 0xd8, 0xe4, 0x28, 0xa1, 0x0d, 0x7f, 0x51, 0xd4, 0x27, 0xf8, 0xdf, 0xc8, 0xf2, 0xef, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xbd, 0x0f, 0x0a, 0x7d, 0xe1, 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 + +// 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 { + // CirculatingSupply returns the total amount of kava tokens in circulation + CirculatingSupply(ctx context.Context, in *QueryCirculatingSupplyRequest, opts ...grpc.CallOption) (*QueryCirculatingSupplyResponse, error) + // TotalSupply returns the total amount of kava tokens + TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) + // CirculatingSupplyHARD returns the total amount of hard tokens in circulation + CirculatingSupplyHARD(ctx context.Context, in *QueryCirculatingSupplyHARDRequest, opts ...grpc.CallOption) (*QueryCirculatingSupplyHARDResponse, error) + // CirculatingSupplyUSDX returns the total amount of usdx tokens in circulation + CirculatingSupplyUSDX(ctx context.Context, in *QueryCirculatingSupplyUSDXRequest, opts ...grpc.CallOption) (*QueryCirculatingSupplyUSDXResponse, error) + // CirculatingSupplySWP returns the total amount of swp tokens in circulation + CirculatingSupplySWP(ctx context.Context, in *QueryCirculatingSupplySWPRequest, opts ...grpc.CallOption) (*QueryCirculatingSupplySWPResponse, error) + // TotalSupplyHARD returns the total amount of hard tokens + TotalSupplyHARD(ctx context.Context, in *QueryTotalSupplyHARDRequest, opts ...grpc.CallOption) (*QueryTotalSupplyHARDResponse, error) + // TotalSupplyUSDX returns the total amount of usdx tokens + TotalSupplyUSDX(ctx context.Context, in *QueryTotalSupplyUSDXRequest, opts ...grpc.CallOption) (*QueryTotalSupplyUSDXResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) CirculatingSupply(ctx context.Context, in *QueryCirculatingSupplyRequest, opts ...grpc.CallOption) (*QueryCirculatingSupplyResponse, error) { + out := new(QueryCirculatingSupplyResponse) + err := c.cc.Invoke(ctx, "/kava.validatorvesting.v1beta1.Query/CirculatingSupply", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) { + out := new(QueryTotalSupplyResponse) + err := c.cc.Invoke(ctx, "/kava.validatorvesting.v1beta1.Query/TotalSupply", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) CirculatingSupplyHARD(ctx context.Context, in *QueryCirculatingSupplyHARDRequest, opts ...grpc.CallOption) (*QueryCirculatingSupplyHARDResponse, error) { + out := new(QueryCirculatingSupplyHARDResponse) + err := c.cc.Invoke(ctx, "/kava.validatorvesting.v1beta1.Query/CirculatingSupplyHARD", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) CirculatingSupplyUSDX(ctx context.Context, in *QueryCirculatingSupplyUSDXRequest, opts ...grpc.CallOption) (*QueryCirculatingSupplyUSDXResponse, error) { + out := new(QueryCirculatingSupplyUSDXResponse) + err := c.cc.Invoke(ctx, "/kava.validatorvesting.v1beta1.Query/CirculatingSupplyUSDX", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) CirculatingSupplySWP(ctx context.Context, in *QueryCirculatingSupplySWPRequest, opts ...grpc.CallOption) (*QueryCirculatingSupplySWPResponse, error) { + out := new(QueryCirculatingSupplySWPResponse) + err := c.cc.Invoke(ctx, "/kava.validatorvesting.v1beta1.Query/CirculatingSupplySWP", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TotalSupplyHARD(ctx context.Context, in *QueryTotalSupplyHARDRequest, opts ...grpc.CallOption) (*QueryTotalSupplyHARDResponse, error) { + out := new(QueryTotalSupplyHARDResponse) + err := c.cc.Invoke(ctx, "/kava.validatorvesting.v1beta1.Query/TotalSupplyHARD", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TotalSupplyUSDX(ctx context.Context, in *QueryTotalSupplyUSDXRequest, opts ...grpc.CallOption) (*QueryTotalSupplyUSDXResponse, error) { + out := new(QueryTotalSupplyUSDXResponse) + err := c.cc.Invoke(ctx, "/kava.validatorvesting.v1beta1.Query/TotalSupplyUSDX", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // CirculatingSupply returns the total amount of kava tokens in circulation + CirculatingSupply(context.Context, *QueryCirculatingSupplyRequest) (*QueryCirculatingSupplyResponse, error) + // TotalSupply returns the total amount of kava tokens + TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) + // CirculatingSupplyHARD returns the total amount of hard tokens in circulation + CirculatingSupplyHARD(context.Context, *QueryCirculatingSupplyHARDRequest) (*QueryCirculatingSupplyHARDResponse, error) + // CirculatingSupplyUSDX returns the total amount of usdx tokens in circulation + CirculatingSupplyUSDX(context.Context, *QueryCirculatingSupplyUSDXRequest) (*QueryCirculatingSupplyUSDXResponse, error) + // CirculatingSupplySWP returns the total amount of swp tokens in circulation + CirculatingSupplySWP(context.Context, *QueryCirculatingSupplySWPRequest) (*QueryCirculatingSupplySWPResponse, error) + // TotalSupplyHARD returns the total amount of hard tokens + TotalSupplyHARD(context.Context, *QueryTotalSupplyHARDRequest) (*QueryTotalSupplyHARDResponse, error) + // TotalSupplyUSDX returns the total amount of usdx tokens + TotalSupplyUSDX(context.Context, *QueryTotalSupplyUSDXRequest) (*QueryTotalSupplyUSDXResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) CirculatingSupply(ctx context.Context, req *QueryCirculatingSupplyRequest) (*QueryCirculatingSupplyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CirculatingSupply not implemented") +} +func (*UnimplementedQueryServer) TotalSupply(ctx context.Context, req *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented") +} +func (*UnimplementedQueryServer) CirculatingSupplyHARD(ctx context.Context, req *QueryCirculatingSupplyHARDRequest) (*QueryCirculatingSupplyHARDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CirculatingSupplyHARD not implemented") +} +func (*UnimplementedQueryServer) CirculatingSupplyUSDX(ctx context.Context, req *QueryCirculatingSupplyUSDXRequest) (*QueryCirculatingSupplyUSDXResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CirculatingSupplyUSDX not implemented") +} +func (*UnimplementedQueryServer) CirculatingSupplySWP(ctx context.Context, req *QueryCirculatingSupplySWPRequest) (*QueryCirculatingSupplySWPResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CirculatingSupplySWP not implemented") +} +func (*UnimplementedQueryServer) TotalSupplyHARD(ctx context.Context, req *QueryTotalSupplyHARDRequest) (*QueryTotalSupplyHARDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalSupplyHARD not implemented") +} +func (*UnimplementedQueryServer) TotalSupplyUSDX(ctx context.Context, req *QueryTotalSupplyUSDXRequest) (*QueryTotalSupplyUSDXResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalSupplyUSDX not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_CirculatingSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCirculatingSupplyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CirculatingSupply(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.validatorvesting.v1beta1.Query/CirculatingSupply", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CirculatingSupply(ctx, req.(*QueryCirculatingSupplyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalSupplyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalSupply(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.validatorvesting.v1beta1.Query/TotalSupply", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalSupply(ctx, req.(*QueryTotalSupplyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_CirculatingSupplyHARD_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCirculatingSupplyHARDRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CirculatingSupplyHARD(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.validatorvesting.v1beta1.Query/CirculatingSupplyHARD", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CirculatingSupplyHARD(ctx, req.(*QueryCirculatingSupplyHARDRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_CirculatingSupplyUSDX_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCirculatingSupplyUSDXRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CirculatingSupplyUSDX(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.validatorvesting.v1beta1.Query/CirculatingSupplyUSDX", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CirculatingSupplyUSDX(ctx, req.(*QueryCirculatingSupplyUSDXRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_CirculatingSupplySWP_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCirculatingSupplySWPRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CirculatingSupplySWP(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.validatorvesting.v1beta1.Query/CirculatingSupplySWP", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CirculatingSupplySWP(ctx, req.(*QueryCirculatingSupplySWPRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TotalSupplyHARD_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalSupplyHARDRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalSupplyHARD(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.validatorvesting.v1beta1.Query/TotalSupplyHARD", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalSupplyHARD(ctx, req.(*QueryTotalSupplyHARDRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TotalSupplyUSDX_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalSupplyUSDXRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalSupplyUSDX(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.validatorvesting.v1beta1.Query/TotalSupplyUSDX", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalSupplyUSDX(ctx, req.(*QueryTotalSupplyUSDXRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "kava.validatorvesting.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CirculatingSupply", + Handler: _Query_CirculatingSupply_Handler, + }, + { + MethodName: "TotalSupply", + Handler: _Query_TotalSupply_Handler, + }, + { + MethodName: "CirculatingSupplyHARD", + Handler: _Query_CirculatingSupplyHARD_Handler, + }, + { + MethodName: "CirculatingSupplyUSDX", + Handler: _Query_CirculatingSupplyUSDX_Handler, + }, + { + MethodName: "CirculatingSupplySWP", + Handler: _Query_CirculatingSupplySWP_Handler, + }, + { + MethodName: "TotalSupplyHARD", + Handler: _Query_TotalSupplyHARD_Handler, + }, + { + MethodName: "TotalSupplyUSDX", + Handler: _Query_TotalSupplyUSDX_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "kava/validatorvesting/v1beta1/query.proto", +} + +func (m *QueryCirculatingSupplyRequest) 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 *QueryCirculatingSupplyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSupplyResponse) 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 *QueryCirculatingSupplyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTotalSupplyRequest) 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 *QueryTotalSupplyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalSupplyResponse) 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 *QueryTotalSupplyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSupplyHARDRequest) 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 *QueryCirculatingSupplyHARDRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplyHARDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSupplyHARDResponse) 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 *QueryCirculatingSupplyHARDResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplyHARDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSupplyUSDXRequest) 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 *QueryCirculatingSupplyUSDXRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplyUSDXRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSupplyUSDXResponse) 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 *QueryCirculatingSupplyUSDXResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplyUSDXResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSupplySWPRequest) 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 *QueryCirculatingSupplySWPRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplySWPRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSupplySWPResponse) 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 *QueryCirculatingSupplySWPResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplySWPResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTotalSupplyHARDRequest) 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 *QueryTotalSupplyHARDRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSupplyHARDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalSupplyHARDResponse) 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 *QueryTotalSupplyHARDResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSupplyHARDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTotalSupplyUSDXRequest) 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 *QueryTotalSupplyUSDXRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSupplyUSDXRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalSupplyUSDXResponse) 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 *QueryTotalSupplyUSDXResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSupplyUSDXResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + 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 *QueryCirculatingSupplyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryCirculatingSupplyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTotalSupplyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalSupplyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryCirculatingSupplyHARDRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryCirculatingSupplyHARDResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryCirculatingSupplyUSDXRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryCirculatingSupplyUSDXResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryCirculatingSupplySWPRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryCirculatingSupplySWPResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTotalSupplyHARDRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalSupplyHARDResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTotalSupplyUSDXRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalSupplyUSDXResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.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 *QueryCirculatingSupplyRequest) 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: QueryCirculatingSupplyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplyRequest: 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 *QueryCirculatingSupplyResponse) 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: QueryCirculatingSupplyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.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 *QueryTotalSupplyRequest) 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: QueryTotalSupplyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSupplyRequest: 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 *QueryTotalSupplyResponse) 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: QueryTotalSupplyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.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 *QueryCirculatingSupplyHARDRequest) 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: QueryCirculatingSupplyHARDRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplyHARDRequest: 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 *QueryCirculatingSupplyHARDResponse) 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: QueryCirculatingSupplyHARDResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplyHARDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.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 *QueryCirculatingSupplyUSDXRequest) 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: QueryCirculatingSupplyUSDXRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplyUSDXRequest: 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 *QueryCirculatingSupplyUSDXResponse) 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: QueryCirculatingSupplyUSDXResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplyUSDXResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.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 *QueryCirculatingSupplySWPRequest) 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: QueryCirculatingSupplySWPRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplySWPRequest: 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 *QueryCirculatingSupplySWPResponse) 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: QueryCirculatingSupplySWPResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplySWPResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.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 *QueryTotalSupplyHARDRequest) 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: QueryTotalSupplyHARDRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSupplyHARDRequest: 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 *QueryTotalSupplyHARDResponse) 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: QueryTotalSupplyHARDResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSupplyHARDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.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 *QueryTotalSupplyUSDXRequest) 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: QueryTotalSupplyUSDXRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSupplyUSDXRequest: 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 *QueryTotalSupplyUSDXResponse) 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: QueryTotalSupplyUSDXResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSupplyUSDXResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.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/validator-vesting/types/query.pb.gw.go b/x/validator-vesting/types/query.pb.gw.go new file mode 100644 index 00000000..4b9c0d4f --- /dev/null +++ b/x/validator-vesting/types/query.pb.gw.go @@ -0,0 +1,543 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: kava/validatorvesting/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_CirculatingSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplyRequest + var metadata runtime.ServerMetadata + + msg, err := client.CirculatingSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CirculatingSupply_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplyRequest + var metadata runtime.ServerMetadata + + msg, err := server.CirculatingSupply(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSupplyRequest + var metadata runtime.ServerMetadata + + msg, err := client.TotalSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSupplyRequest + var metadata runtime.ServerMetadata + + msg, err := server.TotalSupply(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_CirculatingSupplyHARD_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplyHARDRequest + var metadata runtime.ServerMetadata + + msg, err := client.CirculatingSupplyHARD(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CirculatingSupplyHARD_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplyHARDRequest + var metadata runtime.ServerMetadata + + msg, err := server.CirculatingSupplyHARD(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_CirculatingSupplyUSDX_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplyUSDXRequest + var metadata runtime.ServerMetadata + + msg, err := client.CirculatingSupplyUSDX(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CirculatingSupplyUSDX_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplyUSDXRequest + var metadata runtime.ServerMetadata + + msg, err := server.CirculatingSupplyUSDX(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_CirculatingSupplySWP_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplySWPRequest + var metadata runtime.ServerMetadata + + msg, err := client.CirculatingSupplySWP(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CirculatingSupplySWP_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplySWPRequest + var metadata runtime.ServerMetadata + + msg, err := server.CirculatingSupplySWP(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TotalSupplyHARD_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSupplyHARDRequest + var metadata runtime.ServerMetadata + + msg, err := client.TotalSupplyHARD(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalSupplyHARD_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSupplyHARDRequest + var metadata runtime.ServerMetadata + + msg, err := server.TotalSupplyHARD(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TotalSupplyUSDX_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSupplyUSDXRequest + var metadata runtime.ServerMetadata + + msg, err := client.TotalSupplyUSDX(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalSupplyUSDX_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSupplyUSDXRequest + var metadata runtime.ServerMetadata + + msg, err := server.TotalSupplyUSDX(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_CirculatingSupply_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_CirculatingSupply_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_CirculatingSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalSupply_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_TotalSupply_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_TotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CirculatingSupplyHARD_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_CirculatingSupplyHARD_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_CirculatingSupplyHARD_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CirculatingSupplyUSDX_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_CirculatingSupplyUSDX_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_CirculatingSupplyUSDX_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CirculatingSupplySWP_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_CirculatingSupplySWP_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_CirculatingSupplySWP_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalSupplyHARD_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_TotalSupplyHARD_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_TotalSupplyHARD_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalSupplyUSDX_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_TotalSupplyUSDX_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_TotalSupplyUSDX_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_CirculatingSupply_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_CirculatingSupply_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_CirculatingSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalSupply_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_TotalSupply_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_TotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CirculatingSupplyHARD_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_CirculatingSupplyHARD_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_CirculatingSupplyHARD_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CirculatingSupplyUSDX_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_CirculatingSupplyUSDX_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_CirculatingSupplyUSDX_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CirculatingSupplySWP_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_CirculatingSupplySWP_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_CirculatingSupplySWP_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalSupplyHARD_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_TotalSupplyHARD_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_TotalSupplyHARD_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalSupplyUSDX_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_TotalSupplyUSDX_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_TotalSupplyUSDX_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_CirculatingSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "validator-vesting", "v1beta1", "circulating_supply"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TotalSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "validator-vesting", "v1beta1", "total_supply"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_CirculatingSupplyHARD_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "validator-vesting", "v1beta1", "circulating_supply_hard"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_CirculatingSupplyUSDX_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "validator-vesting", "v1beta1", "circulating_supply_usdx"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_CirculatingSupplySWP_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "validator-vesting", "v1beta1", "circulating_supply_swp"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TotalSupplyHARD_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "validator-vesting", "v1beta1", "total_supply_hard"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TotalSupplyUSDX_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "validator-vesting", "v1beta1", "total_supply_usdx"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_CirculatingSupply_0 = runtime.ForwardResponseMessage + + forward_Query_TotalSupply_0 = runtime.ForwardResponseMessage + + forward_Query_CirculatingSupplyHARD_0 = runtime.ForwardResponseMessage + + forward_Query_CirculatingSupplyUSDX_0 = runtime.ForwardResponseMessage + + forward_Query_CirculatingSupplySWP_0 = runtime.ForwardResponseMessage + + forward_Query_TotalSupplyHARD_0 = runtime.ForwardResponseMessage + + forward_Query_TotalSupplyUSDX_0 = runtime.ForwardResponseMessage +)