From 3abb96bddb055ac180997bd90d695df5a9e581b8 Mon Sep 17 00:00:00 2001 From: Joe Bowman Date: Mon, 27 Jan 2025 18:00:59 +0000 Subject: [PATCH] remove airdrop module, migrate module account and IncentiveSpend message type to x/supply --- app/app.go | 4 +- app/keepers/keepers.go | 21 +- app/keepers/keys.go | 2 - app/modules.go | 10 +- app/upgrades.go | 9 +- app/upgrades/types.go | 1 + app/upgrades/upgrades.go | 1 + app/upgrades/v1_7.go | 10 + cmd/quicksilverd/bulk_airdrop.go | 296 -- cmd/quicksilverd/genairdrop.go | 161 - cmd/quicksilverd/root.go | 3 - docs/config.json | 36 +- docs/swagger.yml | 854 +----- go.work.sum | 26 +- proto/quicksilver/airdrop/v1/airdrop.proto | 105 - proto/quicksilver/airdrop/v1/genesis.proto | 17 - proto/quicksilver/airdrop/v1/messages.proto | 67 - proto/quicksilver/airdrop/v1/params.proto | 12 - proto/quicksilver/airdrop/v1/proposals.proto | 19 - proto/quicksilver/airdrop/v1/query.proto | 132 - proto/quicksilver/supply/v1/messages.proto | 43 + x/airdrop/client/cli/query.go | 240 -- x/airdrop/client/cli/tx.go | 72 - x/airdrop/client/cli/vars.go | 10 - x/airdrop/genesis.go | 72 - x/airdrop/ibc_module.go | 1 - x/airdrop/keeper/abci.go | 15 - x/airdrop/keeper/claim_handler.go | 430 --- x/airdrop/keeper/claim_record.go | 232 -- x/airdrop/keeper/grpc_query.go | 126 - x/airdrop/keeper/hooks.go | 38 - x/airdrop/keeper/invariants.go | 48 - x/airdrop/keeper/keeper.go | 129 - x/airdrop/keeper/keeper_test.go | 349 --- x/airdrop/keeper/msg_server_test.go | 579 ---- x/airdrop/keeper/proposal_handler.go | 85 - x/airdrop/keeper/proposal_handler_test.go | 259 -- x/airdrop/keeper/zonedrop.go | 212 -- x/airdrop/module.go | 199 -- x/airdrop/spec/README.md | 461 --- x/airdrop/types/airdrop.go | 153 - x/airdrop/types/airdrop.pb.go | 1327 -------- x/airdrop/types/airdrop_test.go | 324 -- x/airdrop/types/codec.go | 42 - x/airdrop/types/errors.go | 47 - x/airdrop/types/events.go | 8 - x/airdrop/types/expected_keepers.go | 50 - x/airdrop/types/genesis.go | 93 - x/airdrop/types/genesis.pb.go | 431 --- x/airdrop/types/genesis_test.go | 264 -- x/airdrop/types/keys.go | 33 - x/airdrop/types/keys_test.go | 110 - x/airdrop/types/msgs.go | 143 - x/airdrop/types/msgs_test.go | 311 -- x/airdrop/types/params.go | 40 - x/airdrop/types/params.pb.go | 267 -- x/airdrop/types/proposals.go | 58 - x/airdrop/types/proposals.pb.go | 463 --- x/airdrop/types/proposals_test.go | 95 - x/airdrop/types/query.pb.go | 2694 ----------------- x/airdrop/types/query.pb.gw.go | 722 ----- x/airdrop/types/zip.go | 18 - x/airdrop/types/zip_test.go | 61 - x/mint/keeper/keeper.go | 5 +- x/participationrewards/keeper/invariants.go | 2 +- .../keeper/rewards_holdings.go | 5 +- x/supply/keeper/keeper.go | 10 + x/supply/keeper/keeper_test.go | 66 + x/{airdrop => supply}/keeper/msg_server.go | 19 +- x/supply/keeper/msg_server_test.go | 87 + x/supply/types/expected_keepers.go | 6 + x/supply/types/keys.go | 2 + x/{airdrop => supply}/types/messages.pb.go | 588 +--- x/{airdrop => supply}/types/messages.pb.gw.go | 85 +- 74 files changed, 453 insertions(+), 13562 deletions(-) delete mode 100644 cmd/quicksilverd/bulk_airdrop.go delete mode 100644 cmd/quicksilverd/genairdrop.go delete mode 100644 proto/quicksilver/airdrop/v1/airdrop.proto delete mode 100644 proto/quicksilver/airdrop/v1/genesis.proto delete mode 100644 proto/quicksilver/airdrop/v1/messages.proto delete mode 100644 proto/quicksilver/airdrop/v1/params.proto delete mode 100644 proto/quicksilver/airdrop/v1/proposals.proto delete mode 100644 proto/quicksilver/airdrop/v1/query.proto create mode 100644 proto/quicksilver/supply/v1/messages.proto delete mode 100644 x/airdrop/client/cli/query.go delete mode 100644 x/airdrop/client/cli/tx.go delete mode 100644 x/airdrop/client/cli/vars.go delete mode 100644 x/airdrop/genesis.go delete mode 100644 x/airdrop/ibc_module.go delete mode 100644 x/airdrop/keeper/abci.go delete mode 100644 x/airdrop/keeper/claim_handler.go delete mode 100644 x/airdrop/keeper/claim_record.go delete mode 100644 x/airdrop/keeper/grpc_query.go delete mode 100644 x/airdrop/keeper/hooks.go delete mode 100644 x/airdrop/keeper/invariants.go delete mode 100644 x/airdrop/keeper/keeper.go delete mode 100644 x/airdrop/keeper/keeper_test.go delete mode 100644 x/airdrop/keeper/msg_server_test.go delete mode 100644 x/airdrop/keeper/proposal_handler.go delete mode 100644 x/airdrop/keeper/proposal_handler_test.go delete mode 100644 x/airdrop/keeper/zonedrop.go delete mode 100644 x/airdrop/module.go delete mode 100644 x/airdrop/spec/README.md delete mode 100644 x/airdrop/types/airdrop.go delete mode 100644 x/airdrop/types/airdrop.pb.go delete mode 100644 x/airdrop/types/airdrop_test.go delete mode 100644 x/airdrop/types/codec.go delete mode 100644 x/airdrop/types/errors.go delete mode 100644 x/airdrop/types/events.go delete mode 100644 x/airdrop/types/expected_keepers.go delete mode 100644 x/airdrop/types/genesis.go delete mode 100644 x/airdrop/types/genesis.pb.go delete mode 100644 x/airdrop/types/genesis_test.go delete mode 100644 x/airdrop/types/keys.go delete mode 100644 x/airdrop/types/keys_test.go delete mode 100644 x/airdrop/types/msgs.go delete mode 100644 x/airdrop/types/msgs_test.go delete mode 100644 x/airdrop/types/params.go delete mode 100644 x/airdrop/types/params.pb.go delete mode 100644 x/airdrop/types/proposals.go delete mode 100644 x/airdrop/types/proposals.pb.go delete mode 100644 x/airdrop/types/proposals_test.go delete mode 100644 x/airdrop/types/query.pb.go delete mode 100644 x/airdrop/types/query.pb.gw.go delete mode 100644 x/airdrop/types/zip.go delete mode 100644 x/airdrop/types/zip_test.go create mode 100644 x/supply/keeper/keeper_test.go rename x/{airdrop => supply}/keeper/msg_server.go (75%) create mode 100644 x/supply/keeper/msg_server_test.go rename x/{airdrop => supply}/types/messages.pb.go (51%) rename x/{airdrop => supply}/types/messages.pb.gw.go (63%) diff --git a/app/app.go b/app/app.go index acdea5aea..c0978ddc0 100644 --- a/app/app.go +++ b/app/app.go @@ -39,8 +39,8 @@ import ( "github.com/quicksilver-zone/quicksilver/app/keepers" "github.com/quicksilver-zone/quicksilver/docs" - airdroptypes "github.com/quicksilver-zone/quicksilver/x/airdrop/types" interchainstakingtypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" + supplytypes "github.com/quicksilver-zone/quicksilver/x/supply/types" ) func Init() { @@ -64,7 +64,7 @@ var ( allowedReceivingModAcc = map[string]bool{ distrtypes.ModuleName: true, interchainstakingtypes.ModuleName: true, - airdroptypes.ModuleName: true, + supplytypes.AirdropAccount: true, } ) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index f4338c7d3..f67f6166b 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -61,8 +61,6 @@ import ( appconfig "github.com/quicksilver-zone/quicksilver/cmd/config" "github.com/quicksilver-zone/quicksilver/utils" - airdropkeeper "github.com/quicksilver-zone/quicksilver/x/airdrop/keeper" - airdroptypes "github.com/quicksilver-zone/quicksilver/x/airdrop/types" claimsmanagerkeeper "github.com/quicksilver-zone/quicksilver/x/claimsmanager/keeper" claimsmanagertypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" epochskeeper "github.com/quicksilver-zone/quicksilver/x/epochs/keeper" @@ -111,7 +109,6 @@ type AppKeepers struct { InterchainstakingKeeper *interchainstakingkeeper.Keeper InterchainQueryKeeper interchainquerykeeper.Keeper ParticipationRewardsKeeper *participationrewardskeeper.Keeper - AirdropKeeper *airdropkeeper.Keeper SupplyKeeper supplykeeper.Keeper // IBC keepers @@ -334,6 +331,7 @@ func (appKeepers *AppKeepers) InitKeepers( appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), utils.Keys[[]string](maccPerms), supplyEndpointEnabled, ) @@ -489,22 +487,6 @@ func (appKeepers *AppKeepers) InitKeepers( govConfig, ) - appKeepers.AirdropKeeper = airdropkeeper.NewKeeper( - appCodec, - appKeepers.keys[airdroptypes.StoreKey], - appKeepers.GetSubspace(airdroptypes.ModuleName), - appKeepers.AccountKeeper, - appKeepers.BankKeeper, - appKeepers.StakingKeeper, - appKeepers.GovKeeper, - appKeepers.IBCKeeper, - appKeepers.InterchainstakingKeeper, - appKeepers.ParticipationRewardsKeeper, - proofOpsFn, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - // airdropModule := airdrop.NewAppModule(appCodec, appKeepers.AirdropKeeper) - appKeepers.ScopedIBCKeeper = scopedIBCKeeper appKeepers.ScopedTransferKeeper = scopedTransferKeeper appKeepers.ScopedICAControllerKeeper = scopedICAControllerKeeper @@ -536,7 +518,6 @@ func (*AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *cod paramsKeeper.Subspace(interchainstakingtypes.ModuleName) paramsKeeper.Subspace(interchainquerytypes.ModuleName) paramsKeeper.Subspace(participationrewardstypes.ModuleName) - paramsKeeper.Subspace(airdroptypes.ModuleName) return paramsKeeper } diff --git a/app/keepers/keys.go b/app/keepers/keys.go index 56d3e5a70..13bd7ad22 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -23,7 +23,6 @@ import ( ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host" - airdroptypes "github.com/quicksilver-zone/quicksilver/x/airdrop/types" claimsmanagertypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" epochstypes "github.com/quicksilver-zone/quicksilver/x/epochs/types" interchainquerytypes "github.com/quicksilver-zone/quicksilver/x/interchainquery/types" @@ -62,7 +61,6 @@ func KVStoreKeys() []string { interchainstakingtypes.StoreKey, interchainquerytypes.StoreKey, participationrewardstypes.StoreKey, - airdroptypes.StoreKey, supplytypes.StoreKey, } } diff --git a/app/modules.go b/app/modules.go index da72dbb27..885e492e7 100644 --- a/app/modules.go +++ b/app/modules.go @@ -49,8 +49,6 @@ import ( ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client" ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host" - "github.com/quicksilver-zone/quicksilver/x/airdrop" - airdroptypes "github.com/quicksilver-zone/quicksilver/x/airdrop/types" "github.com/quicksilver-zone/quicksilver/x/claimsmanager" claimsmanagertypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" "github.com/quicksilver-zone/quicksilver/x/epochs" @@ -105,7 +103,6 @@ var ( interchainstaking.AppModuleBasic{}, interchainquery.AppModuleBasic{}, participationrewards.AppModuleBasic{}, - airdrop.AppModuleBasic{}, supply.AppModuleBasic{}, ) @@ -124,7 +121,7 @@ var ( interchainstakingtypes.EscrowModuleAccount: {authtypes.Burner}, interchainquerytypes.ModuleName: nil, participationrewardstypes.ModuleName: nil, - airdroptypes.ModuleName: nil, + supplytypes.AirdropAccount: nil, packetforwardtypes.ModuleName: nil, } ) @@ -170,7 +167,6 @@ func appModules( interchainstaking.NewAppModule(appCodec, app.InterchainstakingKeeper), interchainquery.NewAppModule(appCodec, app.InterchainQueryKeeper), participationrewards.NewAppModule(appCodec, app.ParticipationRewardsKeeper), - airdrop.NewAppModule(appCodec, app.AirdropKeeper), supply.NewAppModule(appCodec, app.SupplyKeeper), } } @@ -208,7 +204,6 @@ func simulationModules( interchainstaking.NewAppModule(appCodec, app.InterchainstakingKeeper), interchainquery.NewAppModule(appCodec, app.InterchainQueryKeeper), participationrewards.NewAppModule(appCodec, app.ParticipationRewardsKeeper), - airdrop.NewAppModule(appCodec, app.AirdropKeeper), // supply.NewAppModule(appCodec, app.SupplyKeeper), } } @@ -244,7 +239,6 @@ func orderBeginBlockers() []string { packetforwardtypes.ModuleName, claimsmanagertypes.ModuleName, participationrewardstypes.ModuleName, - airdroptypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, @@ -295,7 +289,6 @@ func orderEndBlockers() []string { claimsmanagertypes.ModuleName, interchainstakingtypes.ModuleName, participationrewardstypes.ModuleName, - airdroptypes.ModuleName, supplytypes.ModuleName, // currently no-op. } @@ -337,7 +330,6 @@ func orderInitBlockers() []string { interchainstakingtypes.ModuleName, interchainquerytypes.ModuleName, participationrewardstypes.ModuleName, - airdroptypes.ModuleName, supplytypes.ModuleName, // NOTE: crisis module must go at the end to check for invariants on each module crisistypes.ModuleName, diff --git a/app/upgrades.go b/app/upgrades.go index ebff9126d..ec0905aa6 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -17,8 +17,9 @@ import ( ) const ( - wasmModuleName = "wasm" - tfModuleName = "tokenfactory" + wasmModuleName = "wasm" + tfModuleName = "tokenfactory" + airdropModuleName = "airdrop" ) func (app *Quicksilver) setUpgradeHandlers() { @@ -76,6 +77,10 @@ func (app *Quicksilver) setUpgradeStoreLoaders() { storeUpgrades = &storetypes.StoreUpgrades{ Deleted: []string{wasmModuleName, tfModuleName}, } + case upgrades.V010706UpgradeName: + storeUpgrades = &storetypes.StoreUpgrades{ + Deleted: []string{airdropModuleName}, + } default: // no-op } diff --git a/app/upgrades/types.go b/app/upgrades/types.go index d9c2fd6d2..055787d82 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -53,6 +53,7 @@ const ( V010702UpgradeName = "v1.7.2" V010704UpgradeName = "v1.7.4" V010705UpgradeName = "v1.7.5" + V010706UpgradeName = "v1.7.6" ) // Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal diff --git a/app/upgrades/upgrades.go b/app/upgrades/upgrades.go index 223acf389..9a724675d 100644 --- a/app/upgrades/upgrades.go +++ b/app/upgrades/upgrades.go @@ -28,6 +28,7 @@ func Upgrades() []Upgrade { {UpgradeName: V010702UpgradeName, CreateUpgradeHandler: V010702UpgradeHandler}, {UpgradeName: V010704UpgradeName, CreateUpgradeHandler: V010704UpgradeHandler}, {UpgradeName: V010705UpgradeName, CreateUpgradeHandler: V010705UpgradeHandler}, + {UpgradeName: V010706UpgradeName, CreateUpgradeHandler: V010706UpgradeHandler}, } } diff --git a/app/upgrades/v1_7.go b/app/upgrades/v1_7.go index 9a26689e6..e9063bfd0 100644 --- a/app/upgrades/v1_7.go +++ b/app/upgrades/v1_7.go @@ -159,3 +159,13 @@ func V010705UpgradeHandler( return mm.RunMigrations(ctx, configurator, fromVM) } } + +func V010706UpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + appKeepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, fromVM) + } +} diff --git a/cmd/quicksilverd/bulk_airdrop.go b/cmd/quicksilverd/bulk_airdrop.go deleted file mode 100644 index 1eccf87f0..000000000 --- a/cmd/quicksilverd/bulk_airdrop.go +++ /dev/null @@ -1,296 +0,0 @@ -package main - -import ( - "bufio" - "encoding/csv" - "encoding/json" - "errors" - "fmt" - "io" - "log" - "os" - "strconv" - "strings" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -// AddZonedropCmd returns add-zonedrop cobra Command. -func AddZonedropCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "add-zonedrop [chain_id] [start_time] [duration] [decay] [actions]", - Short: "Add an zonedrop to genesis.json", - Long: `Add an zonedrop to genesis.json.`, - - Args: cobra.ExactArgs(5), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - chainID := args[0] - - layout := "2006-01-02T15:04:05Z" - startTime, err := time.Parse(layout, args[1]) - if err != nil { - panic(err) - } - - duration, err := time.ParseDuration(args[2]) - if err != nil { - panic(err) - } - decay, err := time.ParseDuration(args[3]) - if err != nil { - panic(err) - } - actionString := args[4] - - airdrop := types.ZoneDrop{ - ChainId: chainID, - StartTime: startTime, - Duration: duration, - Decay: decay, - Allocation: 0, - Actions: []sdk.Dec{}, - IsConcluded: false, - } - - actions := strings.Split(actionString, ",") - for _, action := range actions { - weight := sdk.MustNewDecFromStr(action) - airdrop.Actions = append(airdrop.Actions, weight) - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - airdropGenState := types.GetGenesisStateFromAppState(clientCtx.Codec, appState) - - // assert zonedrop exists - for _, zd := range airdropGenState.ZoneDrops { - if zd.ChainId == airdrop.ChainId { - panic("ZoneDrop for this chainId already exists") - } - } - - airdropGenState.ZoneDrops = append(airdropGenState.ZoneDrops, &airdrop) - - airdropGenStateBz, err := clientCtx.Codec.MarshalJSON(airdropGenState) - if err != nil { - return fmt.Errorf("failed to marshal airdrop genesis state: %w", err) - } - - appState[types.ModuleName] = airdropGenStateBz - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// BulkGenesisAirdropCmd returns add-genesis-airdrop cobra Command. -func BulkGenesisAirdropCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "bulk-genesis-airdrop [file.csv] [chain_id]", - Short: "Add an airdrop claim to genesis.json, from csv", - Long: `Add an airdrop claim to genesis.json, from csv. The zone drop record must already exist.`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - csvfile, err := os.Open(args[0]) - if err != nil { - log.Fatalln("Couldn't open the csv file", err) - } - - r := csv.NewReader(bufio.NewReader(csvfile)) - - claimRecords := make([]*types.ClaimRecord, 0) - // Iterate through the records - for { - // Read each record from csv - record, err := r.Read() - if errors.Is(err, io.EOF) { - break - } - - addr, err := sdk.AccAddressFromBech32(record[0]) - if err != nil { - return err - } - - allocation, err := strconv.ParseUint(record[2], 10, 64) - if err != nil { - return fmt.Errorf("failed to parse allocation: %w", err) - } - - baseValue, err := strconv.ParseUint(record[1], 10, 64) - if err != nil { - return fmt.Errorf("failed to parse base_value: %w", err) - } - - claimRecord := types.ClaimRecord{ - Address: addr.String(), - ChainId: args[1], - MaxAllocation: allocation, - BaseValue: baseValue, - } - - if err := claimRecord.ValidateBasic(); err != nil { - return err - } - - claimRecords = append(claimRecords, &claimRecord) - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - airdropGenState := types.GetGenesisStateFromAppState(clientCtx.Codec, appState) - - var zoneDrop *types.ZoneDrop - // assert zonedrop exists - if len(claimRecords) == 0 { - return fmt.Errorf("claimRecords is empty") - } - - for _, zd := range airdropGenState.ZoneDrops { - if zd.ChainId == claimRecords[0].ChainId { // nolint:gosec - zoneDrop = zd - } - } - - if zoneDrop == nil { - return fmt.Errorf("zoneDrop doesn't exist for chain ID: %s", claimRecords[0].ChainId) // nolint:gosec // TODO: remove - } - - authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - - accs, err := authtypes.UnpackAccounts(authGenState.Accounts) - if err != nil { - return fmt.Errorf("failed to get accounts from any: %w", err) - } - bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - - zoneclaims := map[string]bool{} - existing := airdropGenState.ClaimRecords - - for _, i := range existing { - if i.ChainId == claimRecords[0].ChainId { // nolint:gosec // TODO: remove - zoneclaims[i.Address] = true - } - } - - for idx, claimRecord := range claimRecords { - if idx%100 == 0 { - fmt.Printf("(%d/%d)...\n", idx, len(claimRecords)) - } - - if _, exists := zoneclaims[claimRecord.Address]; exists { - return fmt.Errorf("airdrop claimRecord already exists for user %s on chain ID: %s", claimRecord.Address, claimRecord.ChainId) - } - - // Add the new account to the set of genesis accounts and sanitize the - // accounts afterwards. - zoneDrop.Allocation += claimRecord.MaxAllocation - - // add base account for airdrop recipient, containing 1uqck - balances := banktypes.Balance{Address: claimRecord.Address, Coins: sdk.NewCoins(sdk.NewCoin("uqck", sdk.OneInt()))} - addr, _ := sdk.AccAddressFromBech32(claimRecord.Address) - genAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) - - if err := genAccount.Validate(); err != nil { - return fmt.Errorf("failed to validate new genesis account: %w", err) - } - - if !accs.Contains(addr) { - // If this account does not exist in accs, create it. - accs = append(accs, genAccount) - accs = authtypes.SanitizeGenesisAccounts(accs) - - bankGenState.Balances = append(bankGenState.Balances, balances) - bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) - } - } - - bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) - - airdropGenState.ClaimRecords = append(airdropGenState.ClaimRecords, claimRecords...) - - genAccs, err := authtypes.PackAccounts(accs) - if err != nil { - return fmt.Errorf("failed to convert accounts into any's: %w", err) - } - authGenState.Accounts = genAccs - - authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState) - if err != nil { - return fmt.Errorf("failed to marshal auth genesis state: %w", err) - } - - appState[authtypes.ModuleName] = authGenStateBz - - airdropGenStateBz, err := clientCtx.Codec.MarshalJSON(airdropGenState) - if err != nil { - return fmt.Errorf("failed to marshal airdrop genesis state: %w", err) - } - - appState[types.ModuleName] = airdropGenStateBz - - bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState) - if err != nil { - return fmt.Errorf("failed to marshal bank genesis state: %w", err) - } - - appState[banktypes.ModuleName] = bankGenStateBz - - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/cmd/quicksilverd/genairdrop.go b/cmd/quicksilverd/genairdrop.go deleted file mode 100644 index b5314743c..000000000 --- a/cmd/quicksilverd/genairdrop.go +++ /dev/null @@ -1,161 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "strconv" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -// AddGenesisAirdropCmd returns add-genesis-airdrop cobra Command. -func AddGenesisAirdropCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "add-genesis-airdrop [address] [chain_id] [allocation] [base_value]", - Short: "Add an airdrop claim to genesis.json", - Long: `Add an airdrop claim to genesis.json. The zone drop record must already exist. -`, - Args: cobra.ExactArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - - allocation, err := strconv.ParseUint(args[2], 10, 64) - if err != nil { - return fmt.Errorf("failed to parse allocation: %w", err) - } - - baseValue, err := strconv.ParseUint(args[3], 10, 64) - if err != nil { - return fmt.Errorf("failed to parse base_value: %w", err) - } - - claimRecord := types.ClaimRecord{ - Address: args[0], - ChainId: args[1], - MaxAllocation: allocation, - BaseValue: baseValue, - } - - if err := claimRecord.ValidateBasic(); err != nil { - return err - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - airdropGenState := types.GetGenesisStateFromAppState(clientCtx.Codec, appState) - - var zoneDrop *types.ZoneDrop - // assert zonedrop exists - for _, zd := range airdropGenState.ZoneDrops { - if zd.ChainId == claimRecord.ChainId { - zoneDrop = zd - } - } - - if zoneDrop == nil { - return fmt.Errorf("zoneDrop doesn't exist for chain ID: %s", claimRecord.ChainId) - } - - for _, cr := range airdropGenState.ClaimRecords { - if cr.ChainId == claimRecord.ChainId && cr.Address == claimRecord.Address { - return fmt.Errorf("airdrop claimRecord already exists for user %s on chain ID: %s", claimRecord.Address, claimRecord.ChainId) - } - } - - // Add the new account to the set of genesis accounts and sanitize the - // accounts afterwards. - airdropGenState.ClaimRecords = append(airdropGenState.ClaimRecords, &claimRecord) - zoneDrop.Allocation += claimRecord.MaxAllocation - - airdropGenStateBz, err := clientCtx.Codec.MarshalJSON(airdropGenState) - if err != nil { - return fmt.Errorf("failed to marshal airdrop genesis state: %w", err) - } - - appState[types.ModuleName] = airdropGenStateBz - - // add base account for airdrop recipient, containing 1uqck - balances := banktypes.Balance{Address: addr.String(), Coins: sdk.NewCoins(sdk.NewCoin("uqck", sdk.OneInt()))} - genAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) - - if err := genAccount.Validate(); err != nil { - return fmt.Errorf("failed to validate new genesis account: %w", err) - } - - authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - - accs, err := authtypes.UnpackAccounts(authGenState.Accounts) - if err != nil { - return fmt.Errorf("failed to get accounts from any: %w", err) - } - - if !accs.Contains(addr) { - - // If this account does not exist in accs, create it. - accs = append(accs, genAccount) - accs = authtypes.SanitizeGenesisAccounts(accs) - - genAccs, err := authtypes.PackAccounts(accs) - if err != nil { - return fmt.Errorf("failed to convert accounts into any's: %w", err) - } - authGenState.Accounts = genAccs - - authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState) - if err != nil { - return fmt.Errorf("failed to marshal auth genesis state: %w", err) - } - - appState[authtypes.ModuleName] = authGenStateBz - - bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - bankGenState.Balances = append(bankGenState.Balances, balances) - bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) - bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) - - bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState) - if err != nil { - return fmt.Errorf("failed to marshal bank genesis state: %w", err) - } - - appState[banktypes.ModuleName] = bankGenStateBz - } - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/cmd/quicksilverd/root.go b/cmd/quicksilverd/root.go index 548b79e77..1a3ddfefc 100644 --- a/cmd/quicksilverd/root.go +++ b/cmd/quicksilverd/root.go @@ -100,9 +100,6 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) { genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), genutilcli.ValidateGenesisCmd(app.ModuleBasics), AddGenesisAccountCmd(app.DefaultNodeHome), - AddGenesisAirdropCmd(app.DefaultNodeHome), - BulkGenesisAirdropCmd(app.DefaultNodeHome), - AddZonedropCmd(app.DefaultNodeHome), tmcli.NewCompletionCmd(rootCmd, true), debug.Cmd(), config.Cmd(), diff --git a/docs/config.json b/docs/config.json index f49c4b6a2..b892a30f3 100644 --- a/docs/config.json +++ b/docs/config.json @@ -3,25 +3,9 @@ "info": { "title": "Quicksilver Chain - REST API", "description": "REST interface for query and transaction services", - "version": "1.0.0" + "version": "1.7.6" }, "apis": [ - { - "url": "./tmp-swagger-gen/quicksilver/airdrop/v1/messages.swagger.json" - }, - { - "url": "./tmp-swagger-gen/quicksilver/airdrop/v1/query.swagger.json", - "operationIds": { - "rename": { - "Params": "AirdropParams" - } - }, - "tags": { - "rename": { - "Query": "QueryAirdrop" - } - } - }, { "url": "./tmp-swagger-gen/quicksilver/claimsmanager/v1/messages.swagger.json" }, @@ -47,7 +31,7 @@ } }, { - "url": "./tmp-swagger-gen/quicksilver/interchainquery/v1/messages.swagger.json", + "url": "./tmp-swagger-gen/quicksilver/interchainquery/v1/messages.swagger.json" }, { "url": "./tmp-swagger-gen/quicksilver/interchainquery/v1/query.swagger.json", @@ -101,6 +85,22 @@ "Query": "QueryParticipationRewards" } } + }, + { + "url": "./tmp-swagger-gen/quicksilver/supply/v1/messages.swagger.json" + }, + { + "url": "./tmp-swagger-gen/quicksilver/supply/v1/query.swagger.json", + "operationIds": { + "rename": { + "Params": "SupplyParams" + } + }, + "tags": { + "rename": { + "Query": "QuerySupply" + } + } } ] } diff --git a/docs/swagger.yml b/docs/swagger.yml index d6e7b893e..872362b90 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -2,745 +2,8 @@ swagger: '2.0' info: title: Quicksilver Chain - REST API description: REST interface for query and transaction services - version: 1.0.0 + version: 1.7.6 paths: - /quicksilver/tx/v1/airdrop/claim: - post: - operationId: Claim - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amount: - type: string - format: uint64 - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: body - in: body - required: true - schema: - type: object - properties: - chain_id: - type: string - action: - type: string - format: int64 - address: - type: string - proofs: - type: array - items: - type: object - properties: - key: - type: string - format: byte - data: - type: string - format: byte - proof_ops: - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating - Merkle root - - The data could be arbitrary format, providing - nessecary data - - for example neighbouring node hash - title: ProofOps is Merkle proof defined by the list of ProofOps - height: - type: string - format: int64 - proof_type: - type: string - description: >- - Proof defines a type used to cryptographically prove a - claim. - tags: - - Msg - /quicksilver/tx/v1/airdrop/incentive_pool_spend: - post: - operationId: IncentivePoolSpend - responses: - '200': - description: A successful response. - schema: - type: object - description: >- - MsgIncentivePoolSpendResponse defines the MsgIncentivePoolSpend - response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: body - in: body - required: true - schema: - type: object - properties: - authority: - type: string - to_address: - type: string - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - title: - type: string - description: - type: string - description: >- - MsgIncentivePoolSpend represents a message to send coins from one - account to another. - tags: - - Msg - /quicksilver/airdrop/v1/accountbalance/{chain_id}: - get: - summary: AccountBalance returns the module account balance of the specified zone. - operationId: AccountBalance - responses: - '200': - description: A successful response. - schema: - type: object - properties: - account_balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - QueryAccountBalanceResponse is the response type for - Query/AccountBalance RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: chain_id - description: chain_id identifies the zone. - in: path - required: true - type: string - tags: - - QueryAirdrop - /quicksilver/airdrop/v1/claimrecord/{chain_id}/{address}: - get: - summary: >- - ClaimRecord returns the claim record that corresponds to the given zone - and - - address. - operationId: ClaimRecord - responses: - '200': - description: A successful response. - schema: - type: object - properties: - claim_record: - type: object - properties: - chain_id: - type: string - address: - type: string - actions_completed: - type: object - additionalProperties: - type: object - properties: - complete_time: - type: string - format: date-time - claim_amount: - type: string - format: uint64 - description: >- - CompletedAction represents a claim action completed by - the user. - title: Protobuf3 does not allow enum as map key - max_allocation: - type: string - format: uint64 - base_value: - type: string - format: uint64 - description: >- - ClaimRecord represents a users' claim (including completed - claims) for a - - given zone. - description: >- - QueryClaimRecordResponse is the response type for - Query/ClaimRecord RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: chain_id - in: path - required: true - type: string - - name: address - in: path - required: true - type: string - tags: - - QueryAirdrop - /quicksilver/airdrop/v1/claimrecords/{chain_id}: - get: - summary: ClaimRecords returns all the claim records of the given zone. - operationId: ClaimRecords - responses: - '200': - description: A successful response. - schema: - type: object - properties: - claim_records: - type: array - items: - type: object - properties: - chain_id: - type: string - address: - type: string - actions_completed: - type: object - additionalProperties: - type: object - properties: - complete_time: - type: string - format: date-time - claim_amount: - type: string - format: uint64 - description: >- - CompletedAction represents a claim action completed by - the user. - title: Protobuf3 does not allow enum as map key - max_allocation: - type: string - format: uint64 - base_value: - type: string - format: uint64 - description: >- - ClaimRecord represents a users' claim (including completed - claims) for a - - given zone. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: >- - QueryClaimRecordsResponse is the response type for - Query/ClaimRecords RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: chain_id - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - QueryAirdrop - /quicksilver/airdrop/v1/params: - get: - summary: Params returns the total set of airdrop parameters. - operationId: AirdropParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - tags: - - QueryAirdrop - /quicksilver/airdrop/v1/zonedrop/{chain_id}: - get: - summary: ZoneDrop returns the details of the specified zone airdrop. - operationId: ZoneDrop - responses: - '200': - description: A successful response. - schema: - type: object - properties: - zone_drop: - type: object - properties: - chain_id: - type: string - start_time: - type: string - format: date-time - duration: - type: string - decay: - type: string - allocation: - type: string - format: uint64 - actions: - type: array - items: - type: string - is_concluded: - type: boolean - description: ZoneDrop represents an airdrop for a specific zone. - description: >- - QueryZoneDropResponse is the response type for Query/ZoneDrop RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: chain_id - description: chain_id identifies the zone. - in: path - required: true - type: string - tags: - - QueryAirdrop - /quicksilver/airdrop/v1/zonedrops/{status}: - get: - summary: ZoneDrops returns all zone airdrops of the specified status. - operationId: ZoneDrops - responses: - '200': - description: A successful response. - schema: - type: object - properties: - zone_drops: - type: array - items: - type: object - properties: - chain_id: - type: string - start_time: - type: string - format: date-time - duration: - type: string - decay: - type: string - allocation: - type: string - format: uint64 - actions: - type: array - items: - type: string - is_concluded: - type: boolean - description: ZoneDrop represents an airdrop for a specific zone. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: >- - QueryZoneDropResponse is the response type for Query/ZoneDrops RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: status - description: |- - status enables to query zone airdrops matching a given status: - - Active - - Future - - Expired - in: path - required: true - type: string - enum: - - StatusUndefined - - StatusActive - - StatusFuture - - StatusExpired - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - QueryAirdrop /quicksilver/claimsmanager/v1/claims/{chain_id}: get: summary: Claims returns all zone claims from the current epoch. @@ -5872,3 +5135,118 @@ paths: type: string tags: - QueryParticipationRewards + /supply/tx/v1beta1/incentive_pool_spend: + post: + summary: MsgIncentivePoolSpend defines a method for submit query responses. + operationId: IncentivePoolSpend + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgIncentivePoolSpendResponse defines the MsgIncentivePoolSpend + response + + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + authority: + type: string + to_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: + type: string + description: + type: string + description: >- + MsgIncentivePoolSpend represents a message to send coins from the + airdrop + + module account to another. + tags: + - Msg + /quicksilver/supply/v1/supply: + get: + summary: Supply provide running epochInfos + operationId: Supply + responses: + '200': + description: A successful response. + schema: + type: object + properties: + supply: + type: string + format: uint64 + circulating_supply: + type: string + format: uint64 + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - QuerySupply diff --git a/go.work.sum b/go.work.sum index 609b8fc81..f637872aa 100644 --- a/go.work.sum +++ b/go.work.sum @@ -3,6 +3,7 @@ cel.dev/expr v0.15.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= cel.dev/expr v0.16.0 h1:yloc84fytn4zmJX2GU3TkXGsaieaV7dQ057Qs4sIG2Y= cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= cel.dev/expr v0.16.1/go.mod h1:AsGA5zb3WruAEQeQng1RZdGEXmBj0jvMWh6l5SnNuC8= +cel.dev/expr v0.19.0/go.mod h1:MrpN08Q+lEBs+bGYdLxxHkZoUSsCp0nSKTs0nTymJgw= cloud.google.com/go v0.0.0-20170206221025-ce650573d812/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= @@ -131,6 +132,7 @@ cloud.google.com/go/compute v1.27.0/go.mod h1:LG5HwRmWFKM2C5XxHRiNzkLLXW48WwvyVC cloud.google.com/go/compute v1.28.0 h1:OPtBxMcheSS+DWfci803qvPly3d4w7Eu5ztKBcFfzwk= cloud.google.com/go/compute v1.28.0/go.mod h1:DEqZBtYrDnD5PvjsKwb3onnhX+qjdCVM7eshj1XdjV4= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/contactcenterinsights v1.13.2 h1:46ertIh+cGkTg/lN7fN+TOx09SoM65dpdUp96vXBcMY= cloud.google.com/go/contactcenterinsights v1.13.2/go.mod h1:AfkSB8t7mt2sIY6WpfO61nD9J9fcidIchtxm9FqJVXk= @@ -527,6 +529,7 @@ github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmc github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20190129172621-c8b1d7a94ddf/go.mod h1:aJ4qN3TfrelA6NZ6AXsXRfmEVaYin3EDbSPJrKS8OXo= github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.0 h1:oVLqHXhnYtUwM89y9T1fXGaK9wTkXHgNp8/ZNMQzUxE= github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.0/go.mod h1:dppbR7CwXD4pgtV9t3wD1812RaLDcBjtblcDF5f1vI0= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0/go.mod h1:obipzmGjfSjam60XLwGfqUkJsfiheAl+TUjG+4yzyPM= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/InjectiveLabs/suplog v1.3.3 h1:ARIR3lWD9BxcrmqTwgcGBt8t7e10gwOqllUAXa/MfxI= @@ -841,6 +844,7 @@ github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjl github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= +github.com/envoyproxy/go-control-plane v0.13.1/go.mod h1:X45hY0mufo6Fd0KW3rqsGvQMw58jvjymeCzBU3mWyHw= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= @@ -993,6 +997,7 @@ github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.3/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= @@ -1097,7 +1102,6 @@ github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR3 github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= github.com/hashicorp/go-syslog v1.0.0 h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE= github.com/hashicorp/go.net v0.0.1 h1:sNCoNyDEvN1xa+X0baata4RdcpKwcMS6DH+xwfqPgjw= -github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/mdns v1.0.0 h1:WhIgCr5a7AaVH6jPUwjtRuuE7/RDufnUvzIr48smyxs= github.com/hashicorp/memberlist v0.1.3 h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M= @@ -1506,13 +1510,13 @@ github.com/protolambda/ztyp v0.2.2 h1:rVcL3vBu9W/aV646zF6caLS/dyn9BN8NYiuJzicLNy github.com/protolambda/ztyp v0.2.2/go.mod h1:9bYgKGqg3wJqT9ac1gI2hnVb0STQq7p/1lapqrqY1dU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71 h1:CNooiryw5aisadVfzneSZPswRWvnVW8hF1bS/vo8ReI= github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= -github.com/quicksilver-zone/quicksilver v1.7.4/go.mod h1:PaJDQFVtviAegKpRHtPXoG/gZNY6CZNG8XsTIvTRhQ0= github.com/rabbitmq/amqp091-go v1.2.0 h1:1pHBxAsQh54R9eX/xo679fUEAfv3loMqi0pvRFOj2nk= github.com/rabbitmq/amqp091-go v1.2.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM= github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= @@ -1585,6 +1589,7 @@ github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= @@ -1739,6 +1744,7 @@ go.etcd.io/etcd/client/v3 v3.5.12 h1:v5lCPXn1pf1Uu3M4laUE2hp/geOTc5uPcYYsNe1lDxg go.etcd.io/etcd/client/v3 v3.5.12/go.mod h1:tSbBCakoWmmddL+BKVAJHa9km+O/E+bumDe9mSbPiqw= go.etcd.io/gofail v0.1.0 h1:XItAMIhOojXFQMgrxjnd2EIIHun/d5qL0Pf7FzVTkFg= go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M= +go.opentelemetry.io/contrib/detectors/gcp v1.32.0/go.mod h1:TVqo0Sda4Cv8gCIixd7LuLwW4EylumVWfhjZJjDD4DU= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= @@ -1829,6 +1835,7 @@ golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqR golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= @@ -1848,7 +1855,6 @@ golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeap golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= @@ -1876,7 +1882,6 @@ golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= @@ -1893,6 +1898,7 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/oauth2 v0.0.0-20170207211851-4464e7848382/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= @@ -1904,6 +1910,7 @@ golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5H golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5 h1:ObuXPmIgI4ZMyQLIz48cJYgSyWdjUXc2SZAdyJMwEAU= golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5/go.mod h1:UBKtEnL8aqnd+0JHqZ+2qoMDwtuy6cYhhKNoHLBiTQc= @@ -1963,6 +1970,7 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= @@ -1971,17 +1979,16 @@ golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFK golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2026,7 +2033,6 @@ golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= @@ -2112,6 +2118,7 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go. google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= @@ -2119,6 +2126,7 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go. google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/genproto/googleapis/rpc v0.0.0-20240823204242-4ba0660f739c/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= google.golang.org/grpc v0.0.0-20170208002647-2a6bf6142e96/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= @@ -2128,12 +2136,16 @@ google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLp google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo= diff --git a/proto/quicksilver/airdrop/v1/airdrop.proto b/proto/quicksilver/airdrop/v1/airdrop.proto deleted file mode 100644 index 024957efa..000000000 --- a/proto/quicksilver/airdrop/v1/airdrop.proto +++ /dev/null @@ -1,105 +0,0 @@ -syntax = "proto3"; -package quicksilver.airdrop.v1; - -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/quicksilver-zone/quicksilver/x/airdrop/types"; - -// Action is used as an enum to denote specific actions or tasks. -enum Action { - option (gogoproto.goproto_enum_prefix) = false; - - // Undefined action (per protobuf spec) - ActionUndefined = 0; - // Initial claim action - ActionInitialClaim = 1; - // Deposit tier 1 (e.g. > 5% of base_value) - ActionDepositT1 = 2; - // Deposit tier 2 (e.g. > 10% of base_value) - ActionDepositT2 = 3; - // Deposit tier 3 (e.g. > 15% of base_value) - ActionDepositT3 = 4; - // Deposit tier 4 (e.g. > 22% of base_value) - ActionDepositT4 = 5; - // Deposit tier 5 (e.g. > 30% of base_value) - ActionDepositT5 = 6; - // Active QCK delegation - ActionStakeQCK = 7; - // Intent is set - ActionSignalIntent = 8; - // Cast governance vote on QS - ActionQSGov = 9; - // Governance By Proxy (GbP): cast vote on remote zone - ActionGbP = 10; - // Provide liquidity on Osmosis - ActionOsmosis = 11; -} - -// Status is used as an enum to denote zone status. -enum Status { - option (gogoproto.goproto_enum_prefix) = false; - - StatusUndefined = 0; - StatusActive = 1; - StatusFuture = 2; - StatusExpired = 3; -} - -// ZoneDrop represents an airdrop for a specific zone. -message ZoneDrop { - option (gogoproto.goproto_getters) = false; - - string chain_id = 1; - google.protobuf.Timestamp start_time = 2 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"start_time\"" - ]; - google.protobuf.Duration duration = 3 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.jsontag) = "duration,omitempty", - (gogoproto.moretags) = "yaml:\"duration\"" - ]; - google.protobuf.Duration decay = 4 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.jsontag) = "decay,omitempty", - (gogoproto.moretags) = "yaml:\"decay\"" - ]; - uint64 allocation = 5; - repeated string actions = 6 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - bool is_concluded = 7; -} - -// ClaimRecord represents a users' claim (including completed claims) for a -// given zone. -message ClaimRecord { - option (gogoproto.goproto_getters) = false; - - string chain_id = 1; - string address = 2; - // Protobuf3 does not allow enum as map key - map actions_completed = 3; - uint64 max_allocation = 4; - uint64 base_value = 5; -} - -// CompletedAction represents a claim action completed by the user. -message CompletedAction { - option (gogoproto.goproto_getters) = false; - - google.protobuf.Timestamp complete_time = 1 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"complete_time\"" - ]; - uint64 claim_amount = 2; -} diff --git a/proto/quicksilver/airdrop/v1/genesis.proto b/proto/quicksilver/airdrop/v1/genesis.proto deleted file mode 100644 index 1c8fc7315..000000000 --- a/proto/quicksilver/airdrop/v1/genesis.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package quicksilver.airdrop.v1; - -import "gogoproto/gogo.proto"; -import "quicksilver/airdrop/v1/airdrop.proto"; -import "quicksilver/airdrop/v1/params.proto"; - -option go_package = "github.com/quicksilver-zone/quicksilver/x/airdrop/types"; - -// GenesisState defines the airdrop module's genesis state. -message GenesisState { - option (gogoproto.goproto_getters) = false; - - Params params = 1 [(gogoproto.nullable) = false]; - repeated ZoneDrop zone_drops = 2; - repeated ClaimRecord claim_records = 3; -} diff --git a/proto/quicksilver/airdrop/v1/messages.proto b/proto/quicksilver/airdrop/v1/messages.proto deleted file mode 100644 index 594111915..000000000 --- a/proto/quicksilver/airdrop/v1/messages.proto +++ /dev/null @@ -1,67 +0,0 @@ -syntax = "proto3"; -package quicksilver.airdrop.v1; - -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "quicksilver/claimsmanager/v1/claimsmanager.proto"; - -option go_package = "github.com/quicksilver-zone/quicksilver/x/airdrop/types"; - -// Msg defines the airdrop Msg service. -service Msg { - rpc Claim(MsgClaim) returns (MsgClaimResponse) { - option (google.api.http) = { - post: "/quicksilver/tx/v1/airdrop/claim" - body: "*" - }; - } - - rpc IncentivePoolSpend(MsgIncentivePoolSpend) returns (MsgIncentivePoolSpendResponse) { - option (google.api.http) = { - post: "/quicksilver/tx/v1/airdrop/incentive_pool_spend" - body: "*" - }; - } -} - -message MsgClaim { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string chain_id = 1 [(gogoproto.moretags) = "yaml:\"chain_id\""]; - int64 action = 2 [(gogoproto.moretags) = "yaml:\"action\""]; - string address = 3 [ - (cosmos_proto.scalar) = "cosmos.AddressString", - (gogoproto.moretags) = "yaml:\"address\"" - ]; - - repeated quicksilver.claimsmanager.v1.Proof proofs = 4 [(gogoproto.moretags) = "yaml:\"proofs\""]; -} - -message MsgClaimResponse { - option (gogoproto.goproto_getters) = false; - uint64 amount = 1 [(gogoproto.moretags) = "yaml:\"amount\""]; -} - -// MsgIncentivePoolSpend represents a message to send coins from one account to another. -message MsgIncentivePoolSpend { - option (cosmos.msg.v1.signer) = "authority"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; - string title = 4; - string description = 5; -} - -// MsgIncentivePoolSpendResponse defines the MsgIncentivePoolSpend response type. -message MsgIncentivePoolSpendResponse {} diff --git a/proto/quicksilver/airdrop/v1/params.proto b/proto/quicksilver/airdrop/v1/params.proto deleted file mode 100644 index 0fbb94d01..000000000 --- a/proto/quicksilver/airdrop/v1/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package quicksilver.airdrop.v1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/quicksilver-zone/quicksilver/x/airdrop/types"; - -// Params holds parameters for the airdrop module. -message Params { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.goproto_getters) = false; -} diff --git a/proto/quicksilver/airdrop/v1/proposals.proto b/proto/quicksilver/airdrop/v1/proposals.proto deleted file mode 100644 index d7427fdf6..000000000 --- a/proto/quicksilver/airdrop/v1/proposals.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; -package quicksilver.airdrop.v1; - -import "gogoproto/gogo.proto"; -import "quicksilver/airdrop/v1/airdrop.proto"; - -option go_package = "github.com/quicksilver-zone/quicksilver/x/airdrop/types"; - -message RegisterZoneDropProposal { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - string title = 1; - string description = 2; - - ZoneDrop zone_drop = 3 [(gogoproto.moretags) = "yaml:\"zone_drop\""]; - bytes claim_records = 4 [(gogoproto.moretags) = "yaml:\"claim_records\""]; -} diff --git a/proto/quicksilver/airdrop/v1/query.proto b/proto/quicksilver/airdrop/v1/query.proto deleted file mode 100644 index bc74d3283..000000000 --- a/proto/quicksilver/airdrop/v1/query.proto +++ /dev/null @@ -1,132 +0,0 @@ -syntax = "proto3"; -package quicksilver.airdrop.v1; - -import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "quicksilver/airdrop/v1/airdrop.proto"; -import "quicksilver/airdrop/v1/params.proto"; - -option go_package = "github.com/quicksilver-zone/quicksilver/x/airdrop/types"; - -// Query provides defines the gRPC querier service. -service Query { - // Params returns the total set of airdrop parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/quicksilver/airdrop/v1/params"; - } - // ZoneDrop returns the details of the specified zone airdrop. - rpc ZoneDrop(QueryZoneDropRequest) returns (QueryZoneDropResponse) { - option (google.api.http).get = "/quicksilver/airdrop/v1/zonedrop/{chain_id}"; - } - // AccountBalance returns the module account balance of the specified zone. - rpc AccountBalance(QueryAccountBalanceRequest) returns (QueryAccountBalanceResponse) { - option (google.api.http).get = "/quicksilver/airdrop/v1/accountbalance/{chain_id}"; - } - // ZoneDrops returns all zone airdrops of the specified status. - rpc ZoneDrops(QueryZoneDropsRequest) returns (QueryZoneDropsResponse) { - option (google.api.http).get = "/quicksilver/airdrop/v1/zonedrops/{status}"; - } - // ClaimRecord returns the claim record that corresponds to the given zone and - // address. - rpc ClaimRecord(QueryClaimRecordRequest) returns (QueryClaimRecordResponse) { - option (google.api.http).get = "/quicksilver/airdrop/v1/claimrecord/{chain_id}/{address}"; - } - // ClaimRecords returns all the claim records of the given zone. - rpc ClaimRecords(QueryClaimRecordsRequest) returns (QueryClaimRecordsResponse) { - option (google.api.http).get = "/quicksilver/airdrop/v1/claimrecords/{chain_id}"; - } -} - -// QueryParamsRequest is the request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryParamsResponse { - option (gogoproto.goproto_getters) = false; - // params defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -// QueryZoneDropRequest is the request type for Query/ZoneDrop RPC method. -message QueryZoneDropRequest { - option (gogoproto.goproto_getters) = false; - // chain_id identifies the zone. - string chain_id = 1 [(gogoproto.moretags) = "yaml:\"chain_id\""]; -} - -// QueryZoneDropResponse is the response type for Query/ZoneDrop RPC method. -message QueryZoneDropResponse { - option (gogoproto.goproto_getters) = false; - ZoneDrop zone_drop = 1 [(gogoproto.nullable) = false]; -} - -// QueryAccountBalanceRequest is the request type for Query/AccountBalance RPC -// method. -message QueryAccountBalanceRequest { - option (gogoproto.goproto_getters) = false; - // chain_id identifies the zone. - string chain_id = 1 [(gogoproto.moretags) = "yaml:\"chain_id\""]; -} - -// QueryAccountBalanceResponse is the response type for Query/AccountBalance RPC -// method. -message QueryAccountBalanceResponse { - option (gogoproto.goproto_getters) = false; - - cosmos.base.v1beta1.Coin account_balance = 1 [(gogoproto.moretags) = "yaml:\"account_balance\""]; -} - -// QueryZoneDropsRequest is the request type for Query/ZoneDrops RPC method. -message QueryZoneDropsRequest { - option (gogoproto.goproto_getters) = false; - // status enables to query zone airdrops matching a given status: - // - Active - // - Future - // - Expired - Status status = 1; - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} - -// QueryZoneDropResponse is the response type for Query/ZoneDrops RPC method. -message QueryZoneDropsResponse { - option (gogoproto.goproto_getters) = false; - - repeated ZoneDrop zone_drops = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryClaimRecordRequest is the request type for Query/ClaimRecord RPC method. -message QueryClaimRecordRequest { - option (gogoproto.goproto_getters) = false; - - string chain_id = 1 [(gogoproto.moretags) = "yaml:\"chain_id\""]; - string address = 2 [(gogoproto.moretags) = "yaml:\"address\""]; -} - -// QueryClaimRecordResponse is the response type for Query/ClaimRecord RPC -// method. -message QueryClaimRecordResponse { - option (gogoproto.goproto_getters) = false; - - ClaimRecord claim_record = 1 [(gogoproto.moretags) = "yaml:\"claim_record\""]; -} - -// QueryClaimRecordsRequest is the request type for Query/ClaimRecords RPC -// method. -message QueryClaimRecordsRequest { - option (gogoproto.goproto_getters) = false; - - string chain_id = 1 [(gogoproto.moretags) = "yaml:\"chain_id\""]; - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} - -// QueryClaimRecordsResponse is the response type for Query/ClaimRecords RPC -// method. -message QueryClaimRecordsResponse { - option (gogoproto.goproto_getters) = false; - - repeated ClaimRecord claim_records = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} diff --git a/proto/quicksilver/supply/v1/messages.proto b/proto/quicksilver/supply/v1/messages.proto new file mode 100644 index 000000000..e12214e73 --- /dev/null +++ b/proto/quicksilver/supply/v1/messages.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package quicksilver.supply.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/quicksilver-zone/quicksilver/x/supply/types"; + +// Msg defines the interchainquery Msg service. +service Msg { + // MsgIncentivePoolSpend defines a method for submit query responses. + rpc IncentivePoolSpend(MsgIncentivePoolSpend) returns (MsgIncentivePoolSpendResponse) { + option (google.api.http) = { + post: "/supply/tx/v1beta1/incentive_pool_spend" + body: "*" + }; + } +} + +// MsgIncentivePoolSpend represents a message to send coins from the airdrop +// module account to another. +message MsgIncentivePoolSpend { + option (cosmos.msg.v1.signer) = "authority"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + string title = 4; + string description = 5; +} + +// MsgIncentivePoolSpendResponse defines the MsgIncentivePoolSpend response +// type. +message MsgIncentivePoolSpendResponse {} diff --git a/x/airdrop/client/cli/query.go b/x/airdrop/client/cli/query.go deleted file mode 100644 index a184241d6..000000000 --- a/x/airdrop/client/cli/query.go +++ /dev/null @@ -1,240 +0,0 @@ -package cli - -import ( - "context" - "fmt" - "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -// GetQueryCmd returns the cli query commands for the airdrop module. -func GetQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Query subcommands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - GetParamsQueryCmd(), - GetZoneDropQueryCmd(), - GetAccountBalanceQueryCmd(), - GetZoneDropsQueryCmd(), - GetClaimRecordQueryCmd(), - ) - - return cmd -} - -func GetParamsQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: fmt.Sprintf("Query the current %s parameters", types.ModuleName), - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(&res.Params) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func GetZoneDropQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "zone [chain_id]", - Short: "Query airdrop details of the specified zone", - Example: strings.TrimSpace( - fmt.Sprintf(`$ %s query %s zone %s`, - version.AppName, - types.ModuleName, - exampleChainID, - ), - ), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - // args - chainID := args[0] - - queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryZoneDropRequest{ - ChainId: chainID, - } - - res, err := queryClient.ZoneDrop(cmd.Context(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func GetAccountBalanceQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "account-balance [chain_id]", - Short: "Query airdrop account balance of the specified zone", - Example: strings.TrimSpace( - fmt.Sprintf(`$ %s query %s account-balance %s`, - version.AppName, - types.ModuleName, - exampleChainID, - ), - ), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - // args - chainID := args[0] - - queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryAccountBalanceRequest{ - ChainId: chainID, - } - - res, err := queryClient.AccountBalance(cmd.Context(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func GetZoneDropsQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "zone-drops [status]", - Short: "Query all airdrops of the specified status", - Example: strings.TrimSpace( - fmt.Sprintf(`$ %s query %s zone-drops %s`, - version.AppName, - types.ModuleName, - exampleStatus, - ), - ), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - // args - status, ok := types.Status_value[args[0]] - if !ok { - return types.ErrUnknownStatus - } - - queryClient := types.NewQueryClient(clientCtx) - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - req := &types.QueryZoneDropsRequest{ - Status: types.Status(status), - Pagination: pageReq, - } - - res, err := queryClient.ZoneDrops(cmd.Context(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func GetClaimRecordQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "claim-record [chain_id] [address]", - Short: "Query airdrop claim record details of the given address for the given zone.", - Example: strings.TrimSpace( - fmt.Sprintf(`$ %s query %s claim-record %s %s`, - version.AppName, - types.ModuleName, - exampleChainID, - exampleAddress, - ), - ), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - // args - chainID := args[0] - address, err := sdk.AccAddressFromBech32(args[1]) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryClaimRecordRequest{ - ChainId: chainID, - Address: address.String(), - } - - res, err := queryClient.ClaimRecord(cmd.Context(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/airdrop/client/cli/tx.go b/x/airdrop/client/cli/tx.go deleted file mode 100644 index 11b1a43f5..000000000 --- a/x/airdrop/client/cli/tx.go +++ /dev/null @@ -1,72 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/version" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -// GetTxCmd returns the cli transaction commands for the airdrop module. -func GetTxCmd() *cobra.Command { - txCmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Transaction subcommands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - txCmd.AddCommand( - GetClaimTxCmd(), - ) - - return txCmd -} - -func GetClaimTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "claim [chainID] [action]", - Short: "claim airdrop for the given action in the given zone", - Example: strings.TrimSpace( - fmt.Sprintf("$ %s tx %s claim %s %s", - version.AppName, - types.ModuleName, - exampleChainID, - exampleAction, - ), - ), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - chainID := args[0] - action, err := strconv.ParseInt(args[1], 10, 32) - if err != nil { - return err - } - - msg := &types.MsgClaim{ - ChainId: chainID, - Action: action, - Address: clientCtx.GetFromAddress().String(), - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/airdrop/client/cli/vars.go b/x/airdrop/client/cli/vars.go deleted file mode 100644 index 5ead23896..000000000 --- a/x/airdrop/client/cli/vars.go +++ /dev/null @@ -1,10 +0,0 @@ -package cli - -import "github.com/quicksilver-zone/quicksilver/x/airdrop/types" - -var ( - exampleChainID = "cosmoshub-4" - exampleAction = "ActionDelegateStake" - exampleStatus = types.Status_name[int32(types.StatusActive)] - exampleAddress = "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w" -) diff --git a/x/airdrop/genesis.go b/x/airdrop/genesis.go deleted file mode 100644 index 9eb281f33..000000000 --- a/x/airdrop/genesis.go +++ /dev/null @@ -1,72 +0,0 @@ -package airdrop - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/keeper" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -// InitGenesis initializes the airdrop module's state from a provided genesis -// state. -// This function will panic on failure. -func InitGenesis(ctx sdk.Context, k *keeper.Keeper, genState types.GenesisState) { - k.SetParams(ctx, genState.Params) - - sum := uint64(0) - zsum := make(map[string]uint64) - for _, cr := range genState.ClaimRecords { - zsum[cr.ChainId] += cr.MaxAllocation - sum += cr.MaxAllocation - - if err := k.SetClaimRecord(ctx, *cr); err != nil { - panic(err) - } - } - - moduleBalance := k.GetModuleAccountBalance(ctx) - if sum > moduleBalance.Amount.Uint64() { - panic(fmt.Sprintf("insufficient airdrop module account balance for airdrop module account %s, expected %d", k.GetModuleAccountAddress(ctx), sum)) - } - - for _, zd := range genState.ZoneDrops { - zs, ok := zsum[zd.ChainId] - if !ok { - panic("zone sum not found") - } - - if zs != zd.Allocation { - panic(fmt.Sprintf("zone sum does not match zone allocation; got %d, allocated %d", zs, zd.Allocation)) - } - - zonedropAddress := k.GetZoneDropAccountAddress(zd.ChainId) - - err := k.SendCoinsFromModuleToAccount( - ctx, - types.ModuleName, - zonedropAddress, - sdk.NewCoins( - sdk.NewCoin( - k.BondDenom(ctx), - sdk.NewIntFromUint64(zd.Allocation), - ), - ), - ) - if err != nil { - panic(err) - } - - k.SetZoneDrop(ctx, *zd) - } -} - -// ExportGenesis returns the capability module's exported genesis. -func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *types.GenesisState { - params := k.GetParams(ctx) - zoneDrops := k.AllZoneDrops(ctx) - claimRecords := k.AllClaimRecords(ctx) - - return types.NewGenesisState(params, zoneDrops, claimRecords) -} diff --git a/x/airdrop/ibc_module.go b/x/airdrop/ibc_module.go deleted file mode 100644 index 5cd4b22cc..000000000 --- a/x/airdrop/ibc_module.go +++ /dev/null @@ -1 +0,0 @@ -package airdrop diff --git a/x/airdrop/keeper/abci.go b/x/airdrop/keeper/abci.go deleted file mode 100644 index 9fcd4f312..000000000 --- a/x/airdrop/keeper/abci.go +++ /dev/null @@ -1,15 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// EndBlocker of airdrop module. -func (k *Keeper) EndBlocker(ctx sdk.Context) { - for _, zd := range k.UnconcludedAirdrops(ctx) { - if err := k.EndZoneDrop(ctx, zd.ChainId); err != nil { - // failure in EndBlocker should NOT panic - k.Logger(ctx).Error(err.Error()) - } - } -} diff --git a/x/airdrop/keeper/claim_handler.go b/x/airdrop/keeper/claim_handler.go deleted file mode 100644 index e927c9d5b..000000000 --- a/x/airdrop/keeper/claim_handler.go +++ /dev/null @@ -1,430 +0,0 @@ -package keeper - -import ( - "errors" - "fmt" - - sdkmath "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - - osmosistypes "github.com/quicksilver-zone/quicksilver/third-party-chains/osmosis-types" - osmosislockuptypes "github.com/quicksilver-zone/quicksilver/third-party-chains/osmosis-types/lockup" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" - cmtypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" - icstypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" -) - -var ( - tier1 = "0.05" - tier2 = "0.10" - tier3 = "0.15" - tier4 = "0.22" - tier5 = "0.30" -) - -var ( - decTier1 = sdk.MustNewDecFromStr(tier1) - decTier2 = sdk.MustNewDecFromStr(tier2) - decTier3 = sdk.MustNewDecFromStr(tier3) - decTier4 = sdk.MustNewDecFromStr(tier4) - decTier5 = sdk.MustNewDecFromStr(tier5) -) - -func (k *Keeper) HandleClaim(ctx sdk.Context, cr types.ClaimRecord, action types.Action, proofs []*cmtypes.Proof) (uint64, error) { - // action already completed, nothing to claim - if _, exists := cr.ActionsCompleted[int32(action)]; exists { - return 0, fmt.Errorf("%s already completed", types.Action_name[int32(action)]) - } - - switch action { - case types.ActionInitialClaim: - return k.handleInitial(ctx, &cr, action) - case types.ActionDepositT1: - return k.handleDeposit(ctx, &cr, action, decTier1) - case types.ActionDepositT2: - return k.handleDeposit(ctx, &cr, action, decTier2) - case types.ActionDepositT3: - return k.handleDeposit(ctx, &cr, action, decTier3) - case types.ActionDepositT4: - return k.handleDeposit(ctx, &cr, action, decTier4) - case types.ActionDepositT5: - return k.handleDeposit(ctx, &cr, action, decTier5) - case types.ActionStakeQCK: - return k.handleBondedDelegation(ctx, &cr, action) - case types.ActionSignalIntent: - return k.handleZoneIntent(ctx, &cr, action) - case types.ActionQSGov: - return k.handleGovernanceParticipation(ctx, &cr, action) - case types.ActionGbP: - // TODO: implement handler once GbP is implemented - case types.ActionOsmosis: - return k.handleOsmosisLP(ctx, &cr, action, proofs) - default: - return 0, fmt.Errorf("undefined action [%d]", action) - } - - return 0, fmt.Errorf("handler not implemented for [%d] %s", action, types.Action_name[int32(action)]) -} - -// ------------ -// # Handlers # -// ------------ - -// handleInitial. -func (k *Keeper) handleInitial(ctx sdk.Context, cr *types.ClaimRecord, action types.Action) (uint64, error) { - return k.completeClaim(ctx, cr, action) -} - -// handleDeposit. -func (k *Keeper) handleDeposit(ctx sdk.Context, cr *types.ClaimRecord, action types.Action, threshold sdk.Dec) (uint64, error) { - if err := k.verifyDeposit(ctx, *cr, threshold); err != nil { - return 0, err - } - - return k.completeClaim(ctx, cr, action) -} - -// handleBondedDelegation. -func (k *Keeper) handleBondedDelegation(ctx sdk.Context, cr *types.ClaimRecord, action types.Action) (uint64, error) { - if err := k.verifyBondedDelegation(ctx, cr.Address); err != nil { - return 0, err - } - - return k.completeClaim(ctx, cr, action) -} - -// handleZoneIntent. -func (k *Keeper) handleZoneIntent(ctx sdk.Context, cr *types.ClaimRecord, action types.Action) (uint64, error) { - if err := k.verifyZoneIntent(ctx, cr.ChainId, cr.Address); err != nil { - return 0, err - } - - return k.completeClaim(ctx, cr, action) -} - -// handleZoneIntent. -func (k *Keeper) handleGovernanceParticipation(ctx sdk.Context, cr *types.ClaimRecord, action types.Action) (uint64, error) { - if err := k.verifyGovernanceParticipation(ctx, cr.Address); err != nil { - return 0, err - } - - return k.completeClaim(ctx, cr, action) -} - -// handleOsmosisLP. -func (k *Keeper) handleOsmosisLP(ctx sdk.Context, cr *types.ClaimRecord, action types.Action, proofs []*cmtypes.Proof) (uint64, error) { - if len(proofs) == 0 { - return 0, errors.New("expects at least one LP proof") - } - if err := k.verifyOsmosisLP(ctx, proofs, *cr); err != nil { - return 0, err - } - - return k.completeClaim(ctx, cr, action) -} - -// ------------- -// # Verifiers # -// ------------- - -// verifyDeposit. -func (k *Keeper) verifyDeposit(ctx sdk.Context, cr types.ClaimRecord, threshold sdk.Dec) error { - addr, err := sdk.AccAddressFromBech32(cr.Address) - if err != nil { - return err - } - - zone, ok := k.icsKeeper.GetZone(ctx, cr.ChainId) - if !ok { - return types.ErrZoneNotFound{ID: cr.ChainId} - } - - // obtain all deposit receipts for this user on this zone - receipts, err := k.icsKeeper.UserZoneReceipts(ctx, &zone, addr) - if err != nil { - return fmt.Errorf("unable to obtain zone receipts for %s on zone %s: %w", cr.Address, cr.ChainId, err) - } - - // sum gross deposits amount - gdAmount := sdk.NewInt(0) - for _, rcpt := range receipts { - gdAmount = gdAmount.Add(rcpt.Amount.AmountOf(zone.BaseDenom)) - } - - // calculate target amount - tAmount := threshold.MulInt64(int64(cr.BaseValue)).TruncateInt() //nolint:gosec - - if gdAmount.LT(tAmount) { - return fmt.Errorf("insufficient deposit amount, expects %v got %v", tAmount, gdAmount) - } - - return nil -} - -// verifyBondedDelegation indicates if the given address has an active bonded. -// delegation of QCK on the Quicksilver zone. -func (k *Keeper) verifyBondedDelegation(ctx sdk.Context, address string) error { - addr, err := sdk.AccAddressFromBech32(address) - if err != nil { - return err - } - - amount := k.stakingKeeper.GetDelegatorBonded(ctx, addr) - if !amount.IsPositive() { - return fmt.Errorf("no bonded delegation for %s", addr) - } - return nil -} - -// verifyZoneIntent indicates if the given address has intent set for the given -// zone (chainID). -func (k *Keeper) verifyZoneIntent(ctx sdk.Context, chainID, address string) error { - addr, err := sdk.AccAddressFromBech32(address) - if err != nil { - return err - } - - zone, ok := k.icsKeeper.GetZone(ctx, chainID) - if !ok { - return types.ErrZoneNotFound{ID: chainID} - } - - intent, ok := k.icsKeeper.GetDelegatorIntent(ctx, &zone, addr.String(), false) - if !ok || len(intent.Intents) == 0 { - return fmt.Errorf("intent not found or no intents set for %s", addr) - } - - return nil -} - -// verifyGovernanceParticipation indicates if the given address has voted on -// any governance proposals on the Quicksilver zone. -func (k *Keeper) verifyGovernanceParticipation(ctx sdk.Context, address string) error { - addr, err := sdk.AccAddressFromBech32(address) - if err != nil { - return err - } - - voted := false - k.govKeeper.IterateProposals(ctx, func(proposal govv1.Proposal) (stop bool) { - _, found := k.govKeeper.GetVote(ctx, proposal.Id, addr) - if found { - voted = true - return true - } - return false - }) - - if !voted { - return fmt.Errorf("no governance votes by %s", addr) - } - - return nil -} - -// verifyOsmosisLP utilizes cross-chain-verification (XCV) to indicate if the -// given address provides any liquidity of the zones qAssets on the Osmosis -// chain. -// -// It utilizes Osmosis query: -// -// rpc LockedByID(LockedRequest) returns (LockedResponse); -func (k *Keeper) verifyOsmosisLP(ctx sdk.Context, proofs []*cmtypes.Proof, cr types.ClaimRecord) error { - // get Osmosis zone - var osmoZone *icstypes.Zone - k.icsKeeper.IterateZones(ctx, func(_ int64, zone *icstypes.Zone) (stop bool) { - if zone.AccountPrefix == "osmo" { - osmoZone = zone - return true - } - return false - }) - if osmoZone == nil { - return errors.New("unable to find Osmosis zone") - } - - uAmount := sdk.ZeroInt() - dupCheck := make(map[string]struct{}) - for i, p := range proofs { - proof := p - - // check for duplicate proof submission - if _, exists := dupCheck[string(proof.Key)]; exists { - return fmt.Errorf("duplicate proof submitted, %s", proof.Key) - } - dupCheck[string(proof.Key)] = struct{}{} - - // validate proof tx - if err := k.ValidateProofOps( - ctx, - k.ibcKeeper, - osmoZone.ConnectionId, - osmoZone.ChainId, - proof.Height, - proof.ProofType, - proof.Key, - proof.Data, - proof.ProofOps, - ); err != nil { - return fmt.Errorf("proofs [%d]: %w", i, err) - } - - var lock osmosislockuptypes.PeriodLock - err := k.cdc.Unmarshal(proof.Data, &lock) - if err != nil { - return fmt.Errorf("unable to unmarshal locked response: %w", err) - } - - // verify proof lock owner address is claim record address - if lock.Owner != cr.Address { - return fmt.Errorf("invalid lock owner, expected %s got %s", cr.Address, lock.Owner) - } - - // verify pool is for the relevant zone - // and sum user amounts - amount, err := k.verifyPoolAndGetAmount(ctx, lock, cr) - if err != nil { - return err - } - uAmount = uAmount.Add(amount) - } - - // calculate target amount - dThreshold := decTier4 - if err := k.verifyDeposit(ctx, cr, dThreshold); err != nil { - return fmt.Errorf("%w, must reach at least %s of %d", err, tier4, cr.BaseValue) - } - tAmount := dThreshold.MulInt64(int64(cr.BaseValue / 2)).TruncateInt() //nolint:gosec - - // check liquidity threshold - if uAmount.LT(tAmount) { - return fmt.Errorf("insufficient liquidity, expects at least %s, got %s", tAmount, uAmount) - } - - return nil -} - -func (k *Keeper) verifyPoolAndGetAmount(ctx sdk.Context, lock osmosislockuptypes.PeriodLock, cr types.ClaimRecord) (sdkmath.Int, error) { - return osmosistypes.DetermineApplicableTokensInPool(ctx, k.prKeeper, lock, cr.ChainId, "UNUSED") -} - -// ----------- -// # Helpers # -// ----------- - -func (k *Keeper) completeClaim(ctx sdk.Context, cr *types.ClaimRecord, action types.Action) (uint64, error) { - // update ClaimRecord and obtain total claim amount - claimAmount, err := k.getClaimAmountAndUpdateRecord(ctx, cr, action) - if err != nil { - return 0, err - } - - // send coins to address - coins, err := k.sendCoins(ctx, *cr, claimAmount) - if err != nil { - return 0, err - } - - // emit events - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeClaim, - sdk.NewAttribute(sdk.AttributeKeySender, cr.Address), - sdk.NewAttribute("zone", cr.ChainId), - sdk.NewAttribute(sdk.AttributeKeyAction, action.String()), - sdk.NewAttribute(sdk.AttributeKeyAmount, coins.String()), - ), - }) - - return claimAmount, nil -} - -// getClaimAmountAndUpdateRecord calculates and returns the claimable amount -// after updating the relevant claim record. -func (k *Keeper) getClaimAmountAndUpdateRecord(ctx sdk.Context, cr *types.ClaimRecord, action types.Action) (uint64, error) { - var claimAmount uint64 - - // check and initialize ActionsCompleted map - if cr.ActionsCompleted == nil { - cr.ActionsCompleted = make(map[int32]*types.CompletedAction) - } - - // The concept here is to intuitively claim all outstanding deposit tiers - // that are below the current deposit claim (improved user experience). - // - // ActionDepositT5: t5amount - // ActionDepositT4: t4amount - // ActionDepositT3: t3amount <-- eg. for T3 - // ActionDepositT2: t2amount <-- add to claimAmount if not CompletedAction - // ActionDepositT1: t1amount <-- add to claimAmount if not CompletedAction - // - // For any given deposit action above ActionDepositT1, sum the claimable - // amounts of non completed deposit actions and mark them as complete. - // Then, if no errors occurred, update the ClaimRecord state. - - // check for summable ActionDeposit (T2-T5, T1 has nothing below it to sum) - if action > types.ActionDepositT1 && action <= types.ActionDepositT5 { - // check ActionDeposits from T1 to the target tier - // this also ensures that for any completed ActionDeposit tier, all - // tiers below are guaranteed to be completed as well. - for a := types.ActionDepositT1; a <= action; a++ { - if _, exists := cr.ActionsCompleted[int32(a)]; !exists { - // obtain claimable amount per deposit action - claimable, err := k.GetClaimableAmountForAction(ctx, cr.ChainId, cr.Address, a) - if err != nil { - return 0, err - } - - // update claim record (transient, not yet written to state) - cr.ActionsCompleted[int32(a)] = &types.CompletedAction{ - CompleteTime: ctx.BlockTime(), - ClaimAmount: claimable, - } - - // sum total claimable - claimAmount += claimable - } - } - } else { - // obtain claimable amount - claimable, err := k.GetClaimableAmountForAction(ctx, cr.ChainId, cr.Address, action) - if err != nil { - return 0, err - } - - // set claim amount - claimAmount = claimable - - // update claim record - cr.ActionsCompleted[int32(action)] = &types.CompletedAction{ - CompleteTime: ctx.BlockTime(), - ClaimAmount: claimAmount, - } - } - - // set claim record (persistent) - if err := k.SetClaimRecord(ctx, *cr); err != nil { - return 0, err - } - - return claimAmount, nil -} - -func (k *Keeper) sendCoins(ctx sdk.Context, cr types.ClaimRecord, amount uint64) (sdk.Coins, error) { - coins := sdk.NewCoins( - sdk.NewCoin(k.BondDenom(ctx), sdk.NewIntFromUint64(amount)), - ) - - addr, err := sdk.AccAddressFromBech32(cr.Address) - if err != nil { - return sdk.NewCoins(), err - } - - if err := k.bankKeeper.SendCoins(ctx, k.GetZoneDropAccountAddress(cr.ChainId), addr, coins); err != nil { - return sdk.NewCoins(), err - } - - return coins, nil -} diff --git a/x/airdrop/keeper/claim_record.go b/x/airdrop/keeper/claim_record.go deleted file mode 100644 index 1672c8a95..000000000 --- a/x/airdrop/keeper/claim_record.go +++ /dev/null @@ -1,232 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/bech32" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" - cmtypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" -) - -// GetClaimRecord returns the ClaimRecord of the given address for the given zone. -func (k *Keeper) GetClaimRecord(ctx sdk.Context, chainID, address string) (types.ClaimRecord, error) { - cr := types.ClaimRecord{} - - addr, err := sdk.AccAddressFromBech32(address) - if err != nil { - return cr, err - } - - store := ctx.KVStore(k.storeKey) - b := store.Get(types.GetKeyClaimRecord(chainID, addr)) - if len(b) == 0 { - return cr, types.ErrClaimRecordNotFound - } - - k.cdc.MustUnmarshal(b, &cr) - return cr, nil -} - -// SetClaimRecord creates/updates the given airdrop ClaimRecord. -func (k *Keeper) SetClaimRecord(ctx sdk.Context, cr types.ClaimRecord) error { - _, addr, err := bech32.DecodeAndConvert(cr.Address) - if err != nil { - return err - } - - store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshal(&cr) - store.Set(types.GetKeyClaimRecord(cr.ChainId, addr), b) - - return nil -} - -// DeleteClaimRecord deletes the airdrop ClaimRecord of the given zone and address. -func (k *Keeper) DeleteClaimRecord(ctx sdk.Context, chainID, address string) error { - addr, err := sdk.AccAddressFromBech32(address) - if err != nil { - return err - } - - store := ctx.KVStore(k.storeKey) - store.Delete(types.GetKeyClaimRecord(chainID, addr)) - - return nil -} - -// IterateClaimRecords iterate through zone airdrop ClaimRecords. -func (k *Keeper) IterateClaimRecords(ctx sdk.Context, chainID string, fn func(index int64, cr types.ClaimRecord) (stop bool)) { - store := ctx.KVStore(k.storeKey) - - iterator := sdk.KVStorePrefixIterator(store, types.GetPrefixClaimRecord(chainID)) - defer iterator.Close() - - i := int64(0) - for ; iterator.Valid(); iterator.Next() { - cr := types.ClaimRecord{} - k.cdc.MustUnmarshal(iterator.Value(), &cr) - - stop := fn(i, cr) - - if stop { - break - } - i++ - } -} - -// AllClaimRecords returns all the claim records. -func (k *Keeper) AllClaimRecords(ctx sdk.Context) []*types.ClaimRecord { - var crs []*types.ClaimRecord - - store := ctx.KVStore(k.storeKey) - - iterator := sdk.KVStorePrefixIterator(store, types.KeyPrefixClaimRecord) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - cr := types.ClaimRecord{} - k.cdc.MustUnmarshal(iterator.Value(), &cr) - - crs = append(crs, &cr) - } - - return crs -} - -// AllZoneClaimRecords returns all the claim records of the given zone. -func (k *Keeper) AllZoneClaimRecords(ctx sdk.Context, chainID string) []*types.ClaimRecord { - var crs []*types.ClaimRecord - k.IterateClaimRecords(ctx, chainID, func(_ int64, cr types.ClaimRecord) (stop bool) { - crs = append(crs, &cr) - return false - }) - return crs -} - -// ClearClaimRecords deletes all the claim records of the given zone. -func (k *Keeper) ClearClaimRecords(ctx sdk.Context, chainID string) { - store := ctx.KVStore(k.storeKey) - - iterator := sdk.KVStorePrefixIterator(store, types.GetPrefixClaimRecord(chainID)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - key := iterator.Key() - store.Delete(key) - } -} - -// GetClaimableAmountForAction returns the amount claimable for the given -// action, by the given address, against the given zone. -func (k *Keeper) GetClaimableAmountForAction(ctx sdk.Context, chainID, address string, action types.Action) (uint64, error) { - if !action.InBounds() { - return 0, fmt.Errorf("%w, got %d", types.ErrActionOutOfBounds, action) - } - - cr, err := k.GetClaimRecord(ctx, chainID, address) - if err != nil { - return 0, err - } - - // action already completed, nothing to claim - if _, exists := cr.ActionsCompleted[int32(action)]; exists { - return 0, fmt.Errorf("%w: %s", types.ErrActionCompleted, types.Action_name[int32(action)]) - } - - // get zone airdrop details - zd, ok := k.GetZoneDrop(ctx, cr.ChainId) - if !ok { - return 0, types.ErrZoneDropNotFound - } - - // zone drop is expired, nothing to claim - if k.IsExpiredZoneDrop(ctx, zd) { - return 0, types.ErrZoneDropExpired - } - - // calculate action allocation: - // - zone drop action weight * claim record max allocation - // note: use int32(action)-1 as protobuf3 spec valid enum start at 1 - amount := zd.Actions[int32(action)-1].MulInt64(int64(cr.MaxAllocation)).TruncateInt64() //nolint:gosec - - // airdrop has not yet started to decay - if ctx.BlockTime().Before(zd.StartTime.Add(zd.Duration)) { - return uint64(amount), nil //nolint:gosec - } - - // airdrop has started to decay, calculate claimable portion - elapsedDecayTime := ctx.BlockTime().Sub(zd.StartTime.Add(zd.Duration)) - decayPercent := sdk.NewDec(elapsedDecayTime.Nanoseconds()).QuoInt64(zd.Decay.Nanoseconds()) - claimablePercent := sdk.OneDec().Sub(decayPercent) - amount = claimablePercent.MulInt64(amount).TruncateInt64() - - return uint64(amount), nil //nolint:gosec -} - -// GetClaimableAmountForUser returns the amount claimable for the given user -// against the given zone. -func (k *Keeper) GetClaimableAmountForUser(ctx sdk.Context, chainID, address string) (uint64, error) { - cr, err := k.GetClaimRecord(ctx, chainID, address) - if err != nil { - return 0, err - } - - // get zone airdrop details - zd, ok := k.GetZoneDrop(ctx, cr.ChainId) - if !ok { - return 0, types.ErrZoneDropNotFound - } - - total := uint64(0) - // we will only need the index as we will be calling GetClaimableAmountForAction - for i := range zd.Actions { - // protobuf3 spec: valid enum start at 1 - action := i + 1 - - claimableForAction, err := k.GetClaimableAmountForAction(ctx, cr.ChainId, cr.Address, types.Action(action)) //nolint:gosec - if err != nil { - return 0, err - } - total += claimableForAction - } - - return total, nil -} - -// Claim executes an airdrop claim for the given address on the given action -// against the given zone (chainID). It returns the claim amount or an error -// on failure. -func (k *Keeper) Claim( - ctx sdk.Context, - chainID string, - action types.Action, - address string, - proofs []*cmtypes.Proof, -) (uint64, error) { - // check action in bounds - if !action.InBounds() { - return 0, fmt.Errorf("%w, got %d", types.ErrActionOutOfBounds, action) - } - - // get zone airdrop details - zd, ok := k.GetZoneDrop(ctx, chainID) - if !ok { - return 0, types.ErrZoneDropNotFound - } - - // zone airdrop not active - if !k.IsActiveZoneDrop(ctx, zd) { - return 0, fmt.Errorf("zone airdrop for %s is not active", chainID) - } - - // obtain claim record - cr, err := k.GetClaimRecord(ctx, chainID, address) - if err != nil { - return 0, fmt.Errorf("no zone airdrop found for %q on %q", address, chainID) - } - - return k.HandleClaim(ctx, cr, action, proofs) -} diff --git a/x/airdrop/keeper/grpc_query.go b/x/airdrop/keeper/grpc_query.go deleted file mode 100644 index c746b8dd4..000000000 --- a/x/airdrop/keeper/grpc_query.go +++ /dev/null @@ -1,126 +0,0 @@ -package keeper - -import ( - "context" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -var _ types.QueryServer = &Keeper{} - -// Params returns params of the airdrop module. -func (k *Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - params := k.GetParams(ctx) - - return &types.QueryParamsResponse{Params: params}, nil -} - -// ZoneDrop returns the details of the specified zone airdrop. -func (k *Keeper) ZoneDrop(c context.Context, req *types.QueryZoneDropRequest) (*types.QueryZoneDropResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - zd, ok := k.GetZoneDrop(ctx, req.ChainId) - if !ok { - return nil, types.ErrZoneDropNotFound - } - - return &types.QueryZoneDropResponse{ZoneDrop: zd}, nil -} - -// AccountBalance returns the airdrop module account balance of the specified zone. -func (k *Keeper) AccountBalance(c context.Context, req *types.QueryAccountBalanceRequest) (*types.QueryAccountBalanceResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - ab := k.GetZoneDropAccountBalance(ctx, req.ChainId) - - return &types.QueryAccountBalanceResponse{ - AccountBalance: &ab, - }, nil -} - -// ZoneDrops returns all zone airdrops of the specified status. -func (k *Keeper) ZoneDrops(c context.Context, req *types.QueryZoneDropsRequest) (*types.QueryZoneDropsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - var zds []types.ZoneDrop - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixZoneDrop) - - pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { - var zd types.ZoneDrop - if err := k.cdc.Unmarshal(value, &zd); err != nil { - return err - } - - switch req.Status { - case types.StatusActive: - if k.IsActiveZoneDrop(ctx, zd) { - zds = append(zds, zd) - } - case types.StatusFuture: - if k.IsFutureZoneDrop(ctx, zd) { - zds = append(zds, zd) - } - case types.StatusExpired: - if k.IsExpiredZoneDrop(ctx, zd) { - zds = append(zds, zd) - } - default: - // unknown status no-op - } - - return nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryZoneDropsResponse{ - ZoneDrops: zds, - Pagination: pageRes, - }, nil -} - -// ClaimRecord returns the claim record that corresponds to the given zone and address. -func (k *Keeper) ClaimRecord(c context.Context, req *types.QueryClaimRecordRequest) (*types.QueryClaimRecordResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - cr, err := k.GetClaimRecord(ctx, req.ChainId, req.Address) - if err != nil { - return nil, err - } - - return &types.QueryClaimRecordResponse{ClaimRecord: &cr}, nil -} - -// ClaimRecords returns all the claim records of the given zone. -func (k *Keeper) ClaimRecords(c context.Context, req *types.QueryClaimRecordsRequest) (*types.QueryClaimRecordsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - var crs []types.ClaimRecord - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetPrefixClaimRecord(req.ChainId)) - - pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { - var cr types.ClaimRecord - if err := k.cdc.Unmarshal(value, &cr); err != nil { - return err - } - crs = append(crs, cr) - return nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryClaimRecordsResponse{ - ClaimRecords: crs, - Pagination: pageRes, - }, nil -} diff --git a/x/airdrop/keeper/hooks.go b/x/airdrop/keeper/hooks.go deleted file mode 100644 index dc95881c8..000000000 --- a/x/airdrop/keeper/hooks.go +++ /dev/null @@ -1,38 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - epochstypes "github.com/quicksilver-zone/quicksilver/x/epochs/types" -) - -func (*Keeper) BeforeEpochStart(_ sdk.Context, _ string, _ int64) error { - return nil -} - -func (*Keeper) AfterEpochEnd(_ sdk.Context, _ string, _ int64) error { - return nil -} - -// ___________________________________________________________________________________________________ - -// Hooks wrapper struct for airdrop keeper. -type Hooks struct { - k *Keeper -} - -var _ epochstypes.EpochHooks = Hooks{} - -func (k *Keeper) Hooks() Hooks { - return Hooks{k} -} - -// epochs hooks. - -func (h Hooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error { - return h.k.BeforeEpochStart(ctx, epochIdentifier, epochNumber) -} - -func (h Hooks) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error { - return h.k.AfterEpochEnd(ctx, epochIdentifier, epochNumber) -} diff --git a/x/airdrop/keeper/invariants.go b/x/airdrop/keeper/invariants.go deleted file mode 100644 index 87246693b..000000000 --- a/x/airdrop/keeper/invariants.go +++ /dev/null @@ -1,48 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -const ( - claimRecordInvariantName = "claim-record-max-allocation" -) - -// RegisterInvariants registers all airdrop invariants. -func RegisterInvariants(ir sdk.InvariantRegistry, k *Keeper) { - ir.RegisterRoute(types.ModuleName, claimRecordInvariantName, ClaimRecordInvariant(k)) -} - -// AllInvariants runs all invariants of the module. -func AllInvariants(k *Keeper) sdk.Invariant { - return func(ctx sdk.Context) (string, bool) { - msg, broke := ClaimRecordInvariant(k)(ctx) - return msg, broke - } -} - -func ClaimRecordInvariant(k *Keeper) sdk.Invariant { - return func(ctx sdk.Context) (string, bool) { - crs := k.AllClaimRecords(ctx) - for _, cr := range crs { - sum := uint64(0) - for _, ca := range cr.ActionsCompleted { - sum += ca.ClaimAmount - } - if cr.MaxAllocation < sum { - return sdk.FormatInvariant( - types.ModuleName, - claimRecordInvariantName, - "\tclaim record completed actions exceed max allocation", - ), true - } - } - return sdk.FormatInvariant( - types.ModuleName, - claimRecordInvariantName, - "\tall claim records completed actions are less than or equal to max allocations", - ), false - } -} diff --git a/x/airdrop/keeper/keeper.go b/x/airdrop/keeper/keeper.go deleted file mode 100644 index 8ed07e580..000000000 --- a/x/airdrop/keeper/keeper.go +++ /dev/null @@ -1,129 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/tendermint/tendermint/libs/log" - - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper" - - "github.com/quicksilver-zone/quicksilver/utils" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -type Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - paramSpace paramtypes.Subspace - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - stakingKeeper types.StakingKeeper - govKeeper types.GovKeeper - ibcKeeper *ibckeeper.Keeper - icsKeeper types.InterchainStakingKeeper - prKeeper types.ParticipationRewardsKeeper - - ValidateProofOps utils.ProofOpsFn - - // the address capable of executing authority-scoped messages (ex. params, props). Typically, this - // should be the x/gov module account. - authority string -} - -// NewKeeper returns a new instance of participationrewards Keeper. -// This function will panic on failure. -func NewKeeper( - cdc codec.Codec, - key storetypes.StoreKey, - ps paramtypes.Subspace, - ak types.AccountKeeper, - bk types.BankKeeper, - sk types.StakingKeeper, - gk types.GovKeeper, - ibcKeeper *ibckeeper.Keeper, - icsk types.InterchainStakingKeeper, - prk types.ParticipationRewardsKeeper, - pofn utils.ProofOpsFn, - authority string, -) *Keeper { - if addr := ak.GetModuleAddress(types.ModuleName); addr == nil { - panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) - } - - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - if ibcKeeper == nil { - panic("ibcKeeper is nil") - } - - return &Keeper{ - cdc: cdc, - storeKey: key, - paramSpace: ps, - accountKeeper: ak, - bankKeeper: bk, - stakingKeeper: sk, - govKeeper: gk, - ibcKeeper: ibcKeeper, - icsKeeper: icsk, - prKeeper: prk, - ValidateProofOps: pofn, - authority: authority, - } -} - -// GetAuthority returns the x/airdrop module's authority. -func (k *Keeper) GetAuthority() string { - return k.authority -} - -// GetParams returns the total set of airdrop parameters. -func (k *Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) - return params -} - -// SetParams sets the total set of airdrop parameters. -func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} - -// Logger returns a module-specific logger. -func (*Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// GetModuleAccountAddress gets the airdrop module account address. -func (k *Keeper) GetModuleAccountAddress(_ sdk.Context) sdk.AccAddress { - return k.accountKeeper.GetModuleAddress(types.ModuleName) -} - -// GetModuleAccountBalance gets the airdrop module account coin balance. -func (k *Keeper) GetModuleAccountBalance(ctx sdk.Context) sdk.Coin { - moduleAccAddr := k.GetModuleAccountAddress(ctx) - return k.bankKeeper.GetBalance(ctx, moduleAccAddr, k.stakingKeeper.BondDenom(ctx)) -} - -func (k *Keeper) SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amount sdk.Coins) error { - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amount) -} - -func (k *Keeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAccount sdk.AccAddress, amount sdk.Coins) error { - return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAccount, amount) -} - -func (k *Keeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAccount sdk.AccAddress, recipientModule string, amount sdk.Coins) error { - return k.bankKeeper.SendCoinsFromAccountToModule(ctx, senderAccount, recipientModule, amount) -} - -func (k *Keeper) BondDenom(ctx sdk.Context) string { - return k.stakingKeeper.BondDenom(ctx) -} diff --git a/x/airdrop/keeper/keeper_test.go b/x/airdrop/keeper/keeper_test.go deleted file mode 100644 index 63feab506..000000000 --- a/x/airdrop/keeper/keeper_test.go +++ /dev/null @@ -1,349 +0,0 @@ -package keeper_test - -import ( - "bytes" - "compress/zlib" - "encoding/json" - "testing" - "time" - - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - - ibctesting "github.com/cosmos/ibc-go/v6/testing" - - "github.com/quicksilver-zone/quicksilver/app" - "github.com/quicksilver-zone/quicksilver/utils/addressutils" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" - icstypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" - minttypes "github.com/quicksilver-zone/quicksilver/x/mint/types" -) - -func init() { - ibctesting.DefaultTestingAppInit = app.SetupTestingApp -} - -// TestKeeperTestSuite runs all the tests within this package. -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func newQuicksilverPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path { - path := ibctesting.NewPath(chainA, chainB) - path.EndpointA.ChannelConfig.PortID = ibctesting.TransferPort - path.EndpointB.ChannelConfig.PortID = ibctesting.TransferPort - - return path -} - -type KeeperTestSuite struct { - suite.Suite - - coordinator *ibctesting.Coordinator - - // testing chains used for convenience and readability - chainA *ibctesting.TestChain - chainB *ibctesting.TestChain - - path *ibctesting.Path -} - -func (*KeeperTestSuite) GetQuicksilverApp(chain *ibctesting.TestChain) *app.Quicksilver { - quicksilver, ok := chain.App.(*app.Quicksilver) - if !ok { - panic("not quicksilver app") - } - - return quicksilver -} - -// SetupTest creates a coordinator with 2 test chains. -func (suite *KeeperTestSuite) SetupTest() { - suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) // initializes 2 test chains - suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) // convenience and readability - suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) // convenience and readability - - suite.path = newQuicksilverPath(suite.chainA, suite.chainB) - suite.coordinator.SetupConnections(suite.path) - - suite.coordinator.CurrentTime = time.Now().UTC() - suite.coordinator.UpdateTime() - - suite.initTestZone() - - suite.coordinator.CommitNBlocks(suite.chainA, 10) - suite.coordinator.CommitNBlocks(suite.chainB, 10) -} - -func (suite *KeeperTestSuite) TestDeleteClaimRecord() { - suite.initTestZoneDrop() - - address := addressutils.GenerateAccAddressForTest().String() - - cr := types.ClaimRecord{ - ChainId: suite.chainA.ChainID, - Address: address, - BaseValue: 100, - } - suite.setClaimRecord(cr) - - // delete claim record - err := suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.DeleteClaimRecord(suite.chainA.GetContext(), cr.ChainId, cr.Address) - suite.Require().NoError(err) - - // check if claim record is deleted - _, err = suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.GetClaimRecord(suite.chainA.GetContext(), cr.ChainId, cr.Address) - suite.Require().Error(err) -} - -func (suite *KeeperTestSuite) TestIterateClaimRecords() { - suite.initTestZoneDrop() - - addresses := []string{ - addressutils.GenerateAccAddressForTest().String(), - addressutils.GenerateAccAddressForTest().String(), - addressutils.GenerateAccAddressForTest().String(), - } - - suite.setDefaultClaimRecords(addresses) - - // iterate claim records - var count int - suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.IterateClaimRecords(suite.chainA.GetContext(), suite.chainA.ChainID, func(_ int64, cr types.ClaimRecord) (stop bool) { - count++ - return false - }) - suite.Require().Equal(len(addresses), count) -} - -func (suite *KeeperTestSuite) TestAllZoneClaimRecords() { - suite.initTestZoneDrop() - - addresses := []string{ - addressutils.GenerateAccAddressForTest().String(), - addressutils.GenerateAccAddressForTest().String(), - addressutils.GenerateAccAddressForTest().String(), - } - - suite.setDefaultClaimRecords(addresses) - - // get all claim records - allCRs := suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.AllClaimRecords(suite.chainA.GetContext()) - suite.Require().Equal(len(addresses), len(allCRs)) -} - -func (suite *KeeperTestSuite) TestClearClaimRecords() { - suite.initTestZoneDrop() - - addresses := []string{ - addressutils.GenerateAccAddressForTest().String(), - addressutils.GenerateAccAddressForTest().String(), - addressutils.GenerateAccAddressForTest().String(), - } - - suite.setDefaultClaimRecords(addresses) - - // clear all claim records - suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.ClearClaimRecords(suite.chainA.GetContext(), suite.chainA.ChainID) - - // get all claim records - allCRs := suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.AllClaimRecords(suite.chainA.GetContext()) - suite.Require().Equal(0, len(allCRs)) -} - -func (suite *KeeperTestSuite) TestZoneDrop() { - suite.initTestZoneDrop() - - req := types.QueryZoneDropRequest{ - ChainId: suite.chainB.ChainID, - } - - res, err := suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.ZoneDrop(suite.chainA.GetContext(), &req) - suite.Require().NoError(err) - - zoneDrop := res.ZoneDrop - suite.Require().Equal(suite.chainB.ChainID, zoneDrop.ChainId) - suite.Require().EqualValues(1000000000, zoneDrop.Allocation) -} - -func (suite *KeeperTestSuite) TestZoneDrops() { - suite.initTestZoneDrop() - - req := types.QueryZoneDropsRequest{Status: types.StatusActive} - - res, err := suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.ZoneDrops(suite.chainA.GetContext(), &req) - suite.Require().NoError(err) - - zoneDrops := res.ZoneDrops - suite.Require().Len(zoneDrops, 1) - suite.Require().Equal(suite.chainB.ChainID, zoneDrops[0].ChainId) - suite.Require().EqualValues(1000000000, zoneDrops[0].Allocation) - - // empty status request - req.Status = types.StatusFuture - - res, err = suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.ZoneDrops(suite.chainA.GetContext(), &req) - suite.Require().NoError(err) - suite.Require().Len(res.ZoneDrops, 0) -} - -func (suite *KeeperTestSuite) TestClaimRecord() { - suite.initTestZoneDrop() - - address := addressutils.GenerateAccAddressForTest().String() - - cr := types.ClaimRecord{ - ChainId: suite.chainA.ChainID, - Address: address, - BaseValue: 100, - } - suite.setClaimRecord(cr) - - req := types.QueryClaimRecordRequest{ - ChainId: cr.ChainId, - Address: cr.Address, - } - - res, err := suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.ClaimRecord(suite.chainA.GetContext(), &req) - suite.Require().NoError(err) - - claimRecord := res.ClaimRecord - suite.Require().Equal(cr.ChainId, claimRecord.ChainId) - suite.Require().Equal(cr.Address, claimRecord.Address) - suite.Require().Equal(cr.BaseValue, claimRecord.BaseValue) - - // invalid address - req.Address = "invalid" - _, err = suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.ClaimRecord(suite.chainA.GetContext(), &req) - suite.Require().Error(err) - - // invalid chain id - req.ChainId = "invalid" - req.Address = cr.Address - _, err = suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.ClaimRecord(suite.chainA.GetContext(), &req) - suite.Require().Error(err) -} - -func (suite *KeeperTestSuite) TestClaimRecords() { - suite.initTestZoneDrop() - - addresses := []string{ - addressutils.GenerateAccAddressForTest().String(), - addressutils.GenerateAccAddressForTest().String(), - addressutils.GenerateAccAddressForTest().String(), - } - - suite.setDefaultClaimRecords(addresses) - - req := types.QueryClaimRecordsRequest{ - ChainId: suite.chainA.ChainID, - } - - res, err := suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.ClaimRecords(suite.chainA.GetContext(), &req) - suite.Require().NoError(err) - - claimRecords := res.ClaimRecords - suite.Require().Len(claimRecords, len(addresses)) -} - -func (suite *KeeperTestSuite) initTestZone() { - // test zone - zone := icstypes.Zone{ - ConnectionId: suite.path.EndpointB.ConnectionID, - ChainId: suite.chainB.ChainID, - AccountPrefix: "cosmos", - LocalDenom: "uqatom", - BaseDenom: "uatom", - Is_118: true, - } - - suite.GetQuicksilverApp(suite.chainA).InterchainstakingKeeper.SetZone(suite.chainA.GetContext(), &zone) -} - -func (suite *KeeperTestSuite) setDefaultClaimRecords(addresses []string) { - for _, address := range addresses { - cr := types.ClaimRecord{ - ChainId: suite.chainA.ChainID, - Address: address, - BaseValue: 100, - } - suite.setClaimRecord(cr) - } -} - -func (suite *KeeperTestSuite) getZoneDrop() types.ZoneDrop { - zd := types.ZoneDrop{ - ChainId: suite.chainB.ChainID, - StartTime: time.Now().Add(-5 * time.Minute), - Duration: time.Hour, - Decay: 30 * time.Minute, - Allocation: 1000000000, - Actions: []sdk.Dec{ - 0: sdk.MustNewDecFromStr("0.15"), // 15% - 1: sdk.MustNewDecFromStr("0.06"), // 21% - 2: sdk.MustNewDecFromStr("0.07"), // 28% - 3: sdk.MustNewDecFromStr("0.08"), // 36% - 4: sdk.MustNewDecFromStr("0.09"), // 45% - 5: sdk.MustNewDecFromStr("0.1"), // 55% - 6: sdk.MustNewDecFromStr("0.15"), // 70% - 7: sdk.MustNewDecFromStr("0.05"), // 75% - 8: sdk.MustNewDecFromStr("0.1"), // 85% - 9: sdk.MustNewDecFromStr("0.1"), // 95% - 10: sdk.MustNewDecFromStr("0.05"), // 100% - }, - IsConcluded: false, - } - - return zd -} - -func (suite *KeeperTestSuite) compressClaimRecords(crs []types.ClaimRecord) []byte { - suite.T().Helper() - - bz, err := json.Marshal(&crs) - suite.Require().NoError(err) - - var buf bytes.Buffer - zw := zlib.NewWriter(&buf) - _, err = zw.Write(bz) - suite.Require().NoError(err) - - err = zw.Close() - suite.Require().NoError(err) - - return buf.Bytes() -} - -func (suite *KeeperTestSuite) initTestZoneDrop() { - zd := suite.getZoneDrop() - suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.SetZoneDrop(suite.chainA.GetContext(), zd) - suite.fundZoneDrop(zd.ChainId, zd.Allocation) -} - -func (suite *KeeperTestSuite) fundZoneDrop(chainID string, amount uint64) { - quicksilver := suite.GetQuicksilverApp(suite.chainA) - ctx := suite.chainA.GetContext() - coins := sdk.NewCoins( - sdk.NewCoin( - quicksilver.StakingKeeper.BondDenom(ctx), - sdk.NewIntFromUint64(amount), - ), - ) - // fund zonedrop account - zdacc := quicksilver.AirdropKeeper.GetZoneDropAccountAddress(chainID) - - err := quicksilver.MintKeeper.MintCoins(ctx, coins) - suite.Require().NoError(err) - - err = quicksilver.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, zdacc, coins) - suite.Require().NoError(err) -} - -func (suite *KeeperTestSuite) setClaimRecord(cr types.ClaimRecord) { - err := suite.GetQuicksilverApp(suite.chainA).AirdropKeeper.SetClaimRecord(suite.chainA.GetContext(), cr) - if err != nil { - suite.T().Logf("setClaimRecord error: %v", err) - } - suite.Require().NoError(err) -} diff --git a/x/airdrop/keeper/msg_server_test.go b/x/airdrop/keeper/msg_server_test.go deleted file mode 100644 index 62e4c3d44..000000000 --- a/x/airdrop/keeper/msg_server_test.go +++ /dev/null @@ -1,579 +0,0 @@ -package keeper_test - -import ( - "github.com/tendermint/tendermint/proto/tendermint/crypto" - - sdk "github.com/cosmos/cosmos-sdk/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - staking "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/quicksilver-zone/quicksilver/utils/addressutils" - "github.com/quicksilver-zone/quicksilver/x/airdrop/keeper" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" - cmtypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" - icstypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" - minttypes "github.com/quicksilver-zone/quicksilver/x/mint/types" -) - -func (suite *KeeperTestSuite) Test_msgServer_Claim() { - appA := suite.GetQuicksilverApp(suite.chainA) - - userAddress := addressutils.GenerateAccAddressForTest().String() - denom := "uatom" // same as test zone setup in keeper_test - - msg := types.MsgClaim{} - tests := []struct { - name string - malleate func() - want *types.MsgClaimResponse - wantErr bool - }{ - { - "blank", - func() {}, - nil, - true, - }, - { - "nodrop", - func() { - // no zone airdrop state - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionInitialClaim), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "noclaimrecord", - func() { - // set valid zone airdrop state - suite.initTestZoneDrop() - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionInitialClaim), - Address: userAddress, - Proofs: nil, - } - }, - &types.MsgClaimResponse{ - Amount: 0, - }, - true, - }, - { - "claim_initial", - func() { - // use existing state (from prev test) - - // add claim record - cr := types.ClaimRecord{ - ChainId: suite.chainB.ChainID, - Address: userAddress, - ActionsCompleted: nil, - MaxAllocation: 100000000, - BaseValue: 10000000, - } - - suite.setClaimRecord(cr) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionInitialClaim), - Address: userAddress, - Proofs: nil, - } - }, - &types.MsgClaimResponse{ - Amount: 15000000, - }, - false, - }, - { - "claim_deposit_T5_insufficient", - func() { - // use existing state (from prev test) - - // add deposit - rcpt := icstypes.Receipt{ - ChainId: suite.chainB.ChainID, - Sender: userAddress, - Txhash: "TestDeposit01", - Amount: sdk.NewCoins( - sdk.NewCoin( - denom, - sdk.NewIntFromUint64(2000000), // 20% deposit - ), - ), - } - appA.InterchainstakingKeeper.SetReceipt( - suite.chainA.GetContext(), - rcpt, - ) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionDepositT5), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "claim_deposit_T4_insufficient", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionDepositT4), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "claim_deposit_T3", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionDepositT3), - Address: userAddress, - Proofs: nil, - } - }, - // expects 21% of MaxAllocation - // - 8% for T3 - // - 7% for T2 - // - 6% for T1 - &types.MsgClaimResponse{ - Amount: 21000000, - }, - false, - }, - { - "claim_deposit_T2_completed", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionDepositT2), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "claim_deposit_T1_completed", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionDepositT1), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "claim_deposit_T5", - func() { - // use existing state (from prev test) - - // add deposit - rcpt := icstypes.Receipt{ - ChainId: suite.chainB.ChainID, - Sender: userAddress, - Txhash: "T5_02", - Amount: sdk.NewCoins( - sdk.NewCoin( - denom, - sdk.NewIntFromUint64(1000000), // 10% deposit (sum 30%) - ), - ), - } - appA.InterchainstakingKeeper.SetReceipt( - suite.chainA.GetContext(), - rcpt, - ) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionDepositT5), - Address: userAddress, - Proofs: nil, - } - }, - // expects 19% of MaxAllocation - // - 9% for T4 - // - 10% for T5 - // - 21% for T1-T3 already claimed - &types.MsgClaimResponse{ - Amount: 19000000, - }, - false, - }, - { - "claim_stake_no_bond", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionStakeQCK), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "claim_stake_with_bond", - func() { - // use existing state (from prev test) - - // add staking delegation - valAddress, err := sdk.ValAddressFromHex(suite.chainA.Vals.Validators[2].Address.String()) - suite.Require().NoError(err) - - del := staking.Delegation{ - DelegatorAddress: userAddress, - ValidatorAddress: valAddress.String(), - Shares: sdk.MustNewDecFromStr("10.0"), - } - appA.StakingKeeper.SetDelegation( - suite.chainA.GetContext(), - del, - ) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionStakeQCK), - Address: userAddress, - Proofs: nil, - } - }, - &types.MsgClaimResponse{ - Amount: 15000000, - }, - false, - }, - { - "claim_intent_not_set", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionSignalIntent), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "claim_intent_is_set", - func() { - // use existing state (from prev test) - - // add intent - valAddress, err := sdk.ValAddressFromHex(suite.chainB.Vals.Validators[1].Address.String()) - suite.Require().NoError(err) - - zone, found := appA.InterchainstakingKeeper.GetZone(suite.chainA.GetContext(), suite.chainB.ChainID) - suite.Require().True(found) - - intent := icstypes.DelegatorIntent{ - Delegator: userAddress, - Intents: []*icstypes.ValidatorIntent{ - { - ValoperAddress: valAddress.String(), - Weight: sdk.OneDec(), - }, - }, - } - appA.InterchainstakingKeeper.SetDelegatorIntent( - suite.chainA.GetContext(), - &zone, - intent, - false, - ) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionSignalIntent), - Address: userAddress, - Proofs: nil, - } - }, - &types.MsgClaimResponse{ - Amount: 5000000, - }, - false, - }, - { - "claim_gov_no_votes", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionQSGov), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "claim_gov_voted", - func() { - // use existing state (from prev test) - - // add proposal and vote - prop := govv1.Proposal{ - Id: 0, - Status: govv1.StatusPassed, - } - appA.GovKeeper.SetProposal(suite.chainA.GetContext(), prop) - - vote := govv1.Vote{ - ProposalId: 0, - Voter: userAddress, - Options: []*govv1.WeightedVoteOption{ - { - Option: govv1.VoteOption_VOTE_OPTION_YES, - Weight: "1.0", - }, - }, - } - appA.GovKeeper.SetVote(suite.chainA.GetContext(), vote) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionQSGov), - Address: userAddress, - Proofs: nil, - } - }, - &types.MsgClaimResponse{ - Amount: 10000000, - }, - false, - }, - { - "claim_gbp_invalid", - func() { - // TODO: implement with GbP - }, - nil, - true, - }, - { - "claim_gbp_valid", - func() { - // TODO: implement with GbP - }, - nil, - true, - }, - { - "claim_osmosis_lp_nilproofs", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionOsmosis), - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - { - "claim_osmosis_lp_zeroproof", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionOsmosis), - Address: userAddress, - Proofs: []*cmtypes.Proof{ - {}, - }, - } - }, - nil, - true, - }, - { - "claim_osmosis_lp_invalidproof", - func() { - // use existing state (from prev test) - - // add consensus state - // consensusState := exported.ConsensusState{} - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: int64(types.ActionOsmosis), - Address: userAddress, - Proofs: []*cmtypes.Proof{ - { - Key: []byte(string("123")), - Data: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, - ProofOps: &crypto.ProofOps{ - Ops: []crypto.ProofOp{ - { - Type: "testtype", - Key: []byte(string("123")), - Data: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, - }, - }, - }, - ProofType: "lockup", - Height: 0, - }, - }, - } - }, - nil, - true, - }, - { - "Undefined action", - func() { - // use existing state (from prev test) - - msg = types.MsgClaim{ - ChainId: suite.chainB.ChainID, - Action: 999, - Address: userAddress, - Proofs: nil, - } - }, - nil, - true, - }, - } - for _, tt := range tests { - suite.Run(tt.name, func() { - tt.malleate() - - k := keeper.NewMsgServerImpl(appA.AirdropKeeper) - resp, err := k.Claim(sdk.WrapSDKContext(suite.chainA.GetContext()), &msg) - if tt.wantErr { - suite.Require().Error(err) - suite.Require().Nil(resp) - suite.T().Logf("Error: %v", err) - return - } - - suite.Require().NoError(err) - suite.Require().NotNil(resp) - suite.Require().Equal(tt.want, resp) - }) - } -} - -func (suite *KeeperTestSuite) Test_msgServer_IncentivePoolSpend() { - appA := suite.GetQuicksilverApp(suite.chainA) - - modAccAddr := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" - userAddress := addressutils.GenerateAccAddressForTest().String() - denom := "uatom" // same as test zone setup in keeper_test - coins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewIntFromUint64(1000))) - mintCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewIntFromUint64(100000000))) - - // set up mod acct with funds - err := appA.BankKeeper.MintCoins(suite.chainA.GetContext(), minttypes.ModuleName, mintCoins) - suite.Require().NoError(err) - err = appA.BankKeeper.SendCoinsFromModuleToModule(suite.chainA.GetContext(), minttypes.ModuleName, types.ModuleName, mintCoins) - suite.Require().NoError(err) - - msg := types.MsgIncentivePoolSpend{} - tests := []struct { - name string - malleate func() - want *types.MsgIncentivePoolSpendResponse - wantErr bool - }{ - { - name: "invalid authority", - malleate: func() { - msg = types.MsgIncentivePoolSpend{ - Authority: "invalid", - ToAddress: userAddress, - Amount: coins, - Title: "Invalid Incentive Pool Spend Title", - Description: "Invalid Incentive Pool Spend Description", - } - }, - want: nil, - wantErr: true, - }, - { - name: "valid", - malleate: func() { - msg = types.MsgIncentivePoolSpend{ - Authority: modAccAddr, - ToAddress: userAddress, - Amount: coins, - Title: "Valid Incentive Pool Spend Title", - Description: "Valid Incentive Pool Spend Description", - } - }, - want: &types.MsgIncentivePoolSpendResponse{}, - wantErr: false, - }, - } - for _, tt := range tests { - suite.Run(tt.name, func() { - tt.malleate() - - k := keeper.NewMsgServerImpl(appA.AirdropKeeper) - resp, err := k.IncentivePoolSpend(sdk.WrapSDKContext(suite.chainA.GetContext()), &msg) - if tt.wantErr { - suite.Require().Error(err) - suite.Require().Nil(resp) - suite.T().Logf("Error: %v", err) - return - } - - suite.Require().NoError(err) - suite.Require().NotNil(resp) - suite.Require().Equal(tt.want, resp) - - // verify that balance has been properly transferred - accAddr, err := sdk.AccAddressFromBech32(msg.ToAddress) - suite.Require().NoError(err) - balance := appA.BankKeeper.GetAllBalances(suite.chainA.GetContext(), accAddr) - suite.Require().Equal(msg.Amount, balance) - }) - } -} diff --git a/x/airdrop/keeper/proposal_handler.go b/x/airdrop/keeper/proposal_handler.go deleted file mode 100644 index de9111c31..000000000 --- a/x/airdrop/keeper/proposal_handler.go +++ /dev/null @@ -1,85 +0,0 @@ -package keeper - -import ( - "encoding/json" - "errors" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -type ClaimRecords []types.ClaimRecord - -// HandleRegisterZoneDropProposal is a handler for executing a passed airdrop proposal. -func HandleRegisterZoneDropProposal(ctx sdk.Context, k *Keeper, p *types.RegisterZoneDropProposal) error { - if err := p.ValidateBasic(); err != nil { - return err - } - - _, found := k.icsKeeper.GetZone(ctx, p.ZoneDrop.ChainId) - if !found { - return types.ErrZoneNotFound{ID: p.ZoneDrop.ChainId} - } - - if p.ZoneDrop.StartTime.Before(ctx.BlockTime()) { - return errors.New("zone airdrop already started") - } - - // decompress claim records - crsb, err := types.Decompress(p.ClaimRecords) - if err != nil { - return err - } - - // unmarshal json - var crs ClaimRecords - if err := json.Unmarshal(crsb, &crs); err != nil { - return err - } - - sumMax := uint64(0) - // validate ClaimRecords and process - for i, cr := range crs { - if err := cr.ValidateBasic(); err != nil { - return fmt.Errorf("claim record %d, %w", i, err) - } - - if len(cr.ActionsCompleted) != 0 { - return fmt.Errorf("invalid zonedrop proposal claim record [%d]: contains completed actions", i) - } - - if cr.ChainId != p.ZoneDrop.ChainId { - return fmt.Errorf("invalid zonedrop proposal claim record [%d]: chainID mismatch, expected %q got %q", i, p.ZoneDrop.ChainId, cr.ChainId) - } - - sumMax += cr.MaxAllocation - } - - // check allocations - if sumMax > p.ZoneDrop.Allocation { - return fmt.Errorf("sum of claim records max allocations (%v) exceed zone airdrop allocation (%v)", sumMax, p.ZoneDrop.Allocation) - } - - // process ZoneDrop - k.SetZoneDrop(ctx, *p.ZoneDrop) - for i, cr := range crs { - if err := k.SetClaimRecord(ctx, cr); err != nil { - return fmt.Errorf("invalid zonedrop proposal claim record [%d]: %w", i, err) - } - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), - ), - sdk.NewEvent( - types.EventTypeRegisterZoneDrop, - sdk.NewAttribute(types.AttributeKeyZoneID, p.ZoneDrop.ChainId), - ), - }) - - return nil -} diff --git a/x/airdrop/keeper/proposal_handler_test.go b/x/airdrop/keeper/proposal_handler_test.go deleted file mode 100644 index 0ab1d24de..000000000 --- a/x/airdrop/keeper/proposal_handler_test.go +++ /dev/null @@ -1,259 +0,0 @@ -package keeper_test - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/utils/addressutils" - "github.com/quicksilver-zone/quicksilver/x/airdrop/keeper" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -func (suite *KeeperTestSuite) TestHandleRegisterZoneDropProposal() { - appA := suite.GetQuicksilverApp(suite.chainA) - - validZoneDrop := types.ZoneDrop{ - ChainId: suite.chainB.ChainID, - StartTime: time.Now().Add(time.Hour), - Duration: time.Hour, - Decay: 30 * time.Minute, - Allocation: 1000000000, - Actions: []sdk.Dec{ - 0: sdk.MustNewDecFromStr("0.15"), // 15% - 1: sdk.MustNewDecFromStr("0.06"), // 21% - 2: sdk.MustNewDecFromStr("0.07"), // 28% - 3: sdk.MustNewDecFromStr("0.08"), // 36% - 4: sdk.MustNewDecFromStr("0.09"), // 45% - 5: sdk.MustNewDecFromStr("0.1"), // 55% - 6: sdk.MustNewDecFromStr("0.15"), // 70% - 7: sdk.MustNewDecFromStr("0.05"), // 75% - 8: sdk.MustNewDecFromStr("0.1"), // 85% - 9: sdk.MustNewDecFromStr("0.1"), // 95% - 10: sdk.MustNewDecFromStr("0.05"), // 100% - }, - IsConcluded: false, - } - userAddresses := []string{ - addressutils.GenerateAccAddressForTest().String(), - } - - prop := types.RegisterZoneDropProposal{} - tests := []struct { - name string - malleate func() - wantErr bool - }{ - { - "blank", - func() {}, - true, - }, - { - "invalid-zd-chainID", - func() { - zd := types.ZoneDrop{ - ChainId: "test-01", - StartTime: time.Now().Add(-5 * time.Minute), - Duration: time.Hour, - Decay: 30 * time.Minute, - Allocation: 1000000000, - Actions: []sdk.Dec{ - 0: sdk.MustNewDecFromStr("0.15"), // 15% - 1: sdk.MustNewDecFromStr("0.06"), // 21% - 2: sdk.MustNewDecFromStr("0.07"), // 28% - 3: sdk.MustNewDecFromStr("0.08"), // 36% - 4: sdk.MustNewDecFromStr("0.09"), // 45% - 5: sdk.MustNewDecFromStr("0.1"), // 55% - 6: sdk.MustNewDecFromStr("0.15"), // 70% - 7: sdk.MustNewDecFromStr("0.05"), // 75% - 8: sdk.MustNewDecFromStr("0.1"), // 85% - 9: sdk.MustNewDecFromStr("0.1"), // 95% - 10: sdk.MustNewDecFromStr("0.05"), // 100% - }, - IsConcluded: false, - } - - crs := make([]types.ClaimRecord, len(userAddresses)) - for i := range crs { - crs[i] = types.ClaimRecord{ - ChainId: suite.chainB.ChainID, - Address: userAddresses[i], - ActionsCompleted: nil, - MaxAllocation: 100000000, - BaseValue: 10000000, - } - } - - prop = types.RegisterZoneDropProposal{ - Title: "Test Zone Airdrop Proposal", - Description: "Adding this zone drop allows for automated testing", - ZoneDrop: &zd, - ClaimRecords: suite.compressClaimRecords(crs), - } - }, - true, - }, - { - "invalid-zd-started", - func() { - zd := types.ZoneDrop{ - ChainId: suite.chainB.ChainID, - StartTime: time.Now().Add(-5 * time.Minute), - Duration: time.Hour, - Decay: 30 * time.Minute, - Allocation: 1000000000, - Actions: []sdk.Dec{ - 0: sdk.MustNewDecFromStr("0.15"), // 15% - 1: sdk.MustNewDecFromStr("0.06"), // 21% - 2: sdk.MustNewDecFromStr("0.07"), // 28% - 3: sdk.MustNewDecFromStr("0.08"), // 36% - 4: sdk.MustNewDecFromStr("0.09"), // 45% - 5: sdk.MustNewDecFromStr("0.1"), // 55% - 6: sdk.MustNewDecFromStr("0.15"), // 70% - 7: sdk.MustNewDecFromStr("0.05"), // 75% - 8: sdk.MustNewDecFromStr("0.1"), // 85% - 9: sdk.MustNewDecFromStr("0.1"), // 95% - 10: sdk.MustNewDecFromStr("0.05"), // 100% - }, - IsConcluded: false, - } - - crs := make([]types.ClaimRecord, len(userAddresses)) - for i := range crs { - crs[i] = types.ClaimRecord{ - ChainId: suite.chainB.ChainID, - Address: userAddresses[i], - ActionsCompleted: nil, - MaxAllocation: 100000000, - BaseValue: 10000000, - } - } - - prop = types.RegisterZoneDropProposal{ - Title: "Test Zone Airdrop Proposal", - Description: "Adding this zone drop allows for automated testing", - ZoneDrop: &zd, - ClaimRecords: suite.compressClaimRecords(crs), - } - }, - true, - }, - { - "invalid-cr-chainID", - func() { - zd := validZoneDrop - crs := make([]types.ClaimRecord, len(userAddresses)) - for i := range crs { - crs[i] = types.ClaimRecord{ - ChainId: "test-01", - Address: userAddresses[i], - ActionsCompleted: nil, - MaxAllocation: 100000000, - BaseValue: 10000000, - } - } - - prop = types.RegisterZoneDropProposal{ - Title: "Test Zone Airdrop Proposal", - Description: "Adding this zone drop allows for automated testing", - ZoneDrop: &zd, - ClaimRecords: suite.compressClaimRecords(crs), - } - }, - true, - }, - { - "invalid-cr-completed-actions", - func() { - zd := validZoneDrop - - crs := make([]types.ClaimRecord, len(userAddresses)) - for i := range crs { - crs[i] = types.ClaimRecord{ - ChainId: suite.chainB.ChainID, - Address: userAddresses[i], - ActionsCompleted: map[int32]*types.CompletedAction{ - 1: {}, - }, - MaxAllocation: 100000000, - BaseValue: 10000000, - } - } - - prop = types.RegisterZoneDropProposal{ - Title: "Test Zone Airdrop Proposal", - Description: "Adding this zone drop allows for automated testing", - ZoneDrop: &zd, - ClaimRecords: suite.compressClaimRecords(crs), - } - }, - true, - }, - { - "invalid-allocation-exceeded", - func() { - zd := validZoneDrop - - crs := make([]types.ClaimRecord, len(userAddresses)) - for i := range crs { - crs[i] = types.ClaimRecord{ - ChainId: suite.chainB.ChainID, - Address: userAddresses[i], - ActionsCompleted: nil, - MaxAllocation: 1000000001, - BaseValue: 10000000, - } - } - - prop = types.RegisterZoneDropProposal{ - Title: "Test Zone Airdrop Proposal", - Description: "Adding this zone drop allows for automated testing", - ZoneDrop: &zd, - ClaimRecords: suite.compressClaimRecords(crs), - } - }, - true, - }, - { - "valid", - func() { - zd := validZoneDrop - - crs := make([]types.ClaimRecord, len(userAddresses)) - for i := range crs { - crs[i] = types.ClaimRecord{ - ChainId: suite.chainB.ChainID, - Address: userAddresses[i], - ActionsCompleted: nil, - MaxAllocation: 100000000, - BaseValue: 10000000, - } - } - - prop = types.RegisterZoneDropProposal{ - Title: "Test Zone Airdrop Proposal", - Description: "Adding this zone drop allows for automated testing", - ZoneDrop: &zd, - ClaimRecords: suite.compressClaimRecords(crs), - } - }, - false, - }, - } - for _, tt := range tests { - suite.Run(tt.name, func() { - tt.malleate() - - k := appA.AirdropKeeper - err := keeper.HandleRegisterZoneDropProposal(suite.chainA.GetContext(), k, &prop) - if tt.wantErr { - suite.Require().Error(err) - suite.T().Logf("Error: %v", err) - return - } - - suite.Require().NoError(err) - }) - } -} diff --git a/x/airdrop/keeper/zonedrop.go b/x/airdrop/keeper/zonedrop.go deleted file mode 100644 index 40db951f7..000000000 --- a/x/airdrop/keeper/zonedrop.go +++ /dev/null @@ -1,212 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -// GetZoneDropAccountAddress returns the zone airdrop account address. -func (k *Keeper) GetZoneDropAccountAddress(chainID string) sdk.AccAddress { - name := types.ModuleName + "." + chainID - return authtypes.NewModuleAddress(name) -} - -// GetZoneDropAccountBalance gets the zone airdrop account coin balance. -func (k *Keeper) GetZoneDropAccountBalance(ctx sdk.Context, chainID string) sdk.Coin { - zonedropAccAddr := k.GetZoneDropAccountAddress(chainID) - return k.bankKeeper.GetBalance(ctx, zonedropAccAddr, k.stakingKeeper.BondDenom(ctx)) -} - -// GetZoneDrop returns airdrop details for the zone identified by chainID. -func (k *Keeper) GetZoneDrop(ctx sdk.Context, chainID string) (types.ZoneDrop, bool) { - zd := types.ZoneDrop{} - store := ctx.KVStore(k.storeKey) - b := store.Get(types.GetKeyZoneDrop(chainID)) - if len(b) == 0 { - return zd, false - } - - k.cdc.MustUnmarshal(b, &zd) - return zd, true -} - -// SetZoneDrop creates/updates the given zone airdrop (ZoneDrop). -func (k *Keeper) SetZoneDrop(ctx sdk.Context, zd types.ZoneDrop) { - store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshal(&zd) - store.Set(types.GetKeyZoneDrop(zd.ChainId), b) -} - -// DeleteZoneDrop deletes the airdrop of the zone identified by chainID. -func (k *Keeper) DeleteZoneDrop(ctx sdk.Context, chainID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.GetKeyZoneDrop(chainID)) -} - -// IterateZoneDrops iterates through zone airdrops. -func (k Keeper) IterateZoneDrops(ctx sdk.Context, fn func(index int64, zoneDrop types.ZoneDrop) (stop bool)) { - store := ctx.KVStore(k.storeKey) - - iterator := sdk.KVStorePrefixIterator(store, types.KeyPrefixZoneDrop) - defer iterator.Close() - - i := int64(0) - for ; iterator.Valid(); iterator.Next() { - zd := types.ZoneDrop{} - k.cdc.MustUnmarshal(iterator.Value(), &zd) - - stop := fn(i, zd) - - if stop { - break - } - i++ - } -} - -// AllZoneDrops returns all zone airdrops (active, future, expired). -func (k *Keeper) AllZoneDrops(ctx sdk.Context) []*types.ZoneDrop { - var zds []*types.ZoneDrop - k.IterateZoneDrops(ctx, func(_ int64, zd types.ZoneDrop) (stop bool) { - zds = append(zds, &zd) - return false - }) - return zds -} - -// AllActiveZoneDrops returns all active zone airdrops. -func (k *Keeper) AllActiveZoneDrops(ctx sdk.Context) []types.ZoneDrop { - var zds []types.ZoneDrop - k.IterateZoneDrops(ctx, func(_ int64, zd types.ZoneDrop) (stop bool) { - if k.IsActiveZoneDrop(ctx, zd) { - zds = append(zds, zd) - } - return false - }) - return zds -} - -// IsActiveZoneDrop returns true if the zone airdrop is currently active. -// -// `timeline: |----------s----------D----------d----------|` -// ` ^---------------------^ ` -// -// s: StartTime (time.Time) -// D: Duration (time.Duration) ... s+D -// d: decay (time.Duration) ... s+D+d -// -// isActive: s <= timenow <= s+D+d -// notActive: timenow < s || timenow > s+D+d. -func (k *Keeper) IsActiveZoneDrop(ctx sdk.Context, zd types.ZoneDrop) bool { - bt := ctx.BlockTime() - - // negated checks here ensure inclusive range - return !bt.Before(zd.StartTime) && !bt.After(zd.StartTime.Add(zd.Duration).Add(zd.Decay)) -} - -// AllFutureZoneDrops returns all future zone airdrops. -func (k *Keeper) AllFutureZoneDrops(ctx sdk.Context) []types.ZoneDrop { - var zds []types.ZoneDrop - k.IterateZoneDrops(ctx, func(_ int64, zd types.ZoneDrop) (stop bool) { - if k.IsFutureZoneDrop(ctx, zd) { - zds = append(zds, zd) - } - return false - }) - return zds -} - -// IsFutureZoneDrop returns true if the zone airdrop is in the future. -// -// `timeline: |----------s----------D----------d----------|` -// ` ^---------^ ` -// -// s: StartTime (time.Time) -// D: Duration (time.Duration) ... s+D -// d: decay (time.Duration) ... s+D+d -// -// isFuture: timenow < s -// notFuture: s <= timenow. -func (k *Keeper) IsFutureZoneDrop(ctx sdk.Context, zd types.ZoneDrop) bool { - bt := ctx.BlockTime() - - return bt.Before(zd.StartTime) -} - -// AllExpiredZoneDrops returns all expired zone airdrops. -func (k *Keeper) AllExpiredZoneDrops(ctx sdk.Context) []types.ZoneDrop { - var zds []types.ZoneDrop - k.IterateZoneDrops(ctx, func(_ int64, zd types.ZoneDrop) (stop bool) { - if k.IsExpiredZoneDrop(ctx, zd) { - zds = append(zds, zd) - } - return false - }) - return zds -} - -// IsExpiredZoneDrop returns true if the zone airdrop has already expired. -// -// `timeline: |----------s----------D----------d----------|` -// ` ^---------^` -// -// s: StartTime (time.Time) -// D: Duration (time.Duration) ... s+D -// d: decay (time.Duration) ... s+D+d -// -// isExpired: timenow > s+D+d -// notExpired: timenow < s+D+d. -func (k *Keeper) IsExpiredZoneDrop(ctx sdk.Context, zd types.ZoneDrop) bool { - bt := ctx.BlockTime() - - return bt.After(zd.StartTime.Add(zd.Duration).Add(zd.Decay)) -} - -// UnconcludedAirdrops returns all expired zone airdrops that have not yet been -// concluded. -func (k *Keeper) UnconcludedAirdrops(ctx sdk.Context) []types.ZoneDrop { - var zds []types.ZoneDrop - k.IterateZoneDrops(ctx, func(_ int64, zd types.ZoneDrop) (stop bool) { - if k.IsExpiredZoneDrop(ctx, zd) { - if !zd.IsConcluded { - zds = append(zds, zd) - } - } - return false - }) - return zds -} - -// EndZoneDrop concludes a zone airdrop. It deletes all ClaimRecords for the -// given zone. -func (k *Keeper) EndZoneDrop(ctx sdk.Context, chainID string) error { - if err := k.returnUnclaimedZoneDropTokens(ctx, chainID); err != nil { - return err - } - k.ClearClaimRecords(ctx, chainID) - - zd, ok := k.GetZoneDrop(ctx, chainID) - if !ok { - return types.ErrZoneDropNotFound - } - - zd.IsConcluded = true - k.SetZoneDrop(ctx, zd) - - return nil -} - -// returnUnclaimedZoneDropTokens returns all unclaimed zone airdrop tokens to -// the airdrop module account. -func (k *Keeper) returnUnclaimedZoneDropTokens(ctx sdk.Context, chainID string) error { - zonedropAccountAddress := k.GetZoneDropAccountAddress(chainID) - zonedropAccountBalance := k.GetZoneDropAccountBalance(ctx, chainID) - return k.bankKeeper.SendCoinsFromAccountToModule( - ctx, - zonedropAccountAddress, - types.ModuleName, - sdk.NewCoins(zonedropAccountBalance), - ) -} diff --git a/x/airdrop/module.go b/x/airdrop/module.go deleted file mode 100644 index 7857ba90a..000000000 --- a/x/airdrop/module.go +++ /dev/null @@ -1,199 +0,0 @@ -package airdrop - -import ( - "context" - "encoding/json" - "fmt" - "math/rand" - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/client/cli" - "github.com/quicksilver-zone/quicksilver/x/airdrop/keeper" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -var ( - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModule = AppModule{} - _ module.AppModuleSimulation = AppModule{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the airdrop module. -type AppModuleBasic struct { - cdc codec.Codec -} - -// Name returns the airdrop module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers a legacy amino codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} - -// RegisterInterfaces registers the module's interface types. -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - // RegisterInterfaces registers interfaces and implementations of the bank module. - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns the airdrop module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) -} - -// ValidateGenesis performs genesis state validation for the airdrop module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var gs types.GenesisState - if err := cdc.UnmarshalJSON(bz, &gs); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - - return gs.Validate() -} - -// RegisterRESTRoutes registers the airdrop module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -// This function will panic on failure. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, m *runtime.ServeMux) { - err := types.RegisterQueryHandlerClient(context.Background(), m, types.NewQueryClient(clientCtx)) - if err != nil { - panic(err) - } -} - -// GetTxCmd returns the airdrop module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the airdrop module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the airdrop module. -type AppModule struct { - AppModuleBasic - keeper *keeper.Keeper -} - -// NewAppModule return a new AppModule. -func NewAppModule(cdc codec.Codec, k *keeper.Keeper) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{ - cdc: cdc, - }, - keeper: k, - } -} - -// RegisterInvariants registers the airdrop module invariants. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { - keeper.RegisterInvariants(ir, am.keeper) -} - -// Route returns the message routing key for the airdrop module. -func (am AppModule) Route() sdk.Route { - return sdk.Route{} -} - -// QuerierRoute returns the airdrop module's querier route name. -func (AppModule) QuerierRoute() string { - return types.QuerierRoute -} - -// LegacyQuerierHandler returns the x/airdrop module's sdk.Querier. -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return func(sdk.Context, []string, abci.RequestQuery) ([]byte, error) { - return nil, fmt.Errorf("legacy querier not supported for the x/%s module", types.ModuleName) - } -} - -// RegisterServices registers a gRPC query service to respond to the -// module-specific gRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// InitGenesis performs the airdrop module's genesis -// initialization It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the airdrop module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// BeginBlock executes all ABCI BeginBlock logic respective to the airdrop module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { -} - -// EndBlock executes all ABCI EndBlock logic respective to the airdrop module. It -// returns no validator updates. -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - am.keeper.EndBlocker(ctx) - return []abci.ValidatorUpdate{} -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// ___________________________________________________________________________ - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the mint module. -func (AppModule) GenerateGenesisState(_ *module.SimulationState) { -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized mint param changes for the simulator. -func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{} -} - -// RegisterStoreDecoder registers a decoder for mint module's types. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { -} - -// WeightedOperations doesn't return any mint module operation. -func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { - return nil -} diff --git a/x/airdrop/spec/README.md b/x/airdrop/spec/README.md deleted file mode 100644 index 9f4999e7f..000000000 --- a/x/airdrop/spec/README.md +++ /dev/null @@ -1,461 +0,0 @@ -# Airdrop - -## Abstract - -The purpose of this module is to distribute QCK airdrops to users for engaging in activities related to newly onboarded zones. - -**Objectives:** - -- Provide airdrop to qualifying users; -- Couple airdrop to specific actions or tasks; -- Airdrops configured on a per zone basis; -- Must decay to zero over a specified period, starting at a specific time / block height; - -## Contents - -1. [Concepts](#concepts) -1. [State](#state) -1. [Messages](#messages) -1. [Transactions](#transactions) -1. [Events](#events) -1. [Hooks](#hooks) -1. [Queries](#queries) -1. [Keepers](#keepers) -1. [Parameters](#parameters) -1. [Proposals](#proposals) -1. [Begin Block](#begin-block) -1. [End Block](#end-block) - -## Concepts - -Key concepts, mechanisms and core logic for the module; - -### Module Accounts - -The airdrop module utilizes a module account for every zone airdrop identified by the zone's chain ID to manage airdrop claims accounting. It also has a main module account where all unclaimed amounts will be collected on conclusion of a zone airdrop. - -### ZoneDrops - -A `ZoneDrop` refers to a zone airdrop and is identified by the zone's chain ID. - -#### Status - -A `ZoneDrop` is considered `Active` if, and only if, the current `BlockTime` is between the time window of the airdrop `StartTime` and the added airdrop `Duration` and `Decay` times. - -**Formula:** - -- active: `BlockTime` > `StartTime` && `BlockTime` < `StartTime`+`Duration`+`Decay`; -- future: `BlockTime` < `StartTime`; -- expired: `BlockTime` > `StartTime`+`Duration`+`Decay`; - -#### Duration & Decay - -Airdrop `Duration` refers to the time period an airdrop is active at its full reward potential. Every action claimed during this period will receive rewards directly proportional to the qualifying allocation and the weight of the particular action. - -Airdrop `Decay` refers to the time period after the `Duration` during which the airdrop is still active, but rewards are discounted according to the decay proportion. Thus, any action claimed at the half way mark of the decay duration will only receive 50% of that action's qualifying allocation and weight. - -### Actions - -Airdrop rewards are coupled to specific actions or tasks that users are to perform to unlock airdrop rewards, that they may then claim. Of note here is that the deposit action is subdivided into tiers, where each subsequent tier is unlocked by reaching a particular threshold of the `BaseValue` in deposits. - -### Claim Records - -A `ClaimRecord` represents an individual user's full potential airdrop rewards and is set at as part of the airdrop proposal. Individual rewards are scalable according to the `BaseValue` which may represent particular snapshot data in accordance with the airdrop proposal. - -Any claims completed are recorded against the `ClaimRecord` and claimed amounts may never exceed the defined `MaxAllocation`. - -## State - -### Action - -```go -// Action is used as an enum to denote specific actions or tasks. -type Action int32 - -const ( - // Initial claim action - ActionInitialClaim Action = 0 - // Deposit tier 1 (e.g. > 5% of base_value) - ActionDepositT1 Action = 1 - // Deposit tier 2 (e.g. > 10% of base_value) - ActionDepositT2 Action = 2 - // Deposit tier 3 (e.g. > 15% of base_value) - ActionDepositT3 Action = 3 - // Deposit tier 4 (e.g. > 22% of base_value) - ActionDepositT4 Action = 4 - // Deposit tier 5 (e.g. > 30% of base_value) - ActionDepositT5 Action = 5 - // Active QCK delegation - ActionStakeQCK Action = 6 - // Intent is set - ActionSignalIntent Action = 7 - // Cast governance vote on QS - ActionQSGov Action = 8 - // Governance By Proxy (GbP): cast vote on remote zone - ActionGbP Action = 9 - // Provide liquidity on Osmosis - ActionOsmosis Action = 10 -) - -var Action_name = map[int32]string{ - 0: "ActionInitialClaim", - 1: "ActionDepositT1", - 2: "ActionDepositT2", - 3: "ActionDepositT3", - 4: "ActionDepositT4", - 5: "ActionDepositT5", - 6: "ActionStakeQCK", - 7: "ActionSignalIntent", - 8: "ActionQSGov", - 9: "ActionGbP", - 10: "ActionOsmosis", -} - -var Action_value = map[string]int32{ - "ActionInitialClaim": 0, - "ActionDepositT1": 1, - "ActionDepositT2": 2, - "ActionDepositT3": 3, - "ActionDepositT4": 4, - "ActionDepositT5": 5, - "ActionStakeQCK": 6, - "ActionSignalIntent": 7, - "ActionQSGov": 8, - "ActionGbP": 9, - "ActionOsmosis": 10, -} -``` - -### Status - -```go -// Status is used as an enum to denote zone status. -type Status int32 - -const ( - StatusActive Status = 0 - StatusFuture Status = 1 - StatusExpired Status = 2 -) - -var Status_name = map[int32]string{ - 0: "StatusActive", - 1: "StatusFuture", - 2: "StatusExpired", -} - -var Status_value = map[string]int32{ - "StatusActive": 0, - "StatusFuture": 1, - "StatusExpired": 2, -} -``` - -### ZoneDrop - -```go -var ( - KeyPrefixZoneDrop = []byte{0x01} -) - -func GetKeyZoneDrop(chainID string) []byte { - return append(KeyPrefixZoneDrop, chainID...) -} - -// ZoneDrop represents an airdrop for a specific zone. -type ZoneDrop struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - StartTime time.Time `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time" yaml:"start_time"` - Duration time.Duration `protobuf:"bytes,3,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"` - Decay time.Duration `protobuf:"bytes,4,opt,name=decay,proto3,stdduration" json:"decay,omitempty" yaml:"decay"` - Allocation uint64 `protobuf:"varint,5,opt,name=allocation,proto3" json:"allocation,omitempty"` - Actions []github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,rep,name=actions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"actions"` - IsConcluded bool `protobuf:"varint,7,opt,name=is_concluded,json=isConcluded,proto3" json:"is_concluded,omitempty"` -} -``` - -### ClaimRecord - -```go -var ( - KeyPrefixClaimRecord = []byte{0x02} -) - -func GetKeyClaimRecord(chainID string, addr sdk.AccAddress) []byte { - return append(append(KeyPrefixClaimRecord, chainID...), addr...) -} - -func GetPrefixClaimRecord(chainID string) []byte { - return append(KeyPrefixClaimRecord, chainID...) -} - -// ClaimRecord represents a users' claim (including completed claims) for a -// given zone. -type ClaimRecord struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // Protobuf3 does not allow enum as map key - ActionsCompleted map[int32]*CompletedAction `protobuf:"bytes,3,rep,name=actions_completed,json=actionsCompleted,proto3" json:"actions_completed,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MaxAllocation uint64 `protobuf:"varint,4,opt,name=max_allocation,json=maxAllocation,proto3" json:"max_allocation,omitempty"` - BaseValue uint64 `protobuf:"varint,5,opt,name=base_value,json=baseValue,proto3" json:"base_value,omitempty"` -} -``` - -### CompletedAction - -```go -// CompletedAction represents a claim action completed by the user. -type CompletedAction struct { - CompleteTime time.Time `protobuf:"bytes,1,opt,name=complete_time,json=completeTime,proto3,stdtime" json:"complete_time" yaml:"complete_time"` - ClaimAmount uint64 `protobuf:"varint,2,opt,name=claim_amount,json=claimAmount,proto3" json:"claim_amount,omitempty"` -} -``` - -## Messages - -Description of message types that trigger state transitions; - -```protobuf -// Msg defines the airdrop Msg service. -service Msg { - rpc Claim(MsgClaim) returns (MsgClaimResponse) { - option (google.api.http) = { - post : "/quicksilver/tx/v1/airdrop/claim" - body : "*" - }; - } -} -``` - -### claim - -Claim the airdrop for the given action in the given zone. - -```go -type MsgClaim struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` - Action int64 `protobuf:"varint,2,opt,name=action,proto3" json:"action,omitempty" yaml:"action"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` - Proofs []*types.Proof `protobuf:"bytes,4,rep,name=proofs,proto3" json:"proofs,omitempty" yaml:"proofs"` -} - -type MsgClaimResponse struct { - Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty" yaml:"amount"` -} -``` - -## Transactions - -Description of transactions that collect messages in specific contexts to trigger state transitions; - -### claim - -Claim airdrop for the given action in the given zone. - -`claim [chainID] [action]` - -Example: - -`$ quicksilverd tx airdrop claim cosmoshub-4 ActionDelegateStake` - -## Events - -Events emitted by module for tracking messages and index transactions; - -### RegisterZoneDropProposal - -| Type | Attribute Key | Attribute Value | -| :---------------- | :------------ | :-------------- | -| message | module | airdrop | -| register_zonedrop | chain_id | {chain_id} | - -### MsgClaim - -| Type | Attribute Key | Attribute Value | -| :------------ | :------------ | :-------------- | -| airdrop_claim | sender | {address} | -| airdrop_claim | zone | {chain_id} | -| airdrop_claim | action | {action} | -| airdrop_claim | amount | {amount} | - -## Hooks - -N/A - -## Queries - -Description of available information request queries; - -```protobuf -service Query { - // Params returns the total set of airdrop parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/quicksilver/airdrop/v1/params"; - } - // ZoneDrop returns the details of the specified zone airdrop. - rpc ZoneDrop(QueryZoneDropRequest) returns (QueryZoneDropResponse) { - option (google.api.http).get = - "/quicksilver/airdrop/v1/zonedrop/{chain_id}"; - } - // AccountBalance returns the module account balance of the specified zone. - rpc AccountBalance(QueryAccountBalanceRequest) - returns (QueryAccountBalanceResponse) { - option (google.api.http).get = - "/quicksilver/airdrop/v1/accountbalance/{chain_id}"; - } - // ZoneDrops returns all zone airdrops of the specified status. - rpc ZoneDrops(QueryZoneDropsRequest) returns (QueryZoneDropsResponse) { - option (google.api.http).get = "/quicksilver/airdrop/v1/zonedrops/{status}"; - } - // ClaimRecord returns the claim record that corresponds to the given zone and - // address. - rpc ClaimRecord(QueryClaimRecordRequest) returns (QueryClaimRecordResponse) { - option (google.api.http).get = - "/quicksilver/airdrop/v1/claimrecord/{chain_id}/{address}"; - } - // ClaimRecords returns all the claim records of the given zone. - rpc ClaimRecords(QueryClaimRecordsRequest) - returns (QueryClaimRecordsResponse) { - option (google.api.http).get = - "/quicksilver/airdrop/v1/claimrecords/{chain_id}"; - } -} -``` - -### params - -Query the current airdrop module parameters. - -Use: `params` - -```go -// QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params defines the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} -``` - -### zone - -Query the airdrop details of the specified zone. - -Use: `zone [chain_id]` - -```go -// QueryZoneDropRequest is the request type for Query/ZoneDrop RPC method. -type QueryZoneDropRequest struct { - // chain_id identifies the zone. - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` -} - -// QueryZoneDropResponse is the response type for Query/ZoneDrop RPC method. -type QueryZoneDropResponse struct { - ZoneDrop ZoneDrop `protobuf:"bytes,1,opt,name=zone_drop,json=zoneDrop,proto3" json:"zone_drop"` -} -``` - -### account-balance - -Returns the airdrop module account balance of the specified zone. - -Use: `account-balance [chain_id]` - -```go -// QueryAccountBalanceRequest is the request type for Query/AccountBalance RPC -// method. -type QueryAccountBalanceRequest struct { - // chain_id identifies the zone. - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` -} - -// QueryAccountBalanceResponse is the response type for Query/AccountBalance RPC -// method. -type QueryAccountBalanceResponse struct { - AccountBalance *types.Coin `protobuf:"bytes,1,opt,name=account_balance,json=accountBalance,proto3" json:"account_balance,omitempty" yaml:"account_balance"` -} -``` - -### zone-drops - -Query all airdrops of the specified status. - -Use: `zone-drops [status]` - -```go -// QueryZoneDropsRequest is the request type for Query/ZoneDrops RPC method. -type QueryZoneDropsRequest struct { - // status enables to query zone airdrops matching a given status: - // - Active - // - Future - // - Expired - Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=quicksilver.airdrop.v1.Status" json:"status,omitempty"` - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -// QueryZoneDropResponse is the response type for Query/ZoneDrops RPC method. -type QueryZoneDropsResponse struct { - ZoneDrops []ZoneDrop `protobuf:"bytes,1,rep,name=zone_drops,json=zoneDrops,proto3" json:"zone_drops"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} -``` - -### claim-record - -Query airdrop claim record details of the given address for the given zone. - -Use: `claim-record [chain_id] [address]` - -```go -// QueryClaimRecordRequest is the request type for Query/ClaimRecord RPC method. -type QueryClaimRecordRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` -} - -// QueryClaimRecordResponse is the response type for Query/ClaimRecord RPC -// method. -type QueryClaimRecordResponse struct { - ClaimRecord *ClaimRecord `protobuf:"bytes,1,opt,name=claim_record,json=claimRecord,proto3" json:"claim_record,omitempty" yaml:"claim_record"` -} -``` - -## Keepers - - - -## Parameters - -Module parameters: - -| Key | Type | Example | -| :-- | :--- | :------ | - -Description of parameters: - -- `param_name` - short description; - -## Proposals - -Register a zone airdrop proposal. - -```go -type RegisterZoneDropProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - ZoneDrop *ZoneDrop `protobuf:"bytes,3,opt,name=zone_drop,json=zoneDrop,proto3" json:"zone_drop,omitempty" yaml:"zone_drop"` - ClaimRecords []byte `protobuf:"bytes,4,opt,name=claim_records,json=claimRecords,proto3" json:"claim_records,omitempty" yaml:"claim_records"` -} -``` - -## Begin Block - -N/A - -## End Block - -At the end of every block the module iterates through all unconcluded airdrops (expired but not yet concluded) and calls `EndZoneDrop` for each instance, that deletes all associated `ClaimRecord`s. diff --git a/x/airdrop/types/airdrop.go b/x/airdrop/types/airdrop.go deleted file mode 100644 index 2761e8080..000000000 --- a/x/airdrop/types/airdrop.go +++ /dev/null @@ -1,153 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/ingenuity-build/multierror" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/bech32" -) - -func (zd *ZoneDrop) ValidateBasic() error { - errs := make(map[string]error) - - // must be defined - if zd.ChainId == "" { - errs["ChainID"] = ErrUndefinedAttribute - } - - // must be greater or equal to 0 - // - // - equal will result in immediate decay; - // - greater specifies period of full claim; - // - // specific bounds can be applied via proposal process - if zd.Duration.Microseconds() < 0 { - errs["Duration"] = fmt.Errorf("%w, must not be negative", ErrInvalidDuration) - } - - // must be greater or equal to 0 - // - // - equal will result in a full airdrop reward with immediate cut off on - // expiry; - // - greater will result in a proportionally discounted airdrop reward over - // the duration of decay; - // - // specific bounds can be applied via proposal process - if zd.Decay.Microseconds() < 0 { - errs["Decay"] = fmt.Errorf("%w, must not be negative", ErrInvalidDuration) - } - - // sum of Duration and Decay may not be zero as this will result in - // immediate expiry of the zone airdrop - if zd.Duration.Microseconds()+zd.Decay.Microseconds() == 0 { - if _, exists := errs["Duration"]; !exists { - errs["Duration"] = ErrDurationDecayNonZero{Err: ErrInvalidDuration} - } - if _, exists := errs["Decay"]; !exists { - errs["Decay"] = ErrDurationDecayNonZero{Err: ErrInvalidDuration} - } - } - - // must be positive value - if zd.Allocation == 0 { - errs["Allocation"] = ErrUndefinedAttribute - } - - // must have at least one defined - if len(zd.Actions) == 0 { - errs["Actions"] = ErrUndefinedAttribute - } else { - // may not exceed defined types.Action bounds - // * (-1) to account for enum: 0 = undefined (protobuf3 spec) - if len(zd.Actions) > len(Action_name)-1 { - errs["Action"] = fmt.Errorf("exceeds number of defined actions (%d)", len(Action_name)-1) - } else { - weightSum := sdk.ZeroDec() - for _, aw := range zd.Actions { - weightSum = weightSum.Add(aw) - } - if !weightSum.Equal(sdk.OneDec()) { - errs["Actions"] = fmt.Errorf("%w, got %s", ErrActionWeights, weightSum) - } - } - } - - if len(errs) > 0 { - return multierror.New(errs) - } - - return nil -} - -func (cr *ClaimRecord) ValidateBasic() error { - errs := make(map[string]error) - - // must be defined - if cr.ChainId == "" { - errs["ChainID"] = ErrUndefinedAttribute - } - - // must be valid bech32 - if _, _, err := bech32.DecodeAndConvert(cr.Address); err != nil { - errs["Address"] = err - } - - // must be positive value - if cr.MaxAllocation == 0 { - errs["MaxAllocation"] = ErrUndefinedAttribute - } - - // check action enum in bounds and sum <= max allocation - // action enum, completed action - sum := uint64(0) - i := 0 - // map[actionEnum]*CompletedAction - for ae, ca := range cr.ActionsCompleted { - // action enum (+1 protobuf3 enum spec) - // check enum bounds - kstr := fmt.Sprintf("ActionsCompleted[%d]", i) - if !Action(ae).InBounds() { - errs[kstr+": enum:"] = fmt.Errorf("%w, got %d", ErrActionOutOfBounds, ae) - } - // calc sum - sum += ca.ClaimAmount - - // check claim amount - if ca.ClaimAmount > cr.MaxAllocation { - errs[kstr+": ClaimAmount:"] = fmt.Errorf("exceeds max allocation of %d", cr.MaxAllocation) - } - i++ - } - - if sum > cr.MaxAllocation { - errs["ActionsCompleted"] = fmt.Errorf( - "sum of claims exceed max allocation, expected %d got %d", - cr.MaxAllocation, - sum, - ) - } - - if cr.BaseValue == 0 { - errs["BaseValue"] = ErrUndefinedAttribute - } - - if len(errs) > 0 { - return multierror.New(errs) - } - - return nil -} - -func (a Action) InBounds() bool { - // get action enum - ae := int(a) - - // check action enum - if ae < 1 || ae >= len(Action_name) { - return false - } - - return true -} diff --git a/x/airdrop/types/airdrop.pb.go b/x/airdrop/types/airdrop.pb.go deleted file mode 100644 index a20a54577..000000000 --- a/x/airdrop/types/airdrop.pb.go +++ /dev/null @@ -1,1327 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: quicksilver/airdrop/v1/airdrop.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/durationpb" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Action is used as an enum to denote specific actions or tasks. -type Action int32 - -const ( - // Undefined action (per protobuf spec) - ActionUndefined Action = 0 - // Initial claim action - ActionInitialClaim Action = 1 - // Deposit tier 1 (e.g. > 5% of base_value) - ActionDepositT1 Action = 2 - // Deposit tier 2 (e.g. > 10% of base_value) - ActionDepositT2 Action = 3 - // Deposit tier 3 (e.g. > 15% of base_value) - ActionDepositT3 Action = 4 - // Deposit tier 4 (e.g. > 22% of base_value) - ActionDepositT4 Action = 5 - // Deposit tier 5 (e.g. > 30% of base_value) - ActionDepositT5 Action = 6 - // Active QCK delegation - ActionStakeQCK Action = 7 - // Intent is set - ActionSignalIntent Action = 8 - // Cast governance vote on QS - ActionQSGov Action = 9 - // Governance By Proxy (GbP): cast vote on remote zone - ActionGbP Action = 10 - // Provide liquidity on Osmosis - ActionOsmosis Action = 11 -) - -var Action_name = map[int32]string{ - 0: "ActionUndefined", - 1: "ActionInitialClaim", - 2: "ActionDepositT1", - 3: "ActionDepositT2", - 4: "ActionDepositT3", - 5: "ActionDepositT4", - 6: "ActionDepositT5", - 7: "ActionStakeQCK", - 8: "ActionSignalIntent", - 9: "ActionQSGov", - 10: "ActionGbP", - 11: "ActionOsmosis", -} - -var Action_value = map[string]int32{ - "ActionUndefined": 0, - "ActionInitialClaim": 1, - "ActionDepositT1": 2, - "ActionDepositT2": 3, - "ActionDepositT3": 4, - "ActionDepositT4": 5, - "ActionDepositT5": 6, - "ActionStakeQCK": 7, - "ActionSignalIntent": 8, - "ActionQSGov": 9, - "ActionGbP": 10, - "ActionOsmosis": 11, -} - -func (x Action) String() string { - return proto.EnumName(Action_name, int32(x)) -} - -func (Action) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e3f0590c06bbb467, []int{0} -} - -// Status is used as an enum to denote zone status. -type Status int32 - -const ( - StatusUndefined Status = 0 - StatusActive Status = 1 - StatusFuture Status = 2 - StatusExpired Status = 3 -) - -var Status_name = map[int32]string{ - 0: "StatusUndefined", - 1: "StatusActive", - 2: "StatusFuture", - 3: "StatusExpired", -} - -var Status_value = map[string]int32{ - "StatusUndefined": 0, - "StatusActive": 1, - "StatusFuture": 2, - "StatusExpired": 3, -} - -func (x Status) String() string { - return proto.EnumName(Status_name, int32(x)) -} - -func (Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e3f0590c06bbb467, []int{1} -} - -// ZoneDrop represents an airdrop for a specific zone. -type ZoneDrop struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - StartTime time.Time `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time" yaml:"start_time"` - Duration time.Duration `protobuf:"bytes,3,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"` - Decay time.Duration `protobuf:"bytes,4,opt,name=decay,proto3,stdduration" json:"decay,omitempty" yaml:"decay"` - Allocation uint64 `protobuf:"varint,5,opt,name=allocation,proto3" json:"allocation,omitempty"` - Actions []github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,rep,name=actions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"actions"` - IsConcluded bool `protobuf:"varint,7,opt,name=is_concluded,json=isConcluded,proto3" json:"is_concluded,omitempty"` -} - -func (m *ZoneDrop) Reset() { *m = ZoneDrop{} } -func (m *ZoneDrop) String() string { return proto.CompactTextString(m) } -func (*ZoneDrop) ProtoMessage() {} -func (*ZoneDrop) Descriptor() ([]byte, []int) { - return fileDescriptor_e3f0590c06bbb467, []int{0} -} -func (m *ZoneDrop) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ZoneDrop) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ZoneDrop.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 *ZoneDrop) XXX_Merge(src proto.Message) { - xxx_messageInfo_ZoneDrop.Merge(m, src) -} -func (m *ZoneDrop) XXX_Size() int { - return m.Size() -} -func (m *ZoneDrop) XXX_DiscardUnknown() { - xxx_messageInfo_ZoneDrop.DiscardUnknown(m) -} - -var xxx_messageInfo_ZoneDrop proto.InternalMessageInfo - -// ClaimRecord represents a users' claim (including completed claims) for a -// given zone. -type ClaimRecord struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // Protobuf3 does not allow enum as map key - ActionsCompleted map[int32]*CompletedAction `protobuf:"bytes,3,rep,name=actions_completed,json=actionsCompleted,proto3" json:"actions_completed,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MaxAllocation uint64 `protobuf:"varint,4,opt,name=max_allocation,json=maxAllocation,proto3" json:"max_allocation,omitempty"` - BaseValue uint64 `protobuf:"varint,5,opt,name=base_value,json=baseValue,proto3" json:"base_value,omitempty"` -} - -func (m *ClaimRecord) Reset() { *m = ClaimRecord{} } -func (m *ClaimRecord) String() string { return proto.CompactTextString(m) } -func (*ClaimRecord) ProtoMessage() {} -func (*ClaimRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_e3f0590c06bbb467, []int{1} -} -func (m *ClaimRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClaimRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClaimRecord.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 *ClaimRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClaimRecord.Merge(m, src) -} -func (m *ClaimRecord) XXX_Size() int { - return m.Size() -} -func (m *ClaimRecord) XXX_DiscardUnknown() { - xxx_messageInfo_ClaimRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_ClaimRecord proto.InternalMessageInfo - -// CompletedAction represents a claim action completed by the user. -type CompletedAction struct { - CompleteTime time.Time `protobuf:"bytes,1,opt,name=complete_time,json=completeTime,proto3,stdtime" json:"complete_time" yaml:"complete_time"` - ClaimAmount uint64 `protobuf:"varint,2,opt,name=claim_amount,json=claimAmount,proto3" json:"claim_amount,omitempty"` -} - -func (m *CompletedAction) Reset() { *m = CompletedAction{} } -func (m *CompletedAction) String() string { return proto.CompactTextString(m) } -func (*CompletedAction) ProtoMessage() {} -func (*CompletedAction) Descriptor() ([]byte, []int) { - return fileDescriptor_e3f0590c06bbb467, []int{2} -} -func (m *CompletedAction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompletedAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompletedAction.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 *CompletedAction) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompletedAction.Merge(m, src) -} -func (m *CompletedAction) XXX_Size() int { - return m.Size() -} -func (m *CompletedAction) XXX_DiscardUnknown() { - xxx_messageInfo_CompletedAction.DiscardUnknown(m) -} - -var xxx_messageInfo_CompletedAction proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("quicksilver.airdrop.v1.Action", Action_name, Action_value) - proto.RegisterEnum("quicksilver.airdrop.v1.Status", Status_name, Status_value) - proto.RegisterType((*ZoneDrop)(nil), "quicksilver.airdrop.v1.ZoneDrop") - proto.RegisterType((*ClaimRecord)(nil), "quicksilver.airdrop.v1.ClaimRecord") - proto.RegisterMapType((map[int32]*CompletedAction)(nil), "quicksilver.airdrop.v1.ClaimRecord.ActionsCompletedEntry") - proto.RegisterType((*CompletedAction)(nil), "quicksilver.airdrop.v1.CompletedAction") -} - -func init() { - proto.RegisterFile("quicksilver/airdrop/v1/airdrop.proto", fileDescriptor_e3f0590c06bbb467) -} - -var fileDescriptor_e3f0590c06bbb467 = []byte{ - // 851 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x95, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0xbd, 0xfe, 0xed, 0x67, 0xa7, 0x9e, 0x0c, 0xa5, 0x72, 0x2c, 0x75, 0xed, 0x5a, 0xfc, - 0xb0, 0x0a, 0x59, 0x2b, 0x29, 0x08, 0x88, 0xe0, 0x90, 0xc4, 0xa5, 0x8a, 0x38, 0x40, 0x36, 0xa5, - 0x42, 0x11, 0x92, 0x35, 0xde, 0x9d, 0x38, 0xa3, 0xec, 0xee, 0x98, 0xdd, 0x59, 0x2b, 0xe6, 0xca, - 0xa5, 0xc7, 0x1e, 0xb9, 0x20, 0x21, 0xf1, 0x2f, 0xf0, 0x47, 0xf4, 0x58, 0x71, 0x42, 0x1c, 0x0c, - 0x4a, 0x38, 0x20, 0x8e, 0xfd, 0x0b, 0xd0, 0xcc, 0xec, 0xd6, 0xdb, 0xb8, 0x34, 0x27, 0xbf, 0xf9, - 0xcc, 0x7b, 0xdf, 0xf7, 0xf6, 0xcd, 0x7b, 0x32, 0xbc, 0xf5, 0x5d, 0xcc, 0x9c, 0xb3, 0x88, 0x79, - 0x33, 0x1a, 0x0e, 0x08, 0x0b, 0xdd, 0x90, 0x4f, 0x07, 0xb3, 0xad, 0xd4, 0xb4, 0xa6, 0x21, 0x17, - 0x1c, 0xdf, 0xca, 0x78, 0x59, 0xe9, 0xd5, 0x6c, 0xab, 0xbd, 0xe1, 0xf0, 0xc8, 0xe7, 0xd1, 0x48, - 0x79, 0x0d, 0xf4, 0x41, 0x87, 0xb4, 0x6f, 0x4e, 0xf8, 0x84, 0x6b, 0x2e, 0xad, 0x84, 0x9a, 0x13, - 0xce, 0x27, 0x1e, 0x1d, 0xa8, 0xd3, 0x38, 0x3e, 0x19, 0xb8, 0x71, 0x48, 0x04, 0xe3, 0x41, 0x72, - 0xdf, 0xb9, 0x7a, 0x2f, 0x98, 0x4f, 0x23, 0x41, 0xfc, 0xa4, 0x92, 0xde, 0x3f, 0x05, 0xa8, 0x1e, - 0xf3, 0x80, 0x0e, 0x43, 0x3e, 0xc5, 0x1b, 0x50, 0x75, 0x4e, 0x09, 0x0b, 0x46, 0xcc, 0x6d, 0x19, - 0x5d, 0xa3, 0x5f, 0xb3, 0x2b, 0xea, 0x7c, 0xe0, 0xe2, 0x6f, 0x00, 0x22, 0x41, 0x42, 0x31, 0x92, - 0x02, 0xad, 0x7c, 0xd7, 0xe8, 0xd7, 0xb7, 0xdb, 0x96, 0x56, 0xb7, 0x52, 0x75, 0xeb, 0x61, 0xaa, - 0xbe, 0x77, 0xfb, 0xe9, 0xa2, 0x93, 0x7b, 0xbe, 0xe8, 0xac, 0xcf, 0x89, 0xef, 0xed, 0xf4, 0x96, - 0xb1, 0xbd, 0x27, 0x7f, 0x76, 0x0c, 0xbb, 0xa6, 0x80, 0x74, 0xc7, 0xa7, 0x50, 0x4d, 0x8b, 0x6e, - 0x15, 0x94, 0xee, 0xc6, 0x8a, 0xee, 0x30, 0x71, 0xd8, 0xdb, 0x92, 0xb2, 0xff, 0x2e, 0x3a, 0x38, - 0x0d, 0x79, 0x9f, 0xfb, 0x4c, 0x50, 0x7f, 0x2a, 0xe6, 0xcf, 0x17, 0x9d, 0xa6, 0x4e, 0x96, 0xde, - 0xf5, 0x7e, 0x94, 0xa9, 0x5e, 0xa8, 0xe3, 0x6f, 0xa1, 0xe4, 0x52, 0x87, 0xcc, 0x5b, 0xc5, 0xeb, - 0xd2, 0xbc, 0x97, 0xa4, 0x69, 0x2a, 0xff, 0x97, 0x72, 0x34, 0x92, 0x1c, 0xf2, 0x42, 0x27, 0xd0, - 0xa2, 0xd8, 0x04, 0x20, 0x9e, 0xc7, 0x1d, 0xfd, 0x25, 0xa5, 0xae, 0xd1, 0x2f, 0xda, 0x19, 0x82, - 0x1f, 0x41, 0x85, 0x38, 0xd2, 0x8a, 0x5a, 0xe5, 0x6e, 0xa1, 0x5f, 0xdb, 0xfb, 0x54, 0x26, 0xf9, - 0x63, 0xd1, 0x79, 0x67, 0xc2, 0xc4, 0x69, 0x3c, 0xb6, 0x1c, 0xee, 0x27, 0x4f, 0x9e, 0xfc, 0x6c, - 0x46, 0xee, 0xd9, 0x40, 0xcc, 0xa7, 0x34, 0xb2, 0x86, 0xd4, 0xf9, 0xed, 0xd7, 0x4d, 0x48, 0x26, - 0x62, 0x48, 0x1d, 0x3b, 0x15, 0xc3, 0x77, 0xa0, 0xc1, 0xa2, 0x91, 0xc3, 0x03, 0xc7, 0x8b, 0x5d, - 0xea, 0xb6, 0x2a, 0x5d, 0xa3, 0x5f, 0xb5, 0xeb, 0x2c, 0xda, 0x4f, 0xd1, 0x4e, 0xf1, 0xf1, 0xcf, - 0x9d, 0x5c, 0xef, 0xef, 0x3c, 0xd4, 0xf7, 0x3d, 0xc2, 0x7c, 0x9b, 0x3a, 0x3c, 0x74, 0x5f, 0xf7, - 0xda, 0x2d, 0xa8, 0x10, 0xd7, 0x0d, 0x69, 0x14, 0xa9, 0xa7, 0xae, 0xd9, 0xe9, 0x11, 0x9f, 0xc0, - 0x7a, 0x92, 0x78, 0xe4, 0x70, 0x7f, 0xea, 0x51, 0x41, 0xdd, 0x56, 0xa1, 0x5b, 0xe8, 0xd7, 0xb7, - 0x3f, 0xb1, 0x5e, 0x3d, 0xd5, 0x56, 0x26, 0xa9, 0xb5, 0xab, 0x83, 0xf7, 0xd3, 0xd8, 0xfb, 0x81, - 0x08, 0xe7, 0x36, 0x22, 0x57, 0x30, 0x7e, 0x1b, 0x6e, 0xf8, 0xe4, 0x7c, 0x94, 0xe9, 0x68, 0x51, - 0x75, 0x74, 0xcd, 0x27, 0xe7, 0xbb, 0xcb, 0xa6, 0xde, 0x06, 0x18, 0x93, 0x88, 0x8e, 0x66, 0xc4, - 0x8b, 0x69, 0xd2, 0xf4, 0x9a, 0x24, 0x8f, 0x24, 0x68, 0x7b, 0xf0, 0xe6, 0x2b, 0x13, 0x62, 0x04, - 0x85, 0x33, 0x3a, 0x57, 0x9f, 0x5d, 0xb2, 0xa5, 0x89, 0x3f, 0x83, 0x92, 0x16, 0xd1, 0xb3, 0xfd, - 0xee, 0xff, 0x7e, 0x4c, 0x2a, 0xa4, 0x85, 0x6d, 0x1d, 0xb5, 0x93, 0xff, 0xd8, 0x48, 0xda, 0xfc, - 0x93, 0x01, 0xcd, 0x2b, 0x4e, 0x98, 0xc0, 0x5a, 0xda, 0x2d, 0xbd, 0x40, 0xc6, 0xb5, 0x0b, 0xd4, - 0x4d, 0x16, 0xe8, 0xa6, 0x9e, 0xb7, 0x97, 0xc2, 0xf5, 0x0e, 0x35, 0x52, 0xa6, 0xd6, 0xe8, 0x0e, - 0x34, 0x1c, 0xd9, 0xe7, 0x11, 0xf1, 0x79, 0x1c, 0x08, 0xf5, 0x19, 0x45, 0xbb, 0xae, 0xd8, 0xae, - 0x42, 0xba, 0xbe, 0xbb, 0x3f, 0xe4, 0xa1, 0x9c, 0x94, 0xf5, 0x06, 0x34, 0xb5, 0xf5, 0x75, 0xe0, - 0xd2, 0x13, 0x16, 0x50, 0x17, 0xe5, 0xf0, 0x2d, 0xc0, 0x1a, 0x1e, 0x04, 0x4c, 0x30, 0xe2, 0xa9, - 0xd7, 0x43, 0xc6, 0xd2, 0x79, 0x48, 0xa7, 0x3c, 0x62, 0xe2, 0xe1, 0x16, 0xca, 0xaf, 0xc2, 0x6d, - 0x54, 0x58, 0x85, 0xf7, 0x50, 0x71, 0x15, 0x7e, 0x80, 0x4a, 0xab, 0xf0, 0x43, 0x54, 0xc6, 0x18, - 0x6e, 0x68, 0x78, 0x24, 0xc8, 0x19, 0x3d, 0xdc, 0xff, 0x02, 0x55, 0x96, 0x45, 0x1d, 0xb1, 0x49, - 0x40, 0xbc, 0x83, 0x40, 0xd0, 0x40, 0xa0, 0x2a, 0x6e, 0x42, 0x5d, 0xf3, 0xc3, 0xa3, 0x07, 0x7c, - 0x86, 0x6a, 0x78, 0x0d, 0x6a, 0x1a, 0x3c, 0x18, 0x7f, 0x85, 0x00, 0xaf, 0xc3, 0x9a, 0x3e, 0x7e, - 0x29, 0x17, 0x87, 0x45, 0xa8, 0xde, 0x2e, 0x3e, 0xfe, 0xc5, 0xcc, 0xdd, 0x3d, 0x86, 0xf2, 0x91, - 0x20, 0x22, 0x8e, 0x64, 0x0d, 0xda, 0xca, 0x36, 0x01, 0x41, 0x43, 0x43, 0x19, 0x3d, 0xa3, 0xc8, - 0x58, 0x92, 0xcf, 0x63, 0x11, 0x87, 0x14, 0xe5, 0xa5, 0xb6, 0x26, 0xf7, 0xcf, 0xa7, 0x2c, 0xa4, - 0x2e, 0x2a, 0x68, 0xed, 0xbd, 0xc3, 0xa7, 0x17, 0xa6, 0xf1, 0xec, 0xc2, 0x34, 0xfe, 0xba, 0x30, - 0x8d, 0x27, 0x97, 0x66, 0xee, 0xd9, 0xa5, 0x99, 0xfb, 0xfd, 0xd2, 0xcc, 0x1d, 0x7f, 0x94, 0x59, - 0xf5, 0xcc, 0x7c, 0x6d, 0x7e, 0xcf, 0x03, 0x9a, 0x05, 0x83, 0xf3, 0x17, 0xff, 0x1d, 0x6a, 0xff, - 0xc7, 0x65, 0x35, 0x21, 0xf7, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x54, 0x3c, 0x22, 0xd4, 0x5f, - 0x06, 0x00, 0x00, -} - -func (m *ZoneDrop) 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 *ZoneDrop) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ZoneDrop) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.IsConcluded { - i-- - if m.IsConcluded { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if len(m.Actions) > 0 { - for iNdEx := len(m.Actions) - 1; iNdEx >= 0; iNdEx-- { - { - size := m.Actions[iNdEx].Size() - i -= size - if _, err := m.Actions[iNdEx].MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAirdrop(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if m.Allocation != 0 { - i = encodeVarintAirdrop(dAtA, i, uint64(m.Allocation)) - i-- - dAtA[i] = 0x28 - } - n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Decay, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Decay):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintAirdrop(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x22 - n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Duration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Duration):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintAirdrop(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x1a - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintAirdrop(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x12 - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintAirdrop(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ClaimRecord) 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 *ClaimRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClaimRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BaseValue != 0 { - i = encodeVarintAirdrop(dAtA, i, uint64(m.BaseValue)) - i-- - dAtA[i] = 0x28 - } - if m.MaxAllocation != 0 { - i = encodeVarintAirdrop(dAtA, i, uint64(m.MaxAllocation)) - i-- - dAtA[i] = 0x20 - } - if len(m.ActionsCompleted) > 0 { - for k := range m.ActionsCompleted { - v := m.ActionsCompleted[k] - baseI := i - if v != nil { - { - size, err := v.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAirdrop(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i = encodeVarintAirdrop(dAtA, i, uint64(k)) - i-- - dAtA[i] = 0x8 - i = encodeVarintAirdrop(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintAirdrop(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintAirdrop(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompletedAction) 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 *CompletedAction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompletedAction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClaimAmount != 0 { - i = encodeVarintAirdrop(dAtA, i, uint64(m.ClaimAmount)) - i-- - dAtA[i] = 0x10 - } - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompleteTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompleteTime):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintAirdrop(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintAirdrop(dAtA []byte, offset int, v uint64) int { - offset -= sovAirdrop(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ZoneDrop) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovAirdrop(uint64(l)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime) - n += 1 + l + sovAirdrop(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.Duration) - n += 1 + l + sovAirdrop(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.Decay) - n += 1 + l + sovAirdrop(uint64(l)) - if m.Allocation != 0 { - n += 1 + sovAirdrop(uint64(m.Allocation)) - } - if len(m.Actions) > 0 { - for _, e := range m.Actions { - l = e.Size() - n += 1 + l + sovAirdrop(uint64(l)) - } - } - if m.IsConcluded { - n += 2 - } - return n -} - -func (m *ClaimRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovAirdrop(uint64(l)) - } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovAirdrop(uint64(l)) - } - if len(m.ActionsCompleted) > 0 { - for k, v := range m.ActionsCompleted { - _ = k - _ = v - l = 0 - if v != nil { - l = v.Size() - l += 1 + sovAirdrop(uint64(l)) - } - mapEntrySize := 1 + sovAirdrop(uint64(k)) + l - n += mapEntrySize + 1 + sovAirdrop(uint64(mapEntrySize)) - } - } - if m.MaxAllocation != 0 { - n += 1 + sovAirdrop(uint64(m.MaxAllocation)) - } - if m.BaseValue != 0 { - n += 1 + sovAirdrop(uint64(m.BaseValue)) - } - return n -} - -func (m *CompletedAction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompleteTime) - n += 1 + l + sovAirdrop(uint64(l)) - if m.ClaimAmount != 0 { - n += 1 + sovAirdrop(uint64(m.ClaimAmount)) - } - return n -} - -func sovAirdrop(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAirdrop(x uint64) (n int) { - return sovAirdrop(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ZoneDrop) 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 ErrIntOverflowAirdrop - } - 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: ZoneDrop: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ZoneDrop: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - 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 ErrInvalidLengthAirdrop - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAirdrop - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAirdrop - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.Duration, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Decay", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAirdrop - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.Decay, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Allocation", wireType) - } - m.Allocation = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Allocation |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Actions", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - 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 ErrInvalidLengthAirdrop - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.Actions = append(m.Actions, v) - if err := m.Actions[len(m.Actions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsConcluded", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsConcluded = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipAirdrop(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAirdrop - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClaimRecord) 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 ErrIntOverflowAirdrop - } - 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: ClaimRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClaimRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - 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 ErrInvalidLengthAirdrop - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - 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 ErrInvalidLengthAirdrop - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ActionsCompleted", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAirdrop - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ActionsCompleted == nil { - m.ActionsCompleted = make(map[int32]*CompletedAction) - } - var mapkey int32 - var mapvalue *CompletedAction - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapkey |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthAirdrop - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &CompletedAction{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipAirdrop(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAirdrop - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.ActionsCompleted[mapkey] = mapvalue - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxAllocation", wireType) - } - m.MaxAllocation = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxAllocation |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseValue", wireType) - } - m.BaseValue = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BaseValue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAirdrop(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAirdrop - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompletedAction) 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 ErrIntOverflowAirdrop - } - 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: CompletedAction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompletedAction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompleteTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAirdrop - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAirdrop - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompleteTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimAmount", wireType) - } - m.ClaimAmount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAirdrop - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ClaimAmount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAirdrop(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAirdrop - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAirdrop(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, ErrIntOverflowAirdrop - } - 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, ErrIntOverflowAirdrop - } - 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, ErrIntOverflowAirdrop - } - 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, ErrInvalidLengthAirdrop - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAirdrop - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAirdrop - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAirdrop = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAirdrop = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAirdrop = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/airdrop/types/airdrop_test.go b/x/airdrop/types/airdrop_test.go deleted file mode 100644 index abfe3ef12..000000000 --- a/x/airdrop/types/airdrop_test.go +++ /dev/null @@ -1,324 +0,0 @@ -package types_test - -import ( - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -func TestZoneDrop_ValidateBasic(t *testing.T) { - type fields struct { - ChainID string - StartTime time.Time - Duration time.Duration - Decay time.Duration - Allocation uint64 - Actions []sdk.Dec - IsConcluded bool - } - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - "blank", - fields{}, - true, - }, - { - "invalid-weights-exceeded", - fields{ - ChainID: "", - StartTime: time.Now().Add(time.Hour), - Duration: -time.Minute, - Decay: -time.Second, - Allocation: 0, - Actions: []sdk.Dec{ - sdk.MustNewDecFromStr("0.3"), - sdk.MustNewDecFromStr("0.4"), - sdk.MustNewDecFromStr("0.5"), - }, - IsConcluded: false, - }, - true, - }, - { - "invalid-weights-insufficient", - fields{ - ChainID: "", - StartTime: time.Now().Add(time.Hour), - Duration: 0, - Decay: 0, - Allocation: 0, - Actions: []sdk.Dec{ - sdk.MustNewDecFromStr("0.3"), - sdk.MustNewDecFromStr("0.3"), - sdk.MustNewDecFromStr("0.3"), - }, - IsConcluded: false, - }, - true, - }, - { - "invalid-actions-exceeded", - fields{ - ChainID: "test-1", - StartTime: time.Now().Add(-time.Hour), - Duration: time.Hour, - Decay: 30 * time.Minute, - Allocation: 16400, - Actions: []sdk.Dec{ - sdk.MustNewDecFromStr("0.01"), - sdk.MustNewDecFromStr("0.02"), - sdk.MustNewDecFromStr("0.03"), - sdk.MustNewDecFromStr("0.04"), - sdk.MustNewDecFromStr("0.06"), - sdk.MustNewDecFromStr("0.07"), - sdk.MustNewDecFromStr("0.08"), - sdk.MustNewDecFromStr("0.09"), - sdk.MustNewDecFromStr("0.1"), - sdk.MustNewDecFromStr("0.2"), - sdk.MustNewDecFromStr("0.3"), - sdk.MustNewDecFromStr("0.1"), - }, - IsConcluded: false, - }, - true, - }, - { - "valid", - fields{ - ChainID: "test-1", - StartTime: time.Now().Add(-time.Hour), - Duration: time.Hour, - Decay: 30 * time.Minute, - Allocation: 16400, - Actions: []sdk.Dec{ - sdk.MustNewDecFromStr("0.1"), - sdk.MustNewDecFromStr("0.2"), - sdk.MustNewDecFromStr("0.3"), - sdk.MustNewDecFromStr("0.4"), - }, - IsConcluded: false, - }, - false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - zd := types.ZoneDrop{ - ChainId: tt.fields.ChainID, - StartTime: tt.fields.StartTime, - Duration: tt.fields.Duration, - Decay: tt.fields.Decay, - Allocation: tt.fields.Allocation, - Actions: tt.fields.Actions, - IsConcluded: tt.fields.IsConcluded, - } - - err := zd.ValidateBasic() - if tt.wantErr { - t.Logf("Error:\n%v\n", err) - require.Error(t, err) - return - } - require.NoError(t, err) - }) - } -} - -func TestClaimRecord_ValidateBasic(t *testing.T) { - type fields struct { - ChainID string - Address string - ActionsCompleted map[int32]*types.CompletedAction - MaxAllocation uint64 - BaseValue uint64 - } - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - "blank", - fields{}, - true, - }, - { - "invalid-00", - fields{ - ChainID: "", - Address: "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9lj", - MaxAllocation: 0, - ActionsCompleted: map[int32]*types.CompletedAction{ - 0: { - CompleteTime: time.Now().Add(-time.Hour), - ClaimAmount: 0, - }, - }, - BaseValue: 0, - }, - true, - }, - { - "invalid-01", - fields{ - ChainID: "test-01", - Address: "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs", - MaxAllocation: 144000, - ActionsCompleted: map[int32]*types.CompletedAction{ - 12: { - CompleteTime: time.Now().Add(-time.Minute), - ClaimAmount: 150000, - }, - }, - BaseValue: 25000, - }, - true, - }, - { - "invalid-02", - fields{ - ChainID: "test-01", - Address: "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs", - MaxAllocation: 144000, - ActionsCompleted: map[int32]*types.CompletedAction{ - 1: { - CompleteTime: time.Now().Add(-time.Hour), - ClaimAmount: 50000, - }, - 2: { - CompleteTime: time.Now().Add(-time.Minute), - ClaimAmount: 100000, - }, - 3: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 50000, - }, - }, - BaseValue: 25000, - }, - true, - }, - { - "valid", - fields{ - ChainID: "test-01", - Address: "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs", - MaxAllocation: 144000, - ActionsCompleted: map[int32]*types.CompletedAction{ - 1: { - CompleteTime: time.Now().Add(-time.Hour), - ClaimAmount: 12000, - }, - 2: { - CompleteTime: time.Now().Add(-time.Minute), - ClaimAmount: 12000, - }, - 3: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - 4: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - 5: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - 6: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - 7: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - 8: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - 9: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - 10: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - 11: { - CompleteTime: time.Now().Add(-time.Second), - ClaimAmount: 12000, - }, - }, - BaseValue: 25000, - }, - false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - cr := types.ClaimRecord{ - ChainId: tt.fields.ChainID, - Address: tt.fields.Address, - ActionsCompleted: tt.fields.ActionsCompleted, - MaxAllocation: tt.fields.MaxAllocation, - BaseValue: tt.fields.BaseValue, - } - - err := cr.ValidateBasic() - if tt.wantErr { - require.Error(t, err) - return - } - require.NoError(t, err) - }) - } -} - -func TestAction_InBounds(t *testing.T) { - tests := []struct { - name string - a types.Action - want bool - }{ - { - "exceed lower", - types.ActionUndefined, - false, - }, - { - "exceed upper", - types.Action(len(types.Action_name)), //nolint:gosec - false, - }, - { - "in bounds lower", - 1, - true, - }, - { - "in bounds upper", - types.Action(len(types.Action_name) - 1), //nolint:gosec - true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := tt.a.InBounds() - if got != tt.want { - err := fmt.Errorf("Action.InBounds() = %v, want %v", got, tt.want) - require.NoError(t, err) - } - }) - } -} diff --git a/x/airdrop/types/codec.go b/x/airdrop/types/codec.go deleted file mode 100644 index f5441218a..000000000 --- a/x/airdrop/types/codec.go +++ /dev/null @@ -1,42 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgClaim{}, "quicksilver/MsgClaim", nil) - cdc.RegisterConcrete(&MsgIncentivePoolSpend{}, "quicksilver/MsgIncentivePoolSpend", nil) - cdc.RegisterConcrete(&RegisterZoneDropProposal{}, "quicksilver/RegisterZoneDropProposal", nil) -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgClaim{}, - &MsgIncentivePoolSpend{}, - ) - - registry.RegisterImplementations( - (*govv1beta1.Content)(nil), - &RegisterZoneDropProposal{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -func init() { - RegisterLegacyAminoCodec(amino) - govv1beta1.RegisterProposalType(ProposalTypeRegisterZoneDrop) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) -} diff --git a/x/airdrop/types/errors.go b/x/airdrop/types/errors.go deleted file mode 100644 index d21b46c77..000000000 --- a/x/airdrop/types/errors.go +++ /dev/null @@ -1,47 +0,0 @@ -package types - -import ( - "fmt" - - sdkioerrors "cosmossdk.io/errors" -) - -type ( - ErrZoneNotFound struct { - ID string - } - - ErrDurationDecayNonZero struct { - Err error - } -) - -func (e ErrZoneNotFound) Error() string { - return fmt.Sprintf("zone not found for %s", e.ID) -} - -func (e ErrDurationDecayNonZero) Error() string { - return fmt.Sprintf("%s, sum of Duration and Decay must not be zero", e.Err.Error()) -} - -func (e ErrDurationDecayNonZero) Unwrap() error { - return e.Err -} - -// x/airdrop module sentinel errors. -var ( - ErrZoneDropNotFound = sdkioerrors.Register(ModuleName, 1, "zone airdrop not found") - ErrClaimRecordNotFound = sdkioerrors.Register(ModuleName, 2, "claim record not found") - ErrUnknownStatus = sdkioerrors.Register(ModuleName, 3, "unknown status") - ErrUndefinedAttribute = sdkioerrors.Register(ModuleName, 4, "expected attribute not defined") - ErrInvalidDuration = sdkioerrors.Register(ModuleName, 5, "invalid duration") - ErrActionOutOfBounds = sdkioerrors.Register(ModuleName, 6, fmt.Sprintf("invalid action, expects range [1-%d]", len(Action_value)-1)) - ErrActionWeights = sdkioerrors.Register(ModuleName, 7, "sum of action weights must be 1.0") - ErrDuplicateZoneDrop = sdkioerrors.Register(ModuleName, 8, "duplicate zone drop") - ErrDuplicateClaimRecord = sdkioerrors.Register(ModuleName, 9, "duplicate claim record") - ErrAllocationExceeded = sdkioerrors.Register(ModuleName, 10, "claim records allocations exceed zone drop allocation") - ErrNoClaimRecords = sdkioerrors.Register(ModuleName, 11, "no claim records for zone drop") - ErrZoneDropExpired = sdkioerrors.Register(ModuleName, 12, "nothing to claim, this zone drop has expired") - ErrActionCompleted = sdkioerrors.Register(ModuleName, 13, "nothing to claim, action already completed") - ErrNegativeAttribute = sdkioerrors.Register(ModuleName, 14, "expected attribute must not be negative") -) diff --git a/x/airdrop/types/events.go b/x/airdrop/types/events.go deleted file mode 100644 index 5d3faed84..000000000 --- a/x/airdrop/types/events.go +++ /dev/null @@ -1,8 +0,0 @@ -package types - -const ( - EventTypeClaim = "airdrop_claim" - EventTypeRegisterZoneDrop = "register_zonedrop" - - AttributeKeyZoneID = "chain_id" -) diff --git a/x/airdrop/types/expected_keepers.go b/x/airdrop/types/expected_keepers.go deleted file mode 100644 index 3ef71cc55..000000000 --- a/x/airdrop/types/expected_keepers.go +++ /dev/null @@ -1,50 +0,0 @@ -package types // noalias - -import ( - sdkmath "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - - icstypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" - participationrewardstypes "github.com/quicksilver-zone/quicksilver/x/participationrewards/types" -) - -// AccountKeeper defines the contract required for account APIs. -type AccountKeeper interface { - GetModuleAddress(name string) sdk.AccAddress -} - -// BankKeeper defines the contract needed to be fulfilled for banking and supply -// dependencies. -type BankKeeper interface { - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error - BlockedAddr(addr sdk.AccAddress) bool -} - -// StakingKeeper defines the contract for staking APIs. -type StakingKeeper interface { - BondDenom(ctx sdk.Context) string - GetDelegatorBonded(ctx sdk.Context, delegator sdk.AccAddress) sdkmath.Int -} - -type GovKeeper interface { - IterateProposals(ctx sdk.Context, cb func(proposal govv1.Proposal) (stop bool)) - GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote govv1.Vote, found bool) -} - -type InterchainStakingKeeper interface { - GetZone(ctx sdk.Context, chainID string) (icstypes.Zone, bool) - GetDelegatorIntent(ctx sdk.Context, zone *icstypes.Zone, delegator string, snapshot bool) (icstypes.DelegatorIntent, bool) - IterateZones(ctx sdk.Context, fn func(index int64, zone *icstypes.Zone) (stop bool)) - UserZoneReceipts(ctx sdk.Context, zone *icstypes.Zone, addr sdk.AccAddress) ([]icstypes.Receipt, error) -} - -type ParticipationRewardsKeeper interface { - GetProtocolData(ctx sdk.Context, pdType participationrewardstypes.ProtocolDataType, key string) (participationrewardstypes.ProtocolData, bool) -} diff --git a/x/airdrop/types/genesis.go b/x/airdrop/types/genesis.go deleted file mode 100644 index 03565f6ae..000000000 --- a/x/airdrop/types/genesis.go +++ /dev/null @@ -1,93 +0,0 @@ -package types - -import ( - "encoding/json" - "fmt" - - "github.com/cosmos/cosmos-sdk/codec" -) - -func NewGenesisState(params Params, zoneDrops []*ZoneDrop, claimRecords []*ClaimRecord) *GenesisState { - return &GenesisState{ - Params: params, - ZoneDrops: zoneDrops, - ClaimRecords: claimRecords, - } -} - -// DefaultGenesisState returns the default ics genesis state. -func DefaultGenesisState() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - ZoneDrops: make([]*ZoneDrop, 0), - ClaimRecords: make([]*ClaimRecord, 0), - } -} - -// Validate validates the provided genesis state to ensure the -// expected invariants hold. -func (gs *GenesisState) Validate() error { - if err := gs.Params.Validate(); err != nil { - return err - } - - zoneMap := make(map[string]int) - sumMap := make(map[string]uint64) - for i, zd := range gs.ZoneDrops { - // check for duplicate zone chain id - if zdi, exists := zoneMap[zd.ChainId]; exists { - return fmt.Errorf("%w, [%d] %s already used for zone drop [%d]", ErrDuplicateZoneDrop, i, zd.ChainId, zdi) - } - // validate zone drop - if err := zd.ValidateBasic(); err != nil { - return err - } - // add to lookup map - zoneMap[zd.ChainId] = i - sumMap[zd.ChainId] = 0 - } - - claimMap := make(map[string]int) - for i, cr := range gs.ClaimRecords { - // check for duplicate - key := cr.ChainId + "." + cr.Address - if cmi, exists := claimMap[key]; exists { - return fmt.Errorf("%w, [%d] %s already used for zone drop [%d]", ErrDuplicateClaimRecord, i, key, cmi) - } - // validate claim record - if err := cr.ValidateBasic(); err != nil { - return err - } - // check corresponding zone drop exists - if _, exists := zoneMap[cr.ChainId]; !exists { - return fmt.Errorf("%w, %s for claim record [%d]", ErrZoneDropNotFound, cr.ChainId, i) - } - // sum MaxAllocations per zone - sumMap[cr.ChainId] += cr.MaxAllocation - // add to lookup map - claimMap[key] = i - } - - for i, zd := range gs.ZoneDrops { - if zd.Allocation < sumMap[zd.ChainId] { - return fmt.Errorf("%w, zone drop [%d], max %v, got %v", ErrAllocationExceeded, i, zd.Allocation, sumMap[zd.ChainId]) - } - if sumMap[zd.ChainId] == 0 { - return fmt.Errorf("%w, %s [%d]", ErrNoClaimRecords, zd.ChainId, i) - } - } - - return nil -} - -// GetGenesisStateFromAppState returns x/airdrop GenesisState given raw application -// genesis state. -func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { - var genesisState GenesisState - - if appState[ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) - } - - return &genesisState -} diff --git a/x/airdrop/types/genesis.pb.go b/x/airdrop/types/genesis.pb.go deleted file mode 100644 index fecabb94d..000000000 --- a/x/airdrop/types/genesis.pb.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: quicksilver/airdrop/v1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the airdrop module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - ZoneDrops []*ZoneDrop `protobuf:"bytes,2,rep,name=zone_drops,json=zoneDrops,proto3" json:"zone_drops,omitempty"` - ClaimRecords []*ClaimRecord `protobuf:"bytes,3,rep,name=claim_records,json=claimRecords,proto3" json:"claim_records,omitempty"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_084ff1cd2314e091, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func init() { - proto.RegisterType((*GenesisState)(nil), "quicksilver.airdrop.v1.GenesisState") -} - -func init() { - proto.RegisterFile("quicksilver/airdrop/v1/genesis.proto", fileDescriptor_084ff1cd2314e091) -} - -var fileDescriptor_084ff1cd2314e091 = []byte{ - // 288 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x29, 0x2c, 0xcd, 0x4c, - 0xce, 0x2e, 0xce, 0xcc, 0x29, 0x4b, 0x2d, 0xd2, 0x4f, 0xcc, 0x2c, 0x4a, 0x29, 0xca, 0x2f, 0xd0, - 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x12, 0x43, 0x52, 0xa5, 0x07, 0x55, 0xa5, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, - 0x0f, 0x56, 0xa2, 0x0f, 0x62, 0x41, 0x54, 0x4b, 0xe1, 0x32, 0x13, 0xa6, 0x11, 0xa2, 0x4a, 0x19, - 0x87, 0xaa, 0x82, 0xc4, 0xa2, 0xc4, 0x5c, 0xa8, 0xc5, 0x4a, 0x77, 0x19, 0xb9, 0x78, 0xdc, 0x21, - 0x4e, 0x09, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0xb2, 0xe1, 0x62, 0x83, 0x28, 0x90, 0x60, 0x54, 0x60, - 0xd4, 0xe0, 0x36, 0x92, 0xd3, 0xc3, 0xee, 0x34, 0xbd, 0x00, 0xb0, 0x2a, 0x27, 0x96, 0x13, 0xf7, - 0xe4, 0x19, 0x82, 0xa0, 0x7a, 0x84, 0xec, 0xb9, 0xb8, 0xaa, 0xf2, 0xf3, 0x52, 0xe3, 0x41, 0x8a, - 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0x14, 0x70, 0x99, 0x10, 0x95, 0x9f, 0x97, 0xea, - 0x52, 0x94, 0x5f, 0x10, 0xc4, 0x59, 0x05, 0x65, 0x15, 0x0b, 0x79, 0x70, 0xf1, 0x26, 0xe7, 0x24, - 0x66, 0xe6, 0xc6, 0x17, 0xa5, 0x26, 0xe7, 0x17, 0xa5, 0x14, 0x4b, 0x30, 0x83, 0xcd, 0x50, 0xc6, - 0x65, 0x86, 0x33, 0x48, 0x71, 0x10, 0x58, 0x6d, 0x10, 0x4f, 0x32, 0x82, 0x53, 0x6c, 0xc5, 0xd2, - 0xb1, 0x40, 0x9e, 0xc1, 0x29, 0xf0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, - 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, - 0xcc, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x91, 0x0c, 0xd7, 0x05, - 0xb9, 0x05, 0x59, 0x40, 0xbf, 0x02, 0x1e, 0x78, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, - 0x90, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x2e, 0x93, 0x60, 0xda, 0x01, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClaimRecords) > 0 { - for iNdEx := len(m.ClaimRecords) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ClaimRecords[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.ZoneDrops) > 0 { - for iNdEx := len(m.ZoneDrops) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ZoneDrops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.ZoneDrops) > 0 { - for _, e := range m.ZoneDrops { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.ClaimRecords) > 0 { - for _, e := range m.ClaimRecords { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ZoneDrops", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ZoneDrops = append(m.ZoneDrops, &ZoneDrop{}) - if err := m.ZoneDrops[len(m.ZoneDrops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimRecords", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimRecords = append(m.ClaimRecords, &ClaimRecord{}) - if err := m.ClaimRecords[len(m.ClaimRecords)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/airdrop/types/genesis_test.go b/x/airdrop/types/genesis_test.go deleted file mode 100644 index c6fe36f22..000000000 --- a/x/airdrop/types/genesis_test.go +++ /dev/null @@ -1,264 +0,0 @@ -package types_test - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -func TestGenesisState_Validate(t *testing.T) { - type fields struct { - Params types.Params - ZoneDrops []*types.ZoneDrop - ClaimRecords []*types.ClaimRecord - } - - defaultGenesis := types.DefaultGenesisState() - - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - "null genesis", - fields{}, - false, - }, - { - "default genesis", - fields{ - defaultGenesis.Params, - defaultGenesis.ZoneDrops, - defaultGenesis.ClaimRecords, - }, - false, - }, - { - "duplicate zone drop", - fields{ - types.DefaultParams(), - []*types.ZoneDrop{ - { - ChainId: "test-1", - StartTime: time.Now().Add(1 * time.Minute), - Duration: time.Minute, - Decay: time.Minute, - Allocation: 1000000, - Actions: []sdk.Dec{sdk.OneDec()}, - }, - { - ChainId: "test-1", - StartTime: time.Now().Add(1 * time.Hour), - Duration: time.Hour, - Decay: time.Hour, - Allocation: 5000000, - Actions: []sdk.Dec{sdk.OneDec()}, - }, - }, - []*types.ClaimRecord{}, - }, - true, - }, - { - "invalid zone drop", - fields{ - types.DefaultParams(), - []*types.ZoneDrop{ - { - ChainId: "", - StartTime: time.Now().Add(1 * time.Minute), - Duration: -time.Minute, - Decay: -time.Hour, - Allocation: 0, - Actions: []sdk.Dec{}, - }, - }, - []*types.ClaimRecord{}, - }, - true, - }, - { - "duplicate claim record", - fields{ - types.DefaultParams(), - []*types.ZoneDrop{ - { - ChainId: "test-1", - StartTime: time.Now().Add(1 * time.Minute), - Duration: time.Minute, - Decay: time.Minute, - Allocation: 1000000, - Actions: []sdk.Dec{sdk.OneDec()}, - }, - }, - []*types.ClaimRecord{ - { - ChainId: "test-1", - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - ActionsCompleted: map[int32]*types.CompletedAction{}, - MaxAllocation: 500000, - }, - { - ChainId: "test-1", - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - ActionsCompleted: map[int32]*types.CompletedAction{}, - MaxAllocation: 500000, - }, - }, - }, - true, - }, - { - "invalid claim record", - fields{ - types.DefaultParams(), - []*types.ZoneDrop{ - { - ChainId: "test-1", - StartTime: time.Now().Add(1 * time.Minute), - Duration: time.Minute, - Decay: time.Minute, - Allocation: 1000000, - Actions: []sdk.Dec{sdk.OneDec()}, - }, - }, - []*types.ClaimRecord{ - { - ChainId: "", - Address: "", - ActionsCompleted: map[int32]*types.CompletedAction{ - 999: { - CompleteTime: time.Now().Add(time.Hour), - ClaimAmount: 1000000, - }, - }, - MaxAllocation: 500000, - }, - }, - }, - true, - }, - { - "claim record no zone drop", - fields{ - types.DefaultParams(), - []*types.ZoneDrop{ - { - ChainId: "test-1", - StartTime: time.Now().Add(1 * time.Minute), - Duration: time.Minute, - Decay: time.Minute, - Allocation: 1000000, - Actions: []sdk.Dec{sdk.OneDec()}, - }, - }, - []*types.ClaimRecord{ - { - ChainId: "test-2", - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - ActionsCompleted: map[int32]*types.CompletedAction{ - 0: { - CompleteTime: time.Now().Add(-time.Hour), - ClaimAmount: 100000, - }, - }, - MaxAllocation: 500000, - }, - }, - }, - true, - }, - { - "claim record exceed zone drop", - fields{ - types.DefaultParams(), - []*types.ZoneDrop{ - { - ChainId: "test-1", - StartTime: time.Now().Add(1 * time.Minute), - Duration: time.Minute, - Decay: time.Minute, - Allocation: 1000000, - Actions: []sdk.Dec{sdk.OneDec()}, - }, - }, - []*types.ClaimRecord{ - { - ChainId: "test-1", - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - ActionsCompleted: map[int32]*types.CompletedAction{}, - MaxAllocation: 600000, - }, - { - ChainId: "test-1", - Address: "cosmos1qnk2n4nlkpw9xfqntladh74w6ujtulwn7j8za9", - ActionsCompleted: map[int32]*types.CompletedAction{}, - MaxAllocation: 600000, - }, - }, - }, - true, - }, - { - "no claim records", - fields{ - types.DefaultParams(), - []*types.ZoneDrop{ - { - ChainId: "test-1", - StartTime: time.Now().Add(1 * time.Minute), - Duration: time.Minute, - Decay: time.Minute, - Allocation: 1000000, - Actions: []sdk.Dec{sdk.OneDec()}, - }, - { - ChainId: "test-2", - StartTime: time.Now().Add(1 * time.Hour), - Duration: time.Hour, - Decay: time.Hour, - Allocation: 1000000, - Actions: []sdk.Dec{sdk.OneDec()}, - }, - }, - []*types.ClaimRecord{ - { - ChainId: "test-1", - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - ActionsCompleted: map[int32]*types.CompletedAction{}, - MaxAllocation: 500000, - }, - { - ChainId: "test-1", - Address: "cosmos1qnk2n4nlkpw9xfqntladh74w6ujtulwn7j8za9", - ActionsCompleted: map[int32]*types.CompletedAction{}, - MaxAllocation: 500000, - }, - }, - }, - true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - gs := types.GenesisState{ - Params: tt.fields.Params, - ZoneDrops: tt.fields.ZoneDrops, - ClaimRecords: tt.fields.ClaimRecords, - } - - err := gs.Validate() - if tt.wantErr { - require.Error(t, err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/airdrop/types/keys.go b/x/airdrop/types/keys.go deleted file mode 100644 index 575d1160a..000000000 --- a/x/airdrop/types/keys.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName defines the module name. - ModuleName = "airdrop" - // StoreKey defines the primary module store key. - StoreKey = ModuleName - // QuerierRoute is the querier route for the module. - QuerierRoute = StoreKey - // RouterKey is the message route for the module. - RouterKey = ModuleName -) - -var ( - KeyPrefixZoneDrop = []byte{0x01} - KeyPrefixClaimRecord = []byte{0x02} -) - -func GetKeyZoneDrop(chainID string) []byte { - return append(KeyPrefixZoneDrop, chainID...) -} - -func GetKeyClaimRecord(chainID string, addr sdk.AccAddress) []byte { - return append(append(KeyPrefixClaimRecord, chainID...), addr...) -} - -func GetPrefixClaimRecord(chainID string) []byte { - return append(KeyPrefixClaimRecord, chainID...) -} diff --git a/x/airdrop/types/keys_test.go b/x/airdrop/types/keys_test.go deleted file mode 100644 index b71025bf0..000000000 --- a/x/airdrop/types/keys_test.go +++ /dev/null @@ -1,110 +0,0 @@ -package types_test - -import ( - "fmt" - "reflect" - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -func TestGetKeyZoneDrop(t *testing.T) { - testID := "test-01" - type args struct { - chainID string - } - tests := []struct { - name string - args args - want []byte - }{ - { - "valid", - args{ - chainID: testID, - }, - append([]byte{0x1}, testID...), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := types.GetKeyZoneDrop(tt.args.chainID) - if !reflect.DeepEqual(got, tt.want) { - err := fmt.Errorf("GetKeyZoneDrop() = %v, want %v", got, tt.want) - require.NoError(t, err) - return - } - }) - } -} - -func TestGetKeyClaimRecord(t *testing.T) { - testID := "test-01" - testAddress := "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs" - testAcc, _ := sdk.AccAddressFromBech32(testAddress) - type args struct { - chainID string - addr sdk.AccAddress - } - tests := []struct { - name string - args args - want []byte - }{ - { - "valid", - args{ - chainID: testID, - addr: testAcc, - }, - append(append([]byte{0x2}, testID...), testAcc...), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := types.GetKeyClaimRecord(tt.args.chainID, tt.args.addr) - if !reflect.DeepEqual(got, tt.want) { - err := fmt.Errorf("GetKeyClaimRecord() = %v, want %v", got, tt.want) - // t.Logf("Error:\n%v\n", err) - require.NoError(t, err) - return - } - }) - } -} - -func TestGetPrefixClaimRecord(t *testing.T) { - testID := "tester-01" - type args struct { - chainID string - } - tests := []struct { - name string - args args - want []byte - }{ - { - "valid", - args{ - chainID: testID, - }, - append([]byte{0x2}, testID...), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := types.GetPrefixClaimRecord(tt.args.chainID) - if !reflect.DeepEqual(got, tt.want) { - err := fmt.Errorf("GetPrefixClaimRecord() = %v, want %v", got, tt.want) - // t.Logf("Error:\n%v\n", err) - require.NoError(t, err) - - return - } - }) - } -} diff --git a/x/airdrop/types/msgs.go b/x/airdrop/types/msgs.go deleted file mode 100644 index 795057229..000000000 --- a/x/airdrop/types/msgs.go +++ /dev/null @@ -1,143 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/ingenuity-build/multierror" - - sdkioerrors "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" -) - -// airdrop message types. - -const ( - TypeMsgClaim = "claim" - TypeMsgIncentivePoolSpend = "incentive-pool-spend" -) - -var ( - _ sdk.Msg = &MsgClaim{} - _ legacytx.LegacyMsg = &MsgClaim{} -) - -// NewMsgClaim constructs a msg to claim from a zone airdrop. -func NewMsgClaim(chainID string, action int64, fromAddress sdk.Address) *MsgClaim { - return &MsgClaim{ChainId: chainID, Action: action, Address: fromAddress.String()} -} - -// Route implements Msg. -func (msg MsgClaim) Route() string { return RouterKey } - -// Type implements Msg. -func (msg MsgClaim) Type() string { return TypeMsgClaim } - -// ValidateBasic implements Msg. -func (msg MsgClaim) ValidateBasic() error { - errs := make(map[string]error) - - if msg.ChainId == "" { - errs["ChainID"] = ErrUndefinedAttribute - } - - action := int(msg.Action) - if action < 1 || action >= len(Action_value) { - errs["Action"] = fmt.Errorf("%w, got %d", ErrActionOutOfBounds, msg.Action) - } - - if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { - errs["Address"] = err - } - - for i, p := range msg.Proofs { - pLabel := fmt.Sprintf("Proof [%d]:", i) - if len(p.Key) == 0 { - errs[pLabel+" Key"] = ErrUndefinedAttribute - } - - if len(p.Data) == 0 { - errs[pLabel+" Data"] = ErrUndefinedAttribute - } - - if p.ProofOps == nil { - errs[pLabel+" ProofOps"] = ErrUndefinedAttribute - } - - if p.Height < 0 { - errs[pLabel+" Height"] = ErrNegativeAttribute - } - } - - if len(errs) > 0 { - return multierror.New(errs) - } - - return nil -} - -// GetSignBytes implements Msg. -func (msg MsgClaim) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners implements Msg. -func (msg MsgClaim) GetSigners() []sdk.AccAddress { - address, _ := sdk.AccAddressFromBech32(msg.Address) - return []sdk.AccAddress{address} -} - -// NewMsgIncentivePoolSpend constructs a msg to claim from a zone airdrop. -func NewMsgIncentivePoolSpend(authority, toAddress sdk.Address, amt sdk.Coins) *MsgIncentivePoolSpend { - return &MsgIncentivePoolSpend{ - Authority: authority.String(), - ToAddress: toAddress.String(), - Amount: amt, - } -} - -// Route implements Msg. -func (msg MsgIncentivePoolSpend) Route() string { return RouterKey } - -// Type implements Msg. -func (msg MsgIncentivePoolSpend) Type() string { return TypeMsgClaim } - -// ValidateBasic implements Msg. -func (msg MsgIncentivePoolSpend) ValidateBasic() error { - from, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { - return sdkerrors.ErrInvalidAddress.Wrapf("invalid from address: %s", err) - } - - to, err := sdk.AccAddressFromBech32(msg.ToAddress) - if err != nil { - return sdkerrors.ErrInvalidAddress.Wrapf("invalid to address: %s", err) - } - - if from.Equals(to) { - return sdkerrors.ErrInvalidAddress.Wrapf("to and from addresses equal: %s", err) - } - - if !msg.Amount.IsValid() { - return sdkioerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) - } - - if !msg.Amount.IsAllPositive() { - return sdkioerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) - } - - return nil -} - -// GetSignBytes implements Msg. -func (msg MsgIncentivePoolSpend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners implements Msg. -func (msg MsgIncentivePoolSpend) GetSigners() []sdk.AccAddress { - address, _ := sdk.AccAddressFromBech32(msg.Authority) - return []sdk.AccAddress{address} -} diff --git a/x/airdrop/types/msgs_test.go b/x/airdrop/types/msgs_test.go deleted file mode 100644 index 7e6734d0a..000000000 --- a/x/airdrop/types/msgs_test.go +++ /dev/null @@ -1,311 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/proto/tendermint/crypto" - - sdkmath "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/utils/addressutils" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" - cmtypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" -) - -func TestMsgClaim_ValidateBasic(t *testing.T) { - type fields struct { - ChainID string - Action int64 - Address string - Proofs []*cmtypes.Proof - } - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - "blank", - fields{}, - true, - }, - { - "invalid_no_zone", - fields{ - ChainID: "", - Action: 0, - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{}, - }, - true, - }, - - { - "invalid_action_out_of_bounds_low", - fields{ - ChainID: "cosmoshub-4", - Action: 0, - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{}, - }, - true, - }, - { - "invalid_action_out_of_bounds", - fields{ - ChainID: "cosmoshub-4", - Action: 999, - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{}, - }, - true, - }, - { - "invalid_address_empty", - fields{ - ChainID: "cosmoshub-4", - Action: 0, - Address: "", - Proofs: []*cmtypes.Proof{}, - }, - true, - }, - { - "invalid_address", - fields{ - ChainID: "cosmoshub-4", - Action: 0, - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lkq437x2w", - Proofs: []*cmtypes.Proof{}, - }, - true, - }, - // TODO: add more address checks - // - currently it fails using quick address (no sdk setup done) - { - "invalid_ActionUndefined", - fields{ - ChainID: "cosmoshub-4", - Action: int64(types.ActionUndefined), - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{ - { - Key: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - Data: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - ProofOps: &crypto.ProofOps{}, - Height: 10, - ProofType: "lockup", - }, - }, - }, - true, - }, - { - "invalid proof no key", - fields{ - ChainID: "cosmoshub-4", - Action: int64(types.ActionInitialClaim), - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{ - { - Key: nil, - Data: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - ProofOps: &crypto.ProofOps{}, - Height: 10, - ProofType: "lockup", - }, - }, - }, - true, - }, - { - "invalid proof no data", - fields{ - ChainID: "cosmoshub-4", - Action: int64(types.ActionInitialClaim), - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{ - { - Key: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - Data: nil, - ProofOps: &crypto.ProofOps{}, - Height: 10, - ProofType: "lockup", - }, - }, - }, - true, - }, - { - "invalid proof no proof ops", - fields{ - ChainID: "cosmoshub-4", - Action: int64(types.ActionInitialClaim), - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{ - { - Key: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - Data: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - ProofOps: nil, - Height: 10, - ProofType: "lockup", - }, - }, - }, - true, - }, - { - "invalid proof no height", - fields{ - ChainID: "cosmoshub-4", - Action: int64(types.ActionInitialClaim), - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{ - { - Key: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - Data: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - ProofOps: &crypto.ProofOps{}, - Height: -1, - ProofType: "lockup", - }, - }, - }, - true, - }, - { - "valid", - fields{ - ChainID: "cosmoshub-4", - Action: int64(types.ActionInitialClaim), - Address: "cosmos1pgfzn0zhxjjgte7hprwtnqyhrn534lqk437x2w", - Proofs: []*cmtypes.Proof{ - { - Key: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - Data: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - ProofOps: &crypto.ProofOps{}, - Height: 10, - ProofType: "lockup", - }, - }, - }, - false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - msg := types.MsgClaim{ - ChainId: tt.fields.ChainID, - Action: tt.fields.Action, - Address: tt.fields.Address, - Proofs: tt.fields.Proofs, - } - err := msg.ValidateBasic() - if tt.wantErr { - t.Logf("Error:\n%v\n", err) - require.Error(t, err) - return - } - require.NoError(t, err) - }) - } -} - -func TestMsgIncentivePoolSpendValidateBasic(t *testing.T) { - type fields struct { - Authority string - ToAddress string - Amount sdk.Coins - } - - validTestCoins := sdk.NewCoins(sdk.NewCoin("test", sdk.NewIntFromUint64(10000))) - addr1 := addressutils.GenerateAccAddressForTest().String() - addr2 := addressutils.GenerateAccAddressForTest().String() - - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - "blank", - fields{}, - true, - }, - { - "invalid authority", - fields{ - Authority: "invalid", - ToAddress: addr2, - Amount: validTestCoins, - }, - true, - }, - { - "invalid to address", - fields{ - Authority: addr1, - ToAddress: "invalid", - Amount: validTestCoins, - }, - true, - }, - { - "invalid equal addresses", - fields{ - Authority: addr1, - ToAddress: addr1, - Amount: validTestCoins, - }, - true, - }, - { - "non positive amount", - fields{ - Authority: addr1, - ToAddress: addr2, - Amount: sdk.Coins{}, - }, - true, - }, - { - "invalid amount", - fields{ - Authority: addr1, - ToAddress: addr2, - Amount: sdk.Coins{sdk.Coin{ - Denom: "", - Amount: sdkmath.NewInt(1000), - }}, - }, - true, - }, - { - "valid", - fields{ - Authority: addr1, - ToAddress: addr2, - Amount: validTestCoins, - }, - false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - msg := types.MsgIncentivePoolSpend{ - Authority: tt.fields.Authority, - ToAddress: tt.fields.ToAddress, - Amount: tt.fields.Amount, - } - err := msg.ValidateBasic() - if tt.wantErr { - t.Logf("Error:\n%v\n", err) - require.Error(t, err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/airdrop/types/params.go b/x/airdrop/types/params.go deleted file mode 100644 index e17076579..000000000 --- a/x/airdrop/types/params.go +++ /dev/null @@ -1,40 +0,0 @@ -package types - -import ( - "gopkg.in/yaml.v2" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -// ParamKeyTable for airdrop module. -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new airdrop Params instance. -func NewParams() Params { - return Params{} -} - -// DefaultParams default ics params. -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs implements params.ParamSet. -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - // paramtypes.NewParamSetPair(Key, &p.Attribute, validateAttrib), - } -} - -// Validate validates params. -func (p *Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p *Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/airdrop/types/params.pb.go b/x/airdrop/types/params.pb.go deleted file mode 100644 index 9693d8744..000000000 --- a/x/airdrop/types/params.pb.go +++ /dev/null @@ -1,267 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: quicksilver/airdrop/v1/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params holds parameters for the airdrop module. -type Params struct { -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_e4caf762c8035376, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Params)(nil), "quicksilver.airdrop.v1.Params") -} - -func init() { - proto.RegisterFile("quicksilver/airdrop/v1/params.proto", fileDescriptor_e4caf762c8035376) -} - -var fileDescriptor_e4caf762c8035376 = []byte{ - // 165 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0x2c, 0xcd, 0x4c, - 0xce, 0x2e, 0xce, 0xcc, 0x29, 0x4b, 0x2d, 0xd2, 0x4f, 0xcc, 0x2c, 0x4a, 0x29, 0xca, 0x2f, 0xd0, - 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x12, 0x43, 0x52, 0xa4, 0x07, 0x55, 0xa4, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, - 0x56, 0xa2, 0x0f, 0x62, 0x41, 0x54, 0x2b, 0x09, 0x71, 0xb1, 0x05, 0x80, 0x75, 0x5b, 0x71, 0x74, - 0x2c, 0x90, 0x67, 0x98, 0xb1, 0x40, 0x9e, 0xc1, 0x29, 0xf0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, - 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, - 0x8f, 0xe5, 0x18, 0xa2, 0xcc, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, - 0x91, 0xac, 0xd1, 0xad, 0xca, 0xcf, 0x4b, 0x45, 0x16, 0xd0, 0xaf, 0x80, 0x3b, 0xaf, 0xa4, 0xb2, - 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, 0x9b, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x1d, 0xd4, 0xc6, - 0x68, 0xc2, 0x00, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/airdrop/types/proposals.go b/x/airdrop/types/proposals.go deleted file mode 100644 index cad1fb3fc..000000000 --- a/x/airdrop/types/proposals.go +++ /dev/null @@ -1,58 +0,0 @@ -package types - -import ( - "errors" - "fmt" - "strings" - - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -const ( - ProposalTypeRegisterZoneDrop = "RegisterZoneDrop" -) - -var _ govv1beta1.Content = &RegisterZoneDropProposal{} - -func (m *RegisterZoneDropProposal) GetDescription() string { return m.Description } -func (m *RegisterZoneDropProposal) GetTitle() string { return m.Title } -func (m *RegisterZoneDropProposal) ProposalRoute() string { return RouterKey } -func (m *RegisterZoneDropProposal) ProposalType() string { return ProposalTypeRegisterZoneDrop } - -// ValidateBasic runs basic stateless validity checks. -// -// ZoneDrop is validated in HandleRegisterZoneDropProposal. -// ClaimRecords are validated in HandleRegisterZoneDropProposal. -// -// HandleRegisterZoneDropProposal does validation checks as ZoneDrop is related -// to ClaimRecords. ClaimRecords are in compressed []byte slice format and -// must be decompressed in order to be validated. -func (m *RegisterZoneDropProposal) ValidateBasic() error { - if err := govv1beta1.ValidateAbstract(m); err != nil { - return err - } - - if m.ZoneDrop == nil { - return errors.New("proposal must contain a valid ZoneDrop") - } - - if len(m.ClaimRecords) == 0 { - return errors.New("proposal must contain valid ClaimRecords") - } - - // validate ZoneDrop - return m.ZoneDrop.ValidateBasic() -} - -// String implements the Stringer interface. -func (m *RegisterZoneDropProposal) String() string { - var b strings.Builder - - b.WriteString("Airdrop - ZoneDrop Registration Proposal:\n") - fmt.Fprintf(&b, "\tTitle: %s\n", m.Title) - fmt.Fprintf(&b, "\tDescription: %s\n", m.Description) - b.WriteString("\tZoneDrop:\n") - fmt.Fprintf(&b, "\n%v\n", m.ZoneDrop) - b.WriteString("\n----------\n") - return b.String() -} diff --git a/x/airdrop/types/proposals.pb.go b/x/airdrop/types/proposals.pb.go deleted file mode 100644 index 78471ee64..000000000 --- a/x/airdrop/types/proposals.pb.go +++ /dev/null @@ -1,463 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: quicksilver/airdrop/v1/proposals.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type RegisterZoneDropProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - ZoneDrop *ZoneDrop `protobuf:"bytes,3,opt,name=zone_drop,json=zoneDrop,proto3" json:"zone_drop,omitempty" yaml:"zone_drop"` - ClaimRecords []byte `protobuf:"bytes,4,opt,name=claim_records,json=claimRecords,proto3" json:"claim_records,omitempty" yaml:"claim_records"` -} - -func (m *RegisterZoneDropProposal) Reset() { *m = RegisterZoneDropProposal{} } -func (*RegisterZoneDropProposal) ProtoMessage() {} -func (*RegisterZoneDropProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_d5ca18fdf9feef37, []int{0} -} -func (m *RegisterZoneDropProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RegisterZoneDropProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RegisterZoneDropProposal.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 *RegisterZoneDropProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegisterZoneDropProposal.Merge(m, src) -} -func (m *RegisterZoneDropProposal) XXX_Size() int { - return m.Size() -} -func (m *RegisterZoneDropProposal) XXX_DiscardUnknown() { - xxx_messageInfo_RegisterZoneDropProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_RegisterZoneDropProposal proto.InternalMessageInfo - -func init() { - proto.RegisterType((*RegisterZoneDropProposal)(nil), "quicksilver.airdrop.v1.RegisterZoneDropProposal") -} - -func init() { - proto.RegisterFile("quicksilver/airdrop/v1/proposals.proto", fileDescriptor_d5ca18fdf9feef37) -} - -var fileDescriptor_d5ca18fdf9feef37 = []byte{ - // 322 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2b, 0x2c, 0xcd, 0x4c, - 0xce, 0x2e, 0xce, 0xcc, 0x29, 0x4b, 0x2d, 0xd2, 0x4f, 0xcc, 0x2c, 0x4a, 0x29, 0xca, 0x2f, 0xd0, - 0x2f, 0x33, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc8, 0x2f, 0x4e, 0xcc, 0x29, 0xd6, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0x12, 0x43, 0x52, 0xa7, 0x07, 0x55, 0xa7, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, - 0x9f, 0x9e, 0x0f, 0x56, 0xa2, 0x0f, 0x62, 0x41, 0x54, 0x4b, 0xa9, 0xe0, 0x30, 0x15, 0xa6, 0x11, - 0xac, 0x4a, 0xe9, 0x0b, 0x23, 0x97, 0x44, 0x50, 0x6a, 0x7a, 0x66, 0x71, 0x49, 0x6a, 0x51, 0x54, - 0x7e, 0x5e, 0xaa, 0x4b, 0x51, 0x7e, 0x41, 0x00, 0xd4, 0x5e, 0x21, 0x11, 0x2e, 0xd6, 0x92, 0xcc, - 0x92, 0x9c, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x08, 0x47, 0x48, 0x81, 0x8b, 0x3b, - 0x25, 0xb5, 0x38, 0xb9, 0x28, 0xb3, 0xa0, 0x24, 0x33, 0x3f, 0x4f, 0x82, 0x09, 0x2c, 0x87, 0x2c, - 0x24, 0x14, 0xcc, 0xc5, 0x59, 0x95, 0x9f, 0x97, 0x1a, 0x0f, 0xb2, 0x47, 0x82, 0x59, 0x81, 0x51, - 0x83, 0xdb, 0x48, 0x41, 0x0f, 0xbb, 0xe3, 0xf5, 0x60, 0x96, 0x3a, 0x89, 0x7c, 0xba, 0x27, 0x2f, - 0x50, 0x99, 0x98, 0x9b, 0x63, 0xa5, 0x04, 0xd7, 0xac, 0x14, 0xc4, 0x51, 0x05, 0x95, 0x17, 0xb2, - 0xe5, 0xe2, 0x4d, 0xce, 0x49, 0xcc, 0xcc, 0x8d, 0x2f, 0x4a, 0x4d, 0xce, 0x2f, 0x4a, 0x29, 0x96, - 0x60, 0x51, 0x60, 0xd4, 0xe0, 0x71, 0x92, 0xf8, 0x74, 0x4f, 0x5e, 0x04, 0xa2, 0x0d, 0x45, 0x5a, - 0x29, 0x88, 0x07, 0xcc, 0x0f, 0x82, 0x70, 0xad, 0x78, 0x3a, 0x16, 0xc8, 0x33, 0xcc, 0x58, 0x20, - 0xcf, 0xf0, 0x62, 0x81, 0x3c, 0x83, 0x53, 0xe0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, - 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, - 0x31, 0x44, 0x99, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x23, 0x39, - 0x59, 0x17, 0xe4, 0x0e, 0x64, 0x01, 0xfd, 0x0a, 0x78, 0xa0, 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, - 0xb1, 0x81, 0x03, 0xd4, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x72, 0x1b, 0x2e, 0xce, 0x01, - 0x00, 0x00, -} - -func (m *RegisterZoneDropProposal) 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 *RegisterZoneDropProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RegisterZoneDropProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClaimRecords) > 0 { - i -= len(m.ClaimRecords) - copy(dAtA[i:], m.ClaimRecords) - i = encodeVarintProposals(dAtA, i, uint64(len(m.ClaimRecords))) - i-- - dAtA[i] = 0x22 - } - if m.ZoneDrop != nil { - { - size, err := m.ZoneDrop.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProposals(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposals(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposals(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintProposals(dAtA []byte, offset int, v uint64) int { - offset -= sovProposals(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *RegisterZoneDropProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposals(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposals(uint64(l)) - } - if m.ZoneDrop != nil { - l = m.ZoneDrop.Size() - n += 1 + l + sovProposals(uint64(l)) - } - l = len(m.ClaimRecords) - if l > 0 { - n += 1 + l + sovProposals(uint64(l)) - } - return n -} - -func sovProposals(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozProposals(x uint64) (n int) { - return sovProposals(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *RegisterZoneDropProposal) 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 ErrIntOverflowProposals - } - 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: RegisterZoneDropProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegisterZoneDropProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposals - } - 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 ErrInvalidLengthProposals - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposals - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposals - } - 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 ErrInvalidLengthProposals - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposals - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ZoneDrop", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposals - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProposals - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProposals - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ZoneDrop == nil { - m.ZoneDrop = &ZoneDrop{} - } - if err := m.ZoneDrop.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimRecords", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposals - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProposals - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProposals - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimRecords = append(m.ClaimRecords[:0], dAtA[iNdEx:postIndex]...) - if m.ClaimRecords == nil { - m.ClaimRecords = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposals(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposals - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProposals(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, ErrIntOverflowProposals - } - 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, ErrIntOverflowProposals - } - 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, ErrIntOverflowProposals - } - 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, ErrInvalidLengthProposals - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupProposals - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthProposals - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthProposals = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProposals = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupProposals = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/airdrop/types/proposals_test.go b/x/airdrop/types/proposals_test.go deleted file mode 100644 index 841f4985e..000000000 --- a/x/airdrop/types/proposals_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package types_test - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -func TestRegisterZoneDropProposal_ValidateBasic(t *testing.T) { - type fields struct { - Title string - Description string - ZoneDrop *types.ZoneDrop - ClaimRecords []byte - } - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - "blank", - fields{}, - true, - }, - { - "invalid-nil", - fields{ - Title: "Flashdrop", - Description: "An airdrop that is valid for one hour only", - ZoneDrop: nil, - ClaimRecords: nil, - }, - true, - }, - { - "invalid-empty", - fields{ - Title: "Flashdrop", - Description: "An airdrop that is valid for one hour only", - ZoneDrop: &types.ZoneDrop{}, - ClaimRecords: []byte{}, - }, - true, - }, - // HandleRegisterZoneDropProposal will deal with in depth validation, - // as ClaimRecords is compressed data that needs to be decompressed. - { - "valid", - fields{ - Title: "Flashdrop", - Description: "An airdrop that is valid for one hour only", - ZoneDrop: &types.ZoneDrop{ - ChainId: "test-1", - StartTime: time.Now().Add(-time.Hour), - Duration: time.Hour, - Decay: 30 * time.Minute, - Allocation: 16400, - Actions: []sdk.Dec{ - sdk.MustNewDecFromStr("0.1"), - sdk.MustNewDecFromStr("0.2"), - sdk.MustNewDecFromStr("0.3"), - sdk.MustNewDecFromStr("0.4"), - }, - IsConcluded: false, - }, - ClaimRecords: []byte{0}, - }, - false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - m := types.RegisterZoneDropProposal{ - Title: tt.fields.Title, - Description: tt.fields.Description, - ZoneDrop: tt.fields.ZoneDrop, - ClaimRecords: tt.fields.ClaimRecords, - } - - err := m.ValidateBasic() - if tt.wantErr { - t.Logf("Error:\n%v\n", err) - require.Error(t, err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/airdrop/types/query.pb.go b/x/airdrop/types/query.pb.go deleted file mode 100644 index 2d1d00430..000000000 --- a/x/airdrop/types/query.pb.go +++ /dev/null @@ -1,2694 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: quicksilver/airdrop/v1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" - query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params defines the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -// QueryZoneDropRequest is the request type for Query/ZoneDrop RPC method. -type QueryZoneDropRequest struct { - // chain_id identifies the zone. - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` -} - -func (m *QueryZoneDropRequest) Reset() { *m = QueryZoneDropRequest{} } -func (m *QueryZoneDropRequest) String() string { return proto.CompactTextString(m) } -func (*QueryZoneDropRequest) ProtoMessage() {} -func (*QueryZoneDropRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{2} -} -func (m *QueryZoneDropRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZoneDropRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZoneDropRequest.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 *QueryZoneDropRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZoneDropRequest.Merge(m, src) -} -func (m *QueryZoneDropRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryZoneDropRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZoneDropRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZoneDropRequest proto.InternalMessageInfo - -// QueryZoneDropResponse is the response type for Query/ZoneDrop RPC method. -type QueryZoneDropResponse struct { - ZoneDrop ZoneDrop `protobuf:"bytes,1,opt,name=zone_drop,json=zoneDrop,proto3" json:"zone_drop"` -} - -func (m *QueryZoneDropResponse) Reset() { *m = QueryZoneDropResponse{} } -func (m *QueryZoneDropResponse) String() string { return proto.CompactTextString(m) } -func (*QueryZoneDropResponse) ProtoMessage() {} -func (*QueryZoneDropResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{3} -} -func (m *QueryZoneDropResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZoneDropResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZoneDropResponse.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 *QueryZoneDropResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZoneDropResponse.Merge(m, src) -} -func (m *QueryZoneDropResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryZoneDropResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZoneDropResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZoneDropResponse proto.InternalMessageInfo - -// QueryAccountBalanceRequest is the request type for Query/AccountBalance RPC -// method. -type QueryAccountBalanceRequest struct { - // chain_id identifies the zone. - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` -} - -func (m *QueryAccountBalanceRequest) Reset() { *m = QueryAccountBalanceRequest{} } -func (m *QueryAccountBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAccountBalanceRequest) ProtoMessage() {} -func (*QueryAccountBalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{4} -} -func (m *QueryAccountBalanceRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAccountBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAccountBalanceRequest.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 *QueryAccountBalanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAccountBalanceRequest.Merge(m, src) -} -func (m *QueryAccountBalanceRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAccountBalanceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAccountBalanceRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAccountBalanceRequest proto.InternalMessageInfo - -// QueryAccountBalanceResponse is the response type for Query/AccountBalance RPC -// method. -type QueryAccountBalanceResponse struct { - AccountBalance *types.Coin `protobuf:"bytes,1,opt,name=account_balance,json=accountBalance,proto3" json:"account_balance,omitempty" yaml:"account_balance"` -} - -func (m *QueryAccountBalanceResponse) Reset() { *m = QueryAccountBalanceResponse{} } -func (m *QueryAccountBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAccountBalanceResponse) ProtoMessage() {} -func (*QueryAccountBalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{5} -} -func (m *QueryAccountBalanceResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAccountBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAccountBalanceResponse.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 *QueryAccountBalanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAccountBalanceResponse.Merge(m, src) -} -func (m *QueryAccountBalanceResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAccountBalanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAccountBalanceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAccountBalanceResponse proto.InternalMessageInfo - -// QueryZoneDropsRequest is the request type for Query/ZoneDrops RPC method. -type QueryZoneDropsRequest struct { - // status enables to query zone airdrops matching a given status: - // - Active - // - Future - // - Expired - Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=quicksilver.airdrop.v1.Status" json:"status,omitempty"` - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryZoneDropsRequest) Reset() { *m = QueryZoneDropsRequest{} } -func (m *QueryZoneDropsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryZoneDropsRequest) ProtoMessage() {} -func (*QueryZoneDropsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{6} -} -func (m *QueryZoneDropsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZoneDropsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZoneDropsRequest.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 *QueryZoneDropsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZoneDropsRequest.Merge(m, src) -} -func (m *QueryZoneDropsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryZoneDropsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZoneDropsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZoneDropsRequest proto.InternalMessageInfo - -// QueryZoneDropResponse is the response type for Query/ZoneDrops RPC method. -type QueryZoneDropsResponse struct { - ZoneDrops []ZoneDrop `protobuf:"bytes,1,rep,name=zone_drops,json=zoneDrops,proto3" json:"zone_drops"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryZoneDropsResponse) Reset() { *m = QueryZoneDropsResponse{} } -func (m *QueryZoneDropsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryZoneDropsResponse) ProtoMessage() {} -func (*QueryZoneDropsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{7} -} -func (m *QueryZoneDropsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZoneDropsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZoneDropsResponse.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 *QueryZoneDropsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZoneDropsResponse.Merge(m, src) -} -func (m *QueryZoneDropsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryZoneDropsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZoneDropsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZoneDropsResponse proto.InternalMessageInfo - -// QueryClaimRecordRequest is the request type for Query/ClaimRecord RPC method. -type QueryClaimRecordRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` -} - -func (m *QueryClaimRecordRequest) Reset() { *m = QueryClaimRecordRequest{} } -func (m *QueryClaimRecordRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClaimRecordRequest) ProtoMessage() {} -func (*QueryClaimRecordRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{8} -} -func (m *QueryClaimRecordRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryClaimRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryClaimRecordRequest.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 *QueryClaimRecordRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClaimRecordRequest.Merge(m, src) -} -func (m *QueryClaimRecordRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryClaimRecordRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClaimRecordRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryClaimRecordRequest proto.InternalMessageInfo - -// QueryClaimRecordResponse is the response type for Query/ClaimRecord RPC -// method. -type QueryClaimRecordResponse struct { - ClaimRecord *ClaimRecord `protobuf:"bytes,1,opt,name=claim_record,json=claimRecord,proto3" json:"claim_record,omitempty" yaml:"claim_record"` -} - -func (m *QueryClaimRecordResponse) Reset() { *m = QueryClaimRecordResponse{} } -func (m *QueryClaimRecordResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClaimRecordResponse) ProtoMessage() {} -func (*QueryClaimRecordResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{9} -} -func (m *QueryClaimRecordResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryClaimRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryClaimRecordResponse.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 *QueryClaimRecordResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClaimRecordResponse.Merge(m, src) -} -func (m *QueryClaimRecordResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryClaimRecordResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClaimRecordResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryClaimRecordResponse proto.InternalMessageInfo - -// QueryClaimRecordsRequest is the request type for Query/ClaimRecords RPC -// method. -type QueryClaimRecordsRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryClaimRecordsRequest) Reset() { *m = QueryClaimRecordsRequest{} } -func (m *QueryClaimRecordsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClaimRecordsRequest) ProtoMessage() {} -func (*QueryClaimRecordsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{10} -} -func (m *QueryClaimRecordsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryClaimRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryClaimRecordsRequest.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 *QueryClaimRecordsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClaimRecordsRequest.Merge(m, src) -} -func (m *QueryClaimRecordsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryClaimRecordsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClaimRecordsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryClaimRecordsRequest proto.InternalMessageInfo - -// QueryClaimRecordsResponse is the response type for Query/ClaimRecords RPC -// method. -type QueryClaimRecordsResponse struct { - ClaimRecords []ClaimRecord `protobuf:"bytes,1,rep,name=claim_records,json=claimRecords,proto3" json:"claim_records"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryClaimRecordsResponse) Reset() { *m = QueryClaimRecordsResponse{} } -func (m *QueryClaimRecordsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClaimRecordsResponse) ProtoMessage() {} -func (*QueryClaimRecordsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1ef5e0258aac647f, []int{11} -} -func (m *QueryClaimRecordsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryClaimRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryClaimRecordsResponse.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 *QueryClaimRecordsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClaimRecordsResponse.Merge(m, src) -} -func (m *QueryClaimRecordsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryClaimRecordsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClaimRecordsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryClaimRecordsResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "quicksilver.airdrop.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "quicksilver.airdrop.v1.QueryParamsResponse") - proto.RegisterType((*QueryZoneDropRequest)(nil), "quicksilver.airdrop.v1.QueryZoneDropRequest") - proto.RegisterType((*QueryZoneDropResponse)(nil), "quicksilver.airdrop.v1.QueryZoneDropResponse") - proto.RegisterType((*QueryAccountBalanceRequest)(nil), "quicksilver.airdrop.v1.QueryAccountBalanceRequest") - proto.RegisterType((*QueryAccountBalanceResponse)(nil), "quicksilver.airdrop.v1.QueryAccountBalanceResponse") - proto.RegisterType((*QueryZoneDropsRequest)(nil), "quicksilver.airdrop.v1.QueryZoneDropsRequest") - proto.RegisterType((*QueryZoneDropsResponse)(nil), "quicksilver.airdrop.v1.QueryZoneDropsResponse") - proto.RegisterType((*QueryClaimRecordRequest)(nil), "quicksilver.airdrop.v1.QueryClaimRecordRequest") - proto.RegisterType((*QueryClaimRecordResponse)(nil), "quicksilver.airdrop.v1.QueryClaimRecordResponse") - proto.RegisterType((*QueryClaimRecordsRequest)(nil), "quicksilver.airdrop.v1.QueryClaimRecordsRequest") - proto.RegisterType((*QueryClaimRecordsResponse)(nil), "quicksilver.airdrop.v1.QueryClaimRecordsResponse") -} - -func init() { - proto.RegisterFile("quicksilver/airdrop/v1/query.proto", fileDescriptor_1ef5e0258aac647f) -} - -var fileDescriptor_1ef5e0258aac647f = []byte{ - // 869 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4d, 0x4f, 0x03, 0x45, - 0x18, 0xc7, 0x3b, 0x88, 0x85, 0x0e, 0x58, 0x92, 0x01, 0x79, 0x59, 0xcd, 0x96, 0x2c, 0x06, 0x0d, - 0x2f, 0xbb, 0xb6, 0x4d, 0x44, 0x89, 0x07, 0x2d, 0xbe, 0xc4, 0xc4, 0x18, 0x58, 0x4f, 0x72, 0xb0, - 0x99, 0x6e, 0x37, 0x65, 0x63, 0xbb, 0xb3, 0xec, 0x6c, 0x1b, 0x81, 0xf4, 0xa0, 0x5e, 0xf4, 0x66, - 0xe2, 0xc5, 0x83, 0x1a, 0x3f, 0x80, 0xf1, 0x60, 0x3c, 0xf9, 0x09, 0x38, 0x92, 0x78, 0xf1, 0xd4, - 0x18, 0xf0, 0xec, 0xa1, 0x9f, 0xc0, 0xec, 0xcc, 0xb3, 0x65, 0x5b, 0xba, 0x65, 0x41, 0x6e, 0xc3, - 0xcc, 0xf3, 0xf2, 0xdb, 0xff, 0xf3, 0x42, 0xb1, 0x76, 0xda, 0x76, 0xac, 0xcf, 0xb8, 0xd3, 0xec, - 0xd8, 0xbe, 0x41, 0x1d, 0xbf, 0xee, 0x33, 0xcf, 0xe8, 0x14, 0x8d, 0xd3, 0xb6, 0xed, 0x9f, 0xe9, - 0x9e, 0xcf, 0x02, 0x46, 0x96, 0x63, 0x36, 0x3a, 0xd8, 0xe8, 0x9d, 0xa2, 0xb2, 0x65, 0x31, 0xde, - 0x62, 0xdc, 0xa8, 0x51, 0x6e, 0x4b, 0x07, 0xa3, 0x53, 0xac, 0xd9, 0x01, 0x2d, 0x1a, 0x1e, 0x6d, - 0x38, 0x2e, 0x0d, 0x1c, 0xe6, 0xca, 0x18, 0x8a, 0x1a, 0xb7, 0x8d, 0xac, 0x2c, 0xe6, 0x44, 0xef, - 0x4b, 0x0d, 0xd6, 0x60, 0xe2, 0x68, 0x84, 0x27, 0xb8, 0x7d, 0xb1, 0xc1, 0x58, 0xa3, 0x69, 0x1b, - 0xd4, 0x73, 0x0c, 0xea, 0xba, 0x2c, 0x10, 0x21, 0x39, 0xbc, 0xbe, 0x94, 0xc0, 0x1e, 0x21, 0x4a, - 0xab, 0x8d, 0x04, 0x2b, 0x8f, 0xfa, 0xb4, 0x05, 0xa1, 0xb4, 0x25, 0x4c, 0x8e, 0xc2, 0x0f, 0x38, - 0x14, 0x97, 0xa6, 0x7d, 0xda, 0xb6, 0x79, 0xa0, 0x7d, 0x82, 0x17, 0x87, 0x6e, 0xb9, 0xc7, 0x5c, - 0x6e, 0x93, 0x37, 0x71, 0x56, 0x3a, 0xaf, 0xa2, 0x75, 0xf4, 0xca, 0x5c, 0x49, 0xd5, 0xc7, 0x0b, - 0xa4, 0x4b, 0xbf, 0xca, 0xf4, 0x65, 0xaf, 0x90, 0x31, 0xc1, 0x67, 0x7f, 0xfa, 0xeb, 0x9f, 0x0b, - 0x19, 0xed, 0x43, 0xbc, 0x24, 0x42, 0x1f, 0x33, 0xd7, 0x7e, 0xc7, 0x67, 0x1e, 0xa4, 0x24, 0x3a, - 0x9e, 0xb5, 0x4e, 0xa8, 0xe3, 0x56, 0x9d, 0xba, 0x88, 0x9e, 0xab, 0x2c, 0xf6, 0x7b, 0x85, 0x85, - 0x33, 0xda, 0x6a, 0xee, 0x6b, 0xd1, 0x8b, 0x66, 0xce, 0x88, 0xe3, 0x07, 0x75, 0x88, 0x56, 0xc3, - 0xcf, 0x8f, 0x44, 0x03, 0xd4, 0x03, 0x9c, 0x3b, 0x67, 0xae, 0x5d, 0x0d, 0x89, 0x80, 0x76, 0x3d, - 0x89, 0x36, 0x72, 0x06, 0xde, 0xd9, 0x73, 0xf8, 0x1b, 0x72, 0x98, 0x58, 0x11, 0x39, 0xde, 0xb6, - 0x2c, 0xd6, 0x76, 0x83, 0x0a, 0x6d, 0x52, 0xd7, 0xb2, 0xff, 0x1f, 0xf7, 0x57, 0x08, 0xbf, 0x30, - 0x36, 0x28, 0xe0, 0x7f, 0x8a, 0x17, 0xa8, 0x7c, 0xa9, 0xd6, 0xe4, 0x13, 0x7c, 0xc4, 0x9a, 0x2e, - 0xfb, 0x49, 0x0f, 0xfb, 0x49, 0x87, 0x7e, 0xd2, 0x0f, 0x98, 0xe3, 0x56, 0x94, 0x7e, 0xaf, 0xb0, - 0x2c, 0xf3, 0x8e, 0xf8, 0x6a, 0x66, 0x9e, 0x0e, 0xe5, 0x01, 0x8a, 0x1f, 0xd1, 0x88, 0x7c, 0x51, - 0x03, 0x90, 0xd7, 0x70, 0x96, 0x07, 0x34, 0x68, 0xcb, 0x4a, 0xe7, 0x93, 0x2b, 0xfd, 0xb1, 0xb0, - 0x32, 0xc1, 0x9a, 0xbc, 0x87, 0xf1, 0xed, 0x04, 0xac, 0x4e, 0x09, 0xe4, 0xcd, 0x21, 0x64, 0x39, - 0x5f, 0x11, 0xf8, 0x21, 0x6d, 0x44, 0x4a, 0x9a, 0x31, 0x4f, 0xe0, 0xfb, 0x15, 0xe1, 0xe5, 0x51, - 0x3e, 0x10, 0xe8, 0x5d, 0x8c, 0x07, 0xf5, 0x0d, 0x21, 0x9f, 0x79, 0x40, 0x81, 0x73, 0x51, 0x81, - 0x39, 0x79, 0x7f, 0x0c, 0xef, 0xcb, 0xf7, 0xf2, 0x4a, 0x86, 0x31, 0xc0, 0x5d, 0xbc, 0x22, 0x78, - 0x0f, 0x9a, 0xd4, 0x69, 0x99, 0xb6, 0xc5, 0xfc, 0xfa, 0x23, 0xfb, 0x84, 0xec, 0xe0, 0x19, 0x5a, - 0xaf, 0xfb, 0x36, 0xe7, 0x02, 0x2b, 0x57, 0x21, 0xfd, 0x5e, 0x21, 0x0f, 0xe5, 0x95, 0x0f, 0x9a, - 0x19, 0x99, 0x40, 0xfa, 0x2f, 0x10, 0x5e, 0xbd, 0x9b, 0x1f, 0x14, 0xab, 0xe2, 0x79, 0x2b, 0xbc, - 0xae, 0xfa, 0xe2, 0x1e, 0xfa, 0x69, 0x23, 0x49, 0xb3, 0x58, 0x88, 0xca, 0x4a, 0xbf, 0x57, 0x58, - 0x04, 0xd2, 0x58, 0x08, 0xcd, 0x9c, 0xb3, 0x6e, 0xad, 0x80, 0xe1, 0xfb, 0x31, 0x0c, 0xfc, 0xb1, - 0x22, 0x3c, 0x6d, 0x3b, 0xfd, 0x81, 0xf0, 0xda, 0x18, 0x34, 0xd0, 0xe7, 0x23, 0xfc, 0x5c, 0xfc, - 0xe3, 0xa2, 0xa6, 0x4a, 0x25, 0x90, 0xec, 0xab, 0xf9, 0x98, 0x1a, 0x4f, 0xdd, 0x5a, 0xa5, 0x7f, - 0x67, 0xf0, 0xb3, 0x02, 0x9e, 0x7c, 0x83, 0x70, 0x56, 0x2e, 0x58, 0xb2, 0x95, 0x04, 0x77, 0x77, - 0xa7, 0x2b, 0xdb, 0xa9, 0x6c, 0x65, 0x7e, 0x6d, 0xf3, 0xcb, 0x3f, 0xff, 0xf9, 0x6e, 0x6a, 0x9d, - 0xa8, 0xc6, 0xc4, 0x7f, 0x22, 0xe4, 0x07, 0x84, 0x67, 0xa3, 0xe9, 0x22, 0x3b, 0x13, 0x33, 0x8c, - 0x2c, 0x7c, 0x65, 0x37, 0xa5, 0x35, 0x10, 0x95, 0x05, 0xd1, 0x2e, 0xd9, 0x4e, 0x22, 0x0a, 0x87, - 0x5a, 0x9c, 0x2f, 0xa2, 0x46, 0xea, 0x92, 0xdf, 0x11, 0xce, 0x0f, 0x6f, 0x58, 0x52, 0x9a, 0x98, - 0x76, 0xec, 0x8e, 0x57, 0xca, 0x0f, 0xf2, 0x01, 0xe0, 0x37, 0x04, 0x70, 0x99, 0x14, 0x93, 0x80, - 0x61, 0x25, 0xc3, 0x8e, 0x8e, 0x63, 0xff, 0x84, 0x70, 0x6e, 0xb0, 0xf2, 0x48, 0x3a, 0xa1, 0x06, - 0x75, 0xd6, 0xd3, 0x9a, 0x03, 0x67, 0x49, 0x70, 0xee, 0x90, 0xad, 0xfb, 0x84, 0xe5, 0xc6, 0x85, - 0xdc, 0xf2, 0x5d, 0xf2, 0x1b, 0xc2, 0x73, 0xb1, 0xfe, 0x27, 0xc6, 0xc4, 0x9c, 0x77, 0xb7, 0xa1, - 0xf2, 0x6a, 0x7a, 0x07, 0xc0, 0x7c, 0x4b, 0x60, 0xee, 0x93, 0xd7, 0x93, 0x30, 0xc5, 0xf0, 0xc9, - 0xd9, 0x8d, 0x69, 0x69, 0x5c, 0xc0, 0x8a, 0xec, 0x92, 0x5f, 0x10, 0x9e, 0x8f, 0x4f, 0x3e, 0x49, - 0x0d, 0x31, 0xd0, 0xb6, 0xf8, 0x00, 0x0f, 0xe0, 0xde, 0x13, 0xdc, 0x45, 0x62, 0xa4, 0xe0, 0xe6, - 0x31, 0xf0, 0xca, 0xd1, 0xe5, 0xb5, 0x8a, 0xae, 0xae, 0x55, 0xf4, 0xf7, 0xb5, 0x8a, 0xbe, 0xbd, - 0x51, 0x33, 0x57, 0x37, 0x6a, 0xe6, 0xaf, 0x1b, 0x35, 0x73, 0xbc, 0xd7, 0x70, 0x82, 0x93, 0x76, - 0x4d, 0xb7, 0x58, 0x2b, 0x1e, 0x74, 0x37, 0x2c, 0xd4, 0x50, 0x96, 0xcf, 0x07, 0x79, 0x82, 0x33, - 0xcf, 0xe6, 0xb5, 0xac, 0xf8, 0xcd, 0x57, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x5e, 0xe7, 0xf7, - 0xf6, 0xfc, 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 { - // Params returns the total set of airdrop parameters. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // ZoneDrop returns the details of the specified zone airdrop. - ZoneDrop(ctx context.Context, in *QueryZoneDropRequest, opts ...grpc.CallOption) (*QueryZoneDropResponse, error) - // AccountBalance returns the module account balance of the specified zone. - AccountBalance(ctx context.Context, in *QueryAccountBalanceRequest, opts ...grpc.CallOption) (*QueryAccountBalanceResponse, error) - // ZoneDrops returns all zone airdrops of the specified status. - ZoneDrops(ctx context.Context, in *QueryZoneDropsRequest, opts ...grpc.CallOption) (*QueryZoneDropsResponse, error) - // ClaimRecord returns the claim record that corresponds to the given zone and - // address. - ClaimRecord(ctx context.Context, in *QueryClaimRecordRequest, opts ...grpc.CallOption) (*QueryClaimRecordResponse, error) - // ClaimRecords returns all the claim records of the given zone. - ClaimRecords(ctx context.Context, in *QueryClaimRecordsRequest, opts ...grpc.CallOption) (*QueryClaimRecordsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/quicksilver.airdrop.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ZoneDrop(ctx context.Context, in *QueryZoneDropRequest, opts ...grpc.CallOption) (*QueryZoneDropResponse, error) { - out := new(QueryZoneDropResponse) - err := c.cc.Invoke(ctx, "/quicksilver.airdrop.v1.Query/ZoneDrop", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AccountBalance(ctx context.Context, in *QueryAccountBalanceRequest, opts ...grpc.CallOption) (*QueryAccountBalanceResponse, error) { - out := new(QueryAccountBalanceResponse) - err := c.cc.Invoke(ctx, "/quicksilver.airdrop.v1.Query/AccountBalance", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ZoneDrops(ctx context.Context, in *QueryZoneDropsRequest, opts ...grpc.CallOption) (*QueryZoneDropsResponse, error) { - out := new(QueryZoneDropsResponse) - err := c.cc.Invoke(ctx, "/quicksilver.airdrop.v1.Query/ZoneDrops", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ClaimRecord(ctx context.Context, in *QueryClaimRecordRequest, opts ...grpc.CallOption) (*QueryClaimRecordResponse, error) { - out := new(QueryClaimRecordResponse) - err := c.cc.Invoke(ctx, "/quicksilver.airdrop.v1.Query/ClaimRecord", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ClaimRecords(ctx context.Context, in *QueryClaimRecordsRequest, opts ...grpc.CallOption) (*QueryClaimRecordsResponse, error) { - out := new(QueryClaimRecordsResponse) - err := c.cc.Invoke(ctx, "/quicksilver.airdrop.v1.Query/ClaimRecords", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Params returns the total set of airdrop parameters. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // ZoneDrop returns the details of the specified zone airdrop. - ZoneDrop(context.Context, *QueryZoneDropRequest) (*QueryZoneDropResponse, error) - // AccountBalance returns the module account balance of the specified zone. - AccountBalance(context.Context, *QueryAccountBalanceRequest) (*QueryAccountBalanceResponse, error) - // ZoneDrops returns all zone airdrops of the specified status. - ZoneDrops(context.Context, *QueryZoneDropsRequest) (*QueryZoneDropsResponse, error) - // ClaimRecord returns the claim record that corresponds to the given zone and - // address. - ClaimRecord(context.Context, *QueryClaimRecordRequest) (*QueryClaimRecordResponse, error) - // ClaimRecords returns all the claim records of the given zone. - ClaimRecords(context.Context, *QueryClaimRecordsRequest) (*QueryClaimRecordsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) ZoneDrop(ctx context.Context, req *QueryZoneDropRequest) (*QueryZoneDropResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ZoneDrop not implemented") -} -func (*UnimplementedQueryServer) AccountBalance(ctx context.Context, req *QueryAccountBalanceRequest) (*QueryAccountBalanceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AccountBalance not implemented") -} -func (*UnimplementedQueryServer) ZoneDrops(ctx context.Context, req *QueryZoneDropsRequest) (*QueryZoneDropsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ZoneDrops not implemented") -} -func (*UnimplementedQueryServer) ClaimRecord(ctx context.Context, req *QueryClaimRecordRequest) (*QueryClaimRecordResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClaimRecord not implemented") -} -func (*UnimplementedQueryServer) ClaimRecords(ctx context.Context, req *QueryClaimRecordsRequest) (*QueryClaimRecordsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClaimRecords not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/quicksilver.airdrop.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ZoneDrop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryZoneDropRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ZoneDrop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/quicksilver.airdrop.v1.Query/ZoneDrop", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ZoneDrop(ctx, req.(*QueryZoneDropRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AccountBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAccountBalanceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AccountBalance(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/quicksilver.airdrop.v1.Query/AccountBalance", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AccountBalance(ctx, req.(*QueryAccountBalanceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ZoneDrops_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryZoneDropsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ZoneDrops(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/quicksilver.airdrop.v1.Query/ZoneDrops", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ZoneDrops(ctx, req.(*QueryZoneDropsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ClaimRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClaimRecordRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ClaimRecord(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/quicksilver.airdrop.v1.Query/ClaimRecord", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClaimRecord(ctx, req.(*QueryClaimRecordRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ClaimRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClaimRecordsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ClaimRecords(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/quicksilver.airdrop.v1.Query/ClaimRecords", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClaimRecords(ctx, req.(*QueryClaimRecordsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "quicksilver.airdrop.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "ZoneDrop", - Handler: _Query_ZoneDrop_Handler, - }, - { - MethodName: "AccountBalance", - Handler: _Query_AccountBalance_Handler, - }, - { - MethodName: "ZoneDrops", - Handler: _Query_ZoneDrops_Handler, - }, - { - MethodName: "ClaimRecord", - Handler: _Query_ClaimRecord_Handler, - }, - { - MethodName: "ClaimRecords", - Handler: _Query_ClaimRecords_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "quicksilver/airdrop/v1/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryZoneDropRequest) 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 *QueryZoneDropRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZoneDropRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryZoneDropResponse) 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 *QueryZoneDropResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZoneDropResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ZoneDrop.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryAccountBalanceRequest) 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 *QueryAccountBalanceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAccountBalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAccountBalanceResponse) 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 *QueryAccountBalanceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAccountBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AccountBalance != nil { - { - size, err := m.AccountBalance.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryZoneDropsRequest) 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 *QueryZoneDropsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZoneDropsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Status != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryZoneDropsResponse) 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 *QueryZoneDropsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZoneDropsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ZoneDrops) > 0 { - for iNdEx := len(m.ZoneDrops) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ZoneDrops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryClaimRecordRequest) 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 *QueryClaimRecordRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClaimRecordRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClaimRecordResponse) 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 *QueryClaimRecordResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClaimRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClaimRecord != nil { - { - size, err := m.ClaimRecord.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClaimRecordsRequest) 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 *QueryClaimRecordsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClaimRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClaimRecordsResponse) 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 *QueryClaimRecordsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClaimRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ClaimRecords) > 0 { - for iNdEx := len(m.ClaimRecords) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ClaimRecords[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryZoneDropRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryZoneDropResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ZoneDrop.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAccountBalanceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAccountBalanceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AccountBalance != nil { - l = m.AccountBalance.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryZoneDropsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != 0 { - n += 1 + sovQuery(uint64(m.Status)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryZoneDropsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ZoneDrops) > 0 { - for _, e := range m.ZoneDrops { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClaimRecordRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClaimRecordResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClaimRecord != nil { - l = m.ClaimRecord.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClaimRecordsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClaimRecordsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ClaimRecords) > 0 { - for _, e := range m.ClaimRecords { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryZoneDropRequest) 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: QueryZoneDropRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZoneDropRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryZoneDropResponse) 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: QueryZoneDropResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZoneDropResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ZoneDrop", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ZoneDrop.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 *QueryAccountBalanceRequest) 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: QueryAccountBalanceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAccountBalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAccountBalanceResponse) 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: QueryAccountBalanceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAccountBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountBalance", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AccountBalance == nil { - m.AccountBalance = &types.Coin{} - } - if err := m.AccountBalance.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 *QueryZoneDropsRequest) 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: QueryZoneDropsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZoneDropsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= Status(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryZoneDropsResponse) 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: QueryZoneDropsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZoneDropsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ZoneDrops", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ZoneDrops = append(m.ZoneDrops, ZoneDrop{}) - if err := m.ZoneDrops[len(m.ZoneDrops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryClaimRecordRequest) 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: QueryClaimRecordRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClaimRecordRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - 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 *QueryClaimRecordResponse) 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: QueryClaimRecordResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClaimRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimRecord", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ClaimRecord == nil { - m.ClaimRecord = &ClaimRecord{} - } - if err := m.ClaimRecord.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 *QueryClaimRecordsRequest) 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: QueryClaimRecordsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClaimRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryClaimRecordsResponse) 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: QueryClaimRecordsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClaimRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimRecords", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimRecords = append(m.ClaimRecords, ClaimRecord{}) - if err := m.ClaimRecords[len(m.ClaimRecords)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/airdrop/types/query.pb.gw.go b/x/airdrop/types/query.pb.gw.go deleted file mode 100644 index 1b60105ca..000000000 --- a/x/airdrop/types/query.pb.gw.go +++ /dev/null @@ -1,722 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: quicksilver/airdrop/v1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ZoneDrop_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryZoneDropRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := client.ZoneDrop(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ZoneDrop_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryZoneDropRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := server.ZoneDrop(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AccountBalance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAccountBalanceRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := client.AccountBalance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AccountBalance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAccountBalanceRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := server.AccountBalance(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_ZoneDrops_0 = &utilities.DoubleArray{Encoding: map[string]int{"status": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - -func request_Query_ZoneDrops_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryZoneDropsRequest - var metadata runtime.ServerMetadata - - var ( - val string - e int32 - ok bool - err error - _ = err - ) - - val, ok = pathParams["status"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") - } - - e, err = runtime.Enum(val, Status_value) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) - } - - protoReq.Status = Status(e) - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ZoneDrops_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ZoneDrops(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ZoneDrops_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryZoneDropsRequest - var metadata runtime.ServerMetadata - - var ( - val string - e int32 - ok bool - err error - _ = err - ) - - val, ok = pathParams["status"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") - } - - e, err = runtime.Enum(val, Status_value) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) - } - - protoReq.Status = Status(e) - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ZoneDrops_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ZoneDrops(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ClaimRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClaimRecordRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := client.ClaimRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ClaimRecord_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClaimRecordRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := server.ClaimRecord(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_ClaimRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - -func request_Query_ClaimRecords_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClaimRecordsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ClaimRecords_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ClaimRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ClaimRecords_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClaimRecordsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ClaimRecords_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ClaimRecords(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ZoneDrop_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_ZoneDrop_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_ZoneDrop_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AccountBalance_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_AccountBalance_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_AccountBalance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ZoneDrops_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_ZoneDrops_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_ZoneDrops_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ClaimRecord_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_ClaimRecord_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_ClaimRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ClaimRecords_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_ClaimRecords_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_ClaimRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ZoneDrop_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_ZoneDrop_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_ZoneDrop_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AccountBalance_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_AccountBalance_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_AccountBalance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ZoneDrops_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_ZoneDrops_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_ZoneDrops_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ClaimRecord_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_ClaimRecord_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_ClaimRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ClaimRecords_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_ClaimRecords_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_ClaimRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"quicksilver", "airdrop", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_ZoneDrop_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"quicksilver", "airdrop", "v1", "zonedrop", "chain_id"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_AccountBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"quicksilver", "airdrop", "v1", "accountbalance", "chain_id"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_ZoneDrops_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"quicksilver", "airdrop", "v1", "zonedrops", "status"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_ClaimRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"quicksilver", "airdrop", "v1", "claimrecord", "chain_id", "address"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_ClaimRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"quicksilver", "airdrop", "v1", "claimrecords", "chain_id"}, "", runtime.AssumeColonVerbOpt(true))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_ZoneDrop_0 = runtime.ForwardResponseMessage - - forward_Query_AccountBalance_0 = runtime.ForwardResponseMessage - - forward_Query_ZoneDrops_0 = runtime.ForwardResponseMessage - - forward_Query_ClaimRecord_0 = runtime.ForwardResponseMessage - - forward_Query_ClaimRecords_0 = runtime.ForwardResponseMessage -) diff --git a/x/airdrop/types/zip.go b/x/airdrop/types/zip.go deleted file mode 100644 index 9d5fc9742..000000000 --- a/x/airdrop/types/zip.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -import ( - "bytes" - "compress/zlib" - "io" -) - -func Decompress(data []byte) ([]byte, error) { - // zip reader - zr, err := zlib.NewReader(bytes.NewReader(data)) - if err != nil { - return nil, err - } - defer zr.Close() - - return io.ReadAll(zr) -} diff --git a/x/airdrop/types/zip_test.go b/x/airdrop/types/zip_test.go deleted file mode 100644 index 245f4f419..000000000 --- a/x/airdrop/types/zip_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package types_test - -import ( - "bytes" - "compress/zlib" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" -) - -// TODO test - -func TestDecompress(t *testing.T) { - testString := "hello, world\n" - var b bytes.Buffer - w := zlib.NewWriter(&b) - _, err := w.Write([]byte(testString)) - require.NoError(t, err) - require.NoError(t, w.Close()) - - tests := []struct { - name string - data []byte - expected []byte - wantErr bool - }{ - { - "no data", - nil, - nil, - true, - }, - { - "no data", - []byte{0, 0, 0}, - nil, - true, - }, - - { - "valid data", - b.Bytes(), - []byte(testString), - false, - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - got, err := types.Decompress(tc.data) - if tc.wantErr { - require.Error(t, err) - return - } - require.NoError(t, err) - require.Equal(t, tc.expected, got) - }) - } -} diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index fdd3fd087..41ed1a423 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -10,9 +10,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - airdroptypes "github.com/quicksilver-zone/quicksilver/x/airdrop/types" "github.com/quicksilver-zone/quicksilver/x/mint/types" participationrewards "github.com/quicksilver-zone/quicksilver/x/participationrewards/types" + supplytypes "github.com/quicksilver-zone/quicksilver/x/supply/types" ) // Keeper of the mint store. @@ -165,9 +165,8 @@ func (k Keeper) DistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) error // allocate pool allocation ratio to pool-incentives module account poolIncentivesCoins := sdk.NewCoins(k.GetProportions(mintedCoin, proportions.PoolIncentives)) - // temporary until we have incentives pool sorted :) - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, airdroptypes.ModuleName, poolIncentivesCoins) + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, supplytypes.AirdropAccount, poolIncentivesCoins) if err != nil { return err } diff --git a/x/participationrewards/keeper/invariants.go b/x/participationrewards/keeper/invariants.go index 29b73ddab..316955ecd 100644 --- a/x/participationrewards/keeper/invariants.go +++ b/x/participationrewards/keeper/invariants.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" + "github.com/quicksilver-zone/quicksilver/x/participationrewards/types" ) const ( diff --git a/x/participationrewards/keeper/rewards_holdings.go b/x/participationrewards/keeper/rewards_holdings.go index 41bd591f4..f6d3b2c6a 100644 --- a/x/participationrewards/keeper/rewards_holdings.go +++ b/x/participationrewards/keeper/rewards_holdings.go @@ -6,10 +6,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/quicksilver-zone/quicksilver/utils" - airdroptypes "github.com/quicksilver-zone/quicksilver/x/airdrop/types" cmtypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" icstypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types" "github.com/quicksilver-zone/quicksilver/x/participationrewards/types" + supplytypes "github.com/quicksilver-zone/quicksilver/x/supply/types" ) func (k Keeper) AllocateHoldingsRewards(ctx sdk.Context) error { @@ -20,14 +20,13 @@ func (k Keeper) AllocateHoldingsRewards(ctx sdk.Context) error { if err := k.DistributeToUsersFromModule(ctx, userAllocations); err != nil { k.Logger(ctx).Error("failed to distribute to users", "ua", userAllocations, "err", err) - // we might want to do a soft fail here so that all zones are not affected... return false } if remaining.IsPositive() { k.Logger(ctx).Error("remaining amount to return to incentives pool", "remainder", remaining, "pool balance", k.GetModuleBalance(ctx)) // send unclaimed remainder to incentives pool - if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, airdroptypes.ModuleName, sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), remaining))); err != nil { + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, supplytypes.ModuleName, sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), remaining))); err != nil { k.Logger(ctx).Error("failed to send remaining amount to return to incentives pool", "remainder", remaining, "pool balance", k.GetModuleBalance(ctx), "err", err) return false } diff --git a/x/supply/keeper/keeper.go b/x/supply/keeper/keeper.go index e7e8e7ab0..c7e482181 100644 --- a/x/supply/keeper/keeper.go +++ b/x/supply/keeper/keeper.go @@ -1,6 +1,8 @@ package keeper import ( + "fmt" + "github.com/tendermint/tendermint/libs/log" "cosmossdk.io/math" @@ -21,6 +23,7 @@ type Keeper struct { accountKeeper types.AccountKeeper bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper + govAuthority string moduleAccounts []string endpointEnabled bool } @@ -32,15 +35,22 @@ func NewKeeper( ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, + govAuthority string, moduleAccounts []string, endpointEnabled bool, ) Keeper { + + if addr := ak.GetModuleAddress(types.AirdropAccount); addr == nil { + panic(fmt.Sprintf("%s module account has not been set", types.AirdropAccount)) + } + return Keeper{ cdc: cdc, storeKey: storeKey, accountKeeper: ak, bankKeeper: bk, stakingKeeper: sk, + govAuthority: govAuthority, moduleAccounts: moduleAccounts, endpointEnabled: endpointEnabled, } diff --git a/x/supply/keeper/keeper_test.go b/x/supply/keeper/keeper_test.go new file mode 100644 index 000000000..ae254f52f --- /dev/null +++ b/x/supply/keeper/keeper_test.go @@ -0,0 +1,66 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/suite" + + ibctesting "github.com/cosmos/ibc-go/v6/testing" + + "github.com/quicksilver-zone/quicksilver/app" +) + +func init() { + ibctesting.DefaultTestingAppInit = app.SetupTestingApp +} + +// TestKeeperTestSuite runs all the tests within this package. +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +func newQuicksilverPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path { + path := ibctesting.NewPath(chainA, chainB) + path.EndpointA.ChannelConfig.PortID = ibctesting.TransferPort + path.EndpointB.ChannelConfig.PortID = ibctesting.TransferPort + + return path +} + +type KeeperTestSuite struct { + suite.Suite + + coordinator *ibctesting.Coordinator + + // testing chains used for convenience and readability + chainA *ibctesting.TestChain + chainB *ibctesting.TestChain + + path *ibctesting.Path +} + +func (*KeeperTestSuite) GetQuicksilverApp(chain *ibctesting.TestChain) *app.Quicksilver { + quicksilver, ok := chain.App.(*app.Quicksilver) + if !ok { + panic("not quicksilver app") + } + + return quicksilver +} + +// SetupTest creates a coordinator with 2 test chains. +func (suite *KeeperTestSuite) SetupTest() { + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) // initializes 2 test chains + suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) // convenience and readability + suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) // convenience and readability + + suite.path = newQuicksilverPath(suite.chainA, suite.chainB) + suite.coordinator.SetupConnections(suite.path) + + suite.coordinator.CurrentTime = time.Now().UTC() + suite.coordinator.UpdateTime() + + suite.coordinator.CommitNBlocks(suite.chainA, 10) + suite.coordinator.CommitNBlocks(suite.chainB, 10) +} diff --git a/x/airdrop/keeper/msg_server.go b/x/supply/keeper/msg_server.go similarity index 75% rename from x/airdrop/keeper/msg_server.go rename to x/supply/keeper/msg_server.go index 136931d4c..fe8ecd162 100644 --- a/x/airdrop/keeper/msg_server.go +++ b/x/supply/keeper/msg_server.go @@ -12,7 +12,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/quicksilver-zone/quicksilver/x/airdrop/types" + "github.com/quicksilver-zone/quicksilver/x/supply/types" ) type msgServer struct { @@ -27,22 +27,9 @@ func NewMsgServerImpl(keeper *Keeper) types.MsgServer { var _ types.MsgServer = msgServer{} -func (k msgServer) Claim(goCtx context.Context, msg *types.MsgClaim) (*types.MsgClaimResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - action := types.Action(msg.Action) //nolint:gosec - - amount, err := k.Keeper.Claim(ctx, msg.ChainId, action, msg.Address, msg.Proofs) - if err != nil { - return nil, err - } - - return &types.MsgClaimResponse{Amount: amount}, nil -} - func (k msgServer) IncentivePoolSpend(goCtx context.Context, msg *types.MsgIncentivePoolSpend) (*types.MsgIncentivePoolSpendResponse, error) { - if k.GetAuthority() != msg.Authority { - return nil, sdkioerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + if k.govAuthority != msg.Authority { + return nil, sdkioerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.govAuthority, msg.Authority) } to, err := sdk.AccAddressFromBech32(msg.ToAddress) diff --git a/x/supply/keeper/msg_server_test.go b/x/supply/keeper/msg_server_test.go new file mode 100644 index 000000000..b7206b340 --- /dev/null +++ b/x/supply/keeper/msg_server_test.go @@ -0,0 +1,87 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/quicksilver-zone/quicksilver/utils/addressutils" + minttypes "github.com/quicksilver-zone/quicksilver/x/mint/types" + "github.com/quicksilver-zone/quicksilver/x/supply/keeper" + "github.com/quicksilver-zone/quicksilver/x/supply/types" +) + +func (suite *KeeperTestSuite) Test_msgServer_IncentivePoolSpend() { + appA := suite.GetQuicksilverApp(suite.chainA) + + modAccAddr := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + userAddress := addressutils.GenerateAccAddressForTest().String() + denom := "uatom" // same as test zone setup in keeper_test + coins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewIntFromUint64(1000))) + mintCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewIntFromUint64(100000000))) + + // set up mod acct with funds + err := appA.BankKeeper.MintCoins(suite.chainA.GetContext(), minttypes.ModuleName, mintCoins) + suite.Require().NoError(err) + err = appA.BankKeeper.SendCoinsFromModuleToModule(suite.chainA.GetContext(), minttypes.ModuleName, types.ModuleName, mintCoins) + suite.Require().NoError(err) + + msg := types.MsgIncentivePoolSpend{} + tests := []struct { + name string + malleate func() + want *types.MsgIncentivePoolSpendResponse + wantErr bool + }{ + { + name: "invalid authority", + malleate: func() { + msg = types.MsgIncentivePoolSpend{ + Authority: "invalid", + ToAddress: userAddress, + Amount: coins, + Title: "Invalid Incentive Pool Spend Title", + Description: "Invalid Incentive Pool Spend Description", + } + }, + want: nil, + wantErr: true, + }, + { + name: "valid", + malleate: func() { + msg = types.MsgIncentivePoolSpend{ + Authority: modAccAddr, + ToAddress: userAddress, + Amount: coins, + Title: "Valid Incentive Pool Spend Title", + Description: "Valid Incentive Pool Spend Description", + } + }, + want: &types.MsgIncentivePoolSpendResponse{}, + wantErr: false, + }, + } + for _, tt := range tests { + suite.Run(tt.name, func() { + tt.malleate() + + k := keeper.NewMsgServerImpl(&appA.SupplyKeeper) + resp, err := k.IncentivePoolSpend(sdk.WrapSDKContext(suite.chainA.GetContext()), &msg) + if tt.wantErr { + suite.Require().Error(err) + suite.Require().Nil(resp) + suite.T().Logf("Error: %v", err) + return + } + + suite.Require().NoError(err) + suite.Require().NotNil(resp) + suite.Require().Equal(tt.want, resp) + + // verify that balance has been properly transferred + accAddr, err := sdk.AccAddressFromBech32(msg.ToAddress) + suite.Require().NoError(err) + balance := appA.BankKeeper.GetAllBalances(suite.chainA.GetContext(), accAddr) + suite.Require().Equal(msg.Amount, balance) + }) + } +} diff --git a/x/supply/types/expected_keepers.go b/x/supply/types/expected_keepers.go index e727753ba..cb59d02cc 100644 --- a/x/supply/types/expected_keepers.go +++ b/x/supply/types/expected_keepers.go @@ -17,6 +17,12 @@ type BankKeeper interface { GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin GetSupply(ctx sdk.Context, denom string) sdk.Coin LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error + BlockedAddr(addr sdk.AccAddress) bool } type StakingKeeper interface { diff --git a/x/supply/types/keys.go b/x/supply/types/keys.go index 38eae9a99..0836e395b 100644 --- a/x/supply/types/keys.go +++ b/x/supply/types/keys.go @@ -5,4 +5,6 @@ var ( QuerierRoute = ModuleName RouterKey = ModuleName StoreKey = ModuleName + + AirdropAccount = "airdrop" ) diff --git a/x/airdrop/types/messages.pb.go b/x/supply/types/messages.pb.go similarity index 51% rename from x/airdrop/types/messages.pb.go rename to x/supply/types/messages.pb.go index 32aa7f26b..1b341156d 100644 --- a/x/airdrop/types/messages.pb.go +++ b/x/supply/types/messages.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: quicksilver/airdrop/v1/messages.proto +// source: quicksilver/supply/v1/messages.proto package types @@ -8,12 +8,11 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types1 "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - types "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -34,84 +33,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MsgClaim struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` - Action int64 `protobuf:"varint,2,opt,name=action,proto3" json:"action,omitempty" yaml:"action"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` - Proofs []*types.Proof `protobuf:"bytes,4,rep,name=proofs,proto3" json:"proofs,omitempty" yaml:"proofs"` -} - -func (m *MsgClaim) Reset() { *m = MsgClaim{} } -func (m *MsgClaim) String() string { return proto.CompactTextString(m) } -func (*MsgClaim) ProtoMessage() {} -func (*MsgClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_2b0828c7de1949a1, []int{0} -} -func (m *MsgClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgClaim.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 *MsgClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClaim.Merge(m, src) -} -func (m *MsgClaim) XXX_Size() int { - return m.Size() -} -func (m *MsgClaim) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgClaim proto.InternalMessageInfo - -type MsgClaimResponse struct { - Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty" yaml:"amount"` -} - -func (m *MsgClaimResponse) Reset() { *m = MsgClaimResponse{} } -func (m *MsgClaimResponse) String() string { return proto.CompactTextString(m) } -func (*MsgClaimResponse) ProtoMessage() {} -func (*MsgClaimResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2b0828c7de1949a1, []int{1} -} -func (m *MsgClaimResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgClaimResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgClaimResponse.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 *MsgClaimResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClaimResponse.Merge(m, src) -} -func (m *MsgClaimResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgClaimResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClaimResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgClaimResponse proto.InternalMessageInfo - -// MsgIncentivePoolSpend represents a message to send coins from one account to another. +// MsgIncentivePoolSpend represents a message to send coins from the airdrop +// module account to another. type MsgIncentivePoolSpend struct { Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` @@ -124,7 +47,7 @@ func (m *MsgIncentivePoolSpend) Reset() { *m = MsgIncentivePoolSpend{} } func (m *MsgIncentivePoolSpend) String() string { return proto.CompactTextString(m) } func (*MsgIncentivePoolSpend) ProtoMessage() {} func (*MsgIncentivePoolSpend) Descriptor() ([]byte, []int) { - return fileDescriptor_2b0828c7de1949a1, []int{2} + return fileDescriptor_a0e67f626499cf77, []int{0} } func (m *MsgIncentivePoolSpend) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -153,7 +76,8 @@ func (m *MsgIncentivePoolSpend) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIncentivePoolSpend proto.InternalMessageInfo -// MsgIncentivePoolSpendResponse defines the MsgIncentivePoolSpend response type. +// MsgIncentivePoolSpendResponse defines the MsgIncentivePoolSpend response +// type. type MsgIncentivePoolSpendResponse struct { } @@ -161,7 +85,7 @@ func (m *MsgIncentivePoolSpendResponse) Reset() { *m = MsgIncentivePoolS func (m *MsgIncentivePoolSpendResponse) String() string { return proto.CompactTextString(m) } func (*MsgIncentivePoolSpendResponse) ProtoMessage() {} func (*MsgIncentivePoolSpendResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2b0828c7de1949a1, []int{3} + return fileDescriptor_a0e67f626499cf77, []int{1} } func (m *MsgIncentivePoolSpendResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -191,61 +115,47 @@ func (m *MsgIncentivePoolSpendResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIncentivePoolSpendResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgClaim)(nil), "quicksilver.airdrop.v1.MsgClaim") - proto.RegisterType((*MsgClaimResponse)(nil), "quicksilver.airdrop.v1.MsgClaimResponse") - proto.RegisterType((*MsgIncentivePoolSpend)(nil), "quicksilver.airdrop.v1.MsgIncentivePoolSpend") - proto.RegisterType((*MsgIncentivePoolSpendResponse)(nil), "quicksilver.airdrop.v1.MsgIncentivePoolSpendResponse") + proto.RegisterType((*MsgIncentivePoolSpend)(nil), "quicksilver.supply.v1.MsgIncentivePoolSpend") + proto.RegisterType((*MsgIncentivePoolSpendResponse)(nil), "quicksilver.supply.v1.MsgIncentivePoolSpendResponse") } func init() { - proto.RegisterFile("quicksilver/airdrop/v1/messages.proto", fileDescriptor_2b0828c7de1949a1) -} - -var fileDescriptor_2b0828c7de1949a1 = []byte{ - // 683 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x3d, 0x6f, 0xd3, 0x40, - 0x18, 0x8e, 0x93, 0xf4, 0xeb, 0x2a, 0xbe, 0x4c, 0x29, 0x69, 0x04, 0x76, 0x64, 0x54, 0x29, 0x04, - 0xc5, 0x6e, 0xca, 0x47, 0x25, 0x6f, 0xa4, 0x2c, 0x1d, 0x8a, 0x4a, 0xba, 0xb1, 0x44, 0x17, 0xfb, - 0xb8, 0x9e, 0x6a, 0xdf, 0x19, 0xdf, 0x25, 0x6a, 0x99, 0x50, 0x25, 0x24, 0x46, 0x24, 0xfe, 0x40, - 0x67, 0x26, 0x06, 0xc4, 0xc6, 0xc0, 0xd6, 0xb1, 0x82, 0x85, 0x29, 0xa0, 0x16, 0x09, 0xe6, 0xfe, - 0x02, 0xe4, 0xf3, 0xb9, 0x75, 0x44, 0x69, 0xc5, 0xe4, 0xbb, 0xf7, 0x7d, 0x9e, 0xf7, 0xf3, 0x39, - 0x83, 0xf9, 0xe7, 0x7d, 0xe2, 0x6d, 0x72, 0x12, 0x0c, 0x50, 0xec, 0x40, 0x12, 0xfb, 0x31, 0x8b, - 0x9c, 0x41, 0xcb, 0x09, 0x11, 0xe7, 0x10, 0x23, 0x6e, 0x47, 0x31, 0x13, 0x4c, 0x9f, 0xcd, 0xc1, - 0x6c, 0x05, 0xb3, 0x07, 0xad, 0xaa, 0xe1, 0x31, 0x1e, 0x32, 0xee, 0xf4, 0x20, 0x47, 0xce, 0xa0, - 0xd5, 0x43, 0x02, 0xb6, 0x1c, 0x8f, 0x11, 0x9a, 0xf2, 0xaa, 0xd7, 0x95, 0x3f, 0xe4, 0x58, 0x46, - 0xe5, 0x58, 0x39, 0xe6, 0x52, 0x47, 0x57, 0xde, 0x9c, 0xf4, 0xa2, 0x5c, 0x33, 0x98, 0x61, 0x96, - 0xda, 0x93, 0x93, 0xb2, 0xde, 0xc0, 0x8c, 0xe1, 0x00, 0x39, 0x30, 0x22, 0x0e, 0xa4, 0x94, 0x09, - 0x28, 0x08, 0xa3, 0x19, 0x67, 0x21, 0xdf, 0x86, 0x17, 0x40, 0x12, 0xf2, 0x10, 0x52, 0x88, 0x51, - 0x9c, 0xa4, 0x1d, 0x31, 0xa4, 0x0c, 0xeb, 0x55, 0x11, 0x4c, 0xae, 0x72, 0xbc, 0x9c, 0xb8, 0x74, - 0x1b, 0x4c, 0x7a, 0x1b, 0x90, 0xd0, 0x2e, 0xf1, 0x2b, 0x5a, 0x4d, 0xab, 0x4f, 0xb5, 0xaf, 0x1e, - 0x0d, 0xcd, 0x4b, 0xdb, 0x30, 0x0c, 0x5c, 0x2b, 0xf3, 0x58, 0x9d, 0x09, 0x79, 0x5c, 0xf1, 0xf5, - 0xdb, 0x60, 0x1c, 0x7a, 0x49, 0xfe, 0x4a, 0xb1, 0xa6, 0xd5, 0x4b, 0xed, 0x2b, 0x47, 0x43, 0xf3, - 0x42, 0x8a, 0x4e, 0xed, 0x56, 0x47, 0x01, 0xf4, 0x47, 0x60, 0x02, 0xfa, 0x7e, 0x8c, 0x38, 0xaf, - 0x94, 0x64, 0xe4, 0xc6, 0xd1, 0xd0, 0xbc, 0xa8, 0xb0, 0xa9, 0xc3, 0xfa, 0xf2, 0xa1, 0x39, 0xa3, - 0x46, 0xf0, 0x30, 0x35, 0xad, 0x8b, 0x98, 0x50, 0xdc, 0xc9, 0xa8, 0xfa, 0x63, 0x30, 0x1e, 0xc5, - 0x8c, 0x3d, 0xe3, 0x95, 0x72, 0xad, 0x54, 0x9f, 0x5e, 0xbc, 0x65, 0xe7, 0x17, 0x32, 0xda, 0xdf, - 0xa0, 0x65, 0xaf, 0x25, 0xd8, 0x7c, 0x55, 0x29, 0xd9, 0xea, 0xa8, 0x28, 0xee, 0xe4, 0xeb, 0x5d, - 0xb3, 0xf0, 0x7b, 0xd7, 0x2c, 0x58, 0xcb, 0xe0, 0x72, 0x36, 0x86, 0x0e, 0xe2, 0x11, 0xa3, 0x1c, - 0xc9, 0xf6, 0x42, 0xd6, 0xa7, 0x42, 0x0e, 0xa3, 0x3c, 0xd2, 0x9e, 0xb4, 0x27, 0xed, 0xc9, 0x83, - 0x5b, 0x4e, 0x02, 0x59, 0x9f, 0x8a, 0xe0, 0xda, 0x2a, 0xc7, 0x2b, 0xd4, 0x43, 0x54, 0x90, 0x01, - 0x5a, 0x63, 0x2c, 0x58, 0x8f, 0x10, 0xf5, 0xf5, 0x07, 0x60, 0x0a, 0xf6, 0xc5, 0x06, 0x8b, 0x89, - 0xd8, 0x56, 0xa3, 0xad, 0xfc, 0xb3, 0xdd, 0x13, 0xa8, 0xbe, 0x04, 0x80, 0x60, 0xdd, 0x6c, 0x72, - 0xc5, 0xf3, 0x88, 0x82, 0x29, 0x83, 0xee, 0x1d, 0xd7, 0x5e, 0x92, 0x93, 0x9a, 0xb3, 0x15, 0x23, - 0x91, 0xa8, 0xad, 0x24, 0x6a, 0x2f, 0x33, 0x42, 0xdb, 0x0b, 0x7b, 0x43, 0xb3, 0xf0, 0xee, 0xbb, - 0x59, 0xc7, 0x44, 0x6c, 0xf4, 0x7b, 0xb6, 0xc7, 0x42, 0xa5, 0x44, 0xf5, 0x69, 0x72, 0x7f, 0xd3, - 0x11, 0xdb, 0x11, 0xe2, 0x92, 0xc0, 0xb3, 0xae, 0xf5, 0x19, 0x30, 0x26, 0x88, 0x08, 0x50, 0xa5, - 0x9c, 0x14, 0xd6, 0x49, 0x2f, 0x7a, 0x0d, 0x4c, 0xfb, 0x88, 0x7b, 0x31, 0x89, 0xa4, 0x34, 0xc6, - 0xa4, 0x2f, 0x6f, 0x72, 0x67, 0xb3, 0xb1, 0xef, 0xfc, 0x7a, 0xdf, 0x38, 0xe9, 0xd6, 0x32, 0xc1, - 0xcd, 0x53, 0xc7, 0x97, 0x6d, 0x64, 0xf1, 0x73, 0x11, 0x94, 0x56, 0x39, 0xd6, 0x5f, 0x6a, 0x60, - 0x2c, 0x95, 0x6c, 0xcd, 0x3e, 0xfd, 0x49, 0xda, 0xd9, 0x36, 0xab, 0xf5, 0xf3, 0x10, 0x59, 0x74, - 0xeb, 0xce, 0xce, 0xd7, 0x9f, 0x6f, 0x8b, 0xf3, 0x56, 0xcd, 0xc9, 0x3f, 0x23, 0xb1, 0x95, 0xbc, - 0x9d, 0xec, 0x9f, 0x20, 0x35, 0xe6, 0x6a, 0x0d, 0xfd, 0xa3, 0x06, 0xf4, 0x53, 0x16, 0xdd, 0x3c, - 0x23, 0xdb, 0xdf, 0xf0, 0xea, 0xfd, 0xff, 0x82, 0x1f, 0x57, 0xea, 0xca, 0x4a, 0xef, 0x59, 0xce, - 0x19, 0x95, 0x92, 0x8c, 0xde, 0x8d, 0x18, 0x0b, 0xba, 0x3c, 0x09, 0xe0, 0x6a, 0x8d, 0xf6, 0x93, - 0xbd, 0x03, 0x43, 0xdb, 0x3f, 0x30, 0xb4, 0x1f, 0x07, 0x86, 0xf6, 0xe6, 0xd0, 0x28, 0xec, 0x1f, - 0x1a, 0x85, 0x6f, 0x87, 0x46, 0xe1, 0xe9, 0x52, 0x4e, 0x00, 0xb9, 0xb8, 0xcd, 0x17, 0x8c, 0xa2, - 0x91, 0x44, 0x5b, 0xc7, 0x49, 0xa4, 0x2a, 0x7a, 0xe3, 0xf2, 0x5f, 0x72, 0xf7, 0x4f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x8d, 0x34, 0xd3, 0x8b, 0x46, 0x05, 0x00, 0x00, + proto.RegisterFile("quicksilver/supply/v1/messages.proto", fileDescriptor_a0e67f626499cf77) +} + +var fileDescriptor_a0e67f626499cf77 = []byte{ + // 481 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xb6, 0x13, 0x5a, 0xa9, 0xd7, 0xcd, 0x4a, 0xc1, 0x8d, 0xc0, 0x8e, 0x22, 0x24, 0xa2, 0xaa, + 0xf1, 0x91, 0x80, 0x8a, 0xd4, 0x8d, 0x30, 0x31, 0x54, 0xaa, 0xd2, 0x8d, 0x25, 0x72, 0xec, 0xd3, + 0xf5, 0x54, 0xfb, 0x9e, 0xf1, 0x3b, 0x5b, 0x0d, 0x63, 0x27, 0x46, 0x24, 0xfe, 0x40, 0x67, 0xc4, + 0xc0, 0xd0, 0x95, 0xbd, 0x63, 0x05, 0x0b, 0x13, 0xa0, 0x04, 0x09, 0x7e, 0x06, 0xb2, 0x7d, 0x69, + 0x3c, 0x44, 0x42, 0x4c, 0xf6, 0xfb, 0xbe, 0xf7, 0xbd, 0xf7, 0xfc, 0xf9, 0x23, 0x0f, 0x5f, 0x67, + 0x22, 0x38, 0x43, 0x11, 0xe5, 0x2c, 0xa5, 0x98, 0x25, 0x49, 0x34, 0xa3, 0xf9, 0x80, 0xc6, 0x0c, + 0xd1, 0xe7, 0x0c, 0xbd, 0x24, 0x05, 0x05, 0xd6, 0x4e, 0xad, 0xcb, 0xab, 0xba, 0xbc, 0x7c, 0xd0, + 0x76, 0x02, 0xc0, 0x18, 0x90, 0x4e, 0x7d, 0x64, 0x34, 0x1f, 0x4c, 0x99, 0xf2, 0x07, 0x34, 0x00, + 0x21, 0x2b, 0x59, 0xfb, 0x9e, 0xe6, 0x63, 0xe4, 0xe5, 0x50, 0xe4, 0x9a, 0xd8, 0xad, 0x88, 0x49, + 0x59, 0xd1, 0xaa, 0xd0, 0x54, 0x8b, 0x03, 0x87, 0x0a, 0x2f, 0xde, 0x34, 0x7a, 0x9f, 0x03, 0xf0, + 0x88, 0x51, 0x3f, 0x11, 0xd4, 0x97, 0x12, 0x94, 0xaf, 0x04, 0x48, 0xad, 0xe9, 0x7e, 0x6e, 0x90, + 0x9d, 0x23, 0xe4, 0x2f, 0x65, 0xc0, 0xa4, 0x12, 0x39, 0x3b, 0x06, 0x88, 0x4e, 0x12, 0x26, 0x43, + 0xeb, 0x80, 0x6c, 0xf9, 0x99, 0x3a, 0x85, 0x54, 0xa8, 0x99, 0x6d, 0x76, 0xcc, 0xde, 0xd6, 0xc8, + 0xfe, 0x72, 0xd5, 0x6f, 0xe9, 0x95, 0xcf, 0xc3, 0x30, 0x65, 0x88, 0x27, 0x2a, 0x15, 0x92, 0x8f, + 0x57, 0xad, 0xd6, 0x33, 0x42, 0x14, 0x4c, 0xfc, 0x8a, 0xb6, 0x1b, 0xff, 0x12, 0x2a, 0xd0, 0x80, + 0x15, 0x90, 0x4d, 0x3f, 0x86, 0x4c, 0x2a, 0xbb, 0xd9, 0x69, 0xf6, 0xb6, 0x87, 0xbb, 0x9e, 0x56, + 0x14, 0x1e, 0x79, 0xda, 0x23, 0xef, 0x05, 0x08, 0x39, 0x7a, 0x7c, 0xfd, 0xdd, 0x35, 0x3e, 0xfc, + 0x70, 0x7b, 0x5c, 0xa8, 0xd3, 0x6c, 0xea, 0x05, 0x10, 0x6b, 0x2b, 0xf4, 0xa3, 0x8f, 0xe1, 0x19, + 0x55, 0xb3, 0x84, 0x61, 0x29, 0xc0, 0xb1, 0x1e, 0x6d, 0xb5, 0xc8, 0x86, 0x12, 0x2a, 0x62, 0xf6, + 0x9d, 0xe2, 0xb0, 0x71, 0x55, 0x58, 0x1d, 0xb2, 0x1d, 0x32, 0x0c, 0x52, 0x91, 0x14, 0xde, 0xd8, + 0x1b, 0x25, 0x57, 0x87, 0x0e, 0xef, 0xbe, 0xbd, 0x74, 0x8d, 0x3f, 0x97, 0xae, 0x71, 0xf1, 0xfb, + 0xd3, 0xde, 0xea, 0x6b, 0xbb, 0x2e, 0x79, 0xb0, 0xd6, 0xbe, 0x31, 0xc3, 0x04, 0x24, 0xb2, 0xe1, + 0x95, 0x49, 0x9a, 0x47, 0xc8, 0xad, 0x8f, 0x26, 0xb1, 0xd6, 0xb8, 0xbc, 0xef, 0xad, 0xcd, 0x87, + 0xb7, 0x76, 0x68, 0xfb, 0xe9, 0xff, 0x74, 0x2f, 0x4f, 0xe8, 0x0e, 0x2f, 0xbe, 0xfe, 0x7a, 0xdf, + 0xd8, 0xef, 0x3e, 0x5a, 0xa6, 0x54, 0x9d, 0xdf, 0x46, 0x4e, 0x2c, 0x65, 0x93, 0x04, 0x20, 0x9a, + 0x60, 0x21, 0x3c, 0x34, 0xf7, 0x46, 0xc7, 0xd7, 0x73, 0xc7, 0xbc, 0x99, 0x3b, 0xe6, 0xcf, 0xb9, + 0x63, 0xbe, 0x5b, 0x38, 0xc6, 0xcd, 0xc2, 0x31, 0xbe, 0x2d, 0x1c, 0xe3, 0xd5, 0x41, 0xcd, 0xf3, + 0xda, 0x35, 0xfd, 0x37, 0x20, 0x59, 0x1d, 0xa0, 0xe7, 0xb7, 0xeb, 0x8a, 0xff, 0x30, 0xdd, 0x2c, + 0x03, 0xf7, 0xe4, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x8a, 0x51, 0xce, 0x37, 0x03, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -260,7 +170,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - Claim(ctx context.Context, in *MsgClaim, opts ...grpc.CallOption) (*MsgClaimResponse, error) + // MsgIncentivePoolSpend defines a method for submit query responses. IncentivePoolSpend(ctx context.Context, in *MsgIncentivePoolSpend, opts ...grpc.CallOption) (*MsgIncentivePoolSpendResponse, error) } @@ -272,18 +182,9 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) Claim(ctx context.Context, in *MsgClaim, opts ...grpc.CallOption) (*MsgClaimResponse, error) { - out := new(MsgClaimResponse) - err := c.cc.Invoke(ctx, "/quicksilver.airdrop.v1.Msg/Claim", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) IncentivePoolSpend(ctx context.Context, in *MsgIncentivePoolSpend, opts ...grpc.CallOption) (*MsgIncentivePoolSpendResponse, error) { out := new(MsgIncentivePoolSpendResponse) - err := c.cc.Invoke(ctx, "/quicksilver.airdrop.v1.Msg/IncentivePoolSpend", in, out, opts...) + err := c.cc.Invoke(ctx, "/quicksilver.supply.v1.Msg/IncentivePoolSpend", in, out, opts...) if err != nil { return nil, err } @@ -292,7 +193,7 @@ func (c *msgClient) IncentivePoolSpend(ctx context.Context, in *MsgIncentivePool // MsgServer is the server API for Msg service. type MsgServer interface { - Claim(context.Context, *MsgClaim) (*MsgClaimResponse, error) + // MsgIncentivePoolSpend defines a method for submit query responses. IncentivePoolSpend(context.Context, *MsgIncentivePoolSpend) (*MsgIncentivePoolSpendResponse, error) } @@ -300,9 +201,6 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) Claim(ctx context.Context, req *MsgClaim) (*MsgClaimResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Claim not implemented") -} func (*UnimplementedMsgServer) IncentivePoolSpend(ctx context.Context, req *MsgIncentivePoolSpend) (*MsgIncentivePoolSpendResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method IncentivePoolSpend not implemented") } @@ -311,24 +209,6 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_Claim_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgClaim) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Claim(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/quicksilver.airdrop.v1.Msg/Claim", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Claim(ctx, req.(*MsgClaim)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_IncentivePoolSpend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgIncentivePoolSpend) if err := dec(in); err != nil { @@ -339,7 +219,7 @@ func _Msg_IncentivePoolSpend_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/quicksilver.airdrop.v1.Msg/IncentivePoolSpend", + FullMethod: "/quicksilver.supply.v1.Msg/IncentivePoolSpend", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).IncentivePoolSpend(ctx, req.(*MsgIncentivePoolSpend)) @@ -348,104 +228,16 @@ func _Msg_IncentivePoolSpend_Handler(srv interface{}, ctx context.Context, dec f } var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "quicksilver.airdrop.v1.Msg", + ServiceName: "quicksilver.supply.v1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Claim", - Handler: _Msg_Claim_Handler, - }, { MethodName: "IncentivePoolSpend", Handler: _Msg_IncentivePoolSpend_Handler, }, }, Streams: []grpc.StreamDesc{}, - Metadata: "quicksilver/airdrop/v1/messages.proto", -} - -func (m *MsgClaim) 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 *MsgClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Proofs) > 0 { - for iNdEx := len(m.Proofs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Proofs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMessages(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintMessages(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x1a - } - if m.Action != 0 { - i = encodeVarintMessages(dAtA, i, uint64(m.Action)) - i-- - dAtA[i] = 0x10 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintMessages(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgClaimResponse) 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 *MsgClaimResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgClaimResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Amount != 0 { - i = encodeVarintMessages(dAtA, i, uint64(m.Amount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil + Metadata: "quicksilver/supply/v1/messages.proto", } func (m *MsgIncentivePoolSpend) Marshal() (dAtA []byte, err error) { @@ -547,44 +339,6 @@ func encodeVarintMessages(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovMessages(uint64(l)) - } - if m.Action != 0 { - n += 1 + sovMessages(uint64(m.Action)) - } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovMessages(uint64(l)) - } - if len(m.Proofs) > 0 { - for _, e := range m.Proofs { - l = e.Size() - n += 1 + l + sovMessages(uint64(l)) - } - } - return n -} - -func (m *MsgClaimResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Amount != 0 { - n += 1 + sovMessages(uint64(m.Amount)) - } - return n -} - func (m *MsgIncentivePoolSpend) Size() (n int) { if m == nil { return 0 @@ -631,242 +385,6 @@ func sovMessages(x uint64) (n int) { func sozMessages(x uint64) (n int) { return sovMessages(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgClaim) 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 ErrIntOverflowMessages - } - 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: MsgClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessages - } - 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 ErrInvalidLengthMessages - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMessages - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) - } - m.Action = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessages - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Action |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessages - } - 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 ErrInvalidLengthMessages - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMessages - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proofs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessages - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMessages - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMessages - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proofs = append(m.Proofs, &types.Proof{}) - if err := m.Proofs[len(m.Proofs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMessages(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMessages - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgClaimResponse) 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 ErrIntOverflowMessages - } - 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: MsgClaimResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClaimResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessages - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMessages(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMessages - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgIncentivePoolSpend) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -989,7 +507,7 @@ func (m *MsgIncentivePoolSpend) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types1.Coin{}) + m.Amount = append(m.Amount, types.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/airdrop/types/messages.pb.gw.go b/x/supply/types/messages.pb.gw.go similarity index 63% rename from x/airdrop/types/messages.pb.gw.go rename to x/supply/types/messages.pb.gw.go index e06b7dab5..7d4686a0d 100644 --- a/x/airdrop/types/messages.pb.gw.go +++ b/x/supply/types/messages.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: quicksilver/airdrop/v1/messages.proto +// source: quicksilver/supply/v1/messages.proto /* Package types is a reverse proxy. @@ -33,40 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Msg_Claim_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgClaim - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Claim(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Msg_Claim_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgClaim - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Claim(ctx, &protoReq) - return msg, metadata, err - -} - func request_Msg_IncentivePoolSpend_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgIncentivePoolSpend var metadata runtime.ServerMetadata @@ -107,29 +73,6 @@ func local_request_Msg_IncentivePoolSpend_0(ctx context.Context, marshaler runti // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_Claim_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_Msg_Claim_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_Msg_Claim_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("POST", pattern_Msg_IncentivePoolSpend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -194,26 +137,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_Claim_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_Msg_Claim_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Msg_Claim_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("POST", pattern_Msg_IncentivePoolSpend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -238,13 +161,9 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } var ( - pattern_Msg_Claim_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"quicksilver", "tx", "v1", "airdrop", "claim"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Msg_IncentivePoolSpend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"quicksilver", "tx", "v1", "airdrop", "incentive_pool_spend"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_IncentivePoolSpend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"supply", "tx", "v1beta1", "incentive_pool_spend"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( - forward_Msg_Claim_0 = runtime.ForwardResponseMessage - forward_Msg_IncentivePoolSpend_0 = runtime.ForwardResponseMessage )