PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/moul/x/daily/erc721/v1

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v1
Namespace
moul / x / daily / erc721
Files
5 (README)(gnomod.toml)
Exported functions
7
Module
gno.land/r/moul/x/daily/erc721/v1
gno
0.9

Files (5)

  • README.mdmarkdown
  • gnomod.tomltoml
  • erc721.gnogno
  • erc721_test.gnogno
  • render_example_test.gnogno
README.mdPreviewRaw
# 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](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md).

---


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.Tree`s, 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
```

## What changed in v1

State moved from a hand-rolled `avl.Tree` + `nextID` + zero-padding helper to
[`p/moul/kit/store`](/p/moul/kit/store/v0), which keys entries by
[`seqid`](/p/nt/seqid/v0) instead of a fixed-width decimal string.

`v0` padded token ids to width 12. Past that width the padding stops and the tree
orders `"1000000000000"` before `"999999999999"`, so every list this realm
renders would be wrong from that entry on. `store` keys are 8 big-endian bytes
whose order is numeric for every `uint64`, so there is no width left to outgrow.

`approvals`, the secondary index on the same ids, is keyed with `store.ID.Key()`
so the two trees cannot drift apart. `balances` keeps its own address-keyed
tree, which the store does not cover. `minted` is gone: with no burn, the
highest id ever assigned *is* the supply, so `LastID()` answers it.

Token ids stay plain integers and the rendered output is unchanged. This is a
storage change, which under this repo's versioning rule is a compatibility
change, hence a new version rather than an edit in place. [`v0`](https://github.com/moul/gno-contracts/tree/4f2df83869b80470eb81c48a82fdbe82256b8113/r/moul/x/daily/erc721) stays
live and untouched.

<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->

---

Part of **[moul/gno-contracts](https://github.com/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/v1 dependency graph](https://raw.githubusercontent.com/moul/gno-contracts/main/_assets/gno.land/r/moul/x/daily/erc721/v1/deps.png)

> 🧪 **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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).

<!-- END GNOCONTRACTS FOOTER -->

Functions

  • Approve(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, spender string, id int64)

  • BalanceOf(owner string) uint64

  • Mint(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, to string) int64

  • OwnerOf(id int64) string

  • Render(path string) string

  • TotalSupply() int64

  • Transfer(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, to string, id int64)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

Rendered

RenderedRawgnoweb ↗

vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.