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

nsvote/v1 package

Overview

Package nsvote holds domain requests and the votes on them.

A SEPARATE REALM, and deliberately so. It never writes to nsdata: it only reads it, to answer two questions — does this address hold a name, and who is the admin. So it needs no trusted-logic grant, it cannot corrupt the registry however wrong its own logic turns out to be, and it can be replaced or abandoned without touching a single name anybody owns.

WHAT IT DOES NOT DO

It does not create domains. A vote is advice; creating the domain stays a deliberate admin call in nslogic. Wiring the two together would mean a majority could add a domain nobody had looked at, and the vault has no undo.

It holds no funds, at any point, for anybody. The only cost of proposing or voting is the storage each writer pays for their own bytes, which the chain moves directly and which comes back if the record is ever deleted.

Functions

CanTakePart

func CanTakePart(who address) bool

CanTakePart answers the one question the page needs before it offers any of this: does this address hold a name.

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1.CanTakePart()"

Result

CountProposals

func CountProposals() int64

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1.CountProposals()"

Result

GetProposal

func GetProposal(id int64) string

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1.GetProposal()"

Result

HasVoted

func HasVoted(id int64, voter address) string

HasVoted lets the page grey out a button instead of letting somebody sign a transaction that is certain to be rejected.

Params

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1.HasVoted(,)"

Result

ListProposals

func ListProposals(after string, limit int) (rows, next string)

ListProposals pages newest first, which is the order anybody actually wants to read them in.

Params

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1.ListProposals(,)"

Result

Propose

func Propose(cur realm, kind, label, reason string) int64

Propose asks for a domain or for a chain. Anyone holding a name may ask.

The proposer pays the storage for their own proposal, and nothing else. That cost is the whole of the spam control: it is small enough that a real request is nothing to think about and large enough that filling the tree with rubbish is not free.

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/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Propose" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Propose" -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 "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Purge

func Purge(cur realm, id int64) int64

Purge deletes a closed request and its votes, releasing the storage.

The refund goes to WHOEVER SIGNS THIS, which is not the people who paid — so it is admin-only and it is not a tidying operation to run casually. It exists because a registry that can only ever grow is worse, not because reclaiming somebody else's deposit is free money.

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/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Purge" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Purge" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Resolve

func Resolve(cur realm, id int64, accepted bool)

Resolve records what was decided. It does NOT create the domain — that stays a separate, deliberate call in nslogic. A vote is advice, and the vault has no undo.

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/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Resolve" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Resolve" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Roster

func Roster(after string, limit int) (rows, next string)

Roster is the raw material for the leaderboards: one line per name, owner first, so the caller can aggregate however it likes.

It lives here rather than in nslogic because this realm is being deployed anyway and nslogic is not — adding it there would have cost a fresh deployment of the largest realm we have, for a read.

Paged, and the page walks every name in it. That is fine at the scale this registry is at and it will not be fine at fifty thousand names; at that point the aggregate belongs somewhere it is kept as it changes rather than recomputed on every read.

Params

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1.Roster(,)"

Result

Version

func Version() string

Version lets a caller find out what it is talking to BEFORE it sends a transaction that would be rejected for having the wrong number of arguments.

v1 has no such function, so a nil answer is itself the answer: an older realm. That is cheaper and more honest than the site assuming the newest shape and failing at signing time, which is exactly what happened when Propose grew a `kind`.

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1.Version()"

Result

Vote

func Vote(cur realm, id int64, yes bool)

Vote records a yes or no. One per address per proposal, and it cannot be changed: a vote that can be switched turns the count into a race against whoever is watching, and there is no deadline here to make that fair.

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/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Vote" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Vote" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Withdraw

func Withdraw(cur realm, id int64)

Withdraw closes a request the proposer no longer wants. The votes already cast stay: deleting them would refund their storage to whoever called this, which is not the person who paid 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/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Withdraw" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1xr6tgxnpled50h74eafmvxway7z0ytr5rsmeme/nsvote/v1" -func "Withdraw" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx