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 erc721 is an idiomatic gno.land port of the Solidity ERC-721 non-fungible token standard. Each token has a un...

Readme View source

erc721 — NFT (ERC-721 port)

⚠️ Experimental — generated with no human supervision by the daily MCP pipeline (Solidity→Gno port). Not audited. See r/moul/x/daily.


An idiomatic gno.land port of the Solidity ERC-721 non-fungible token standard. Each token is a unique, sequentially-minted integer id owned by exactly one address. Ownership, per-owner balances and single-token approvals live in ordered avl.Trees, so Render can list every token deterministically. msg.sender maps to unsafe.PreviousRealm().Address(), require to panic, and Solidity events to chain.Emit (Mint, Transfer, Approval).

Transactions

  • Mint(cur realm, to address) int64 — mint the next token id to to; returns the id.
  • Transfer(cur realm, to address, id int64) — move a token you own (or are approved for) to to; clears the approval.
  • Approve(cur realm, spender address, id int64) — owner grants spender the right to transfer token id.

Read-only

  • OwnerOf(id int64) address — owner of a token (panics if it does not exist).
  • BalanceOf(owner address) uint64 — number of tokens held by owner.
  • TotalSupply() int64 — total tokens in circulation.
  • Render(path string) — Markdown: total supply + a token → owner → approved table.

Example

Mint(cur, g1alice...)          // -> tokenID 1
Mint(cur, g1alice...)          // -> tokenID 2
Approve(cur, g1bob..., 1)      // alice approves bob for token 1
Transfer(cur, g1carol..., 1)   // owner alice sends token 1 to carol
OwnerOf(1)                     // -> g1carol...
BalanceOf(g1alice...)          // -> 1
TotalSupply()                  // -> 2

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

Dependency graph:

gno.land/r/moul/x/daily/erc721/v0 dependency graph

🧪 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 erc721 is an idiomatic gno.land port of the Solidity ERC-721 non-fungible token standard. Each token has a unique integer id owned by exactly one address; ids are minted sequentially. Ownership, per-owner balances and single-token approvals are kept in ordered avl trees so that Render can iterate deterministically.

Functions 6

func Approve

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

Approve grants `spender` the right to transfer token `id`. Only the current owner may approve.

func BalanceOf

Action
1func BalanceOf(owner address) uint64
source

BalanceOf is the exported read-only accessor for balanceOf.

func Mint

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

Mint creates the next token id and assigns it to `to`. Only sequential minting is supported (id is returned via the Mint event).

func Render

1func Render(path string) string
source

Render displays collection metadata and a token -> owner table.

func Transfer

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

Transfer moves token `id` from the caller to `to`. The caller must own the token (approvals are cleared on transfer).

Imports 4

Source Files 3