diff --git a/app/app.go b/app/app.go index 0f08df2ec..355d95a90 100644 --- a/app/app.go +++ b/app/app.go @@ -44,6 +44,7 @@ import ( "github.com/classic-terra/core/app/keepers" terraappparams "github.com/classic-terra/core/app/params" v2 "github.com/classic-terra/core/app/upgrades/v2" + v3 "github.com/classic-terra/core/app/upgrades/v3" customante "github.com/classic-terra/core/custom/auth/ante" customauthrest "github.com/classic-terra/core/custom/auth/client/rest" @@ -193,6 +194,7 @@ func NewTerraApp( SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), IBCChannelKeeper: app.IBCKeeper.ChannelKeeper, DistributionKeeper: app.DistrKeeper, + GovKeeper: app.GovKeeper, }, ) if err != nil { @@ -402,4 +404,8 @@ func (app *TerraApp) setupUpgradeHandlers() { v2.UpgradeName, v2.CreateV2UpgradeHandler(app.mm, app.configurator), ) + app.UpgradeKeeper.SetUpgradeHandler( + v3.UpgradeName, + v3.CreateV3UpgradeHandler(app.mm, app.configurator), + ) } diff --git a/app/upgrades/v3/constants.go b/app/upgrades/v3/constants.go new file mode 100644 index 000000000..be7e36cde --- /dev/null +++ b/app/upgrades/v3/constants.go @@ -0,0 +1,3 @@ +package v3 + +const UpgradeName = "v3" diff --git a/app/upgrades/v3/upgrades.go b/app/upgrades/v3/upgrades.go new file mode 100644 index 000000000..3eb41583c --- /dev/null +++ b/app/upgrades/v3/upgrades.go @@ -0,0 +1,17 @@ +package v3 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateV3UpgradeHandler( + mm *module.Manager, + cfg module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + // treasury store migration + return mm.RunMigrations(ctx, cfg, fromVM) + } +} diff --git a/custom/auth/ante/ante.go b/custom/auth/ante/ante.go index 5da803f19..ba464dd7d 100644 --- a/custom/auth/ante/ante.go +++ b/custom/auth/ante/ante.go @@ -9,6 +9,7 @@ import ( cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" ) // HandlerOptions are the options required for constructing a default SDK AnteHandler. @@ -22,6 +23,7 @@ type HandlerOptions struct { SigGasConsumer cosmosante.SignatureVerificationGasConsumer IBCChannelKeeper channelkeeper.Keeper DistributionKeeper distributionkeeper.Keeper + GovKeeper govkeeper.Keeper } // NewAnteHandler returns an AnteHandler that checks and increments sequence @@ -70,5 +72,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), cosmosante.NewIncrementSequenceDecorator(options.AccountKeeper), ibcante.NewAnteDecorator(options.IBCChannelKeeper), + NewMinInitialDepositDecorator(options.GovKeeper, options.TreasuryKeeper), ), nil } diff --git a/custom/auth/ante/expected_keeper.go b/custom/auth/ante/expected_keeper.go index c5b75f09b..230819521 100644 --- a/custom/auth/ante/expected_keeper.go +++ b/custom/auth/ante/expected_keeper.go @@ -3,6 +3,7 @@ package ante import ( sdk "github.com/cosmos/cosmos-sdk/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) // TreasuryKeeper for tax charging & recording @@ -12,6 +13,7 @@ type TreasuryKeeper interface { GetTaxCap(ctx sdk.Context, denom string) (taxCap sdk.Int) GetBurnSplitRate(ctx sdk.Context) sdk.Dec HasBurnTaxExemptionAddress(ctx sdk.Context, addresses ...string) bool + GetMinInitialDepositRatio(ctx sdk.Context) sdk.Dec } // OracleKeeper for feeder validation @@ -29,3 +31,7 @@ type DistrKeeper interface { FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error GetFeePool(ctx sdk.Context) distributiontypes.FeePool } + +type GovKeeper interface { + GetDepositParams(ctx sdk.Context) govtypes.DepositParams +} diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go new file mode 100644 index 000000000..c5c5b80c4 --- /dev/null +++ b/custom/auth/ante/min_initial_deposit.go @@ -0,0 +1,75 @@ +package ante + +import ( + "fmt" + core "github.com/classic-terra/core/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +// MinInitialDeposit Decorator will check Initial Deposits for MsgSubmitProposal +type MinInitialDepositDecorator struct { + govKeeper govkeeper.Keeper + treasuryKeeper TreasuryKeeper +} + +// NewMinInitialDeposit returns new min initial deposit decorator instance +func NewMinInitialDepositDecorator(govKeeper govkeeper.Keeper, treasuryKeeper TreasuryKeeper) MinInitialDepositDecorator { + return MinInitialDepositDecorator{ + govKeeper: govKeeper, + treasuryKeeper: treasuryKeeper, + } +} + +// IsMsgSubmitProposal checks whether the input msg is a MsgSubmitProposal +func IsMsgSubmitProposal(msg sdk.Msg) bool { + _, ok := msg.(*govtypes.MsgSubmitProposal) + return ok +} + +// HandleCheckMinInitialDeposit +func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper govkeeper.Keeper, treasuryKeeper TreasuryKeeper) (err error) { + submitPropMsg, ok := msg.(*govtypes.MsgSubmitProposal) + if !ok { + return fmt.Errorf("Could not dereference msg as MsgSubmitProposal") + } + + minDeposit := govKeeper.GetDepositParams(ctx).MinDeposit + requiredAmount := sdk.NewDecFromInt(minDeposit.AmountOf(core.MicroLunaDenom)).Mul(treasuryKeeper.GetMinInitialDepositRatio(ctx)).TruncateInt() + + requiredDepositCoins := sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, requiredAmount), + ) + initialDepositCoins := submitPropMsg.GetInitialDeposit() + + if !initialDepositCoins.IsAllGTE(requiredDepositCoins) { + return fmt.Errorf("Not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) + } + + return nil +} + +// AnteHandle handles checking MsgSubmitProposal +func (midd MinInitialDepositDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + if simulate { + return next(ctx, tx, simulate) + } + + msgs := tx.GetMsgs() + for _, msg := range msgs { + + if !IsMsgSubmitProposal(msg) { + continue + } + + err := HandleCheckMinInitialDeposit(ctx, msg, midd.govKeeper, midd.treasuryKeeper) + if err != nil { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, err.Error()) + } + + } + + return next(ctx, tx, simulate) +} diff --git a/custom/auth/ante/min_initial_deposit_test.go b/custom/auth/ante/min_initial_deposit_test.go new file mode 100644 index 000000000..4d33e114a --- /dev/null +++ b/custom/auth/ante/min_initial_deposit_test.go @@ -0,0 +1,144 @@ +package ante_test + +import ( + //"fmt" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + // banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + + "github.com/classic-terra/core/custom/auth/ante" + // core "github.com/terra-money/core/types" + // treasury "github.com/terra-money/core/x/treasury/types" + + //"github.com/cosmos/cosmos-sdk/types/query" + //cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" + //"github.com/cosmos/cosmos-sdk/x/auth/types" + //minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func (suite *AnteTestSuite) TestMinInitialDepositRatioDefault() { + suite.SetupTest(true) // setup + suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() + + midd := ante.NewMinInitialDepositDecorator(suite.app.GovKeeper, suite.app.TreasuryKeeper) + antehandler := sdk.ChainAnteDecorators(midd) + + // set required deposit to uluna + suite.app.GovKeeper.SetDepositParams(suite.ctx, govtypes.DefaultDepositParams()) + govparams := suite.app.GovKeeper.GetDepositParams(suite.ctx) + govparams.MinDeposit = sdk.NewCoins( + sdk.NewCoin("uluna", sdk.NewInt(1_000_000)), + ) + suite.app.GovKeeper.SetDepositParams(suite.ctx, govparams) + + // set initial deposit ratio to 0.0 + ratio := sdk.ZeroDec() + suite.app.TreasuryKeeper.SetMinInitialDepositRatio(suite.ctx, ratio) + + // keys and addresses + priv1, _, addr1 := testdata.KeyTestPubAddr() + prop1 := govtypes.NewTextProposal("prop1", "prop1") + depositCoins1 := sdk.NewCoins() + + // create prop tx + msg, _ := govtypes.NewMsgSubmitProposal(prop1, depositCoins1, addr1) + feeAmount := testdata.NewTestFeeAmount() + gasLimit := testdata.NewTestGasLimit() + suite.Require().NoError(suite.txBuilder.SetMsgs(msg)) + suite.txBuilder.SetFeeAmount(feeAmount) + suite.txBuilder.SetGasLimit(gasLimit) + privs, accNums, accSeqs := []cryptotypes.PrivKey{priv1}, []uint64{0}, []uint64{0} + tx, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.ctx.ChainID()) + suite.Require().NoError(err) + + // antehandler should not error + _, err = antehandler(suite.ctx, tx, false) + suite.Require().NoError(err, "error: Proposal whithout initial deposit should have gone through") +} + +func (suite *AnteTestSuite) TestMinInitialDepositRatioWithSufficientDeposit() { + suite.SetupTest(true) // setup + suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() + + midd := ante.NewMinInitialDepositDecorator(suite.app.GovKeeper, suite.app.TreasuryKeeper) + antehandler := sdk.ChainAnteDecorators(midd) + + // set required deposit to uluna + suite.app.GovKeeper.SetDepositParams(suite.ctx, govtypes.DefaultDepositParams()) + govparams := suite.app.GovKeeper.GetDepositParams(suite.ctx) + govparams.MinDeposit = sdk.NewCoins( + sdk.NewCoin("uluna", sdk.NewInt(1_000_000)), + ) + suite.app.GovKeeper.SetDepositParams(suite.ctx, govparams) + + // set initial deposit ratio to 0.2 + ratio := sdk.NewDecWithPrec(2, 1) + suite.app.TreasuryKeeper.SetMinInitialDepositRatio(suite.ctx, ratio) + + // keys and addresses + priv1, _, addr1 := testdata.KeyTestPubAddr() + prop1 := govtypes.NewTextProposal("prop1", "prop1") + depositCoins1 := sdk.NewCoins( + sdk.NewCoin("uluna", sdk.NewInt(200_000)), + ) + + // create prop tx + msg, _ := govtypes.NewMsgSubmitProposal(prop1, depositCoins1, addr1) + feeAmount := testdata.NewTestFeeAmount() + gasLimit := testdata.NewTestGasLimit() + suite.Require().NoError(suite.txBuilder.SetMsgs(msg)) + suite.txBuilder.SetFeeAmount(feeAmount) + suite.txBuilder.SetGasLimit(gasLimit) + privs, accNums, accSeqs := []cryptotypes.PrivKey{priv1}, []uint64{0}, []uint64{0} + tx, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.ctx.ChainID()) + suite.Require().NoError(err) + + // antehandler should not error + _, err = antehandler(suite.ctx, tx, false) + suite.Require().NoError(err, "error: Proposal with sufficient initial deposit should have gone through") +} + +func (suite *AnteTestSuite) TestMinInitialDepositRatioWithInsufficientDeposit() { + suite.SetupTest(true) // setup + suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() + + midd := ante.NewMinInitialDepositDecorator(suite.app.GovKeeper, suite.app.TreasuryKeeper) + antehandler := sdk.ChainAnteDecorators(midd) + + // set required deposit to uluna + suite.app.GovKeeper.SetDepositParams(suite.ctx, govtypes.DefaultDepositParams()) + govparams := suite.app.GovKeeper.GetDepositParams(suite.ctx) + govparams.MinDeposit = sdk.NewCoins( + sdk.NewCoin("uluna", sdk.NewInt(1_000_000)), + ) + suite.app.GovKeeper.SetDepositParams(suite.ctx, govparams) + + // set initial deposit ratio to 0.2 + ratio := sdk.NewDecWithPrec(2, 1) + suite.app.TreasuryKeeper.SetMinInitialDepositRatio(suite.ctx, ratio) + + // keys and addresses + priv1, _, addr1 := testdata.KeyTestPubAddr() + prop1 := govtypes.NewTextProposal("prop1", "prop1") + depositCoins1 := sdk.NewCoins( + sdk.NewCoin("uluna", sdk.NewInt(100_000)), + ) + + // create prop tx + msg, _ := govtypes.NewMsgSubmitProposal(prop1, depositCoins1, addr1) + feeAmount := testdata.NewTestFeeAmount() + gasLimit := testdata.NewTestGasLimit() + suite.Require().NoError(suite.txBuilder.SetMsgs(msg)) + suite.txBuilder.SetFeeAmount(feeAmount) + suite.txBuilder.SetGasLimit(gasLimit) + privs, accNums, accSeqs := []cryptotypes.PrivKey{priv1}, []uint64{0}, []uint64{0} + tx, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.ctx.ChainID()) + suite.Require().NoError(err) + + // antehandler should not error + _, err = antehandler(suite.ctx, tx, false) + suite.Require().Error(err, "error: Proposal with insufficient initial deposit should have failed") +} diff --git a/proto/terra/treasury/v1beta1/treasury.proto b/proto/terra/treasury/v1beta1/treasury.proto index 7fd0d6572..4b7d75c26 100644 --- a/proto/terra/treasury/v1beta1/treasury.proto +++ b/proto/terra/treasury/v1beta1/treasury.proto @@ -31,6 +31,11 @@ message Params { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + string min_initial_deposit_ratio = 9 [ + (gogoproto.moretags) = "yaml:\"min_initial_deposit_ratio\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } // PolicyConstraints - defines policy constraints can be applied in tax & reward policies diff --git a/x/treasury/keeper/migrations.go b/x/treasury/keeper/migrations.go index 0e9aeea9b..52a99a95b 100644 --- a/x/treasury/keeper/migrations.go +++ b/x/treasury/keeper/migrations.go @@ -74,3 +74,10 @@ func (m Migrator) Migrate1to2(ctx sdk.Context) error { return nil } + +// Migrate2to3 migrates from version 2 to 3. +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + m.keeper.SetMinInitialDepositRatio(ctx, types.DefaultMinInitialDepositRatio) + + return nil +} \ No newline at end of file diff --git a/x/treasury/keeper/params.go b/x/treasury/keeper/params.go index 44af6d47b..f8f6f5541 100644 --- a/x/treasury/keeper/params.go +++ b/x/treasury/keeper/params.go @@ -57,6 +57,15 @@ func (k Keeper) SetBurnSplitRate(ctx sdk.Context, burnTaxSplit sdk.Dec) { k.paramSpace.Set(ctx, types.KeyBurnTaxSplit, burnTaxSplit) } +func (k Keeper) GetMinInitialDepositRatio(ctx sdk.Context) (res sdk.Dec) { + k.paramSpace.Get(ctx, types.KeyMinInitialDepositRatio, &res) + return +} + +func (k Keeper) SetMinInitialDepositRatio(ctx sdk.Context, minInitialDepositRatio sdk.Dec) { + k.paramSpace.Set(ctx, types.KeyMinInitialDepositRatio, minInitialDepositRatio) +} + // GetParams returns the total set of treasury parameters. func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { k.paramSpace.GetParamSet(ctx, ¶ms) diff --git a/x/treasury/legacy/v05/migrate_test.go b/x/treasury/legacy/v05/migrate_test.go index 00623edc3..73155886f 100644 --- a/x/treasury/legacy/v05/migrate_test.go +++ b/x/treasury/legacy/v05/migrate_test.go @@ -153,7 +153,8 @@ func TestMigrate(t *testing.T) { }, "window_long": "52", "window_probation": "18", - "window_short": "4" + "window_short": "4", + "min_initial_deposit_ratio": "0" }, "reward_weight": "1.000000000000000000", "tax_caps": [ diff --git a/x/treasury/module.go b/x/treasury/module.go index 96d5bc757..886492777 100644 --- a/x/treasury/module.go +++ b/x/treasury/module.go @@ -138,6 +138,11 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err != nil { panic(err) } + + err = cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3) + if err != nil { + panic(err) + } } // InitGenesis performs genesis initialization for the treasury module. It returns @@ -158,7 +163,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 3 } // BeginBlock returns the begin blocker for the treasury module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} diff --git a/x/treasury/types/params.go b/x/treasury/types/params.go index 38b8e13dc..98b3a3089 100644 --- a/x/treasury/types/params.go +++ b/x/treasury/types/params.go @@ -21,6 +21,7 @@ var ( KeyWindowLong = []byte("WindowLong") KeyWindowProbation = []byte("WindowProbation") KeyBurnTaxSplit = []byte("BurnTaxSplit") + KeyMinInitialDepositRatio = []byte("MinInitialDepositRatio") ) // Default parameter values @@ -45,6 +46,7 @@ var ( DefaultTaxRate = sdk.NewDecWithPrec(1, 3) // 0.1% DefaultRewardWeight = sdk.NewDecWithPrec(5, 2) // 5% DefaultBurnTaxSplit = sdk.NewDecWithPrec(1, 1) // 10% goes to community pool, 90% burn + DefaultMinInitialDepositRatio = sdk.ZeroDec() // 0% min initial deposit ) var _ paramstypes.ParamSet = &Params{} @@ -60,6 +62,7 @@ func DefaultParams() Params { WindowLong: DefaultWindowLong, WindowProbation: DefaultWindowProbation, BurnTaxSplit: DefaultBurnTaxSplit, + MinInitialDepositRatio: DefaultMinInitialDepositRatio, } } @@ -87,6 +90,7 @@ func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { paramstypes.NewParamSetPair(KeyWindowLong, &p.WindowLong, validateWindowLong), paramstypes.NewParamSetPair(KeyWindowProbation, &p.WindowProbation, validateWindowProbation), paramstypes.NewParamSetPair(KeyBurnTaxSplit, &p.BurnTaxSplit, validateBurnTaxSplit), + paramstypes.NewParamSetPair(KeyMinInitialDepositRatio, &p.MinInitialDepositRatio, validateMinInitialDepositRatio), } } @@ -248,3 +252,22 @@ func validateBurnTaxSplit(i interface{}) error { return nil } + +func validateMinInitialDepositRatio(i interface{}) error { + + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid paramater type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("min initial deposit ratio must be positive: %s", v) + } + + if v.GT(sdk.OneDec()) { + return fmt.Errorf("min initial deposit ratio must less than or equal 1.0: %s", v) + } + + return nil + +} diff --git a/x/treasury/types/treasury.pb.go b/x/treasury/types/treasury.pb.go index a9601107b..8fb8e4165 100644 --- a/x/treasury/types/treasury.pb.go +++ b/x/treasury/types/treasury.pb.go @@ -38,6 +38,7 @@ type Params struct { WindowLong uint64 `protobuf:"varint,6,opt,name=window_long,json=windowLong,proto3" json:"window_long,omitempty" yaml:"window_long"` WindowProbation uint64 `protobuf:"varint,7,opt,name=window_probation,json=windowProbation,proto3" json:"window_probation,omitempty" yaml:"window_probation"` BurnTaxSplit github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=burn_tax_split,json=burnTaxSplit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"burn_tax_split" yaml:"burn_tax_split"` + MinInitialDepositRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_initial_deposit_ratio" yaml:"min_initial_deposit_ratio"` } func (m *Params) Reset() { *m = Params{} } @@ -278,53 +279,56 @@ func init() { } var fileDescriptor_353bb3a9c554268e = []byte{ - // 735 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xbb, 0x6f, 0xe3, 0x36, - 0x1c, 0xc7, 0xad, 0x3a, 0x75, 0x1c, 0xda, 0xa9, 0x13, 0x25, 0x4d, 0x94, 0xb4, 0xb0, 0x0c, 0x02, - 0x2d, 0xdc, 0x21, 0x32, 0x92, 0x0e, 0x05, 0xb2, 0x14, 0x75, 0xda, 0x26, 0x06, 0x5a, 0xc0, 0x50, - 0x32, 0x15, 0x05, 0x04, 0x5a, 0x26, 0x64, 0xa2, 0x16, 0x29, 0x90, 0x74, 0x23, 0x77, 0xef, 0x56, - 0x14, 0x87, 0x9b, 0x82, 0x9b, 0x32, 0xdf, 0x5f, 0x92, 0x31, 0xe3, 0xe1, 0x06, 0xdf, 0x21, 0x59, - 0x6e, 0xf6, 0x5f, 0x70, 0x10, 0x49, 0xbf, 0x72, 0x4f, 0xe3, 0x26, 0xf1, 0xf7, 0xfa, 0xfc, 0xbe, - 0xa4, 0xf8, 0x00, 0xdf, 0x48, 0xcc, 0x39, 0x6a, 0x48, 0x8e, 0x91, 0x18, 0xf0, 0x61, 0xe3, 0xef, - 0xc3, 0x0e, 0x96, 0xe8, 0x70, 0xea, 0xf0, 0x12, 0xce, 0x24, 0xb3, 0x77, 0x54, 0x9a, 0x37, 0xf5, - 0x9a, 0xb4, 0xfd, 0xed, 0x88, 0x45, 0x4c, 0xa5, 0x34, 0xb2, 0x91, 0xce, 0xde, 0xaf, 0x86, 0x4c, - 0xc4, 0x4c, 0x34, 0x3a, 0x48, 0xe0, 0x29, 0x31, 0x64, 0x84, 0xea, 0x38, 0xbc, 0x2a, 0x80, 0x42, - 0x1b, 0x71, 0x14, 0x0b, 0x3b, 0x04, 0x40, 0xa2, 0x34, 0x48, 0x58, 0x9f, 0x84, 0x43, 0xc7, 0xaa, - 0x59, 0xf5, 0xd2, 0xd1, 0x77, 0xde, 0xdb, 0xbb, 0x79, 0x6d, 0x95, 0x75, 0xc2, 0xa8, 0x90, 0x1c, - 0x11, 0x2a, 0x45, 0x73, 0xef, 0x66, 0xe4, 0xe6, 0xc6, 0x23, 0x77, 0x73, 0x88, 0xe2, 0xfe, 0x31, - 0x9c, 0xa1, 0xa0, 0xbf, 0x26, 0x51, 0xaa, 0x0b, 0xec, 0x3e, 0x58, 0xe7, 0xf8, 0x12, 0xf1, 0xee, - 0xa4, 0xcf, 0x67, 0xcb, 0xf6, 0xf9, 0xda, 0xf4, 0xd9, 0xd6, 0x7d, 0x16, 0x68, 0xd0, 0x2f, 0x6b, - 0xdb, 0x74, 0xfb, 0xdf, 0x02, 0x7b, 0x02, 0x93, 0x88, 0x12, 0xc6, 0x51, 0x84, 0x83, 0xce, 0x80, - 0x77, 0x31, 0x0d, 0x24, 0xe2, 0x11, 0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 0x62, 0x02, 0x19, 0x47, 0xf8, 0x25, 0x39, 0xd3, 0x01, 0x1f, 0x5b, 0x60, 0x5b, - 0x89, 0x6b, 0x51, 0x22, 0x09, 0xea, 0xb7, 0x84, 0x18, 0x20, 0x1a, 0x62, 0xfb, 0x1f, 0x50, 0x24, - 0x66, 0xfc, 0x61, 0x6d, 0x27, 0x46, 0x9b, 0xf9, 0x83, 0x93, 0xc2, 0xe5, 0x74, 0x4d, 0xfb, 0x35, - 0xcf, 0x6e, 0xee, 0xaa, 0xd6, 0xed, 0x5d, 0xd5, 0x7a, 0x79, 0x57, 0xb5, 0x1e, 0xdd, 0x57, 0x73, - 0xb7, 0xf7, 0xd5, 0xdc, 0xb3, 0xfb, 0x6a, 0xee, 0x0f, 0x6f, 0x9e, 0xd6, 0x47, 0x42, 0x90, 0xf0, - 0x40, 0xbf, 0x3e, 0x21, 0xe3, 0xb8, 0x91, 0xce, 0x1e, 0x21, 0x45, 0xee, 0x14, 0xd4, 0x63, 0xf1, - 0xfd, 0xeb, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4d, 0xb0, 0x90, 0xa5, 0xa3, 0x06, 0x00, 0x00, + // 772 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x4d, 0x8f, 0x1b, 0x35, + 0x18, 0xc7, 0x33, 0xa4, 0xec, 0x26, 0x4e, 0x4a, 0xb6, 0xee, 0x92, 0x9d, 0x14, 0x94, 0x89, 0x2c, + 0x81, 0xc2, 0xa1, 0x13, 0xb5, 0x1c, 0x90, 0xf6, 0x82, 0xc8, 0x16, 0xda, 0x48, 0x20, 0x45, 0xee, + 0x9e, 0x10, 0xd2, 0xc8, 0x99, 0x58, 0x13, 0x8b, 0x8c, 0x3d, 0xb2, 0x1d, 0x76, 0xc2, 0x9d, 0x1b, + 0x20, 0xc4, 0x09, 0x71, 0xea, 0x11, 0xf1, 0x49, 0x7a, 0xec, 0x11, 0x71, 0x08, 0x68, 0xf7, 0xc2, + 0x39, 0x9f, 0x00, 0x8d, 0xed, 0xbc, 0x15, 0x16, 0x1a, 0xed, 0x29, 0x7e, 0xde, 0x7e, 0xcf, 0xdf, + 0xce, 0x3c, 0x36, 0x78, 0x47, 0x53, 0x29, 0x49, 0x4f, 0x4b, 0x4a, 0xd4, 0x4c, 0xce, 0x7b, 0x5f, + 0x3d, 0x18, 0x51, 0x4d, 0x1e, 0xac, 0x1d, 0x61, 0x26, 0x85, 0x16, 0xb0, 0x69, 0xd2, 0xc2, 0xb5, + 0xd7, 0xa5, 0xdd, 0x3b, 0x4e, 0x44, 0x22, 0x4c, 0x4a, 0xaf, 0x58, 0xd9, 0xec, 0x7b, 0xed, 0x58, + 0xa8, 0x54, 0xa8, 0xde, 0x88, 0x28, 0xba, 0x26, 0xc6, 0x82, 0x71, 0x1b, 0x47, 0xbf, 0x1c, 0x82, + 0x83, 0x21, 0x91, 0x24, 0x55, 0x30, 0x06, 0x40, 0x93, 0x3c, 0xca, 0xc4, 0x94, 0xc5, 0x73, 0xdf, + 0xeb, 0x78, 0xdd, 0xda, 0xc3, 0xf7, 0xc2, 0x7f, 0xef, 0x16, 0x0e, 0x4d, 0xd6, 0x99, 0xe0, 0x4a, + 0x4b, 0xc2, 0xb8, 0x56, 0xfd, 0xd6, 0xf3, 0x45, 0x50, 0x5a, 0x2e, 0x82, 0x3b, 0x73, 0x92, 0x4e, + 0x4f, 0xd1, 0x06, 0x85, 0x70, 0x55, 0x93, 0xdc, 0x16, 0xc0, 0x29, 0xb8, 0x2d, 0xe9, 0x05, 0x91, + 0xe3, 0x55, 0x9f, 0xd7, 0xf6, 0xed, 0xf3, 0xb6, 0xeb, 0x73, 0x6c, 0xfb, 0xec, 0xd0, 0x10, 0xae, + 0x5b, 0xdb, 0x75, 0xfb, 0xde, 0x03, 0x2d, 0x45, 0x59, 0xc2, 0x99, 0x90, 0x24, 0xa1, 0xd1, 0x68, + 0x26,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 0x3f, 0x7b, 0xe0, + 0xe8, 0xe3, 0x4c, 0xc4, 0x93, 0x73, 0x92, 0x0f, 0xa5, 0x88, 0x29, 0x1d, 0x2b, 0xf8, 0x8d, 0x07, + 0xea, 0xe6, 0xe6, 0x73, 0x0e, 0xdf, 0xeb, 0x94, 0xff, 0x7b, 0x6f, 0x8f, 0xdd, 0xde, 0xee, 0x6e, + 0x5d, 0x9b, 0xae, 0x18, 0xfd, 0xfa, 0x47, 0xd0, 0x7d, 0x85, 0x0d, 0x14, 0x1c, 0x85, 0x6b, 0x7a, + 0xa3, 0x03, 0xfd, 0xe8, 0x81, 0x63, 0x23, 0xce, 0x7d, 0x52, 0x03, 0xa5, 0x66, 0x84, 0xc7, 0x14, + 0x7e, 0x0d, 0x2a, 0xcc, 0xad, 0xff, 0x5f, 0xdb, 0x99, 0xd3, 0xe6, 0xfe, 0xc1, 0x55, 0xe1, 0x7e, + 0xba, 0xd6, 0xfd, 0xfa, 0x4f, 0x9e, 0x5f, 0xb6, 0xbd, 0x17, 0x97, 0x6d, 0xef, 0xcf, 0xcb, 0xb6, + 0xf7, 0xc3, 0x55, 0xbb, 0xf4, 0xe2, 0xaa, 0x5d, 0xfa, 0xed, 0xaa, 0x5d, 0xfa, 0x3c, 0xdc, 0xa6, + 0x4d, 0x89, 0x52, 0x2c, 0xbe, 0x6f, 0x5f, 0xc3, 0x58, 0x48, 0xda, 0xcb, 0x37, 0x8f, 0xa2, 0x21, + 0x8f, 0x0e, 0xcc, 0xe3, 0xf5, 0xfe, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x5b, 0xd0, 0x11, + 0x33, 0x07, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -370,6 +374,9 @@ func (this *Params) Equal(that interface{}) bool { if !this.BurnTaxSplit.Equal(that1.BurnTaxSplit) { return false } + if !this.MinInitialDepositRatio.Equal(that1.MinInitialDepositRatio) { + return false + } return true } @@ -427,6 +434,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.MinInitialDepositRatio.Size() + i -= size + if _, err := m.MinInitialDepositRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTreasury(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a { size := m.BurnTaxSplit.Size() i -= size @@ -669,6 +686,8 @@ func (m *Params) Size() (n int) { } l = m.BurnTaxSplit.Size() n += 1 + l + sovTreasury(uint64(l)) + l = m.MinInitialDepositRatio.Size() + n += 1 + l + sovTreasury(uint64(l)) return n } @@ -981,6 +1000,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreasury + } + 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 ErrInvalidLengthTreasury + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreasury + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinInitialDepositRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTreasury(dAtA[iNdEx:]) diff --git a/x/wasm/types/expected_keeper.go b/x/wasm/types/expected_keeper.go index a30c58697..18083083c 100644 --- a/x/wasm/types/expected_keeper.go +++ b/x/wasm/types/expected_keeper.go @@ -41,6 +41,7 @@ type TreasuryKeeper interface { GetTaxCap(ctx sdk.Context, denom string) (taxCap sdk.Int) GetBurnSplitRate(ctx sdk.Context) sdk.Dec HasBurnTaxExemptionAddress(ctx sdk.Context, addresses ...string) bool + GetMinInitialDepositRatio(ctx sdk.Context) sdk.Dec } // GRPCQueryHandler defines a function type which handles ABCI Query requests