Couples
Couples returns how many distinct token couples are represented.
Command
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairreg/v0.Couples()"
Result
Package pairreg is the registry every AMM pair instance announces itself to, and the unified frontend over all of them.
It is the third artifact of the instance-per-realm pattern: one shared p/moul/x/pair/v0 holding the logic, N tiny realms holding one pair each, and this realm knowing all of them.
Register keys an instance by cur.Previous().PkgPath(), which the runtime supplies, so an instance cannot claim a path that is not its own. That is the whole on-chain guarantee. It is NOT a guarantee about the code at that path: gno has no way to read another package's source from inside a realm, so nothing here can check that an instance really runs the shared template. The mirror image of Ethereum's CREATE2, which proves the code and says nothing legible about who deployed it.
Consequences a reader of the index must keep in mind:
Instances register a *pair.Pair pointer, not an address, the way grc20reg registers a *grc20.Token. One vm/qrender here therefore renders the real state of every instance, with no indexer and no multicall. It is safe because pair.Pair holds only concrete types: an interface or a func field would let a hostile instance hand foreign code to this realm's frame.
Couples returns how many distinct token couples are represented.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairreg/v0.Couples()"
InstancesFor returns the instance paths claiming a given couple id.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairreg/v0.InstancesFor()"
Register records the calling realm as an instance. Call it from the instance's init, so that deploying and listing are one transaction:
1func init(cur realm) {
2 p = pair.New(keyA, keyB, grc20reg.MustGet(keyA), grc20reg.MustGet(keyB))
3 pairreg.Register(cross(cur), p)
4}
Permissionless by design: anyone may deploy an instance under their own address namespace and land here. Spam is self funded, since the registering transaction pays for the storage it adds.
# 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/x/pairreg/v0" -func "Register" -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/x/pairreg/v0" -func "Register" -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 is the unified frontend: the index of every instance with its live state, or one instance's own page when path is an instance path.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairreg/v0.Render()"
Size returns how many instances are registered.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairreg/v0.Size()"
Get returns the entry for an instance path, or nil.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairreg/v0.Get()"