PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/samcrew/launchpad/vesting/v1

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v1
Namespace
samcrew / launchpad / vesting
Files
2 (gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/samcrew/launchpad/vesting/v1
gno
0.9

Files (2)

  • gnomod.tomltoml
  • vesting.gnogno
vesting.gnogno
1
// Package vesting computes cliff-then-linear token release.
2package vesting
3
4import sm "gno.land/p/samcrew/launchpad/safemath/v1"
5
6type Schedule struct {
7 Total int64
8 Start int64 // unix seconds
9 Cliff int64 // seconds after Start before anything vests
10 Duration int64 // seconds after Start when everything has vested
11}
12
13func (s Schedule) Validate() {
14 if s.Total <= 0 || s.Start < 0 || s.Duration <= 0 || s.Cliff < 0 || s.Cliff > s.Duration {
15 panic("launchpad/vesting: invalid schedule")
16 }
17 sm.Add(s.Start, s.Duration)
18}
19
20func (s Schedule) VestedAt(now int64) int64 {
21 s.Validate()
22 if now < sm.Add(s.Start, s.Cliff) {
23 return 0
24 }
25 elapsed := now - s.Start
26 if elapsed >= s.Duration {
27 return s.Total
28 }
29 return sm.MulDiv(s.Total, elapsed, s.Duration)
30}
31
32func (s Schedule) Releasable(now, released int64) int64 {
33 return sm.Sub(s.VestedAt(now), released)
34}
35

Functions

not supported for pure packages by the node (vm/qfuncs)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.