From 6dcb232b22e7cbfa172fe1da546b8a6fc86c419f Mon Sep 17 00:00:00 2001 From: Till Ziegler Date: Thu, 27 Jun 2024 08:36:09 +0200 Subject: [PATCH] feature: add oracle split param and logic --- custom/auth/ante/expected_keeper.go | 1 + custom/auth/ante/fee_burntax.go | 24 ++- custom/auth/ante/fee_test.go | 41 +++++- go.mod | 1 + go.sum | 2 + proto/terra/treasury/v1beta1/treasury.proto | 6 + x/treasury/keeper/params.go | 9 ++ x/treasury/types/params.go | 29 ++++ x/treasury/types/treasury.pb.go | 155 +++++++++++++------- 9 files changed, 207 insertions(+), 61 deletions(-) diff --git a/custom/auth/ante/expected_keeper.go b/custom/auth/ante/expected_keeper.go index 1326fb785..f99093bed 100644 --- a/custom/auth/ante/expected_keeper.go +++ b/custom/auth/ante/expected_keeper.go @@ -16,6 +16,7 @@ type TreasuryKeeper interface { HasBurnTaxExemptionAddress(ctx sdk.Context, addresses ...string) bool HasBurnTaxExemptionContract(ctx sdk.Context, address string) bool GetMinInitialDepositRatio(ctx sdk.Context) sdk.Dec + GetOracleSplit(ctx sdk.Context) sdk.Dec } // OracleKeeper for feeder validation diff --git a/custom/auth/ante/fee_burntax.go b/custom/auth/ante/fee_burntax.go index fd76cd3ea..b9cd15f57 100644 --- a/custom/auth/ante/fee_burntax.go +++ b/custom/auth/ante/fee_burntax.go @@ -6,15 +6,18 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/types" + oracle "github.com/classic-terra/core/v3/x/oracle/types" treasury "github.com/classic-terra/core/v3/x/treasury/types" ) // BurnTaxSplit splits func (fd FeeDecorator) BurnTaxSplit(ctx sdk.Context, taxes sdk.Coins) (err error) { burnSplitRate := fd.treasuryKeeper.GetBurnSplitRate(ctx) + oracleSplitRate := fd.treasuryKeeper.GetOracleSplit(ctx) + distributionDeltaCoins := sdk.NewCoins() + oracleSplitCoins := sdk.NewCoins() if burnSplitRate.IsPositive() { - distributionDeltaCoins := sdk.NewCoins() for _, taxCoin := range taxes { splitcoinAmount := burnSplitRate.MulInt(taxCoin.Amount).RoundInt() @@ -24,6 +27,25 @@ func (fd FeeDecorator) BurnTaxSplit(ctx sdk.Context, taxes sdk.Coins) (err error taxes = taxes.Sub(distributionDeltaCoins...) } + if oracleSplitRate.IsPositive() { + + for _, distrCoin := range distributionDeltaCoins { + oracleCoinAmnt := oracleSplitRate.MulInt(distrCoin.Amount).RoundInt() + oracleSplitCoins = oracleSplitCoins.Add(sdk.NewCoin(distrCoin.Denom, oracleCoinAmnt)) + } + } + + if !oracleSplitCoins.IsZero() { + if err = fd.bankKeeper.SendCoinsFromModuleToModule( + ctx, + types.FeeCollectorName, + oracle.ModuleName, + oracleSplitCoins, + ); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error()) + } + } + if !taxes.IsZero() { if err = fd.bankKeeper.SendCoinsFromModuleToModule( ctx, diff --git a/custom/auth/ante/fee_test.go b/custom/auth/ante/fee_test.go index 50dcc8c4c..67d12cedd 100644 --- a/custom/auth/ante/fee_test.go +++ b/custom/auth/ante/fee_test.go @@ -732,14 +732,26 @@ func (s *AnteTestSuite) TestTaxExemption() { // go test -v -run ^TestAnteTestSuite/TestBurnSplitTax$ github.com/classic-terra/core/v3/custom/auth/ante func (s *AnteTestSuite) TestBurnSplitTax() { - s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 0)) // 100% - s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 1)) // 10% - s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 2)) // 0.1% - s.runBurnSplitTaxTest(sdk.NewDecWithPrec(0, 0)) // 0% burn all taxes (old burn tax behavior) - s.runBurnSplitTaxTest(sdk.NewDecWithPrec(-1, 1)) // -10% invalid rate + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 0), sdk.ZeroDec()) // 100% distribute, 0% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 1), sdk.ZeroDec()) // 10% distribute, 0% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 2), sdk.ZeroDec()) // 0.1% distribute, 0% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(0, 0), sdk.ZeroDec()) // 0% distribute, 0% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 0), sdk.NewDecWithPrec(5, 1)) // 100% distribute, 50% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 1), sdk.NewDecWithPrec(5, 1)) // 10% distribute, 50% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 2), sdk.NewDecWithPrec(5, 1)) // 0.1% distribute, 50% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(0, 0), sdk.NewDecWithPrec(5, 1)) // 0% distribute, 50% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 0), sdk.ZeroDec()) // 100% distribute, 0% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 1), sdk.ZeroDec()) // 10% distribute, 0% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 2), sdk.ZeroDec()) // 0.1% distribute, 0% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(0, 0), sdk.ZeroDec()) // 0% distribute, 0% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 0), sdk.OneDec()) // 100% distribute, 100% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 1), sdk.OneDec()) // 10% distribute, 100% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(1, 2), sdk.OneDec()) // 0.1% distribute, 100% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(0, 0), sdk.OneDec()) // 0% distribute, 100% to oracle + s.runBurnSplitTaxTest(sdk.NewDecWithPrec(-1, 1), sdk.ZeroDec()) // -10% distribute - invalid rate } -func (s *AnteTestSuite) runBurnSplitTaxTest(burnSplitRate sdk.Dec) { +func (s *AnteTestSuite) runBurnSplitTaxTest(burnSplitRate sdk.Dec, oracleSplitRate sdk.Dec) { s.SetupTest(true) // setup require := s.Require() s.txBuilder = s.clientCtx.TxConfig.NewTxBuilder() @@ -752,6 +764,7 @@ func (s *AnteTestSuite) runBurnSplitTaxTest(burnSplitRate sdk.Dec) { // Set burn split tax tk.SetBurnSplitRate(s.ctx, burnSplitRate) + tk.SetOracleSplit(s.ctx, oracleSplitRate) // keys and addresses priv1, _, addr1 := testdata.KeyTestPubAddr() @@ -804,15 +817,27 @@ func (s *AnteTestSuite) runBurnSplitTaxTest(burnSplitRate sdk.Dec) { tk.BurnCoinsFromBurnAccount(s.ctx) feeCollectorAfter := sdk.NewDecCoinsFromCoins(bk.GetAllBalances(s.ctx, ak.GetModuleAddress(authtypes.FeeCollectorName))...) + oracleAfter := sdk.NewDecCoinsFromCoins(bk.GetAllBalances(s.ctx, ak.GetModuleAddress(oracletypes.ModuleName))...) taxes := ante.FilterMsgAndComputeTax(s.ctx, tk, msg) burnTax := sdk.NewDecCoinsFromCoins(taxes...) if burnSplitRate.IsPositive() { distributionDeltaCoins := burnTax.MulDec(burnSplitRate) + expectedOracleCoins := distributionDeltaCoins.MulDec(oracleSplitRate) + expectedDistrCoins := distributionDeltaCoins.Sub(expectedOracleCoins) + + if expectedOracleCoins == nil { + expectedOracleCoins = sdk.NewDecCoins() + } + + if expectedDistrCoins == nil { + expectedDistrCoins = sdk.NewDecCoins() + } // expected: community pool 50% - fmt.Printf("BurnSplitRate %v, DistributionDeltaCoins %v\n", burnSplitRate, distributionDeltaCoins) - require.Equal(feeCollectorAfter, distributionDeltaCoins) + fmt.Printf("-- BurnSplitRate %+v, OracleSplitRate %+v, OracleCoins %+v, DistrCoins %+v\n", burnSplitRate, oracleSplitRate, expectedOracleCoins, expectedDistrCoins) + require.Equal(feeCollectorAfter, expectedDistrCoins) + require.Equal(oracleAfter, expectedOracleCoins) burnTax = burnTax.Sub(distributionDeltaCoins) } diff --git a/go.mod b/go.mod index 992398a07..fa7a9a22d 100644 --- a/go.mod +++ b/go.mod @@ -65,6 +65,7 @@ require ( github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/opencontainers/runc v1.1.12 // indirect + github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect diff --git a/go.sum b/go.sum index d5e71c43c..98228659e 100644 --- a/go.sum +++ b/go.sum @@ -1079,6 +1079,8 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= diff --git a/proto/terra/treasury/v1beta1/treasury.proto b/proto/terra/treasury/v1beta1/treasury.proto index 1d91a9c63..a6e0b8893 100644 --- a/proto/terra/treasury/v1beta1/treasury.proto +++ b/proto/terra/treasury/v1beta1/treasury.proto @@ -41,6 +41,12 @@ message Params { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + string oracle_split = 10 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.moretags) = "yaml:\"oracle_split\"", + (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/params.go b/x/treasury/keeper/params.go index c9e101c0b..03c0aaead 100644 --- a/x/treasury/keeper/params.go +++ b/x/treasury/keeper/params.go @@ -66,6 +66,15 @@ func (k Keeper) SetMinInitialDepositRatio(ctx sdk.Context, minInitialDepositRati k.paramSpace.Set(ctx, types.KeyMinInitialDepositRatio, minInitialDepositRatio) } +func (k Keeper) GetOracleSplit(ctx sdk.Context) (res sdk.Dec) { + k.paramSpace.Get(ctx, types.KeyOracleSplit, &res) + return +} + +func (k Keeper) SetOracleSplit(ctx sdk.Context, oracleSplit sdk.Dec) { + k.paramSpace.Set(ctx, types.KeyOracleSplit, oracleSplit) +} + // GetParams returns the total set of treasury parameters. func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { k.paramSpace.GetParamSetIfExists(ctx, ¶ms) diff --git a/x/treasury/types/params.go b/x/treasury/types/params.go index 45eb7e8e1..b6684fd83 100644 --- a/x/treasury/types/params.go +++ b/x/treasury/types/params.go @@ -22,6 +22,7 @@ var ( KeyWindowProbation = []byte("WindowProbation") KeyBurnTaxSplit = []byte("BurnTaxSplit") KeyMinInitialDepositRatio = []byte("MinInitialDepositRatio") + KeyOracleSplit = []byte("OracleSplit") ) // Default parameter values @@ -47,6 +48,7 @@ var ( 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 + DefaultOracleSplit = sdk.NewDecWithPrec(5, 1) // 50% oracle, 50% community pool ) var _ paramstypes.ParamSet = &Params{} @@ -63,6 +65,7 @@ func DefaultParams() Params { WindowProbation: DefaultWindowProbation, BurnTaxSplit: DefaultBurnTaxSplit, MinInitialDepositRatio: DefaultMinInitialDepositRatio, + OracleSplit: DefaultOracleSplit, } } @@ -90,6 +93,7 @@ func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { paramstypes.NewParamSetPair(KeyWindowProbation, &p.WindowProbation, validateWindowProbation), paramstypes.NewParamSetPair(KeyBurnTaxSplit, &p.BurnTaxSplit, validateBurnTaxSplit), paramstypes.NewParamSetPair(KeyMinInitialDepositRatio, &p.MinInitialDepositRatio, validateMinInitialDepositRatio), + paramstypes.NewParamSetPair(KeyOracleSplit, &p.OracleSplit, validateOraceSplit), } } @@ -137,6 +141,14 @@ func (p Params) Validate() error { return fmt.Errorf("treasury parameter WindowLong must be bigger than WindowShort: (%d, %d)", p.WindowLong, p.WindowShort) } + if p.OracleSplit.IsNegative() { + return fmt.Errorf("treasury parameter OracleSplit must be positive: %s", p.OracleSplit) + } + + if p.OracleSplit.GT(sdk.OneDec()) { + return fmt.Errorf("treasury parameter OracleSplit must be less than or equal to 1.0: %s", p.OracleSplit) + } + return nil } @@ -268,3 +280,20 @@ func validateMinInitialDepositRatio(i interface{}) error { return nil } + +func validateOraceSplit(i interface{}) error { + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid paramater type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("oracle split must be positive: %s", v) + } + + if v.GT(sdk.OneDec()) { + return fmt.Errorf("oracle split must be less than or equal to 1.0: %s", v) + } + + return nil +} diff --git a/x/treasury/types/treasury.pb.go b/x/treasury/types/treasury.pb.go index b6e05e793..bcd8f5061 100644 --- a/x/treasury/types/treasury.pb.go +++ b/x/treasury/types/treasury.pb.go @@ -37,6 +37,7 @@ type Params struct { 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"` + OracleSplit github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=oracle_split,json=oracleSplit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_split" yaml:"oracle_split"` } func (m *Params) Reset() { *m = Params{} } @@ -257,58 +258,59 @@ func init() { } var fileDescriptor_353bb3a9c554268e = []byte{ - // 804 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xbf, 0x6f, 0x23, 0x45, - 0x14, 0xf6, 0xe2, 0x23, 0xb1, 0xc7, 0x3e, 0x9c, 0x9b, 0x0b, 0xce, 0xfa, 0x40, 0x5e, 0x6b, 0x25, - 0x90, 0x29, 0x62, 0x2b, 0x77, 0x05, 0x52, 0x1a, 0x24, 0x27, 0x80, 0x22, 0x40, 0x58, 0x7b, 0x01, - 0x24, 0x9a, 0x65, 0x3c, 0x1e, 0xad, 0x07, 0xbc, 0x33, 0xab, 0x99, 0xf1, 0x65, 0x0d, 0x12, 0x05, - 0x12, 0x3d, 0xa2, 0x42, 0x40, 0x71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, - 0xb4, 0x07, 0x00, 0x00, + // 832 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0xe9, 0xd2, 0x4d, 0x27, 0x59, 0xd2, 0x9d, 0x2d, 0xa9, 0xb3, 0xa0, 0x38, 0xb2, 0x04, + 0x0a, 0x87, 0x26, 0xea, 0xee, 0x01, 0xa9, 0x17, 0xa4, 0xb4, 0x80, 0x2a, 0x40, 0x44, 0x6e, 0x01, + 0x89, 0x8b, 0x99, 0x4c, 0x46, 0xce, 0x80, 0x3d, 0x63, 0xcd, 0x4c, 0x5a, 0x07, 0x24, 0x0e, 0x48, + 0xdc, 0x11, 0x27, 0x04, 0x1c, 0xf6, 0xcc, 0x19, 0xf1, 0x37, 0xec, 0x71, 0xc5, 0x09, 0x38, 0x04, + 0xd4, 0x5e, 0x38, 0xe7, 0x2f, 0x40, 0x9e, 0x99, 0xfc, 0x32, 0xbb, 0xb0, 0xd1, 0x9e, 0x92, 0xf7, + 0xde, 0xf7, 0xbe, 0xef, 0x9b, 0x67, 0xfb, 0xd9, 0xe0, 0x15, 0x45, 0x84, 0x40, 0x5d, 0x25, 0x08, + 0x92, 0x63, 0x31, 0xe9, 0x5e, 0x1c, 0x0e, 0x88, 0x42, 0x87, 0x8b, 0x44, 0x27, 0x15, 0x5c, 0x71, + 0x58, 0xd7, 0xb0, 0xce, 0x22, 0x6b, 0x61, 0x77, 0x9b, 0x98, 0xcb, 0x84, 0xcb, 0xee, 0x00, 0x49, + 0xb2, 0xe8, 0xc5, 0x9c, 0x32, 0xd3, 0x77, 0xb7, 0x61, 0xea, 0xa1, 0x8e, 0xba, 0x26, 0xb0, 0xa5, + 0xbd, 0x88, 0x47, 0xdc, 0xe4, 0xf3, 0x7f, 0x26, 0xeb, 0xff, 0x5e, 0x06, 0xdb, 0x7d, 0x24, 0x50, + 0x22, 0x21, 0x06, 0x40, 0xa1, 0x2c, 0x4c, 0x79, 0x4c, 0xf1, 0xc4, 0x75, 0x5a, 0x4e, 0xbb, 0x72, + 0xef, 0xb5, 0xce, 0xe3, 0x8d, 0x74, 0xfa, 0x1a, 0x75, 0xcc, 0x99, 0x54, 0x02, 0x51, 0xa6, 0x64, + 0xaf, 0xf1, 0x70, 0xea, 0x95, 0x66, 0x53, 0xef, 0xf6, 0x04, 0x25, 0xf1, 0x91, 0xbf, 0xa4, 0xf2, + 0x83, 0x1d, 0x85, 0x32, 0xd3, 0x00, 0x63, 0x70, 0x4b, 0x90, 0x4b, 0x24, 0x86, 0x73, 0x9d, 0xe7, + 0x36, 0xd5, 0x79, 0xd9, 0xea, 0xec, 0x19, 0x9d, 0x35, 0x36, 0x3f, 0xa8, 0x9a, 0xd8, 0xaa, 0xfd, + 0xe8, 0x80, 0x86, 0x24, 0x34, 0x62, 0x94, 0x0b, 0x14, 0x91, 0x70, 0x30, 0x16, 0x43, 0xc2, 0x42, + 0x85, 0x44, 0x44, 0x94, 0xbb, 0xd5, 0x72, 0xda, 0x3b, 0xbd, 0x4f, 0x72, 0xbe, 0x3f, 0xa6, 0xde, + 0xab, 0x11, 0x55, 0xa3, 0xf1, 0xa0, 0x83, 0x79, 0x62, 0x07, 0x67, 0x7f, 0x0e, 0xe4, 0xf0, 0xb3, + 0xae, 0x9a, 0xa4, 0x44, 0x76, 0x4e, 0x08, 0x9e, 0x4d, 0xbd, 0x96, 0x51, 0x7e, 0x22, 0xb1, 0xff, + 0xeb, 0xcf, 0x07, 0xc0, 0xce, 0xfe, 0x84, 0xe0, 0x60, 0x7f, 0x05, 0xd9, 0xd3, 0xc0, 0x73, 0x8d, + 0x83, 0x5f, 0x39, 0x60, 0x37, 0xa1, 0x8c, 0xb2, 0x28, 0xa4, 0x0c, 0x0b, 0x92, 0x10, 0xa6, 0xdc, + 0x1b, 0xda, 0xd5, 0x47, 0x1b, 0xbb, 0xda, 0x37, 0xae, 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x71, 0x72, 0x1e, 0x19, 0x54, 0xd4, 0xd2, 0x87, 0xff, 0xad, 0x03, 0xf6, 0xb4, 0x39, + 0x7b, 0xd3, 0x9f, 0x4a, 0x39, 0x46, 0x0c, 0x13, 0xf8, 0x39, 0x28, 0x53, 0xfb, 0xff, 0xff, 0xbd, + 0x1d, 0x5b, 0x6f, 0xf6, 0xea, 0xce, 0x1b, 0x37, 0xf3, 0xb5, 0xd0, 0xeb, 0xbd, 0xf3, 0xf0, 0xaa, + 0xe9, 0x3c, 0xba, 0x6a, 0x3a, 0x7f, 0x5d, 0x35, 0x9d, 0x6f, 0xae, 0x9b, 0xa5, 0x47, 0xd7, 0xcd, + 0xd2, 0x6f, 0xd7, 0xcd, 0xd2, 0xc7, 0x87, 0xab, 0x6c, 0x31, 0x92, 0x92, 0xe2, 0x03, 0xf3, 0x0d, + 0x80, 0xb9, 0x20, 0xdd, 0x8b, 0xfb, 0xdd, 0x6c, 0xf9, 0x35, 0xa0, 0xc9, 0x07, 0xdb, 0xfa, 0xd5, + 0x7c, 0xff, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x42, 0xe7, 0xc8, 0x2c, 0x08, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -357,6 +359,9 @@ func (this *Params) Equal(that interface{}) bool { if !this.MinInitialDepositRatio.Equal(that1.MinInitialDepositRatio) { return false } + if !this.OracleSplit.Equal(that1.OracleSplit) { + return false + } return true } func (this *PolicyConstraints) Equal(that interface{}) bool { @@ -412,6 +417,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.OracleSplit.Size() + i -= size + if _, err := m.OracleSplit.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTreasury(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 { size := m.MinInitialDepositRatio.Size() i -= size @@ -665,6 +680,8 @@ func (m *Params) Size() (n int) { n += 1 + l + sovTreasury(uint64(l)) l = m.MinInitialDepositRatio.Size() n += 1 + l + sovTreasury(uint64(l)) + l = m.OracleSplit.Size() + n += 1 + l + sovTreasury(uint64(l)) return n } @@ -1009,6 +1026,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleSplit", 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.OracleSplit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTreasury(dAtA[iNdEx:])