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 wrapped is an accounting-only port of Wrapped Ether (WETH).

Readme View source

wrapped — Wrapped Ether (WETH), gno.land port

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


An accounting-only port of the canonical Wrapped Ether (WETH) contract. WETH lets you lock native ETH to mint a 1:1 ERC-20 token and burn it to unlock the ETH again. gno.land / sapphire has no msg.value / payable, so this realm models the wrap/unwrap purely as uint64 ledger accounting — no real coin ever moves. Balances live in an avl.Tree; every mutation emits a Deposit, Withdrawal, or Transfer event, mirroring the original contract.

API

  • Deposit(cur realm, amount uint64) — credit the caller's wrapped balance and totalSupply (models wrapping native funds; accounting only).
  • Withdraw(cur realm, amount uint64) — burn amount from the caller and from totalSupply (panics on insufficient balance).
  • Transfer(cur realm, to address, amount uint64) — move wrapped units.
  • BalanceOf(owner address) uint64 — read a single balance.
  • TotalSupply() uint64 — read the total wrapped supply.
  • Render(path string) string — Markdown: total supply + non-zero balances table.

Example calls

# wrap 1000 units for the caller
gnokey maketx call -pkgpath gno.land/r/moul/x/daily/wrapped/v0 -func Deposit -args 1000 ...

# send 250 to another address
gnokey maketx call ... -func Transfer -args g1<recipient> -args 250 ...

# unwrap 500 units
gnokey maketx call ... -func Withdraw -args 500 ...

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/wrapped/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 wrapped is an accounting-only port of Wrapped Ether (WETH).

The canonical WETH contract lets anyone lock native ETH and mint a 1:1 ERC-20 representation (and burn it back). On gno.land / sapphire there is no msg.value / payable, so there is NO real coin transfer here: Deposit and Withdraw are pure accounting operations that model the wrap/unwrap. Balances and totalSupply are plain uint64 ledgers kept in an avl.Tree.

Functions 6

func BalanceOf

Action
1func BalanceOf(owner address) uint64
source

BalanceOf is the exported read-only accessor for a single owner.

func Deposit

crossing Action
1func Deposit(cur realm, amount uint64)
source

Deposit wraps `amount` units of the (notional) native coin, crediting the caller's wrapped balance and the global totalSupply. Accounting only: no real coin ever moves — it models locking native funds to mint the wrapped token.

func Render

1func Render(path string) string
source

Render shows the total supply and a table of non-zero balances.

func TotalSupply

Action
1func TotalSupply() uint64
source

TotalSupply returns the total amount of wrapped units in existence.

func Transfer

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

Transfer moves `amount` wrapped units from the caller to `to`.

func Withdraw

crossing Action
1func Withdraw(cur realm, amount uint64)
source

Withdraw unwraps `amount` units, burning them from the caller's balance and from totalSupply. Panics if the caller lacks the balance.

Imports 4

Source Files 3