Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

vesting package

Overview

Package vesting holds grants of GNOT, BUBBLE or any registered GRC20 and pays each out on its own schedule: a share at the start, the rest by the day over a term, to one beneficiary, for as long as the grant's owner does not revoke it. Anyone may open a grant for anyone; nothing here is a setting but each grant's owner.

Every grant has its OWN address — the realm's sub-realm `grant-<id>` (chain.DerivePkgSubAddr) — and that is how it is funded: send the tokens there (a bank send for GNOT, Transfer for a GRC20, a holders' vote that mints BUBBLE to it). The realm moves tokens out of a grant's address and never between grants; what sits at the realm's main address belongs to nobody and stays there, so send only to a grant's address.

The schedule. Nothing before start, or before start + cliff; at start the up-front share is vested; each full day after start vests an equal share of the rest, until day Days, when all of Total has vested (Days 0: all of it at start). Claim pays the beneficiary what has vested and not yet been paid, as far as the grant's balance goes; anyone may call it, since the money has one destination. Revoke, by the owner, freezes the schedule where it stands and returns everything above what has vested to the owner; what had vested stays the beneficiary's to claim. A revoke before the up-front share has arrived (what was already paid counts as arrived) VOIDS the grant: nothing vests, and whatever lands later is the owner's to sweep. Sweep, by the owner, returns what the schedule can never owe (a gift, a double funding) without ending anything. A grant opened with no owner is irrevocable, and its excess is the beneficiary's to sweep.

Votes. BUBBLE held by a grant is self-delegated, inside the token's ledger, to the grant's own address, and this realm never delegates it or votes with it; the beneficiary's weight grows as they claim.

Immutable, not private (gnomod.toml).

Functions

AcceptOwner

func AcceptOwner(cur realm, id int64)

AcceptOwner takes the owner role of a grant, by the one named.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "AcceptOwner" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "AcceptOwner" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Balance

func Balance(id int64) int64

Balance is what the grant's address holds of its token.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting.Balance()"

Result

Claim

func Claim(cur realm, id int64) int64

Claim pays the beneficiary everything claimable and returns the amount. Anyone may call it.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "Claim" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "Claim" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Claimable

func Claimable(id int64) int64

Claimable is what Claim would pay now: the vested part not yet paid, as far as the balance goes.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting.Claimable()"

Result

Count

func Count() int64

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting.Count()"

Result

Create

func Create(cur realm, owner, beneficiary address, token string, total, upfront, start, cliffDays, days int64, note string) int64

Create opens a grant and returns its id. owner may revoke it ("" makes it irrevocable); the tokens are sent to Address(id) afterwards, by anyone. token: "gnot", "bubble" or a registry key. start 0 is now; a past start is allowed, a future one up to a hundred years out. days 0 vests everything at start. note is a label of up to 120 plain characters (no markup: the pages render it).

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "Create" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "Create" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Render

func Render(path string) string

Render: "" the newest grants; "<id>" one grant; "json/<id>" its figures in base units; "by/<address>" the grants an address owns or receives.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting.Render()"

Result

Revoke

func Revoke(cur realm, id int64) int64

Revoke ends the schedule where it stands (the first time) and returns to the owner everything the grant holds beyond what has vested and is still the beneficiary's to claim. Before the up-front share has arrived, counting what was already paid out as arrived, it voids the grant instead: nothing vests, ever — so a unit of dust sent ahead of the owner's revoke, claimed or not, cannot turn a void into a freeze that keeps the up-front share. (A grant with no up-front share measures against what the schedule had released by the revoke.) Returns what went back; 0 when nothing did.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "Revoke" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "Revoke" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

SetOwner

func SetOwner(cur realm, id int64, to address)

SetOwner names the next owner; nothing moves until they AcceptOwner. Naming "" withdraws the offer.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "SetOwner" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "SetOwner" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Sweep

func Sweep(cur realm, id int64) int64

Sweep returns to the owner what the schedule can never owe the beneficiary — above the unpaid rest of the grant while it runs, above what is still claimable once revoked — without ending anything. Owner only; on a grant with no owner the excess is the beneficiary's, and anyone may send it there.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "Sweep" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting" -func "Sweep" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Vested

func Vested(id int64) int64

Vested is what the schedule has released by now — or by the revoke, if there was one. Never above Total.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting.Vested()"

Result

Get

func Get(id int64) Grant

Get is a copy of the grant.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/vesting.Get()"

Result