From 02cbaecdc358b49590b5ff6ab578dea355375dda Mon Sep 17 00:00:00 2001 From: keruch <53012408+keruch@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:12:16 +0300 Subject: [PATCH] feat: removed incentives feature flag and decreased IRO `MinEpochsPaidOver` default value (#1652) --- .../dymension/incentives/params.proto | 3 - x/incentives/keeper/hooks.go | 5 -- x/incentives/types/params.go | 41 +++------ x/incentives/types/params.pb.go | 90 +++++-------------- x/iro/types/params.go | 2 +- 5 files changed, 36 insertions(+), 105 deletions(-) diff --git a/proto/dymensionxyz/dymension/incentives/params.proto b/proto/dymensionxyz/dymension/incentives/params.proto index c0b77c907..0e93c2407 100644 --- a/proto/dymensionxyz/dymension/incentives/params.proto +++ b/proto/dymensionxyz/dymension/incentives/params.proto @@ -29,7 +29,4 @@ message Params { (gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - // FeatureFlagEpochEndDistribution enables distribution of gauge rewards - // at the end of each epoch. If disabled, rewards are not distributed. - bool feature_flag_epoch_end_distribution = 5; } diff --git a/x/incentives/keeper/hooks.go b/x/incentives/keeper/hooks.go index e0b7a5f83..ee8d8b136 100644 --- a/x/incentives/keeper/hooks.go +++ b/x/incentives/keeper/hooks.go @@ -14,11 +14,6 @@ func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochN // AfterEpochEnd is the epoch end hook. func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error { params := k.GetParams(ctx) - - if !params.FeatureFlagEpochEndDistribution { - return nil - } - if epochIdentifier == params.DistrEpochIdentifier { // begin distribution if it's start time gauges := k.GetUpcomingGauges(ctx) diff --git a/x/incentives/types/params.go b/x/incentives/types/params.go index 755768d6b..52a43252c 100644 --- a/x/incentives/types/params.go +++ b/x/incentives/types/params.go @@ -12,11 +12,10 @@ import ( // Incentives parameters key store. var ( - KeyDistrEpochIdentifier = []byte("DistrEpochIdentifier") - KeyCreateGaugeFee = []byte("CreateGaugeFee") - KeyAddToGaugeFee = []byte("AddToGaugeFee") - KeyAddDenomFee = []byte("AddDenomFee") - KeyFeatureFlagEpochEndDistribution = []byte("FeatureFlagEpochEndDistribution") + KeyDistrEpochIdentifier = []byte("DistrEpochIdentifier") + KeyCreateGaugeFee = []byte("CreateGaugeFee") + KeyAddToGaugeFee = []byte("AddToGaugeFee") + KeyAddDenomFee = []byte("AddDenomFee") ) // ParamKeyTable returns the key table for the incentive module's parameters. @@ -25,24 +24,22 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams takes an epoch distribution identifier, then returns an incentives Params struct. -func NewParams(distrEpochIdentifier string, createGaugeFee, addToGaugeFee, addDenomFee math.Int, ffEpochEndDistribution bool) Params { +func NewParams(distrEpochIdentifier string, createGaugeFee, addToGaugeFee, addDenomFee math.Int) Params { return Params{ - DistrEpochIdentifier: distrEpochIdentifier, - CreateGaugeBaseFee: createGaugeFee, - AddToGaugeBaseFee: addToGaugeFee, - AddDenomFee: addDenomFee, - FeatureFlagEpochEndDistribution: ffEpochEndDistribution, + DistrEpochIdentifier: distrEpochIdentifier, + CreateGaugeBaseFee: createGaugeFee, + AddToGaugeBaseFee: addToGaugeFee, + AddDenomFee: addDenomFee, } } // DefaultParams returns the default incentives module parameters. func DefaultParams() Params { return Params{ - DistrEpochIdentifier: DefaultDistrEpochIdentifier, - CreateGaugeBaseFee: DefaultCreateGaugeFee, - AddToGaugeBaseFee: DefaultAddToGaugeFee, - AddDenomFee: DefaultAddDenomFee, - FeatureFlagEpochEndDistribution: false, + DistrEpochIdentifier: DefaultDistrEpochIdentifier, + CreateGaugeBaseFee: DefaultCreateGaugeFee, + AddToGaugeBaseFee: DefaultAddToGaugeFee, + AddDenomFee: DefaultAddDenomFee, } } @@ -60,9 +57,6 @@ func (p Params) Validate() error { if err := validateAddDenomFee(p.AddDenomFee); err != nil { return err } - if err := validateBool(p.FeatureFlagEpochEndDistribution); err != nil { - return err - } return nil } @@ -73,7 +67,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyCreateGaugeFee, &p.CreateGaugeBaseFee, validateCreateGaugeFeeInterface), paramtypes.NewParamSetPair(KeyAddToGaugeFee, &p.AddToGaugeBaseFee, validateAddToGaugeFeeInterface), paramtypes.NewParamSetPair(KeyAddDenomFee, &p.AddDenomFee, validateAddDenomFee), - paramtypes.NewParamSetPair(KeyFeatureFlagEpochEndDistribution, &p.FeatureFlagEpochEndDistribution, validateBool), } } @@ -109,11 +102,3 @@ func validateAddDenomFee(i interface{}) error { } 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/incentives/types/params.pb.go b/x/incentives/types/params.pb.go index 97f28c9f8..0773d1bc4 100644 --- a/x/incentives/types/params.pb.go +++ b/x/incentives/types/params.pb.go @@ -39,9 +39,6 @@ type Params struct { AddToGaugeBaseFee github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=add_to_gauge_base_fee,json=addToGaugeBaseFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"add_to_gauge_base_fee"` // AddDenomFee is a fee charged for adding every new denom to the gauge. AddDenomFee github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=add_denom_fee,json=addDenomFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"add_denom_fee"` - // FeatureFlagEpochEndDistribution enables distribution of gauge rewards - // at the end of each epoch. If disabled, rewards are not distributed. - FeatureFlagEpochEndDistribution bool `protobuf:"varint,5,opt,name=feature_flag_epoch_end_distribution,json=featureFlagEpochEndDistribution,proto3" json:"feature_flag_epoch_end_distribution,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -84,13 +81,6 @@ func (m *Params) GetDistrEpochIdentifier() string { return "" } -func (m *Params) GetFeatureFlagEpochEndDistribution() bool { - if m != nil { - return m.FeatureFlagEpochEndDistribution - } - return false -} - func init() { proto.RegisterType((*Params)(nil), "dymensionxyz.dymension.incentives.Params") } @@ -100,31 +90,28 @@ func init() { } var fileDescriptor_256a114c8e13cfa0 = []byte{ - // 379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x41, 0x6b, 0xe2, 0x40, - 0x14, 0xc7, 0x93, 0x75, 0x57, 0x76, 0xb3, 0xec, 0x61, 0x83, 0x2e, 0xb2, 0xb0, 0x89, 0xba, 0x50, - 0xbc, 0x34, 0x39, 0x78, 0x28, 0xf4, 0x28, 0x6a, 0x11, 0x7a, 0x68, 0x43, 0xa1, 0xd0, 0xcb, 0x74, - 0x92, 0x79, 0x89, 0x43, 0xcd, 0x4c, 0xc8, 0x4c, 0xc4, 0xf4, 0x53, 0xf4, 0x63, 0x79, 0xf4, 0x58, - 0x7a, 0x90, 0xa2, 0xdf, 0xa0, 0x9f, 0xa0, 0x64, 0x14, 0x4d, 0x4b, 0x7b, 0xf1, 0x34, 0x33, 0x6f, - 0xfe, 0xef, 0xf7, 0x7f, 0x3c, 0xfe, 0x86, 0x43, 0xf2, 0x18, 0x98, 0xa0, 0x9c, 0xcd, 0xf2, 0x7b, - 0x77, 0xf7, 0x70, 0x29, 0x0b, 0x80, 0x49, 0x3a, 0x05, 0xe1, 0x26, 0x38, 0xc5, 0xb1, 0x70, 0x92, - 0x94, 0x4b, 0x6e, 0xb6, 0xca, 0xfa, 0x7d, 0xb3, 0xb3, 0xd7, 0xff, 0xad, 0x45, 0x3c, 0xe2, 0x4a, - 0xed, 0x16, 0xb7, 0x4d, 0x63, 0x7b, 0x5e, 0x31, 0xaa, 0x17, 0x8a, 0x64, 0x5e, 0x1b, 0x7f, 0x08, - 0x15, 0x32, 0x45, 0x90, 0xf0, 0x60, 0x8c, 0x28, 0x29, 0x3a, 0x43, 0x0a, 0x69, 0x43, 0x6f, 0xea, - 0x9d, 0x1f, 0xbd, 0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, 0x76, 0x73, 0x52, 0x1a, 0xee, 0x93, - 0x60, 0x4d, 0xbb, 0xee, 0xac, 0x9c, 0x2e, 0x35, 0xb1, 0x5f, 0x55, 0x21, 0xe9, 0xbe, 0x06, 0x00, - 0x00, 0xff, 0xff, 0x52, 0x46, 0x0d, 0x10, 0x8f, 0x02, 0x00, 0x00, + // 332 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x31, 0x4f, 0xf2, 0x40, + 0x18, 0xc7, 0x5b, 0xde, 0x37, 0x24, 0xd6, 0x38, 0xd8, 0x80, 0x21, 0x26, 0x16, 0x61, 0x30, 0x2e, + 0xf6, 0x06, 0x06, 0x13, 0x47, 0xa2, 0x18, 0x36, 0x25, 0x26, 0x26, 0x2e, 0xf5, 0xe8, 0x3d, 0x94, + 0x8b, 0xde, 0x3d, 0x4d, 0xef, 0x20, 0xd4, 0x4f, 0xe1, 0xc7, 0x62, 0x64, 0x34, 0x0e, 0xc4, 0xc0, + 0x37, 0x70, 0x74, 0x32, 0x77, 0x18, 0x40, 0xa3, 0x0b, 0x53, 0x7b, 0xcf, 0xfd, 0xff, 0xbf, 0xdf, + 0x70, 0x8f, 0x17, 0xb2, 0x5c, 0x80, 0x54, 0x1c, 0xe5, 0x28, 0x7f, 0x22, 0xcb, 0x03, 0xe1, 0x32, + 0x06, 0xa9, 0xf9, 0x10, 0x14, 0x49, 0x69, 0x46, 0x85, 0x0a, 0xd3, 0x0c, 0x35, 0xfa, 0xb5, 0xf5, + 0xfc, 0xaa, 0x1c, 0xae, 0xf2, 0xfb, 0xa5, 0x04, 0x13, 0xb4, 0x69, 0x62, 0xfe, 0x16, 0xc5, 0xfa, + 0x47, 0xc1, 0x2b, 0x5e, 0x59, 0x92, 0x7f, 0xeb, 0xed, 0x31, 0xae, 0x74, 0x16, 0x41, 0x8a, 0x71, + 0x3f, 0xe2, 0xcc, 0x34, 0x7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x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -147,16 +134,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.FeatureFlagEpochEndDistribution { - i-- - if m.FeatureFlagEpochEndDistribution { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } { size := m.AddDenomFee.Size() i -= size @@ -224,9 +201,6 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) l = m.AddDenomFee.Size() n += 1 + l + sovParams(uint64(l)) - if m.FeatureFlagEpochEndDistribution { - n += 2 - } return n } @@ -399,26 +373,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FeatureFlagEpochEndDistribution", 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.FeatureFlagEpochEndDistribution = bool(v != 0) default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/iro/types/params.go b/x/iro/types/params.go index f90b44606..eba08ba14 100644 --- a/x/iro/types/params.go +++ b/x/iro/types/params.go @@ -13,7 +13,7 @@ var ( DefaultTakerFee = "0.02" // 2% DefaultCreationFee = math.NewInt(1).MulRaw(1e18) /* 1 Rollapp token */ DefaultMinPlanDuration = 0 * time.Hour // no enforced minimum by default - DefaultIncentivePlanMinimumNumEpochsPaidOver = uint64(10_080) // default: min 7 days (based on 1 minute distribution epoch) + DefaultIncentivePlanMinimumNumEpochsPaidOver = uint64(364) // default: min 364 days (based on 1 day distribution epoch) DefaultIncentivePlanMinimumStartTimeAfterSettlement = 60 * time.Minute // default: min 1 hour after settlement )