Pure package on pearl-1
coinio
gno.land/p/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/coinio
pure packageprimitivevalue-handling
Native-coin I/O for realms: the Receive receipt-guard trio (caller shape, envelope, denomination), Payout via RealmSend, reserve-protected Sweep, and HeldAt.
Identity
| Import path | gno.land/p/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/coinio |
|---|---|
| Kind | pure package (/p/) |
| Chain | pearl-1 |
| Namespace | g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3 |
| Realm address | none — A /p/ package is not a realm: it holds no state, custodies no coins and is never a transaction sender. The pkgPath derivation would still produce a value; recording one would name nothing. |
Provenance
chain-attested| Deployed at height | 583,585 |
|---|---|
| Deploy transaction | 31b53d1b763132576eb85fce25fb7d3881b279351d0949e18a72c366167706ae look it up on the RPC |
| Deployer | g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3 |
| Gas used | 11,407,612 |
| Storage | 5,534 bytes, deposit 553400ugnot |
| Files on chain | coinio.gno gnomod.toml |
| Deployed bytes | coinio.gno — 5,685 bytes |
| sha256 | ea9d467d380ff2971695d452f96fe64ea46d847d094023f755edf5f79995b09d |
Do not take the hash above on trust. $download returns the bytes pearl-1 is actually running; this command fetches them and prints their digest, which should equal the one in the table:
curl -sS 'https://pearl.testnets.gno.land/p/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/coinio$download&file=coinio.gno' | shasum -a 256Expected: ea9d467d380ff2971695d452f96fe64ea46d847d094023f755edf5f79995b09d — 5,685 bytes. This was checked for all 21 packages while building this site's architecture record; every one matched. Use curl: pearl's edge answers Python's default user-agent with HTTP 403.
API
chain-derived 3 exported functions.
This is a /p/ package: you import it, you do not call it in a transaction. gnoweb's $help shows only exported top-level functions, so the types and methods below do not appear there at all — which is why this reference exists.
Overview
Package coinio is the chain-facing coin plumbing that every value-holding realm on gno.land repeats: verified payment receipt, disciplined payout, and reserve-protected surplus sweeping. It was extracted from two audited, pearl-1-validated realms (vault and bounties) whose implementations of these mechanics were line-identical.
The package is PURE and STATELESS: it holds no balances, no roles, and no configuration; all state stays in the consuming realm (and its accounting package, e.g. feeledger). It emits no events — consumers emit their own. Every function either succeeds or panics, aborting the transaction: these are payment guards, and no failure here has a meaningful recovery path.
CAPABILITY CONTRACT: pure packages cannot declare crossing functions (a first `realm` parameter), so every coin-moving function here uses the canonical secondary-parameter shape `(_ int, rlm realm, ...)` — the same pattern as chain treasury packages. Pass 0 and your crossing entrypoint's own live `cur` (forwarded through non-crossing calls keeps it current). Each function asserts rlm.IsCurrent() before acting, so a stale, stored, or Previous() realm value fails closed (the designation-forgery guard secondary realm parameters require). Coins can only move FROM rlm.Address() — the calling realm itself — so no consumer can spend another realm's funds through this package.
AUTHORIZATION is the consumer's responsibility: coinio decides HOW coins move, never WHO may move them. Gate your entrypoints before calling in.
ORDERING CONTRACT (the one invariant coinio cannot enforce): debit your own accounting BEFORE calling Payout or Sweep (checks-effects-interactions). A panic inside coinio aborts the whole transaction, reverting your debit with it — that is what makes the debit-first order safe.
Imports
chainchain/bankerchain/runtime/unsafe
Functions
HeldAt
func HeldAt(addr address, denom string) int64
HeldAt returns the amount of denom held at addr. Read-only; usable from views and Render without a realm capability.
Payout
func Payout(_ int, rlm realm, to address, denom string, amount int64)
Payout sends amount of denom from the calling realm's own address to `to`. DEBIT YOUR ACCOUNTING FIRST — a panic here (or anywhere later in the transaction) reverts the debit together with the send.
Sweep
func Sweep(_ int, rlm realm, to address, denom string, reserve int64) int64
Sweep sends the surplus of a single denomination — everything the calling realm holds above `reserve` — to `to`, and returns the swept amount. Pass your total liabilities as the reserve for the denom your accounting tracks, and 0 for foreign denominations. Panics if there is no positive surplus, so reserved funds are untouchable by construction. One denomination per call keeps the operation gas- bounded regardless of how many junk denoms third parties force-send.
Doc text is reproduced as vm/qdoc returns it. The node markdown-escapes doc comments, so a bracket or angle bracket may carry a backslash the committed source does not have. The source itself is at source and in this repository.
Dependencies
chain-attested| Imports | chain, chain/banker, chain/runtime/unsafe |
|---|---|
| First-party dependencies | none |
| Used by | bounty_panel, coindemo, grants, market, service_market, subscriptions |
Known limitations
curatedThe manifest records no limitation for this package. That is an absence of a recorded caveat, not a proof that none exists — the deployment record below is the fuller account, and it always carries its own "what was NOT verified live" section.
Source and records
| Source file | pearl/p/coinio/coinio.gno at commit 6a510c665a53 in the project repository (not public — the digest command above is the check that needs no repository) |
|---|---|
| Matches the deployed bytes | yes — byte-identical |
| Registered in | gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/service_registry as coinio (type library) |
| Records | catalog/primitives.md#coiniopearl/DEPLOYMENT.md |