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

config/v1 package

Overview

Package config is the one realm moul's other realms read their settings from: a key/value store plus the manager list that decides who may write it.

Why a realm and not a constant

A value shared by several contracts, hardcoded in each, is changed by redeploying each. On mainnet a public realm cannot even be redeployed at its own path, so "changing it" means a new version and a new path for every consumer. Here it is a transaction.

Bump rarely, and never for a new setting

This realm IS public and versioned, so its path moves on every bump. That makes a bump expensive, which is exactly why the settings API is generic: a new setting is a new KEY, and a key costs one transaction. Only a change to the shape of this realm (a new function, a changed signature) is worth a version.

When a bump does happen, the state does not move

A later version imports this one and relays to it rather than holding anything of its own, so v1, v2 and v3 all read and write the same settings, the same pause and the same member list. Delegation only runs backwards in time, which is why the root is the oldest version that has the state and not the newest. See proxy.gno.

What lives here

settings.gno the key/value store, and the mygnoscan accessors over it keys.gno the key grammar: a name, optionally scoped to one realm blocks.gno the notice a realm renders above and below its content pause.gno the switch a realm checks before it acts proxy.gno the relay that lets a later version share this state config.gno the member list, unchanged from v0

Governance

init seeds the authority with the deploying EOA. Everything that writes goes through Authorizer, so transferring authority to a DAO transfers the settings with it: there is no address hardcoded on the write path.

Functions

AddManager

func AddManager(cur realm, addr address) error

AddManager adds a new address to the list of authorized managers. This only works if the current authority is a MemberAuthority. The caller must be authorized by the current authority.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "AddManager" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "AddManager" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

AllowProxy

func AllowProxy(cur realm, pkgPath string)

AllowProxy registers a newer version of this realm as a relay. Manager only.

It takes a package path rather than an address because a path is what a manager can check by eye; the address is derived here with the same function the chain uses, so the two cannot drift.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "AllowProxy" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "AllowProxy" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

AssertReadable

func AssertReadable()

AssertReadable aborts unless the realm calling in may still be read.

Most realms should NOT put this in Render. A page that aborts tells a reader nothing; TopBlock tells them what happened and when to come back. Reach for this only where serving stale data is itself the harm.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.AssertReadable()"

Result

AssertReadableFor

func AssertReadableFor(pkgPath string)

AssertReadableFor is AssertReadable for a named realm.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.AssertReadableFor()"

Result

AssertWritable

func AssertWritable()

AssertWritable aborts unless the realm calling in may still change state. This is the one line a mutating function needs.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.AssertWritable()"

Result

AssertWritableFor

func AssertWritableFor(pkgPath string)

AssertWritableFor is AssertWritable for a named realm, for a crossing function that cannot be read off the stack.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.AssertWritableFor()"

Result

BottomBlock

func BottomBlock() string

BottomBlock returns the notice for the realm calling in, ready to concatenate after its content.

No pause banner here: one is enough, and the top is where it is read.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.BottomBlock()"

Result

BottomBlockFor

func BottomBlockFor(pkgPath string) string

BottomBlockFor is BottomBlock for a named realm.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.BottomBlockFor()"

Result

Get

func Get(key string) string

Get returns a setting's value, or "" when it is not set. Reads are open: a realm importing this one calls Get on every render and pays nothing beyond the cross-realm call.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Get()"

Result

GetOr

func GetOr(key, fallback string) string

GetOr returns a setting's value, or fallback when it is unset or empty. This is the shape every consumer wants: a realm should still render on a chain where this one was never deployed with that key.

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.GetOr(,)"

Result

Has

func Has(key string) bool

Has reports whether key is set, including to the empty string, which GetOr cannot distinguish from unset.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Has()"

Result

HasManager

func HasManager(cur realm, addr address) bool

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "HasManager" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "HasManager" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

IsPaused

func IsPaused() bool

IsPaused reports whether the realm calling in is held back at all, ReadOnly as well as fully paused.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.IsPaused()"

Result

IsPausedFor

func IsPausedFor(pkgPath string) bool

IsPausedFor is IsPaused for a named realm.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.IsPausedFor()"

Result

IsProxy

func IsProxy(addr address) bool

IsProxy reports whether addr is a registered relay.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.IsProxy()"

Result

KeyFor

func KeyFor(name, pkgPath string) string

KeyFor builds the scoped key for a setting on one realm, and returns the bare name when pkgPath names no realm this can scope to.

This is what a realm should render when it wants to tell a manager which setting to change, so the command in the page is the command that works.

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.KeyFor(,)"

Result

Keys

func Keys() []string

Keys returns every set key, in sorted order.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Keys()"

Result

ListProxies

func ListProxies() []string

ListProxies returns the registered relay paths, in sorted order.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.ListProxies()"

Result

Manifest

func Manifest() string

Manifest returns one tab-separated line per setting:

Example
1<key>\t<rev>\t<height>\t<value>

It is the whole config in one vm/qeval read, for a tool that wants to diff the chain against a local file without a call per key. The value is last because it is the only field that can contain a tab.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Manifest()"

Result

Mygnoscan

func Mygnoscan() string

Mygnoscan is the explorer page of the realm calling in.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Mygnoscan()"

Result

MygnoscanFooter

func MygnoscanFooter() string

MygnoscanFooter is the render-ready form: the markdown line the realm calling in appends under its output.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.MygnoscanFooter()"

Result

MygnoscanFooterFor

func MygnoscanFooterFor(pkgPath string) string

MygnoscanFooterFor is MygnoscanFooter for a named realm.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.MygnoscanFooterFor()"

Result

MygnoscanFor

func MygnoscanFor(pkgPath string) string

MygnoscanFor is Mygnoscan for a named realm.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.MygnoscanFor()"

Result

MygnoscanURL

func MygnoscanURL() string

MygnoscanURL returns the explorer base moul's realms should link to, falling back to the package default when nothing is set here.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.MygnoscanURL()"

Result

Pause

func Pause() pausable.State

Pause returns the pause state of the realm calling in: the stricter of the global setting and that realm's own.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Pause()"

Result

PauseFor

func PauseFor(pkgPath string) pausable.State

PauseFor is Pause for a named realm.

A stale per-realm entry can never re-open a realm during a global pause, because the two combine with pausable.Strictest rather than one overriding the other. The cost is that exempting one realm from a global pause is not expressible: clear the global and set the others.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.PauseFor()"

Result

RemoveManager

func RemoveManager(cur realm, addr address) error

RemoveManager removes an address from the list of authorized managers. This only works if the current authority is a MemberAuthority. The caller must be authorized by the current authority.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "RemoveManager" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "RemoveManager" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Render

func Render(path string) string

Render shows the whole configuration: the settings, who may change them, and where this realm itself can be inspected.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Render()"

Result

RevokeProxy

func RevokeProxy(cur realm, pkgPath string)

RevokeProxy withdraws a relay. Manager only.

Revoking one that was never registered aborts rather than passing quietly: at this point in an incident, "done" and "you misspelled it" must not look the same.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "RevokeProxy" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "RevokeProxy" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Scanner

func Scanner() mygnoscan.Scanner

Scanner returns a link builder pointed at the configured explorer, on whichever network answers for the running chain (or at the KeyMygnoscanNetwork override, when one is set).

This is the function other realms are meant to call:

Example
1config.Scanner().Realm("gno.land/r/moul/home")
2config.Scanner().Address(someAddr)

Changing where every one of them points is then one transaction against this realm, not a redeploy of each.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Scanner()"

Result

Scope

func Scope(pkgPath string) string

Scope turns a package path into the scope half of a key, stripping the chain domain: "gno.land/r/moul/home" and "r/moul/home" both give "r/moul/home".

A path that is not shaped like one comes back empty, and every caller here treats that as "no scope", falling back to the global setting rather than inventing a key nobody can type.

The chain domain is tried first and the literal "gno.land/" second, so a key written on one chain still resolves on another whose domain differs. Twin of mygnoscan.TrimDomain, which answers the same question for a URL and is stricter about the characters, because its output lands inside a link.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Scope()"

Result

Set

func Set(cur realm, key, value string)

Set creates or replaces a setting. Only an address the Authorizer accepts may call it.

It panics rather than returning an error, which is the opposite of the manager functions in config.gno, and deliberately so: a returned error from a realm call leaves the transaction SUCCESSFUL. A rejected config write that reports success is the one outcome worth ruling out here, because the caller then walks away believing the new value is live and every realm reading this key keeps serving the old one. The manager functions predate that reasoning and are frozen on chain at v0; new surface does not inherit the mistake.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "Set" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "Set" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

SetAs

func SetAs(cur realm, principal address, key, value string)

SetAs is Set, performed by a registered proxy on behalf of principal.

Two checks, and both have to hold: the caller is a registered relay, and the principal it names is authorized. Neither is redundant. Dropping the first would let any realm claim any principal; dropping the second would make a registered proxy an unconditional bypass of the member list.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "SetAs" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "SetAs" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

SettingsRevision

func SettingsRevision() int

SettingsRevision counts every settings write this realm has accepted. A client that caches config polls this one int to learn that nothing moved.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.SettingsRevision()"

Result

Size

func Size() int

Size returns how many settings are set.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.Size()"

Result

SplitKey

func SplitKey(key string) (name, scope string)

SplitKey takes a key apart. An unscoped key returns an empty scope, and so does a malformed one: callers pair this with validKey rather than trusting the split.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.SplitKey()"

Result

TopBlock

func TopBlock() string

TopBlock returns the notice for the realm calling in, ready to concatenate in front of its content. Empty when there is nothing to say, which is the default and the usual case.

Three things can appear, in this order, separated by blank lines:

  1. the pause banner, when this realm or every realm is paused
  2. the global block.top
  3. this realm's own block.top

The pause banner comes first because it is the one a reader has to see, and it is included here rather than left to the realm so that guarding writes with AssertWritable is enough to also explain the refusal on the page.

Global and scoped are BOTH shown rather than one overriding the other: a chain-wide warning and a per-realm changelog are different messages, and dropping either because the other exists is the surprising behaviour.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.TopBlock()"

Result

TopBlockFor

func TopBlockFor(pkgPath string) string

TopBlockFor is TopBlock for a named realm. Use it from a crossing function, where the caller cannot be read off the stack, or to render another realm's notice.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/config/v1.TopBlockFor()"

Result

TransferManagement

func TransferManagement(cur realm, newAuthority authz.Authority) error

TransferManagement transfers the authority to manage keys to a new authority. The caller must be authorized by the current authority.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "TransferManagement" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "TransferManagement" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Unset

func Unset(cur realm, key string)

Unset removes a setting, so readers fall back to their built-in default. Removing a key that is not set is an error, not a no-op: it almost always means the key was misspelled here or in the realm that reads it.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "Unset" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "Unset" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

UnsetAs

func UnsetAs(cur realm, principal address, key string)

UnsetAs is Unset, performed by a registered proxy on behalf of principal.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "UnsetAs" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/config/v1" -func "UnsetAs" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx