AddToken
func(key string)AddToken whitelists a token by its grc20reg key, enabled (W2).
- OID
- 05f05f…7b49:3
AddToken details
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).
- OID
- 05f05f…7b49:5
SetTokenEnabled details
SetFeeBps
func(bps int64)SetFeeBps sets the default fee for NEW offers (F4, F5).
- OID
- 05f05f…7b49:6
SetFeeBps details
SetGnomicFee
func(enabled bool, bps int64)SetGnomicFee turns the reduced GNOMIC fee on or off and sets it (F6).
- OID
- 05f05f…7b49:7
SetGnomicFee details
SetFeeRecipient
func(to .uverse.address)SetFeeRecipient changes where fees go.
- OID
- 05f05f…7b49:8
SetFeeRecipient details
SetPaused
func(p bool)SetPaused blocks or allows new offers and fills. It never blocks Cancel (A2, R10).
- OID
- 05f05f…7b49:9
SetPaused details
TransferAdmin
func(to .uverse.address)TransferAdmin hands the admin role to another address.
- OID
- 05f05f…7b49:10
TransferAdmin details
requireAdmin
func()- OID
- 05f05f…7b49:11
requireAdmin details
requireFee
func(bps int64)- OID
- 05f05f…7b49:12
requireFee details
adminAddress
untyped stringValue
"g1z252jewcp2gaxs9h2mln2edqce49t7sntl4nes"
feeRecipientAddress
untyped stringValue
"g1qlkugyn80ur88mqu9jdqaawl4j54xvfhdu6alk"
gnomicTokenKey
untyped stringValue
"gno.land/r/nym-thegnomic001/gnomic.GNOMIC"
defaultFeeBps
int64Value
30
gnomicFeeEnabled
untyped boolValue
true
gnomicFeeBps
int64Value
10
bpsDenominator
untyped bigintValue
(10000 <untyped> bigint)
feeOf
func(amount int64, bps int64) int64feeOf 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.
- OID
- 05f05f…7b49:13
feeOf details
feeFor
func(tokenKey string) int64feeFor picks the fee a new offer on tokenKey is created with (F4, F6).
- OID
- 05f05f…7b49:15
feeFor details
addSat
func(a int64, b int64) int64addSat 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.
- OID
- 05f05f…7b49:16
addSat details
maxInt64
int64Value
9223372036854775807
ugnot
untyped stringValue
"ugnot"
feeCapBps
int64Fixed 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 bigintFixed 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 bigintFixed 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 bigintFixed 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 stringEvents. Every one carries the offer id and the addresses involved.
Value
"OfferCreated"
EventOfferFilled
untyped stringEvents. Every one carries the offer id and the addresses involved.
Value
"OfferFilled"
EventOfferCancelled
untyped stringEvents. Every one carries the offer id and the addresses involved.
Value
"OfferCancelled"
EventAdminChanged
untyped stringEvents. Every one carries the offer id and the addresses involved.
Value
"AdminChanged"
EventFeeChanged
untyped stringEvents. Every one carries the offer id and the addresses involved.
Value
"FeeChanged"
EventFeeRecipientChanged
untyped stringEvents. Every one carries the offer id and the addresses involved.
Value
"FeeRecipientChanged"
EventTokenChanged
untyped stringEvents. Every one carries the offer id and the addresses involved.
Value
"TokenChanged"
EventPaused
untyped stringEvents. Every one carries the offer id and the addresses involved.
Value
"Paused"
admin
.uverse.addressValue
<gnolang.StringValue>
feeRecipient
.uverse.addressValue
<gnolang.StringValue>
realmAddr
.uverse.addressValue
<gnolang.StringValue>
webPath
string// "/r/\<namespace>/otc", for gnoweb links
Value
"/r/nym-thegnomic001/otc"
feeBps
int64Value
30
gnomicKey
stringValue
"gno.land/r/nym-thegnomic001/gnomic.GNOMIC"
gnomicFeeOn
boolValue
true
gnomicFee
int64Value
10
paused
boolValue
false
tokens
v0.Tree- OID
- 05f05f…7b49:27
tokens details
offers
v0.Tree- OID
- 05f05f…7b49:29
offers details
openPublic
v0.Tree- OID
- 05f05f…7b49:31
openPublic details
byMaker
v0.Tree- OID
- 05f05f…7b49:33
byMaker details
lastID
uint64Value
10
totalFees
int64// ugnot sent to the fee recipient (F7)
Value
100000
totalVolume
int64// sum of GnotAmt over filled offers (F7)
Value
100000000
filledCount
int64Value
2
init.50
func()- OID
- 05f05f…7b49:38
init.50 details
CreateSellToken
func(tokenKey string, tokenAmt int64, gnotAmt int64, taker string, expiresAt int64) uint64CreateSellToken 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.
- OID
- 05f05f…7b49:40
CreateSellToken details
CreateSellGnot
func(tokenKey string, tokenAmt int64, taker string, expiresAt int64) uint64CreateSellGnot 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.
- OID
- 05f05f…7b49:41
CreateSellGnot details
newOffer
func(maker .uverse.address, side otc.Side, tokenKey string, tokenAmt int64, gnotAmt int64, taker string, expiresAt int64) *otc.Offer- OID
- 05f05f…7b49:42
newOffer details
index
func(o *otc.Offer)- OID
- 05f05f…7b49:43
index details
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).
- OID
- 05f05f…7b49:44
Fill details
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).
- OID
- 05f05f…7b49:45
Cancel details
closeOffer
func(o *otc.Offer, s otc.Status)- OID
- 05f05f…7b49:46
closeOffer details
expired
func(o *otc.Offer) boolexpired is true once block time reaches ExpiresAt (R9). An expired offer stays Open until its maker cancels it (R10, R11).
- OID
- 05f05f…7b49:47
expired details
mustOffer
func(id uint64) *otc.Offer- OID
- 05f05f…7b49:48
mustOffer details
requireTokenEnabled
func(key string)- OID
- 05f05f…7b49:49
requireTokenEnabled details
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.
- OID
- 05f05f…7b49:50
requireUser details
sentUgnot
func() int64sentUgnot returns the ugnot attached to the call, and refuses any envelope that is not exactly one positive ugnot coin.
- OID
- 05f05f…7b49:51
sentUgnot details
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.
- OID
- 05f05f…7b49:52
requireNoCoins details
pay
func(to .uverse.address, amount int64)- OID
- 05f05f…7b49:53
pay details
padID
func(id uint64) stringpadID makes ids sort as numbers in the trees.
- OID
- 05f05f…7b49:54
padID details
emitCreated
func(o *otc.Offer)- OID
- 05f05f…7b49:55
emitCreated details
RealmAddress
func() .uverse.address- OID
- 05f05f…7b49:56
RealmAddress details
GetOffer
func(id uint64) stringGetOffer returns one offer as JSON, public or private.
- OID
- 05f05f…7b49:58
GetOffer details
ListOpen
func(offset int, limit int) stringListOpen returns open public offers, newest first (S9).
- OID
- 05f05f…7b49:59
ListOpen details
ListByMaker
func(addr string, offset int, limit int) stringListByMaker returns every offer of one maker, private and closed ones included, newest first.
- OID
- 05f05f…7b49:60
ListByMaker details
GetConfig
func() stringGetConfig returns the parameters and the whitelist as JSON.
- OID
- 05f05f…7b49:61
GetConfig details
GetStats
func() stringGetStats returns the running totals as JSON (F7).
- OID
- 05f05f…7b49:62
GetStats details
Render
func(path string) stringRender serves "" (stats and the first page), "page/N" and "offer/ID".
- OID
- 05f05f…7b49:63
Render details
renderHome
func(page int) string- OID
- 05f05f…7b49:64
renderHome details
renderOffer
func(o *otc.Offer) string- OID
- 05f05f…7b49:65
renderOffer details
listJSON
func(t *v0.Tree, offset int, limit int) string- OID
- 05f05f…7b49:66
listJSON details
offerJSON
func(o *otc.Offer) string- OID
- 05f05f…7b49:67
offerJSON details
tokenInfo
func(key string) (string, int)- OID
- 05f05f…7b49:68
tokenInfo details
jstr
func(s string) stringjstr quotes a string for JSON.
- OID
- 05f05f…7b49:69
jstr details
num
func(v int64) string- OID
- 05f05f…7b49:70
num details
num64
func(v uint64) string- OID
- 05f05f…7b49:71
num64 details
units
func(v int64, dec int) stringunits formats base units with dec decimals, trailing zeros dropped.
- OID
- 05f05f…7b49:72
units details
bps
func(v int64) string- OID
- 05f05f…7b49:73
bps details
short
func(a .uverse.address) string- OID
- 05f05f…7b49:74
short details
link
func(path string) stringlink is an absolute gnoweb link to one of this realm's Render paths. gnoweb rejects a bare ":path" destination and prints it as plain text.
- OID
- 05f05f…7b49:75
link details
expiry
func(o *otc.Offer) stringexpiry is the Expires cell: the date, marked once it has passed.
- OID
- 05f05f…7b49:76
expiry details
when
func(unix int64) string- OID
- 05f05f…7b49:77
when details
Side
typeSide 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
typeStatus is Open until the offer is filled or cancelled. Both are terminal (R12).
Value
otc.Status
Open
otc.StatusValue
<zero>
Filled
otc.StatusValue
<zero>
Cancelled
otc.StatusValue
<zero>
Offer
typeOffer is one escrowed trade: exactly one GRC20 side and one GNOT side (R1).
Value
otc.Offer
ErrPaused
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: paused"
ErrNotUser
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: must be a direct user call"
ErrNoCoins
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: this call takes no coins"
ErrBadPayment
untyped stringErrors 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 stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: amounts must be positive"
ErrBadExpiry
untyped stringErrors 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 stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: invalid address"
ErrTakerIsMaker
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: taker cannot be the maker"
ErrTokenNotListed
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: token not whitelisted"
ErrTokenDisabled
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: token disabled"
ErrTokenUnknown
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: token not in grc20reg"
ErrTokenExists
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: token already whitelisted"
ErrTooManyTokens
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: token whitelist is full"
ErrNoOffer
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: no such offer"
ErrNotOpen
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: offer is not open"
ErrNotMaker
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: not maker"
ErrNotTaker
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: offer is reserved for another taker"
ErrOwnOffer
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: maker cannot fill own offer"
ErrExpired
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: offer expired"
ErrNotAdmin
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: not admin"
ErrFeeAboveCap
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: fee above cap"
ErrFeeToRealm
untyped stringErrors are short and stable so that tests and the frontend can match them.
Value
"otc: fee recipient cannot be the realm"