diff --git a/app/app.go b/app/app.go index 863c7836..96bba9e9 100644 --- a/app/app.go +++ b/app/app.go @@ -86,6 +86,7 @@ import ( "github.com/terra-money/alliance/x/alliance" allianceclient "github.com/terra-money/alliance/x/alliance/client" alliancetypes "github.com/terra-money/alliance/x/alliance/types" + "github.com/terra-money/core/v2/x/feeburn" feeshare "github.com/terra-money/core/v2/x/feeshare" feesharetypes "github.com/terra-money/core/v2/x/feeshare/types" @@ -285,6 +286,7 @@ func NewTerraApp( postHandler := post.NewPostHandler( post.HandlerOptions{ FeeShareKeeper: app.Keepers.FeeShareKeeper, + FeeBurnKeeper: app.Keepers.FeeBurnKeeper, BankKeeper: app.Keepers.BankKeeper, WasmKeeper: app.Keepers.WasmKeeper, }, @@ -570,6 +572,7 @@ func (app *TerraApp) SimulationManager() *module.SimulationManager { customwasmodule.NewAppModule(appCodec, &app.Keepers.WasmKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.BaseApp.MsgServiceRouter(), app.Keepers.GetSubspace(wasmtypes.ModuleName)), alliance.NewAppModule(appCodec, app.Keepers.AllianceKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.interfaceRegistry, app.Keepers.GetSubspace(alliancetypes.ModuleName)), feeshare.NewAppModule(app.Keepers.FeeShareKeeper, app.Keepers.AccountKeeper, app.GetSubspace(feesharetypes.ModuleName)), + feeburn.NewAppModule(app.Keepers.FeeBurnKeeper), ) sm.RegisterStoreDecoders() diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 4cd0e67f..083e8e63 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -93,16 +93,17 @@ import ( tokenfactorykeeper "github.com/terra-money/core/v2/x/tokenfactory/keeper" tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types" + pobkeeper "github.com/skip-mev/pob/x/builder/keeper" pobtype "github.com/skip-mev/pob/x/builder/types" "github.com/terra-money/alliance/x/alliance" alliancekeeper "github.com/terra-money/alliance/x/alliance/keeper" alliancetypes "github.com/terra-money/alliance/x/alliance/types" custombankkeeper "github.com/terra-money/core/v2/x/bank/keeper" + feeburnkeeper "github.com/terra-money/core/v2/x/feeburn/keeper" + feeburntypes "github.com/terra-money/core/v2/x/feeburn/types" feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper" feesharetypes "github.com/terra-money/core/v2/x/feeshare/types" - pobkeeper "github.com/skip-mev/pob/x/builder/keeper" - terraappconfig "github.com/terra-money/core/v2/app/config" // unnamed import of statik for swagger UI support _ "github.com/terra-money/core/v2/client/docs/statik" @@ -112,7 +113,7 @@ var wasmCapabilities = "iterator,staking,stargate,token_factory,cosmwasm_1_1,cos // module account permissions var maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, + authtypes.FeeCollectorName: {authtypes.Burner}, distrtypes.ModuleName: nil, icatypes.ModuleName: nil, minttypes.ModuleName: {authtypes.Minter}, @@ -160,6 +161,7 @@ type TerraAppKeepers struct { TokenFactoryKeeper tokenfactorykeeper.Keeper AllianceKeeper alliancekeeper.Keeper FeeShareKeeper feesharekeeper.Keeper + FeeBurnKeeper feeburnkeeper.Keeper ICQKeeper icqkeeper.Keeper // IBC hooks @@ -516,6 +518,12 @@ func NewTerraAppKeepers( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + keepers.FeeBurnKeeper = feeburnkeeper.NewKeeper( + keys[feeburntypes.StoreKey], + appCodec, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + keepers.FeeShareKeeper = feesharekeeper.NewKeeper( appCodec, keys[feesharetypes.StoreKey], @@ -588,6 +596,7 @@ func (app *TerraAppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legacyA paramsKeeper.Subspace(tokenfactorytypes.ModuleName).WithKeyTable(tokenfactorytypes.ParamKeyTable()) paramsKeeper.Subspace(feesharetypes.ModuleName).WithKeyTable(feesharetypes.ParamKeyTable()) paramsKeeper.Subspace(alliancetypes.ModuleName).WithKeyTable(alliancetypes.ParamKeyTable()) + paramsKeeper.Subspace(feeburntypes.ModuleName) return paramsKeeper } diff --git a/app/keepers/keys.go b/app/keepers/keys.go index 496af563..5db7c5ca 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -43,11 +43,11 @@ import ( tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types" + pobtype "github.com/skip-mev/pob/x/builder/types" alliancetypes "github.com/terra-money/alliance/x/alliance/types" + feeburntypes "github.com/terra-money/core/v2/x/feeburn/types" feesharetypes "github.com/terra-money/core/v2/x/feeshare/types" - pobtype "github.com/skip-mev/pob/x/builder/types" - // unnamed import of statik for swagger UI support _ "github.com/terra-money/core/v2/client/docs/statik" ) @@ -62,7 +62,7 @@ func (keepers *TerraAppKeepers) GenerateKeys() { icahosttypes.StoreKey, icacontrollertypes.StoreKey, routertypes.StoreKey, consensusparamtypes.StoreKey, tokenfactorytypes.StoreKey, wasmtypes.StoreKey, ibcfeetypes.StoreKey, ibchookstypes.StoreKey, crisistypes.StoreKey, - alliancetypes.StoreKey, feesharetypes.StoreKey, pobtype.StoreKey, icqtypes.StoreKey, + alliancetypes.StoreKey, feesharetypes.StoreKey, feeburntypes.StoreKey, pobtype.StoreKey, icqtypes.StoreKey, ) keepers.tkeys = sdk.NewTransientStoreKeys(paramstypes.TStoreKey) diff --git a/app/modules.go b/app/modules.go index 13fb70d3..02ec1c8d 100644 --- a/app/modules.go +++ b/app/modules.go @@ -51,6 +51,8 @@ import ( ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v7/modules/core" alliancetypes "github.com/terra-money/alliance/x/alliance/types" + "github.com/terra-money/core/v2/x/feeburn" + feeburntypes "github.com/terra-money/core/v2/x/feeburn/types" feesharetypes "github.com/terra-money/core/v2/x/feeshare/types" tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types" @@ -119,6 +121,7 @@ var ModuleBasics = module.NewBasicManager( consensus.AppModuleBasic{}, alliance.AppModuleBasic{}, feeshare.AppModuleBasic{}, + feeburn.AppModuleBasic{}, pob.AppModuleBasic{}, icq.AppModuleBasic{}, ) @@ -159,6 +162,7 @@ func appModules(app *TerraApp, encodingConfig terrappsparams.EncodingConfig, ski feeshare.NewAppModule(app.Keepers.FeeShareKeeper, app.Keepers.AccountKeeper, app.GetSubspace(feesharetypes.ModuleName)), pob.NewAppModule(app.appCodec, app.Keepers.BuilderKeeper), icq.NewAppModule(app.Keepers.ICQKeeper), + feeburn.NewAppModule(app.Keepers.FeeBurnKeeper), } } @@ -196,6 +200,7 @@ var initGenesisOrder = []string{ feesharetypes.ModuleName, consensusparamtypes.ModuleName, icqtypes.ModuleName, + feeburntypes.ModuleName, pobtype.ModuleName, } @@ -229,6 +234,7 @@ var beginBlockersOrder = []string{ feesharetypes.ModuleName, consensusparamtypes.ModuleName, icqtypes.ModuleName, + feeburntypes.ModuleName, pobtype.ModuleName, } @@ -262,5 +268,6 @@ var endBlockerOrder = []string{ feesharetypes.ModuleName, consensusparamtypes.ModuleName, icqtypes.ModuleName, + feeburntypes.ModuleName, pobtype.ModuleName, } diff --git a/app/post/post.go b/app/post/post.go index d10d3668..0181a8c0 100644 --- a/app/post/post.go +++ b/app/post/post.go @@ -1,6 +1,7 @@ package post import ( + feeburnpost "github.com/terra-money/core/v2/x/feeburn/post" feesharepost "github.com/terra-money/core/v2/x/feeshare/post" customwasmkeeper "github.com/terra-money/core/v2/x/wasm/keeper" wasmpost "github.com/terra-money/core/v2/x/wasm/post" @@ -12,13 +13,18 @@ type HandlerOptions struct { FeeShareKeeper feesharepost.FeeShareKeeper BankKeeper feesharepost.BankKeeper WasmKeeper customwasmkeeper.Keeper + FeeBurnKeeper feeburnpost.FeeBurnKeeper } func NewPostHandler(options HandlerOptions) sdk.PostHandler { + // NOTE: feesharepost handler MUST always run before the wasmpost handler because + // feeshare will distribute the fees between the contracts enabled with feeshare + // and then wasmpost will clean the list of executed contracts in the block. postDecorators := []sdk.PostDecorator{ feesharepost.NewFeeSharePayoutDecorator(options.FeeShareKeeper, options.BankKeeper, options.WasmKeeper), wasmpost.NewWasmdDecorator(options.WasmKeeper), + feeburnpost.NewFeeBurnDecorator(options.FeeBurnKeeper, options.BankKeeper), } return sdk.ChainPostDecorators(postDecorators...) diff --git a/app/upgrade_handler.go b/app/upgrade_handler.go index 23f19618..6e19ab3f 100644 --- a/app/upgrade_handler.go +++ b/app/upgrade_handler.go @@ -15,6 +15,7 @@ import ( v2_7 "github.com/terra-money/core/v2/app/upgrades/v2.7" v2_8 "github.com/terra-money/core/v2/app/upgrades/v2.8" v2_9 "github.com/terra-money/core/v2/app/upgrades/v2.9" + feeburntypes "github.com/terra-money/core/v2/x/feeburn/types" feesharetypes "github.com/terra-money/core/v2/x/feeshare/types" tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types" @@ -143,5 +144,12 @@ func (app *TerraApp) RegisterUpgradeStores() { }, } app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } else if upgradeInfo.Name == terraappconfig.Upgrade2_9 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + Added: []string{ + feeburntypes.StoreKey, + }, + } + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } } diff --git a/integration-tests/package-lock.json b/integration-tests/package-lock.json index bfcffad7..95aa77bd 100644 --- a/integration-tests/package-lock.json +++ b/integration-tests/package-lock.json @@ -9,7 +9,7 @@ "version": "v2.9.0", "license": "MIT", "dependencies": { - "@terra-money/feather.js": "^2.0.0-beta.14", + "@terra-money/feather.js": "^2.0.0-beta.15", "moment": "^2.29.4" }, "devDependencies": { @@ -1802,9 +1802,9 @@ } }, "node_modules/@terra-money/feather.js": { - "version": "2.0.0-beta.14", - "resolved": "https://registry.npmjs.org/@terra-money/feather.js/-/feather.js-2.0.0-beta.14.tgz", - "integrity": "sha512-imb/Pi6Y3+8lAiLODAYU0PQ5Pygugc3QLrf1wpL8VsQFKu8sJAFsL4k/UUGnR0h0iR3GSAtq+kebcX8NwxhsJA==", + "version": "2.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@terra-money/feather.js/-/feather.js-2.0.0-beta.15.tgz", + "integrity": "sha512-EDCGUAbIRedk8233gwshE1DF8nRtV7SUF390vDsAwozuRGHSXtZzDzB8SkdHlF8tDOz3ZEj/99aCuUVy2k5MiQ==", "dependencies": { "@ethersproject/bytes": "^5.7.0", "@terra-money/legacy.proto": "npm:@terra-money/terra.proto@^0.1.7", @@ -7007,9 +7007,9 @@ } }, "@terra-money/feather.js": { - "version": "2.0.0-beta.14", - "resolved": "https://registry.npmjs.org/@terra-money/feather.js/-/feather.js-2.0.0-beta.14.tgz", - "integrity": "sha512-imb/Pi6Y3+8lAiLODAYU0PQ5Pygugc3QLrf1wpL8VsQFKu8sJAFsL4k/UUGnR0h0iR3GSAtq+kebcX8NwxhsJA==", + "version": "2.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@terra-money/feather.js/-/feather.js-2.0.0-beta.15.tgz", + "integrity": "sha512-EDCGUAbIRedk8233gwshE1DF8nRtV7SUF390vDsAwozuRGHSXtZzDzB8SkdHlF8tDOz3ZEj/99aCuUVy2k5MiQ==", "requires": { "@ethersproject/bytes": "^5.7.0", "@terra-money/legacy.proto": "npm:@terra-money/terra.proto@^0.1.7", diff --git a/integration-tests/package.json b/integration-tests/package.json index d2acc023..b3812a75 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -35,7 +35,7 @@ "typescript": "^5.2.2" }, "dependencies": { - "@terra-money/feather.js": "^2.0.0-beta.14", + "@terra-money/feather.js": "^2.0.0-beta.15", "moment": "^2.29.4" } } diff --git a/integration-tests/src/helpers/lcd.connection.ts b/integration-tests/src/helpers/lcd.connection.ts index b228bc7f..74f5409e 100644 --- a/integration-tests/src/helpers/lcd.connection.ts +++ b/integration-tests/src/helpers/lcd.connection.ts @@ -6,8 +6,8 @@ export function getLCDClient() { "test-1": { lcd: "http://localhost:1316", chainID: "test-1", - gasPrices: "0.15uluna", - gasAdjustment: 1.5, + gasPrices: "0.015uluna", + gasAdjustment: 1.75, prefix: "terra" } }), @@ -15,8 +15,8 @@ export function getLCDClient() { "test-2": { lcd: "http://localhost:1317", chainID: "test-2", - gasPrices: "0.15uluna", - gasAdjustment: 1.5, + gasPrices: "0.015uluna", + gasAdjustment: 1.75, prefix: "terra" } }) diff --git a/integration-tests/src/modules/pob/pob.test.ts b/integration-tests/src/modules/pob/pob.test.ts index f99ae5bc..4d8717c8 100644 --- a/integration-tests/src/modules/pob/pob.test.ts +++ b/integration-tests/src/modules/pob/pob.test.ts @@ -54,7 +54,7 @@ describe("Proposer Builder Module (https://github.com/skip-mev/pob) ", () => { chainID: "test-1", accountNumber: accInfo.getAccountNumber(), sequence: accInfo.getSequenceNumber() + 1, - fee: new Fee(100000, new Coins({ uluna: 100000 })), + fee: new Fee(100000, new Coins({ uluna: 5000 })), timeoutHeight: parseInt(blockHeight) + 20, }); @@ -71,7 +71,7 @@ describe("Proposer Builder Module (https://github.com/skip-mev/pob) ", () => { chainID: "test-1", accountNumber: accInfo.getAccountNumber(), sequence: accInfo.getSequenceNumber(), - fee: new Fee(100000, new Coins({ uluna: 100000 })), + fee: new Fee(100000, new Coins({ uluna: 5000 })), timeoutHeight: parseInt(blockHeight) + 20, }); @@ -83,18 +83,19 @@ describe("Proposer Builder Module (https://github.com/skip-mev/pob) ", () => { let buildTx = await wallet11.createAndSignTx({ msgs: [MsgAuctionBid.fromData({ "@type": "/pob.builder.v1.MsgAuctionBid", - bid: { amount: "100000", denom: "uluna" }, + bid: { amount: "120000", denom: "uluna" }, bidder: accounts.pobMnemonic1.accAddress("terra"), transactions: [secondSignedSendTx.toBytes(), firstSignedSendTx.toBytes()] })], memo: "Build block", chainID: "test-1", - fee: new Fee(100000, new Coins({ uluna: 100000 })), + fee: new Fee(125000, new Coins({ uluna: 10000 })), timeoutHeight: parseInt(blockHeight) + 20, }); const result = await LCD.chain1.tx.broadcastSync(buildTx, "test-1"); await blockInclusion(); const txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1"); + console.log(JSON.stringify(txResult)) expect(txResult.logs).toBeDefined(); // Recover the transactions hashes from the bundled transactions // to query the respective transaction data and check there are two diff --git a/integration-tests/src/teardown.ts b/integration-tests/src/teardown.ts index fe0fa714..63c7e23d 100644 --- a/integration-tests/src/teardown.ts +++ b/integration-tests/src/teardown.ts @@ -2,14 +2,8 @@ import { execSync } from 'child_process'; import path from 'path'; module.exports = async () => { - try { - const pathToDataDir = path.join(__dirname, "/test-data"); - execSync("pkill relayer") - execSync("pkill terrad") - execSync("pkill terrad") - execSync(`rm -r ${pathToDataDir}`) - } - catch (e) { - console.log(e) - } + const pathToDataDir = path.join(__dirname, "/test-data"); + execSync("pkill relayer") + execSync("pkill terrad") + execSync(`rm -r ${pathToDataDir}`) } \ No newline at end of file diff --git a/proto/terra/feeburn/v1/events.proto b/proto/terra/feeburn/v1/events.proto new file mode 100644 index 00000000..349297ad --- /dev/null +++ b/proto/terra/feeburn/v1/events.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package terra.feeburn.v1; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/terra-money/core/v2/x/feeburn/types"; + +// Event fired when fees are burned with the amount of fees burned +message FeeBurnEvent { + // Amount of the payout + repeated cosmos.base.v1beta1.Coin fees_burn = 1 [ + (gogoproto.nullable) = false + ]; +} diff --git a/proto/terra/feeburn/v1/genesis.proto b/proto/terra/feeburn/v1/genesis.proto new file mode 100644 index 00000000..0d059512 --- /dev/null +++ b/proto/terra/feeburn/v1/genesis.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package terra.feeburn.v1; + +import "terra/feeburn/v1/params.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/terra-money/core/v2/x/feeburn/types"; + +// GenesisState defines the feeburn module's genesis state. +message GenesisState { + // params defines the paramaters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/terra/feeburn/v1/params.proto b/proto/terra/feeburn/v1/params.proto new file mode 100644 index 00000000..a710ac23 --- /dev/null +++ b/proto/terra/feeburn/v1/params.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package terra.feeburn.v1; + +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/terra-money/core/v2/x/feeburn/types"; + +// Params defines the parameters for the feeburn module +message Params { + bool enable_fee_burn = 1; +} diff --git a/proto/terra/feeburn/v1/query.proto b/proto/terra/feeburn/v1/query.proto new file mode 100644 index 00000000..432a3a62 --- /dev/null +++ b/proto/terra/feeburn/v1/query.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package terra.feeburn.v1; + +import "terra/feeburn/v1/params.proto"; +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/terra-money/core/v2/x/feeburn/types"; + +// Query defines the gRPC querier service. +service Query { + // Params retrieves the FeeShare module params + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/terra/feeburn/v1/params"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params is the returned FeeShare parameter + Params params = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/terra/feeburn/v1/tx.proto b/proto/terra/feeburn/v1/tx.proto new file mode 100644 index 00000000..033c9c14 --- /dev/null +++ b/proto/terra/feeburn/v1/tx.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package terra.feeburn.v1; + +import "cosmos_proto/cosmos.proto"; +import "google/api/annotations.proto"; +import "terra/feeburn/v1/params.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; + +option go_package = "github.com/terra-money/core/v2/x/feeburn/types"; + +// Msg defines the fees burn service. +service Msg { + // Update the params of the module through gov v1 type. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +// Since: terra v2.9.0 +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/feeshare parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: terra v2.9.0 +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/x/feeburn/client/cli/query.go b/x/feeburn/client/cli/query.go new file mode 100644 index 00000000..58f2e9c1 --- /dev/null +++ b/x/feeburn/client/cli/query.go @@ -0,0 +1,57 @@ +package cli + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + + "github.com/terra-money/core/v2/x/feeburn/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd() *cobra.Command { + // Group tokenfactory queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + GetParams(), + ) + + return cmd +} + +// GetParams returns the params for the module +func GetParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params [flags]", + Short: "Get the params for the x/feeburn module", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/feeburn/keeper/genesis.go b/x/feeburn/keeper/genesis.go new file mode 100644 index 00000000..9c17fbc3 --- /dev/null +++ b/x/feeburn/keeper/genesis.go @@ -0,0 +1,21 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/terra-money/core/v2/x/feeburn/types" +) + +// InitGenesis import module genesis +func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) { + if err := k.SetParams(ctx, data.Params); err != nil { + panic(err) + } +} + +// ExportGenesis export module state +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + return &types.GenesisState{ + Params: k.GetParams(ctx), + } +} diff --git a/x/feeburn/keeper/grpc_query.go b/x/feeburn/keeper/grpc_query.go new file mode 100644 index 00000000..49e7e483 --- /dev/null +++ b/x/feeburn/keeper/grpc_query.go @@ -0,0 +1,28 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/terra-money/core/v2/x/feeburn/types" +) + +var _ types.QueryServer = Querier{} + +// Querier defines a wrapper around the x/feeburn +// keeper providing gRPC method handlers. +type Querier struct { + Keeper +} + +func NewQuerier(k Keeper) Querier { + return Querier{Keeper: k} +} + +// Params returns the fees module params +func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := q.GetParams(ctx) + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/feeburn/keeper/keeper.go b/x/feeburn/keeper/keeper.go new file mode 100644 index 00000000..d6b732ee --- /dev/null +++ b/x/feeburn/keeper/keeper.go @@ -0,0 +1,39 @@ +package keeper + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/codec" + + "github.com/cometbft/cometbft/libs/log" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/terra-money/core/v2/x/tokenfactory/types" +) + +type Keeper struct { + storeKey storetypes.StoreKey + cdc codec.BinaryCodec + authority string +} + +// NewKeeper returns a new instance of the x/tokenfactory keeper +func NewKeeper(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, authority string) Keeper { + + return Keeper{ + storeKey: storeKey, + cdc: cdc, + authority: authority, + } +} + +// Logger returns a logger for the x/tokenfactory module +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/feeburn/keeper/msg_server.go b/x/feeburn/keeper/msg_server.go new file mode 100644 index 00000000..7a3d5193 --- /dev/null +++ b/x/feeburn/keeper/msg_server.go @@ -0,0 +1,39 @@ +package keeper + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/terra-money/core/v2/x/feeburn/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + var _ authtypes.ModuleAccountI + + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (m msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if m.Keeper.GetAuthority() != msg.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", m.GetAuthority(), msg.Authority) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + if err := m.SetParams(sdkCtx, msg.Params); err != nil { + return nil, err + } + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/feeburn/keeper/params.go b/x/feeburn/keeper/params.go new file mode 100644 index 00000000..e74b4392 --- /dev/null +++ b/x/feeburn/keeper/params.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "github.com/terra-money/core/v2/x/feeburn/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams returns the total set params. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams sets the total set of params. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/feeburn/module.go b/x/feeburn/module.go new file mode 100644 index 00000000..8fbbef4e --- /dev/null +++ b/x/feeburn/module.go @@ -0,0 +1,171 @@ +package feeburn + +import ( + "context" + "encoding/json" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/terra-money/core/v2/x/feeburn/client/cli" + "github.com/terra-money/core/v2/x/feeburn/keeper" + "github.com/terra-money/core/v2/x/feeburn/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct{} + +func NewAppModuleBasic() AppModuleBasic { + return AppModuleBasic{} +} + +// Name returns the x/feeburn module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the x/feeburn module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the x/feeburn module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + /* #nosec */ + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) //nolint:errcheck +} + +// GetTxCmd returns the x/tokenfactory module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return nil +} + +// GetQueryCmd returns the x/feeburn module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +func NewAppModule(keeper keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(), + keeper: keeper, + } +} + +// Name returns the x/feeburn module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// QuerierRoute returns the x/feeburn module's query routing key. +func (AppModule) QuerierRoute() string { return types.RouterKey } + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper)) +} + +// RegisterInvariants registers the x/feeburn module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the x/feeburn module's genesis initialization. It +// returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + cdc.MustUnmarshalJSON(gs, &genState) + + am.keeper.InitGenesis(ctx, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the x/feeburn module's exported genesis state as raw +// JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 3 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the feeburn module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the feeburn module. It +// returns no validator updates. +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} + +// ___________________________________________________________________________ + +// AppModuleSimulation functions + +// GenerateGenesisState creates a randomized GenState of the fees module. +func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { +} + +// ProposalContents returns content functions for governance proposals. +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{} +} + +// RegisterStoreDecoder registers a decoder for fees module's types. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { +} + +// WeightedOperations returns fees module weighted operations +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { + return []simtypes.WeightedOperation{} +} diff --git a/x/feeburn/post/expected_keepers.go b/x/feeburn/post/expected_keepers.go new file mode 100644 index 00000000..1d6dcc39 --- /dev/null +++ b/x/feeburn/post/expected_keepers.go @@ -0,0 +1,15 @@ +package post + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/terra-money/core/v2/x/feeburn/types" +) + +// Define the expected keeper interface +type BankKeeper interface { + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error +} + +type FeeBurnKeeper interface { + GetParams(ctx sdk.Context) types.Params +} diff --git a/x/feeburn/post/post.go b/x/feeburn/post/post.go new file mode 100644 index 00000000..b63fe446 --- /dev/null +++ b/x/feeburn/post/post.go @@ -0,0 +1,93 @@ +package post + +import ( + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/terra-money/core/v2/x/feeburn/types" +) + +type FeeBurnDecorator struct { + feeBurnKeeper FeeBurnKeeper + bankkeeper BankKeeper +} + +func NewFeeBurnDecorator(feeBurnKeeper FeeBurnKeeper, bankkeeper BankKeeper) FeeBurnDecorator { + return FeeBurnDecorator{feeBurnKeeper, bankkeeper} +} + +func (bd FeeBurnDecorator) PostHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, success bool, next sdk.PostHandler) (newCtx sdk.Context, err error) { + // if the feeburn is not enabled then just continue with the next decorator + if !bd.feeBurnKeeper.GetParams(ctx).EnableFeeBurn { + return next(ctx, tx, simulate, success) + } + + // Parse sdk.Tx to sdk.FeeTx that way we can get the information + // about the transaction fees and the fee payer. + feeTx, ok := tx.(sdk.FeeTx) + if !ok { + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + } + + // Get the fees and check if these fees are zero, + // when fees are zero continue with the next decorator + // because there is nothing to burn + txFees := feeTx.GetFee() + if txFees.IsZero() { + return next(ctx, tx, simulate, success) + } + + // Give the gas meter, we can calculate how much gas to refund to the user + // when the Gas Limit is set to zero it means that it's infinite and we + // will not refund anything to the user: + // README: https://docs.cosmos.network/main/learn/beginner/gas-fees#gas-meter + gasMeter := ctx.GasMeter() + if gasMeter.Limit() == 0 { + return next(ctx, tx, simulate, success) + } + gasLimit := math.LegacyNewDecFromInt(sdk.NewInt(int64(gasMeter.Limit()))) + remainingGas := math.LegacyNewDecFromInt(sdk.NewInt(int64(gasMeter.GasRemaining()))) + + var toBurn sdk.Coins + // Iterate over the transaction fees and calculate the proportional part + // of the unused fees denominated in the tokens used to pay fo the fees + // and add it to the toBurn variable that will be sent to the user. + for _, txFee := range txFees { + // Percentage of unused gas for this specific denom + remainingGasProportion := remainingGas.Quo(gasLimit) + + // Given the percentage of unused gas, calculate the + // proportional part of the fees that will be refunded + // to the user in this specific denom. + unusedFees := math.LegacyNewDecFromInt(txFee.Amount). + Mul(remainingGasProportion). + TruncateInt() + + // When the unused fees are positive it means that the user + // will receive a refund in this specific denom to its wallet. + if unusedFees.IsPositive() { + toBurn = append(toBurn, sdk.NewCoin(txFee.Denom, unusedFees)) + } + } + if toBurn.IsZero() { + return next(ctx, tx, simulate, success) + } + + // Execute the refund to the user, if there is an error + // return the error otherwise continue with the execution + err = bd.bankkeeper.BurnCoins(ctx, authtypes.FeeCollectorName, toBurn) + if err != nil { + return ctx, err + } + + err = ctx.EventManager().EmitTypedEvent( + &types.FeeBurnEvent{FeesBurn: toBurn}, + ) + if err != nil { + return ctx, err + } + + return next(ctx, tx, simulate, success) +} diff --git a/x/feeburn/types/codec.go b/x/feeburn/types/codec.go new file mode 100644 index 00000000..264ac957 --- /dev/null +++ b/x/feeburn/types/codec.go @@ -0,0 +1,38 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + AminoCdc = codec.NewAminoCodec(amino) +) + +const ( + // Amino names + updateFeeBurnParams = "terra/feeburn/MsgUpdateParams" +) + +func init() { + RegisterLegacyAminoCodec(amino) + + sdk.RegisterLegacyAminoCodec(amino) +} + +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, updateFeeBurnParams, nil) +} diff --git a/x/feeburn/types/events.pb.go b/x/feeburn/types/events.pb.go new file mode 100644 index 00000000..16e52fc2 --- /dev/null +++ b/x/feeburn/types/events.pb.go @@ -0,0 +1,334 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/feeburn/v1/events.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Event fired when fees are burned with the amount of fees burned +type FeeBurnEvent struct { + // Amount of the payout + FeesBurn []types.Coin `protobuf:"bytes,1,rep,name=fees_burn,json=feesBurn,proto3" json:"fees_burn"` +} + +func (m *FeeBurnEvent) Reset() { *m = FeeBurnEvent{} } +func (m *FeeBurnEvent) String() string { return proto.CompactTextString(m) } +func (*FeeBurnEvent) ProtoMessage() {} +func (*FeeBurnEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c4b84def882b33, []int{0} +} +func (m *FeeBurnEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FeeBurnEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FeeBurnEvent.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 *FeeBurnEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_FeeBurnEvent.Merge(m, src) +} +func (m *FeeBurnEvent) XXX_Size() int { + return m.Size() +} +func (m *FeeBurnEvent) XXX_DiscardUnknown() { + xxx_messageInfo_FeeBurnEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_FeeBurnEvent proto.InternalMessageInfo + +func (m *FeeBurnEvent) GetFeesBurn() []types.Coin { + if m != nil { + return m.FeesBurn + } + return nil +} + +func init() { + proto.RegisterType((*FeeBurnEvent)(nil), "terra.feeburn.v1.FeeBurnEvent") +} + +func init() { proto.RegisterFile("terra/feeburn/v1/events.proto", fileDescriptor_f6c4b84def882b33) } + +var fileDescriptor_f6c4b84def882b33 = []byte{ + // 235 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0xcf, 0x31, 0x4b, 0xc4, 0x30, + 0x14, 0x07, 0xf0, 0x16, 0x45, 0xb4, 0x3a, 0xc8, 0xe1, 0xa0, 0x07, 0x46, 0x71, 0x72, 0xf1, 0x3d, + 0x72, 0xae, 0x4e, 0x15, 0xc5, 0xc1, 0xc9, 0xd1, 0x45, 0x9a, 0xf0, 0xae, 0x76, 0x68, 0xde, 0x91, + 0xa4, 0xc1, 0xfb, 0x16, 0x7e, 0xac, 0x1b, 0x6f, 0x74, 0x12, 0x69, 0xbf, 0x88, 0x24, 0x2d, 0xb7, + 0x3d, 0xf2, 0xe7, 0xff, 0xe3, 0x9f, 0xe2, 0xd2, 0x93, 0xb5, 0x15, 0x2e, 0x89, 0x54, 0x67, 0x0d, + 0x06, 0x89, 0x14, 0xc8, 0x78, 0x07, 0x2b, 0xcb, 0x9e, 0x67, 0xa7, 0x29, 0x86, 0x29, 0x86, 0x20, + 0xe7, 0x42, 0xb3, 0x6b, 0xd9, 0xa1, 0xaa, 0x1c, 0x61, 0x90, 0x8a, 0x7c, 0x25, 0x51, 0x73, 0x63, + 0xc6, 0xc6, 0xfc, 0xac, 0xe6, 0x9a, 0xd3, 0x89, 0xf1, 0x1a, 0x5f, 0x6f, 0x5e, 0x8b, 0x93, 0x67, + 0xa2, 0xb2, 0xb3, 0xe6, 0x29, 0xf2, 0xb3, 0x87, 0xe2, 0x68, 0x49, 0xe4, 0x3e, 0xa2, 0x7a, 0x9e, + 0x5f, 0xef, 0xdd, 0x1e, 0x2f, 0x2e, 0x60, 0x94, 0x21, 0xca, 0x30, 0xc9, 0xf0, 0xc8, 0x8d, 0x29, + 0xf7, 0x37, 0xbf, 0x57, 0xd9, 0xdb, 0x61, 0x6c, 0x44, 0xa2, 0x7c, 0xd9, 0xf4, 0x22, 0xdf, 0xf6, + 0x22, 0xff, 0xeb, 0x45, 0xfe, 0x3d, 0x88, 0x6c, 0x3b, 0x88, 0xec, 0x67, 0x10, 0xd9, 0x3b, 0xd4, + 0x8d, 0xff, 0xec, 0x14, 0x68, 0x6e, 0x31, 0x4d, 0xbf, 0x6b, 0xd9, 0xd0, 0x1a, 0x35, 0x5b, 0xc2, + 0xb0, 0xc0, 0xaf, 0xdd, 0x4f, 0xfd, 0x7a, 0x45, 0x4e, 0x1d, 0xa4, 0x79, 0xf7, 0xff, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xbb, 0x3e, 0xfd, 0xb8, 0x07, 0x01, 0x00, 0x00, +} + +func (m *FeeBurnEvent) 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 *FeeBurnEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FeeBurnEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FeesBurn) > 0 { + for iNdEx := len(m.FeesBurn) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeesBurn[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *FeeBurnEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.FeesBurn) > 0 { + for _, e := range m.FeesBurn { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *FeeBurnEvent) 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 ErrIntOverflowEvents + } + 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: FeeBurnEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FeeBurnEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeesBurn", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeesBurn = append(m.FeesBurn, types.Coin{}) + if err := m.FeesBurn[len(m.FeesBurn)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(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, ErrIntOverflowEvents + } + 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, ErrIntOverflowEvents + } + 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, ErrIntOverflowEvents + } + 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, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/feeburn/types/genesis.go b/x/feeburn/types/genesis.go new file mode 100644 index 00000000..52ba6316 --- /dev/null +++ b/x/feeburn/types/genesis.go @@ -0,0 +1,21 @@ +package types + +// NewGenesisState creates a new genesis state. +func NewGenesisState(params Params) GenesisState { + return GenesisState{ + Params: params, + } +} + +// DefaultGenesis sets default feeburn genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return gs.Params.Validate() +} diff --git a/x/feeburn/types/genesis.pb.go b/x/feeburn/types/genesis.pb.go new file mode 100644 index 00000000..fafefb97 --- /dev/null +++ b/x/feeburn/types/genesis.pb.go @@ -0,0 +1,322 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/feeburn/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the feeburn module's genesis state. +type GenesisState struct { + // params defines the paramaters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_90d5cfa8b221d60b, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "terra.feeburn.v1.GenesisState") +} + +func init() { proto.RegisterFile("terra/feeburn/v1/genesis.proto", fileDescriptor_90d5cfa8b221d60b) } + +var fileDescriptor_90d5cfa8b221d60b = []byte{ + // 203 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x49, 0x2d, 0x2a, + 0x4a, 0xd4, 0x4f, 0x4b, 0x4d, 0x4d, 0x2a, 0x2d, 0xca, 0xd3, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, + 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0xcb, 0xeb, 0x41, + 0xe5, 0xf5, 0xca, 0x0c, 0xa5, 0x64, 0x31, 0x74, 0x14, 0x24, 0x16, 0x25, 0xe6, 0x42, 0x35, 0x48, + 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x99, 0xfa, 0x20, 0x16, 0x44, 0x54, 0xc9, 0x8d, 0x8b, 0xc7, + 0x1d, 0x62, 0x6e, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x19, 0x17, 0x1b, 0x44, 0x97, 0x04, 0xa3, + 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x84, 0x1e, 0xba, 0x3d, 0x7a, 0x01, 0x60, 0x79, 0x27, 0x96, 0x13, + 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0xaa, 0x9d, 0x3c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, + 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, + 0x8e, 0x21, 0x4a, 0x2f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x6c, + 0x96, 0x6e, 0x6e, 0x7e, 0x5e, 0x6a, 0xa5, 0x7e, 0x72, 0x7e, 0x51, 0xaa, 0x7e, 0x99, 0x91, 0x7e, + 0x05, 0xdc, 0xc5, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x87, 0x19, 0x03, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x2a, 0x45, 0x23, 0x17, 0x01, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/feeburn/types/keys.go b/x/feeburn/types/keys.go new file mode 100644 index 00000000..50f35f9c --- /dev/null +++ b/x/feeburn/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // module name + ModuleName = "feeburn" + + // StoreKey to be used when creating the KVStore + StoreKey = ModuleName + + // RouterKey to be used for message routing + RouterKey = ModuleName +) + +// prefix bytes for the fees persistent store +const prefixParams = 1 + +// KVStore key prefixes +var ( + ParamsKey = []byte{prefixParams} +) diff --git a/x/feeburn/types/msg.go b/x/feeburn/types/msg.go new file mode 100644 index 00000000..daa29335 --- /dev/null +++ b/x/feeburn/types/msg.go @@ -0,0 +1,29 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + return m.Params.Validate() +} diff --git a/x/feeburn/types/params.go b/x/feeburn/types/params.go new file mode 100644 index 00000000..238f2565 --- /dev/null +++ b/x/feeburn/types/params.go @@ -0,0 +1,33 @@ +package types + +import ( + "fmt" +) + +// NewParams creates a new Params object +func NewParams(enableFeeBurn bool) Params { + return Params{ + EnableFeeBurn: enableFeeBurn, + } +} + +func DefaultParams() Params { + return Params{ + EnableFeeBurn: true, + } +} +func (p Params) Validate() error { + if err := validateBool(p.EnableFeeBurn); err != nil { + return err + } + return nil +} + +func validateBool(i interface{}) error { + _, ok := i.(bool) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + return nil +} diff --git a/x/feeburn/types/params.pb.go b/x/feeburn/types/params.pb.go new file mode 100644 index 00000000..15c72d8d --- /dev/null +++ b/x/feeburn/types/params.pb.go @@ -0,0 +1,309 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/feeburn/v1/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the feeburn module +type Params struct { + EnableFeeBurn bool `protobuf:"varint,1,opt,name=enable_fee_burn,json=enableFeeBurn,proto3" json:"enable_fee_burn,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_3a15896888eb6594, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetEnableFeeBurn() bool { + if m != nil { + return m.EnableFeeBurn + } + return false +} + +func init() { + proto.RegisterType((*Params)(nil), "terra.feeburn.v1.Params") +} + +func init() { proto.RegisterFile("terra/feeburn/v1/params.proto", fileDescriptor_3a15896888eb6594) } + +var fileDescriptor_3a15896888eb6594 = []byte{ + // 193 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0x49, 0x2d, 0x2a, + 0x4a, 0xd4, 0x4f, 0x4b, 0x4d, 0x4d, 0x2a, 0x2d, 0xca, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x2c, + 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0x4b, 0xeb, 0x41, 0xa5, + 0xf5, 0xca, 0x0c, 0xa5, 0x24, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xe3, 0xc1, 0xf2, 0xfa, 0x10, + 0x0e, 0x44, 0xb1, 0x92, 0x01, 0x17, 0x5b, 0x00, 0x58, 0xb3, 0x90, 0x1a, 0x17, 0x7f, 0x6a, 0x5e, + 0x62, 0x52, 0x4e, 0x6a, 0x7c, 0x5a, 0x6a, 0x6a, 0x3c, 0x48, 0xab, 0x04, 0xa3, 0x02, 0xa3, 0x06, + 0x47, 0x10, 0x2f, 0x44, 0xd8, 0x2d, 0x35, 0xd5, 0xa9, 0xb4, 0x28, 0xcf, 0xc9, 0xe3, 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, 0xf4, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, + 0x92, 0xf3, 0x73, 0xf5, 0xc1, 0x6e, 0xd0, 0xcd, 0xcd, 0xcf, 0x4b, 0xad, 0xd4, 0x4f, 0xce, 0x2f, + 0x4a, 0xd5, 0x2f, 0x33, 0xd2, 0xaf, 0x80, 0x3b, 0xb9, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, + 0xec, 0x04, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xbd, 0x53, 0xa9, 0xd0, 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 + if m.EnableFeeBurn { + i-- + if m.EnableFeeBurn { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EnableFeeBurn { + n += 2 + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableFeeBurn", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableFeeBurn = bool(v != 0) + 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/feeburn/types/query.pb.go b/x/feeburn/types/query.pb.go new file mode 100644 index 00000000..9c79d168 --- /dev/null +++ b/x/feeburn/types/query.pb.go @@ -0,0 +1,535 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/feeburn/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1611ccec56a9c46c, []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 is the returned FeeShare parameter + 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_1611ccec56a9c46c, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "terra.feeburn.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "terra.feeburn.v1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("terra/feeburn/v1/query.proto", fileDescriptor_1611ccec56a9c46c) } + +var fileDescriptor_1611ccec56a9c46c = []byte{ + // 281 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x49, 0x2d, 0x2a, + 0x4a, 0xd4, 0x4f, 0x4b, 0x4d, 0x4d, 0x2a, 0x2d, 0xca, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, + 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0xcb, 0xea, 0x41, 0x65, 0xf5, + 0xca, 0x0c, 0xa5, 0x64, 0x31, 0xd4, 0x17, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x43, 0x34, 0x48, 0xc9, + 0xa4, 0xe7, 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, + 0x24, 0x96, 0x64, 0xe6, 0xe7, 0xc1, 0x64, 0x45, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4c, 0x7d, 0x10, + 0x0b, 0x22, 0xaa, 0x24, 0xc2, 0x25, 0x14, 0x08, 0xb2, 0x33, 0x00, 0x6c, 0x50, 0x50, 0x6a, 0x61, + 0x69, 0x6a, 0x71, 0x89, 0x92, 0x2f, 0x97, 0x30, 0x8a, 0x68, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, + 0x90, 0x19, 0x17, 0x1b, 0xc4, 0x42, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x09, 0x3d, 0x74, + 0x27, 0xea, 0x41, 0x74, 0x38, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, 0x6d, 0xd4, 0xc0, + 0xc8, 0xc5, 0x0a, 0x36, 0x4f, 0xa8, 0x9c, 0x8b, 0x0d, 0xa2, 0x42, 0x48, 0x05, 0x53, 0x2f, 0xa6, + 0x43, 0xa4, 0x54, 0x09, 0xa8, 0x82, 0x38, 0x4c, 0x49, 0xa1, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x52, + 0x42, 0x12, 0xfa, 0x38, 0x42, 0xc8, 0xc9, 0xe3, 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, 0xf4, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0x21, 0xba, 0x75, + 0x73, 0xf3, 0xf3, 0x52, 0x2b, 0xf5, 0x93, 0xf3, 0x8b, 0x52, 0xf5, 0xcb, 0x8c, 0xf4, 0x2b, 0xe0, + 0xa6, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x03, 0xce, 0x18, 0x10, 0x00, 0x00, 0xff, + 0xff, 0x61, 0x1f, 0x41, 0xde, 0xbd, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Params retrieves the FeeShare module params + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/terra.feeburn.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params retrieves the FeeShare module params + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.feeburn.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) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "terra.feeburn.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "terra/feeburn/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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/feeburn/types/query.pb.gw.go b/x/feeburn/types/query.pb.gw.go new file mode 100644 index 00000000..f4821ee8 --- /dev/null +++ b/x/feeburn/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: terra/feeburn/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 + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"terra", "feeburn", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/feeburn/types/tx.pb.go b/x/feeburn/types/tx.pb.go new file mode 100644 index 00000000..2e1579e6 --- /dev/null +++ b/x/feeburn/types/tx.pb.go @@ -0,0 +1,599 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/feeburn/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "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 + +// MsgUpdateParams is the Msg/UpdateParams request type. +// Since: terra v2.9.0 +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/feeshare parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_03c516264e456cb4, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: terra v2.9.0 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_03c516264e456cb4, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "terra.feeburn.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "terra.feeburn.v1.MsgUpdateParamsResponse") +} + +func init() { proto.RegisterFile("terra/feeburn/v1/tx.proto", fileDescriptor_03c516264e456cb4) } + +var fileDescriptor_03c516264e456cb4 = []byte{ + // 343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xb1, 0x4e, 0x02, 0x31, + 0x1c, 0xc6, 0xaf, 0x6a, 0x48, 0xa8, 0x46, 0xcd, 0x85, 0x84, 0x83, 0xe8, 0x89, 0x4c, 0x68, 0x42, + 0x1b, 0x30, 0x61, 0x70, 0x93, 0xc9, 0x85, 0xc4, 0x60, 0x5c, 0x8c, 0x89, 0x29, 0x47, 0x2d, 0x97, + 0x78, 0xfd, 0x5f, 0xda, 0x42, 0x60, 0xf5, 0x09, 0xf4, 0x4d, 0x1c, 0x7c, 0x08, 0x46, 0xe2, 0xe4, + 0x64, 0x0c, 0x0c, 0xbe, 0x86, 0xe1, 0x7a, 0x48, 0x84, 0xc1, 0xad, 0xed, 0xef, 0xeb, 0xf7, 0x7d, + 0xed, 0x1f, 0x17, 0x0c, 0x57, 0x8a, 0xd1, 0x07, 0xce, 0x3b, 0x7d, 0x25, 0xe9, 0xa0, 0x46, 0xcd, + 0x90, 0xc4, 0x0a, 0x0c, 0xb8, 0xfb, 0x09, 0x22, 0x29, 0x22, 0x83, 0x5a, 0xb1, 0x10, 0x80, 0x8e, + 0x40, 0xdf, 0x27, 0x9c, 0xda, 0x8d, 0x15, 0x17, 0x0f, 0x04, 0x80, 0x78, 0xe4, 0x94, 0xc5, 0x21, + 0x65, 0x52, 0x82, 0x61, 0x26, 0x04, 0xb9, 0xa0, 0x87, 0x6b, 0x29, 0x31, 0x53, 0x2c, 0x5a, 0xe0, + 0x9c, 0x00, 0x01, 0xd6, 0x74, 0xbe, 0x4a, 0x4f, 0xf3, 0x36, 0x80, 0x46, 0x5a, 0xcc, 0x6f, 0x44, + 0x5a, 0x58, 0x50, 0x7e, 0x41, 0x78, 0xaf, 0xa5, 0xc5, 0x4d, 0xdc, 0x65, 0x86, 0x5f, 0x25, 0x46, + 0x6e, 0x03, 0x67, 0x59, 0xdf, 0xf4, 0x40, 0x85, 0x66, 0xe4, 0xa1, 0x12, 0xaa, 0x64, 0x9b, 0xde, + 0xfb, 0x5b, 0x35, 0x97, 0x96, 0xbc, 0xe8, 0x76, 0x15, 0xd7, 0xfa, 0xda, 0xa8, 0x50, 0x8a, 0xf6, + 0x52, 0xea, 0x36, 0x70, 0xc6, 0x56, 0xf1, 0x36, 0x4a, 0xa8, 0xb2, 0x5d, 0xf7, 0xc8, 0xea, 0xab, + 0x89, 0x4d, 0x68, 0x6e, 0x8d, 0x3f, 0x8f, 0x9c, 0x76, 0xaa, 0x3e, 0xdf, 0x7d, 0xfa, 0x7e, 0x3d, + 0x5d, 0xfa, 0x94, 0x0b, 0x38, 0xbf, 0x52, 0xa9, 0xcd, 0x75, 0x0c, 0x52, 0xf3, 0x7a, 0x80, 0x37, + 0x5b, 0x5a, 0xb8, 0x77, 0x78, 0xe7, 0x4f, 0xe3, 0xe3, 0xf5, 0xa4, 0x15, 0x87, 0xe2, 0xc9, 0xbf, + 0x92, 0x45, 0x48, 0xf3, 0x72, 0x3c, 0xf5, 0xd1, 0x64, 0xea, 0xa3, 0xaf, 0xa9, 0x8f, 0x9e, 0x67, + 0xbe, 0x33, 0x99, 0xf9, 0xce, 0xc7, 0xcc, 0x77, 0x6e, 0x89, 0x08, 0x4d, 0xaf, 0xdf, 0x21, 0x01, + 0x44, 0x34, 0xb1, 0xab, 0x46, 0x20, 0xf9, 0x88, 0x06, 0xa0, 0x38, 0x1d, 0xd4, 0xe9, 0xf0, 0x77, + 0x2c, 0x66, 0x14, 0x73, 0xdd, 0xc9, 0x24, 0x9f, 0x7c, 0xf6, 0x13, 0x00, 0x00, 0xff, 0xff, 0x02, + 0x2d, 0x31, 0xec, 0x1a, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // Update the params of the module through gov v1 type. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/terra.feeburn.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // Update the params of the module through gov v1 type. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.feeburn.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "terra.feeburn.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "terra/feeburn/v1/tx.proto", +} + +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/feeshare/post/expected_keepers.go b/x/feeshare/post/expected_keepers.go index 36e3428a..7eeb2676 100644 --- a/x/feeshare/post/expected_keepers.go +++ b/x/feeshare/post/expected_keepers.go @@ -11,6 +11,7 @@ import ( type BankKeeper interface { SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error } type FeeShareKeeper interface {