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

wbubble source realm

Package wbubble is wrapped BUBBLE: the Bubble Rumble token as a registered GRC20, backed one to one by BUBBLE held in...

Overview

Package wbubble is wrapped BUBBLE: the Bubble Rumble token as a registered GRC20, backed one to one by BUBBLE held in this realm. It exists for gnoswap, which pools only tokens registered in gno.land/r/nt/grc20reg/v0 — and the registry takes only a *grc20.Token made by grc20.NewToken inside the registering realm. BUBBLE (gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/bubble) keeps its ledger in kourt's grc20votes, not a grc20.Token, and a realm cannot be redeployed; so this realm holds BUBBLE and issues a registered token for it, the way gno.land/r/gnoland/wugnot wraps ugnot (ref/ holds the mainnet sources this mirrors).

Wrap pulls BUBBLE from the caller — an allowance the caller granted THIS realm on the bubble realm, spent by this realm as itself — and mints the same amount of wrapped BUBBLE to the caller. Unwrap burns the caller's wrapped BUBBLE and sends the same amount of BUBBLE back. Nothing else mints or burns, and nothing here is a setting: no admin, no pause, no minter. The reserve (this realm's BUBBLE balance) covers the wrapped supply after every call, and a call that would leave it short aborts.

Votes. BUBBLE carries a vote in its own realm; wrapped BUBBLE carries none. The BUBBLE held here is self-delegated, inside the bubble ledger, to this realm's own address — the ledger's default for every holder — and this realm never delegates it or votes with it, so that weight is never cast. Unwrap to vote.

Constants 1

const tokenName, tokenSymbol, tokenDecimals, pkgPath, RegistryKey, one

 1const (
 2	tokenName     = "Bubble Rumble BUBBLE (wrapped)"
 3	tokenSymbol   = "BUBBLE"
 4	tokenDecimals = 6
 5	pkgPath       = "gno.land/r/g1leu8d2vsplhehcfkjg50mwgdpxdkt8tztu95wr/wbubble" // must match gnomod.toml
 6	// RegistryKey is what gno.land/r/nt/grc20reg/v0 knows this token as: the realm path and the symbol.
 7	RegistryKey = pkgPath + "." + tokenSymbol
 8
 9	one = int64(1_000_000) // one BUBBLE in base units
10)
source

Variables 1

var Token, ledger

1var (
2	Token  *grc20.Token
3	ledger *grc20.PrivateLedger
4)
source

Token is the registered token, exported as wugnot exports its own: a *grc20.Token carries no spend authority (its tellers act only for the realm that builds them, and only with an allowance), and the registry hands the same pointer to anyone. ledger is the mint and burn, and it never leaves this package.

Functions 10

func Render

1func Render(path string) string
source

Render: "" the token's page; "balance/<addr>" one wrapped balance as a number (wugnot's path); "json" the figures for the box.

func Reserve

Action
1func Reserve() int64
source

Reserve is the BUBBLE this realm holds. It covers TotalSupply after every call (checkReserve).

func Unwrap

crossing Action
1func Unwrap(cur realm, amount int64)
source

Unwrap burns amount of the caller's wrapped BUBBLE and sends them as much BUBBLE. The burn goes first: a caller without the wrapped tokens is refused before anything moves.

func Wrap

crossing Action
1func Wrap(cur realm, amount int64)
source

Wrap takes amount BUBBLE from the caller and mints as much wrapped BUBBLE to them. First, on the bubble realm, the caller approves THIS realm for the amount (bubble.Approve with spender Address()): bubble reads its own caller as the spender, and its caller here is this realm, not the user. A failure inside bubble panics across the realm boundary and aborts the whole transaction, so nothing is minted for BUBBLE that did not arrive.

Imports 6

Source Files 2