| 612 | } |
| 613 | |
| 614 | func (m MsgAddProviderDistributionPeriodRequest) ValidateBasic() error { |
| 615 | if m.Signer == "" { |
| 616 | return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Signer) |
| 617 | } |
| 618 | |
| 619 | for _, period := range m.DistributionPeriods { |
| 620 | if period.DistributionPeriodStartBlock > period.DistributionPeriodEndBlock { |
| 621 | return fmt.Errorf("provider distribution period start block must be < end block: %d %d", period.DistributionPeriodStartBlock, period.DistributionPeriodEndBlock) |
| 622 | } |
| 623 | |
| 624 | if period.DistributionPeriodBlockRate.LT(sdk.NewDec(0)) || |
| 625 | period.DistributionPeriodBlockRate.GT(sdk.NewDec(1)) { |
| 626 | return fmt.Errorf("provider distribution period block rate must be >= 0 and <= 1 but is: %s", period.DistributionPeriodBlockRate.String()) |
| 627 | } |
| 628 | |
| 629 | if period.DistributionPeriodMod == 0 { |
| 630 | return fmt.Errorf("provider distribution period modulo must be > 0") |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | return nil |
| 635 | } |
| 636 | |
| 637 | func (m MsgAddProviderDistributionPeriodRequest) GetSignBytes() []byte { |
| 638 | return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) |