Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source realm

based on Wikipedia's Solidity example: [https://en.wikipedia.org/wiki/Solidity](https://en.wikipedia.org/wiki/Solidity)

Readme View source

gno.land/r/moul/demo/wikicoin

Step 5 of the r/moul/demo walkthrough: the token from Wikipedia's Solidity article, translated to gno line by line.

1func Mint(cur realm, receiver address, amount uint)   // minter only
2func Send(cur realm, receiver address, amount uint)
3func BalanceOf(addr address) uint

What the translation shows:

  • Solidity's constructor becomes init(), which runs once at deploy. The deployer is recorded as minter.
  • mapping(address => uint) becomes an avl.Tree keyed by the address string. Gno has maps, but an avl tree is the storage-friendly choice for a ledger that grows.
  • require(msg.sender == minter) becomes an explicit panic("restricted"). A panic aborts the transaction and reverts every write, the same way a revert does.
  • Solidity's msg.sender is unsafe.OriginCaller() here, which is the transaction signer, not the immediate caller. That distinction does not matter in a demo and matters a great deal in production: it is what AssertOriginCall guards exist for.

This is teaching material, not a token to use. For a real one, use p/nt/grc20, which grc20 demonstrates next.

Previous: render. Next: grc20.


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

On mainnet: deployment status transactions unique callers deployed revision

Dependency graph:

gno.land/r/moul/demo/wikicoin/v0 dependency graph

⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.

Overview

based on Wikipedia's Solidity example: https://en.wikipedia.org/wiki/Solidity

Functions 3

Dependencies

Imports 3

/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/demo/wikicoin/v0

Imported by indexer

Source Files 4