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 source realm

Realm aaabbb is ONE AMM pair, AAA/BBB, and nothing else.

Readme View source

gno.land/r/moul/x/pairs/aaabbb/v0

One AMM pair, AAA/BBB, and nothing else: the worked example of an instance realm.

Read the file, it is the point. Two constants, an init that builds the pair and registers it, and one-line re-exports forwarding cur into p/moul/x/pair/v0. It is tools/pairgen output, differing only in its doc comment and in two blank imports that force the in-repo test tokens to initialise first (an instance deployed against already-deployed tokens needs neither).

1go -C tools run ./pairgen gno.land/r/moul/x/pairs/aaa/v0.AAA \
2    gno.land/r/moul/x/pairs/bbb/v0.BBB -o /tmp/out -namespace moul/x/pairs
3diff /tmp/out/aaabbb/aaabbb.gno r/moul/x/pairs/aaabbb/aaabbb.gno

Trades against the two throwaway faucet tokens r/moul/x/pairs/aaa/v0 and r/moul/x/pairs/bbb/v0. Neither has any value.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/pairs/aaabbb/v0 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.

Overview

Realm aaabbb is ONE AMM pair, AAA/BBB, and nothing else.

This is the whole instance half of the instance-per-realm pattern, and it is meant to be read in full in one screen: two configuration constants, an init that builds the pair and announces it to the registry, and one-line re-exports that forward the realm's own `cur` into the shared logic in p/moul/x/pair/v0. Every instance in the ecosystem is byte-identical to this file except for the two constants, which is what makes verifying an unknown instance a two-line diff.

The re-exports cannot be factored away: MsgCall addresses a realm path and a function name, so anything a user calls has to be declared here.

State and funds belong to THIS realm: the pair struct is its variable, the tokens sit at its own package address, and its creator paid its storage deposit. A bug in one instance cannot touch another.

Pattern, and why an AMM is the contested case for it: see the README of gno.land/p/moul/x/pair/v0.

Functions 9

func Swap

crossing Action
1func Swap(cur realm, keyIn string, amountIn, minOut int64) int64
source

Imports 5

Source Files 4