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

otc state

Back to all declarations

AddToken

func(key string)

AddToken whitelists a token by its grc20reg key, enabled (W2).

Open
OID
05f05f…7b49:3
AddToken details

Inspect func

SetTokenEnabled

func(key string, enabled bool)

SetTokenEnabled switches new offers on a token on or off. Open offers on a disabled token can still be filled and cancelled (W2).

Open
OID
05f05f…7b49:5
SetTokenEnabled details

Inspect func

SetFeeBps

func(bps int64)

SetFeeBps sets the default fee for NEW offers (F4, F5).

Open
OID
05f05f…7b49:6
SetFeeBps details

Inspect func

SetGnomicFee

func(enabled bool, bps int64)

SetGnomicFee turns the reduced GNOMIC fee on or off and sets it (F6).

Open
OID
05f05f…7b49:7
SetGnomicFee details

Inspect func

SetFeeRecipient

func(to .uverse.address)

SetFeeRecipient changes where fees go.

Open
OID
05f05f…7b49:8
SetFeeRecipient details

Inspect func

SetPaused

func(p bool)

SetPaused blocks or allows new offers and fills. It never blocks Cancel (A2, R10).

Open
OID
05f05f…7b49:9
SetPaused details

Inspect func

TransferAdmin

func(to .uverse.address)

TransferAdmin hands the admin role to another address.

Open
OID
05f05f…7b49:10
TransferAdmin details

Inspect func

adminAddress

untyped string

Value

"g1z252jewcp2gaxs9h2mln2edqce49t7sntl4nes"

feeRecipientAddress

untyped string

Value

"g1qlkugyn80ur88mqu9jdqaawl4j54xvfhdu6alk"

gnomicTokenKey

untyped string

Value

"gno.land/r/nym-thegnomic001/gnomic.GNOMIC"

defaultFeeBps

int64

Value

30

gnomicFeeEnabled

untyped bool

Value

true

gnomicFeeBps

int64

Value

10

bpsDenominator

untyped bigint

Value

(10000 <untyped> bigint)

feeOf

func(amount int64, bps int64) int64

feeOf is bps of amount, rounded down (F1). Split so that a large amount cannot overflow on the multiplication: bps is at most feeCapBps, so both terms stay far below int64 max.

Open
OID
05f05f…7b49:13
feeOf details

Inspect func

feeFor

func(tokenKey string) int64

feeFor picks the fee a new offer on tokenKey is created with (F4, F6).

Open
OID
05f05f…7b49:15
feeFor details

Inspect func

addSat

func(a int64, b int64) int64

addSat adds two non-negative totals without wrapping (S5). The totals are statistics, not money: one that stops at the ceiling is better than one that turns negative.

Open
OID
05f05f…7b49:16
addSat details

Inspect func

maxInt64

int64

Value

9223372036854775807

ugnot

untyped string

Value

"ugnot"

feeCapBps

int64

Fixed limits. They are not configuration: config.gno is regenerated by scripts/render.sh at deploy, and a security cap must be the one the tests ran against.

Value

100

defaultPageSize

untyped bigint

Fixed limits. They are not configuration: config.gno is regenerated by scripts/render.sh at deploy, and a security cap must be the one the tests ran against.

Value

(20 <untyped> bigint)

maxPageSize

untyped bigint

Fixed limits. They are not configuration: config.gno is regenerated by scripts/render.sh at deploy, and a security cap must be the one the tests ran against.

Value

(50 <untyped> bigint)

maxTokens

untyped bigint

Fixed limits. They are not configuration: config.gno is regenerated by scripts/render.sh at deploy, and a security cap must be the one the tests ran against.

Value

(50 <untyped> bigint)

EventOfferCreated

untyped string

Events. Every one carries the offer id and the addresses involved.

Value

"OfferCreated"

EventOfferFilled

untyped string

Events. Every one carries the offer id and the addresses involved.

Value

"OfferFilled"

EventOfferCancelled

untyped string

Events. Every one carries the offer id and the addresses involved.

Value

"OfferCancelled"

EventAdminChanged

untyped string

Events. Every one carries the offer id and the addresses involved.

Value

"AdminChanged"

EventFeeChanged

untyped string

Events. Every one carries the offer id and the addresses involved.

Value

"FeeChanged"

EventFeeRecipientChanged

untyped string

Events. Every one carries the offer id and the addresses involved.

Value

"FeeRecipientChanged"

EventTokenChanged

untyped string

Events. Every one carries the offer id and the addresses involved.

Value

"TokenChanged"

EventPaused

untyped string

Events. Every one carries the offer id and the addresses involved.

Value

"Paused"

admin

.uverse.address

Value

<gnolang.StringValue>

feeRecipient

.uverse.address

Value

<gnolang.StringValue>

realmAddr

.uverse.address

Value

<gnolang.StringValue>

webPath

string

// "/r/\<namespace>/otc", for gnoweb links

Value

"/r/nym-thegnomic001/otc"

feeBps

int64

Value

30

gnomicKey

string

Value

"gno.land/r/nym-thegnomic001/gnomic.GNOMIC"

gnomicFeeOn

bool

Value

true

gnomicFee

int64

Value

10

paused

bool

Value

false

lastID

uint64

Value

10

totalFees

int64

// ugnot sent to the fee recipient (F7)

Value

100000

totalVolume

int64

// sum of GnotAmt over filled offers (F7)

Value

100000000

filledCount

int64

Value

2

CreateSellToken

func(tokenKey string, tokenAmt int64, gnotAmt int64, taker string, expiresAt int64) uint64

CreateSellToken escrows tokenAmt of the token and asks gnotAmt ugnot for it. The maker must first Approve this realm's address for exactly tokenAmt in the token's realm; only that amount is pulled (S4). Returns the offer id.

Open
OID
05f05f…7b49:40
CreateSellToken details

Inspect func

CreateSellGnot

func(tokenKey string, tokenAmt int64, taker string, expiresAt int64) uint64

CreateSellGnot escrows the ugnot sent with the call and asks tokenAmt of the token for it. Only a direct user call may attach coins (S1). Returns the offer id.

Open
OID
05f05f…7b49:41
CreateSellGnot details

Inspect func

newOffer

func(maker .uverse.address, side otc.Side, tokenKey string, tokenAmt int64, gnotAmt int64, taker string, expiresAt int64) *otc.Offer
Open
OID
05f05f…7b49:42
newOffer details

Inspect func

Fill

func(id uint64)

Fill takes an open offer in full (R8). - SellToken: attach exactly GnotAmt ugnot; direct user call only (S1). - SellGnot: attach nothing (S2) and first Approve this realm for exactly TokenAmt; the tokens go straight from the taker to the maker. The fee comes off the GNOT side and goes to the fee recipient in the same call (F2, F3).

Open
OID
05f05f…7b49:44
Fill details

Inspect func

Cancel

func(id uint64)

Cancel returns the escrow to the maker. Only the maker can call it (R11), at any time, including after expiry and while paused (R10).

Open
OID
05f05f…7b49:45
Cancel details

Inspect func

closeOffer

func(o *otc.Offer, s otc.Status)
Open
OID
05f05f…7b49:46
closeOffer details

Inspect func

expired

func(o *otc.Offer) bool

expired is true once block time reaches ExpiresAt (R9). An expired offer stays Open until its maker cancels it (R10, R11).

Open
OID
05f05f…7b49:47
expired details

Inspect func

mustOffer

func(id uint64) *otc.Offer
Open
OID
05f05f…7b49:48
mustOffer details

Inspect func

requireTokenEnabled

func(key string)
Open
OID
05f05f…7b49:49
requireTokenEnabled details

Inspect func

requireUser

func()

requireUser insists on a direct user call (S1). The coin envelope belongs to the whole message, so a realm in the middle could spend it elsewhere and leave OriginSend describing a payment this realm never received — the "phantom payment" of atomicswap.NewCustomCoinSwap. \`maketx run\` is refused for the same reason.

Open
OID
05f05f…7b49:50
requireUser details

Inspect func

sentUgnot

func() int64

sentUgnot returns the ugnot attached to the call, and refuses any envelope that is not exactly one positive ugnot coin.

Open
OID
05f05f…7b49:51
sentUgnot details

Inspect func

requireNoCoins

func()

requireNoCoins refuses any coin on a call that is not meant to receive one (S2): this realm has no way to send stray coins back.

Open
OID
05f05f…7b49:52
requireNoCoins details

Inspect func

pay

func(to .uverse.address, amount int64)
Open
OID
05f05f…7b49:53
pay details

Inspect func

padID

func(id uint64) string

padID makes ids sort as numbers in the trees.

Open
OID
05f05f…7b49:54
padID details

Inspect func

emitCreated

func(o *otc.Offer)
Open
OID
05f05f…7b49:55
emitCreated details

Inspect func

RealmAddress

func() .uverse.address
Open
OID
05f05f…7b49:56
RealmAddress details

Inspect func

GetOffer

func(id uint64) string

GetOffer returns one offer as JSON, public or private.

Open
OID
05f05f…7b49:58
GetOffer details

Inspect func

ListOpen

func(offset int, limit int) string

ListOpen returns open public offers, newest first (S9).

Open
OID
05f05f…7b49:59
ListOpen details

Inspect func

ListByMaker

func(addr string, offset int, limit int) string

ListByMaker returns every offer of one maker, private and closed ones included, newest first.

Open
OID
05f05f…7b49:60
ListByMaker details

Inspect func

GetConfig

func() string

GetConfig returns the parameters and the whitelist as JSON.

Open
OID
05f05f…7b49:61
GetConfig details

Inspect func

GetStats

func() string

GetStats returns the running totals as JSON (F7).

Open
OID
05f05f…7b49:62
GetStats details

Inspect func

Render

func(path string) string

Render serves "" (stats and the first page), "page/N" and "offer/ID".

Open
OID
05f05f…7b49:63
Render details

Inspect func

renderHome

func(page int) string
Open
OID
05f05f…7b49:64
renderHome details

Inspect func

renderOffer

func(o *otc.Offer) string
Open
OID
05f05f…7b49:65
renderOffer details

Inspect func

listJSON

func(t *v0.Tree, offset int, limit int) string
Open
OID
05f05f…7b49:66
listJSON details

Inspect func

offerJSON

func(o *otc.Offer) string
Open
OID
05f05f…7b49:67
offerJSON details

Inspect func

tokenInfo

func(key string) (string, int)
Open
OID
05f05f…7b49:68
tokenInfo details

Inspect func

jstr

func(s string) string

jstr quotes a string for JSON.

Open
OID
05f05f…7b49:69
jstr details

Inspect func

units

func(v int64, dec int) string

units formats base units with dec decimals, trailing zeros dropped.

Open
OID
05f05f…7b49:72
units details

Inspect func

short

func(a .uverse.address) string
Open
OID
05f05f…7b49:74
short details

Inspect func

expiry

func(o *otc.Offer) string

expiry is the Expires cell: the date, marked once it has passed.

Open
OID
05f05f…7b49:76
expiry details

Inspect func

Side

type

Side says which half of the offer the maker escrowed.

Value

otc.Side

SellToken

otc.Side

// maker escrows the token, taker pays GNOT

Value

<zero>

SellGnot

otc.Side

// maker escrows GNOT, taker pays the token

Value

<zero>

Status

type

Status is Open until the offer is filled or cancelled. Both are terminal (R12).

Value

otc.Status

Open

otc.Status

Value

<zero>

Filled

otc.Status

Value

<zero>

Cancelled

otc.Status

Value

<zero>

Offer

type

Offer is one escrowed trade: exactly one GRC20 side and one GNOT side (R1).

Value

otc.Offer

ErrPaused

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: paused"

ErrNotUser

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: must be a direct user call"

ErrNoCoins

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: this call takes no coins"

ErrBadPayment

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: send exactly the required ugnot and nothing else"

ErrBadAmount

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: amounts must be positive"

ErrBadExpiry

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: expiry must be 0 or in the future"

ErrBadAddress

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: invalid address"

ErrTakerIsMaker

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: taker cannot be the maker"

ErrTokenNotListed

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: token not whitelisted"

ErrTokenDisabled

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: token disabled"

ErrTokenUnknown

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: token not in grc20reg"

ErrTokenExists

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: token already whitelisted"

ErrTooManyTokens

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: token whitelist is full"

ErrNoOffer

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: no such offer"

ErrNotOpen

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: offer is not open"

ErrNotMaker

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: not maker"

ErrNotTaker

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: offer is reserved for another taker"

ErrOwnOffer

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: maker cannot fill own offer"

ErrExpired

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: offer expired"

ErrNotAdmin

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: not admin"

ErrFeeAboveCap

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: fee above cap"

ErrFeeToRealm

untyped string

Errors are short and stable so that tests and the frontend can match them.

Value

"otc: fee recipient cannot be the realm"
AddToken : func(key string) Inspect
SetTokenEnabled : func(key string, enabled bool) Inspect
SetFeeBps : func(bps int64) Inspect
SetGnomicFee : func(enabled bool, bps int64) Inspect
SetFeeRecipient : func(to .uverse.address) Inspect
SetPaused : func(p bool) Inspect
TransferAdmin : func(to .uverse.address) Inspect
requireAdmin : func() Inspect
requireFee : func(bps int64) Inspect
adminAddress : untyped string ="g1z252jewcp2gaxs9h2mln2edqce49t7sntl4nes"
feeRecipientAddress : untyped string ="g1qlkugyn80ur88mqu9jdqaawl4j54xvfhdu6alk"
gnomicTokenKey : untyped string ="gno.land/r/nym-thegnomic001/gnomic.GNOMIC"
defaultFeeBps : int64 =30
gnomicFeeEnabled : untyped bool =true
gnomicFeeBps : int64 =10
bpsDenominator : untyped bigint =(10000 <untyped> bigint)
feeOf : func(amount int64, bps int64) int64 Inspect
feeFor : func(tokenKey string) int64 Inspect
addSat : func(a int64, b int64) int64 Inspect
maxInt64 : int64 =9223372036854775807
ugnot : untyped string ="ugnot"
feeCapBps : int64 =100
defaultPageSize : untyped bigint =(20 <untyped> bigint)
maxPageSize : untyped bigint =(50 <untyped> bigint)
maxTokens : untyped bigint =(50 <untyped> bigint)
EventOfferCreated : untyped string ="OfferCreated"
EventOfferFilled : untyped string ="OfferFilled"
EventOfferCancelled : untyped string ="OfferCancelled"
EventAdminChanged : untyped string ="AdminChanged"
EventFeeChanged : untyped string ="FeeChanged"
EventFeeRecipientChanged : untyped string ="FeeRecipientChanged"
EventTokenChanged : untyped string ="TokenChanged"
EventPaused : untyped string ="Paused"
admin : .uverse.address =<gnolang.StringValue>
feeRecipient : .uverse.address =<gnolang.StringValue>
realmAddr : .uverse.address =<gnolang.StringValue>
webPath : string ="/r/nym-thegnomic001/otc"
feeBps : int64 =30
gnomicKey : string ="gno.land/r/nym-thegnomic001/gnomic.GNOMIC"
gnomicFeeOn : bool =true
gnomicFee : int64 =10
paused : bool =false
tokens : v0.Tree Inspect
offers : v0.Tree Inspect
openPublic : v0.Tree Inspect
byMaker : v0.Tree Inspect
lastID : uint64 =10
totalFees : int64 =100000
totalVolume : int64 =100000000
filledCount : int64 =2
init.50 : func() Inspect
CreateSellToken : func(tokenKey string, tokenAmt int64, gnotAmt int64, taker string, expiresAt int64) uint64 Inspect
CreateSellGnot : func(tokenKey string, tokenAmt int64, taker string, expiresAt int64) uint64 Inspect
newOffer : func(maker .uverse.address, side otc.Side, tokenKey string, tokenAmt int64, gnotAmt int64, taker string, expiresAt int64) *otc.Offer Inspect
index : func(o *otc.Offer) Inspect
Fill : func(id uint64) Inspect
Cancel : func(id uint64) Inspect
closeOffer : func(o *otc.Offer, s otc.Status) Inspect
expired : func(o *otc.Offer) bool Inspect
mustOffer : func(id uint64) *otc.Offer Inspect
requireTokenEnabled : func(key string) Inspect
requireUser : func() Inspect
sentUgnot : func() int64 Inspect
requireNoCoins : func() Inspect
pay : func(to .uverse.address, amount int64) Inspect
padID : func(id uint64) string Inspect
emitCreated : func(o *otc.Offer) Inspect
RealmAddress : func() .uverse.address Inspect
GetOffer : func(id uint64) string Inspect
ListOpen : func(offset int, limit int) string Inspect
ListByMaker : func(addr string, offset int, limit int) string Inspect
GetConfig : func() string Inspect
GetStats : func() string Inspect
Render : func(path string) string Inspect
renderHome : func(page int) string Inspect
renderOffer : func(o *otc.Offer) string Inspect
listJSON : func(t *v0.Tree, offset int, limit int) string Inspect
offerJSON : func(o *otc.Offer) string Inspect
tokenInfo : func(key string) (string, int) Inspect
jstr : func(s string) string Inspect
num : func(v int64) string Inspect
num64 : func(v uint64) string Inspect
units : func(v int64, dec int) string Inspect
bps : func(v int64) string Inspect
short : func(a .uverse.address) string Inspect
expiry : func(o *otc.Offer) string Inspect
when : func(unix int64) string Inspect
Side : type =otc.Side
SellToken : otc.Side =<zero>
SellGnot : otc.Side =<zero>
Status : type =otc.Status
Open : otc.Status =<zero>
Filled : otc.Status =<zero>
Cancelled : otc.Status =<zero>
Offer : type =otc.Offer
ErrPaused : untyped string ="otc: paused"
ErrNotUser : untyped string ="otc: must be a direct user call"
ErrNoCoins : untyped string ="otc: this call takes no coins"
ErrBadPayment : untyped string ="otc: send exactly the required ugnot and nothing else"
ErrBadAmount : untyped string ="otc: amounts must be positive"
ErrBadExpiry : untyped string ="otc: expiry must be 0 or in the future"
ErrBadAddress : untyped string ="otc: invalid address"
ErrTakerIsMaker : untyped string ="otc: taker cannot be the maker"
ErrTokenNotListed : untyped string ="otc: token not whitelisted"
ErrTokenDisabled : untyped string ="otc: token disabled"
ErrTokenUnknown : untyped string ="otc: token not in grc20reg"
ErrTokenExists : untyped string ="otc: token already whitelisted"
ErrTooManyTokens : untyped string ="otc: token whitelist is full"
ErrNoOffer : untyped string ="otc: no such offer"
ErrNotOpen : untyped string ="otc: offer is not open"
ErrNotMaker : untyped string ="otc: not maker"
ErrNotTaker : untyped string ="otc: offer is reserved for another taker"
ErrOwnOffer : untyped string ="otc: maker cannot fill own offer"
ErrExpired : untyped string ="otc: offer expired"
ErrNotAdmin : untyped string ="otc: not admin"
ErrFeeAboveCap : untyped string ="otc: fee above cap"
ErrFeeToRealm : untyped string ="otc: fee recipient cannot be the realm"