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

aaabbb/v0 package

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

AddLiquidity

func AddLiquidity(cur realm, maxA, maxB int64) int64

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/x/pairs/aaabbb/v0" -func "AddLiquidity" -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/x/pairs/aaabbb/v0" -func "AddLiquidity" -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
  

Keys

func Keys() (string, string)

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairs/aaabbb/v0.Keys()"

Result

Quote

func Quote(keyIn string, amountIn int64) int64

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairs/aaabbb/v0.Quote(,)"

Result

RemoveLiquidity

func RemoveLiquidity(cur realm, shares int64) (int64, int64)

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/x/pairs/aaabbb/v0" -func "RemoveLiquidity" -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/pairs/aaabbb/v0" -func "RemoveLiquidity" -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

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairs/aaabbb/v0.Render()"

Result

Reserves

func Reserves() (int64, int64)

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairs/aaabbb/v0.Reserves()"

Result

SharesOf

func SharesOf(owner address) int64

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairs/aaabbb/v0.SharesOf()"

Result

Swap

func Swap(cur realm, keyIn string, amountIn, minOut int64) int64

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/x/pairs/aaabbb/v0" -func "Swap" -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/x/pairs/aaabbb/v0" -func "Swap" -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
  

TotalShares

func TotalShares() int64

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/pairs/aaabbb/v0.TotalShares()"

Result