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).

Function

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