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 state

Back to all declarations

Path

untyped string

Path is this realm's package path, which every denom it issues embeds.

Value

"gno.land/r/moul/x/nativeify/v0"

MinBase

untyped bigint

MinBase and MaxBase bound a base denom name. The chain enforces exactly this (\`isValidBaseDenom\` in the banker stdlib): a lowercase letter, then 2 to 15 more lowercase letters or digits. Validating here rather than letting the banker abort is the difference between a usable error and a stack trace.

Value

(3 <untyped> bigint)

MaxBase

untyped bigint

MinBase and MaxBase bound a base denom name. The chain enforces exactly this (\`isValidBaseDenom\` in the banker stdlib): a lowercase letter, then 2 to 15 more lowercase letters or digits. Validating here rather than letting the banker abort is the difference between a usable error and a stack trace.

Value

(16 <untyped> bigint)

pair

type

Value

v0.pair

bases

[]string

// creation order, for a stable Render

Value

<zero>

home

.uverse.address

// this realm's address: where every escrow sits

Value

<gnolang.StringValue>

Nativeify

func(tokenKey string, base string) string

Nativeify creates the native counterpart of a GRC20 registered in \`r/nt/grc20reg\`, and returns its denom. It issues nothing: [Wrap](#Wrap) does that. \`base\` is the part of the denom after the colon, yours to choose, unique in this realm and in the chain's charset. One native denom per underlying token: a second one would double the chain's per-denom storage for no new capability, and realm-denom balances live under their own store keys, which are not gas-metered.

Open
OID
0d2f6e…2c96:14
Nativeify details

Inspect func

Wrap

func(base string, amount int64) int64

Wrap escrows \`amount\` of the underlying and issues the same number of native coins to the caller. You must \`Approve\` this realm's address on the underlying token first, through that token's own realm. Until you do, this realm has no authority over your balance at all, and Wrap fails with "insufficient allowance", which is the system working.

Open
OID
0d2f6e…2c96:15
Wrap details

Inspect func

Unwrap

func(base string) int64

Unwrap destroys the native coins attached to this call and releases the same number of underlying GRC20 units to the caller. ### Why you have to send the coins rather than let this realm take them {#hdr-Why_you_have_to_send_the_coins_rather_than_let_this_realm_take_them} This realm holds a \`BankerTypeRealmIssue\` banker, and \`RemoveCoin\` takes an arbitrary address, so it could delete the caller's coins directly and save them a flag. It does not, and the reason is worth stating where somebody copying this will read it: a realm whose normal operation is to remove coins from addresses that did not hand them over has no way left to demonstrate that it only ever does so consensually. Every \`RemoveCoin\` here names this realm's own address, which anybody can check by reading the source, and the coins get to that address the only way a native coin ever moves, by their holder pushing them. So: attach them. -send <amount>/gno.land/r/moul/x/nativeify/v0:<base>

Open
OID
0d2f6e…2c96:16
Unwrap details

Inspect func

Denom

func(base string) string

Denom returns the denom this realm issues for a base name.

Open
OID
0d2f6e…2c96:17
Denom details

Inspect func

TokenKey

func(base string) string

TokenKey returns the grc20reg key of the underlying behind a base name.

Open
OID
0d2f6e…2c96:18
TokenKey details

Inspect func

Bases

func() []string

Bases returns every base name this realm issues, in creation order.

Open
OID
0d2f6e…2c96:19
Bases details

Inspect func

Solvency

func(base string) (escrowed int64, issued int64)

Solvency returns what is escrowed and what is issued for a base name. They are read from two different places on the chain, the GRC20 ledger and the bank, and this realm's own bookkeeping is not consulted for either: if they ever disagree, the disagreement is the answer.

Open
OID
0d2f6e…2c96:20
Solvency details

Inspect func

IsSolvent

func(base string) bool

IsSolvent reports whether every coin issued for a base name is backed. It allows escrowed > issued, which is what a donation to this realm's address looks like and cannot hurt anybody, and refuses the reverse.

Open
OID
0d2f6e…2c96:21
IsSolvent details

Inspect func

Underlying

func(base string) *v0.Token

Underlying returns the underlying token behind a base name, for a caller that wants its name, symbol or decimals.

Open
OID
0d2f6e…2c96:22
Underlying details

Inspect func

mustPair

func(base string) *v0.pair
Open
OID
0d2f6e…2c96:23
mustPair details

Inspect func

assertBase

func(base string)

assertBase applies the chain's own base-denom rule before the banker does, so the caller reads a sentence instead of a stack trace.

Open
OID
0d2f6e…2c96:24
assertBase details

Inspect func

Render

func(path string) string

Render lists the pairs. \`?\<base>\` shows one.

Open
OID
0d2f6e…2c96:25
Render details

Inspect func

renderOne

func(base string) string
Open
OID
0d2f6e…2c96:28
renderOne details

Inspect func
Path : untyped string ="gno.land/r/moul/x/nativeify/v0"
MinBase : untyped bigint =(3 <untyped> bigint)
MaxBase : untyped bigint =(16 <untyped> bigint)
pair : type =v0.pair
byBase : *v0.Tree Inspect
byKey : *v0.Tree Inspect
bases : []string =<zero>
home : .uverse.address =<gnolang.StringValue>
init.8 : func() Inspect
Home : func() .uverse.address Inspect
Nativeify : func(tokenKey string, base string) string Inspect
Wrap : func(base string, amount int64) int64 Inspect
Unwrap : func(base string) int64 Inspect
Denom : func(base string) string Inspect
TokenKey : func(base string) string Inspect
Bases : func() []string Inspect
Solvency : func(base string) (escrowed int64, issued int64) Inspect
IsSolvent : func(base string) bool Inspect
Underlying : func(base string) *v0.Token Inspect
mustPair : func(base string) *v0.pair Inspect
assertBase : func(base string) Inspect
Render : func(path string) string Inspect
renderIndex : func() string Inspect
renderOne : func(base string) string Inspect