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

gnomic source realm

Parametric GRC20 realm for gno.land.

Overview

Parametric GRC20 realm for gno.land.

All configuration (name, symbol, decimals, supply, metadata) lives in config.gno. This file holds only the logic, which is not meant to be edited.

The realm:

  • creates a GRC20 token through gno.land/p/nt/grc20/v0
  • registers it with gno.land/r/nt/grc20reg/v0 (required to be discoverable by GnoSwap, wallets and explorers)
  • mints the initial supply to the deploying address
  • exposes the GRC20 methods as top-level functions callable via MsgCall
  • enforces a hard ceiling (maxSupply) on minting
  • lets the owner give up minting forever (DropOwnership)

Variables 1

var Token, Ownable, privateLedger, userTeller, unit, hardCap, totalMinted, tokenKey, deployHeight, realmAddr

 1var (
 2	// Token is the public handle on the token: other realms can read it, but
 3	// cannot mutate balances (the PrivateLedger stays private).
 4	Token *grc20.Token
 5
 6	// Ownable holds the administrative authority (mint / administrative burn).
 7	Ownable *ownable.Ownable
 8
 9	privateLedger *grc20.PrivateLedger
10	userTeller    grc20.Teller
11
12	// unit = 10^tokenDecimals, the conversion factor between whole units and
13	// base units.
14	unit int64
15
16	// hardCap = maxSupply * unit, expressed in base units.
17	hardCap int64
18
19	// totalMinted is the CUMULATIVE amount ever minted, and never goes down.
20	//
21	// The ceiling is checked against this figure rather than against circulating
22	// supply, because Burn lowers supply: checking that, burning would reopen
23	// minting headroom and "21 million" would become an instantaneous limit
24	// instead of a final one. With the cumulative counter burned tokens are gone
25	// for good, which is what a fixed supply is supposed to mean.
26	totalMinted int64
27
28	// tokenKey is the canonical key in the GRC20 registry: "<pkgpath>.<SYMBOL>".
29	// It is the identifier used by GnoSwap and friends.
30	tokenKey string
31
32	deployHeight int64
33	realmAddr    address
34)
source

Functions 19

func Allowance

Action
1func Allowance(owner, spender address) int64
source

Allowance returns how much spender may draw from owner.

func Approve

crossing Action
1func Approve(cur realm, spender address, amount int64)
source

Approve authorises spender to draw up to amount from the caller.

func BalanceOf

Action
1func BalanceOf(owner address) int64
source

BalanceOf returns the balance of owner in base units.

func Burn

crossing Action
1func Burn(cur realm, amount int64)
source

Burn destroys amount of the caller's tokens, reducing the supply.

func Burned

Action
1func Burned() int64
source

Burned returns the total destroyed: cumulative minted minus circulating.

func DropOwnership

crossing Action
1func DropOwnership(cur realm)
source

DropOwnership gives up administration for good: no future mint will ever be possible. The operation cannot be undone.

func Holders

Action
1func Holders() int
source

Holders returns the number of addresses with a non-zero balance.

func MaxSupply

Action
1func MaxSupply() int64
source

MaxSupply returns the hard ceiling in base units: it caps the cumulative amount ever minted, not the circulating supply.

func Mint

crossing Action
1func Mint(cur realm, to address, amount int64)
source

Mint creates amount (base units) in favour of to. Owner only, and never beyond maxSupply. After DropOwnership this function is unusable forever: the supply becomes immutable upwards.

func TokenKey

Action
1func TokenKey() string
source

TokenKey returns the token's key in the GRC20 registry ("<pkgpath>.<SYMBOL>"), to be used with r/nt/grc20reg and with GnoSwap.

func TotalMinted

Action
1func TotalMinted() int64
source

TotalMinted returns the cumulative amount ever minted. It never goes down, not even after a Burn: hardCap - TotalMinted() is the remaining headroom.

func Transfer

crossing Action
1func Transfer(cur realm, to address, amount int64)
source

Transfer sends amount (base units) from the caller to to.

func TransferFrom

crossing Action
1func TransferFrom(cur realm, from, to address, amount int64)
source

TransferFrom moves amount from from to to, consuming the caller's allowance.

func TransferOwnership

crossing Action
1func TransferOwnership(cur realm, newOwner address)
source

TransferOwnership hands administration over to newOwner.

Imports 9

Source Files 3