()
| 110 | } |
| 111 | |
| 112 | func (m MsgAddRewardPeriodRequest) ValidateBasic() error { |
| 113 | for _, period := range m.RewardPeriods { |
| 114 | if period.RewardPeriodId == "" { |
| 115 | return fmt.Errorf("reward period id must be non-empty: %d", period.RewardPeriodStartBlock) |
| 116 | } |
| 117 | if period.RewardPeriodEndBlock < period.RewardPeriodStartBlock { |
| 118 | return fmt.Errorf("reward period start block must be before end block: %d %d", period.RewardPeriodStartBlock, period.RewardPeriodEndBlock) |
| 119 | } |
| 120 | for _, multiplier := range period.RewardPeriodPoolMultipliers { |
| 121 | if multiplier.Multiplier.LT(sdk.ZeroDec()) { |
| 122 | return fmt.Errorf("pool multiplier should be less than 0 | pool : %s , multiplier : %s", multiplier.PoolMultiplierAsset, multiplier.Multiplier.String()) |
| 123 | } |
| 124 | if multiplier.Multiplier.GT(sdk.MustNewDecFromStr("10.00")) { |
| 125 | return fmt.Errorf("pool multiplier should be greater than 10 | pool : %s , multiplier : %s", multiplier.PoolMultiplierAsset, multiplier.Multiplier.String()) |
| 126 | } |
| 127 | } |
| 128 | if period.RewardPeriodDefaultMultiplier.LT(sdk.ZeroDec()) { |
| 129 | return fmt.Errorf("default should be less than 0 |multiplier : %s", period.RewardPeriodDefaultMultiplier.String()) |
| 130 | } |
| 131 | if period.RewardPeriodDefaultMultiplier.GT(sdk.MustNewDecFromStr("10.00")) { |
| 132 | return fmt.Errorf("default multiplier should be greater than 10 | multiplier : %s", period.RewardPeriodDefaultMultiplier.String()) |
| 133 | } |
| 134 | } |
| 135 | return nil |
| 136 | } |
| 137 | |
| 138 | func (m MsgAddRewardPeriodRequest) GetSignBytes() []byte { |
| 139 | return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) |
no test coverage detected