Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

access.gno

0.43 Kb · 29 lines
 1package manager
 2
 3type Access struct {
 4	Since TimePoint
 5}
 6
 7func NewAccess(since TimePoint) Access {
 8	return Access{
 9		Since: since,
10	}
11}
12
13func NewAccessWithDelay(since TimePoint, delay uint32) Access {
14	if since.IsZero() {
15		return Access{Since: 0}
16	}
17
18	return Access{
19		Since: since + TimePoint(delay),
20	}
21}
22
23func (access Access) isActiveAt(now TimePoint) bool {
24	if access.Since.IsZero() {
25		return false
26	}
27
28	return !access.Since.After(now)
29}