-
Notifications
You must be signed in to change notification settings - Fork 91
/
vest_entry.go
33 lines (26 loc) · 942 Bytes
/
vest_entry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (entry VestEntry) Validate() error {
if entry.VesterAccount == "" {
return errorsmod.Wrapf(ErrInvalidVesterAccount, "vester account cannot be empty")
}
if entry.TreasuryAccount == "" {
return errorsmod.Wrapf(ErrInvalidTreasuryAccount, "treasury account cannot be empty")
}
if err := sdk.ValidateDenom(entry.Denom); err != nil {
return errorsmod.Wrapf(ErrInvalidDenom, err.Error())
}
if !entry.StartTime.Before(entry.EndTime) {
return errorsmod.Wrapf(ErrInvalidStartAndEndTimes, "start_time = %v, end_time = %v", entry.StartTime, entry.EndTime)
}
if entry.StartTime.Location().String() != "UTC" {
return errorsmod.Wrapf(ErrInvalidTimeZone, "start_time must be in UTC")
}
if entry.EndTime.Location().String() != "UTC" {
return errorsmod.Wrapf(ErrInvalidTimeZone, "start_time must be in UTC")
}
return nil
}