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

v0 source realm

Package erc20 implements MiniToken, a minimal fungible token modeled on the Solidity ERC-20 idea, ported to gno.land ...

Readme View source

MiniToken (ERC-20)

⚠️ Experimental — generated with no human supervision. This realm was produced automatically by an MCP-driven agent to exercise the gno MCP server and tooling, and to generate test content for gno compilers, linters and formatters. Not audited. Not for production. Full context & folder README: r/moul/x/daily


A minimal fungible-token realm for gno.land (gno 0.9 / sapphire), porting the classic Solidity ERC-20 idea. It keeps package-level state — a balances map, a total supply, and per-owner allowances — behind gno 0.9 crossing functions that authenticate the caller via cur.IsCurrent() + cur.Previous(). Render returns a Markdown dashboard with the token metadata and a table of holders.

Realm path: gno.land/r/REPLACE_ADDR/erc20 (deploy address injected at deploy time).

Exported API

  • Mint(cur realm, to address, amount uint64) — create new tokens for to.
  • Transfer(cur realm, to address, amount uint64) — send tokens from the caller.
  • Approve(cur realm, spender address, amount uint64) — grant a spending allowance.
  • TransferFrom(cur realm, from, to address, amount uint64) — spend an allowance.
  • BalanceOf(holder address) uint64 · Allowance(owner, spender address) uint64
  • TotalSupply() uint64 · Name() string · Symbol() string
  • Render(path string) string — Markdown view for gnoweb.

Example calls

1# Mint 1000 MINI to yourself
2gnokey maketx call -pkgpath "gno.land/r/REPLACE_ADDR/erc20" \
3  -func Mint -args "<your-addr>" -args 1000 \
4  -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid sapphire-1 <key>
5
6# Transfer 250 MINI to another account
7gnokey maketx call -pkgpath "gno.land/r/REPLACE_ADDR/erc20" \
8  -func Transfer -args "<recipient-addr>" -args 250 \
9  -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid sapphire-1 <key>

View the token dashboard at https://gno.land/r/REPLACE_ADDR/erc20 on gnoweb.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.

Overview

Package erc20 implements MiniToken, a minimal fungible token modeled on the Solidity ERC-20 idea, ported to gno.land (gno 0.9 / sapphire).

State is package-level and persistent. All state-mutating exported functions are crossing functions (they take `cur realm` as the first parameter) per the gno 0.9 interrealm convention, and identify the caller via cur.Previous().Address() after checking cur.IsCurrent().

Functions 10

func Allowance

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

Allowance returns how much `spender` may still pull from `owner`.

func Approve

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

Approve authorizes `spender` to pull up to `amount` tokens from the caller. Crossing function.

func BalanceOf

Action
1func BalanceOf(holder address) uint64
source

BalanceOf returns the token balance of `holder`. Read-only, non-crossing.

func Mint

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

Mint creates `amount` new tokens and credits them to `to`, increasing the total supply. Crossing function.

func Render

1func Render(path string) string
source

Render produces the gnoweb Markdown view of the token: metadata plus a deterministically-ordered table of non-zero balances. Render is NOT a crossing function (no `cur realm` parameter).

func Transfer

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

Transfer moves `amount` tokens from the caller to `to`. Crossing function.

func TransferFrom

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

TransferFrom moves `amount` tokens from `from` to `to`, spending the caller's allowance granted by `from`. Crossing function.

Imports 4

  • errors stdlib
  • sort stdlib
  • strconv stdlib
  • strings stdlib

Source Files 3