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

market state

Back to all declarations

Denom

untyped string

Denom is the only asset this realm accepts.

Value

"ugnot"

MaxFeeBps

int64

MaxFeeBps is the hard protocol-fee cap: 1000 bps = 10%.

Value

1000

StatusActive

untyped string

Listing status values.

Value

"active"

StatusSold

untyped string

Listing status values.

Value

"sold"

StatusCancelled

untyped string

Listing status values.

Value

"cancelled"

MaxTitleLen

untyped bigint

Input bounds.

Value

(80 <untyped> bigint)

MaxDescLen

untyped bigint

Input bounds.

Value

(2000 <untyped> bigint)

MinPrice

int64

Input bounds.

Value

1

listing

type

Value

market.listing

admin

.uverse.address

// may set fee, fee recipient, stage successor

Value

<gnolang.StringValue>

pendingAdmin

.uverse.address

// staged by TransferAdmin, completes via AcceptAdmin

Value

<zero>

feeRecipient

.uverse.address

// may withdraw fees and sweep surplus

Value

<gnolang.StringValue>

feeBps

int64

// fee snapshotted into NEW listings

Value

0

self

.uverse.address

// this realm's address, captured at deploy

Value

<gnolang.StringValue>

nextID

int64

Value

2

CreateListing

func(title string, description string, price int64, maxFeeBps int64) int64

CreateListing publishes an immutable listing and returns its id. No coins are accepted (the storage deposit the caller pays is the anti-spam). The current protocol fee is snapshotted into the listing and must not exceed maxFeeBps, the ceiling the seller signed for; pass MaxFeeBps to accept any legal fee. Sellers may be EOAs or realms.

Open
OID
08caff…7a57:19
CreateListing details

Inspect func

Buy

func(id int64)

Buy purchases an active listing. The buyer must be a direct EOA caller and attach EXACTLY the listed price in ugnot — any mismatch (including a price the seller changed by cancel-and-relist) aborts and the coins revert with the transaction. Settlement is atomic: the seller's proceeds (price minus the snapshotted fee) become claimable, the fee accrues to the pot, and the buyer is recorded. Terminal.

Open
OID
08caff…7a57:20
Buy details

Inspect func

CancelListing

func(id int64)

CancelListing withdraws an active listing. Only the seller may cancel; no funds are involved. Terminal.

Open
OID
08caff…7a57:21
CancelListing details

Inspect func

Claim

func(amount int64)

Claim sends amount ugnot of the caller's claimable proceeds back to the caller.

Open
OID
08caff…7a57:22
Claim details

Inspect func

ClaimAll

func()

ClaimAll sends the caller's entire claimable proceeds back to the caller. Fails if there is nothing to claim.

Open
OID
08caff…7a57:23
ClaimAll details

Inspect func

WithdrawFees

func()

WithdrawFees sends the accrued fee pot to the fee recipient. Only the fee recipient may call it.

Open
OID
08caff…7a57:24
WithdrawFees details

Inspect func

SweepDenom

func(denom string)

SweepDenom sends the surplus of a single denomination to the fee recipient. For ugnot only the excess over Liabilities() moves; other denoms move wholly. Only the fee recipient may call it.

Open
OID
08caff…7a57:25
SweepDenom details

Inspect func

SetFeeBps

func(bps int64)

SetFeeBps sets the protocol fee snapshotted into FUTURE listings. Existing listings keep the fee they were created under. Admin only; bounded by \[0, MaxFeeBps].

Open
OID
08caff…7a57:26
SetFeeBps details

Inspect func

SetFeeRecipient

func(next .uverse.address)

SetFeeRecipient re-points the fee/surplus role, including the pot accrued so far. Admin only; zero address rejected.

Open
OID
08caff…7a57:27
SetFeeRecipient details

Inspect func

TransferAdmin

func(next .uverse.address)

TransferAdmin STAGES a successor admin; the handoff completes only when that address calls AcceptAdmin (2-step, so a typo cannot brick administration — pattern adopted from memba\_appstore\_v2). Admin only; zero address rejected. Re-staging overwrites a previous stage.

Open
OID
08caff…7a57:28
TransferAdmin details

Inspect func

AcceptAdmin

func()

AcceptAdmin completes a staged admin handoff. Only the staged address may call it.

Open
OID
08caff…7a57:29
AcceptAdmin details

Inspect func

ListingInfo

func(id int64) (seller .uverse.address, title string, price int64, feeBps int64, status string, buyer .uverse.address)

ListingInfo returns a listing's fields by value: seller, title, price, snapshotted fee bps, status, and buyer (zero unless sold).

Open
OID
08caff…7a57:30
ListingInfo details

Inspect func

Description

func(id int64) string

Description returns a listing's raw description text.

Open
OID
08caff…7a57:31
Description details

Inspect func

Quote

func(id int64) (price int64, fee int64, toSeller int64)

Quote returns what a buyer pays and what the seller would receive for a listing, at its SNAPSHOTTED fee — the same arithmetic Buy performs (pattern from nsmarket/v4: a fee discovered after signing is a fee the seller was not told about).

Open
OID
08caff…7a57:32
Quote details

Inspect func

PendingAdmin

func() .uverse.address
Open
OID
08caff…7a57:34
PendingAdmin details

Inspect func

FeeRecipient

func() .uverse.address
Open
OID
08caff…7a57:35
FeeRecipient details

Inspect func

FeeBps

func() int64

FeeBps returns the fee that will be snapshotted into newly created listings (existing listings keep their own snapshot).

Open
OID
08caff…7a57:36
FeeBps details

Inspect func

NumListings

func() int64

NumListings returns how many listings have ever been created.

Open
OID
08caff…7a57:37
NumListings details

Inspect func

BalanceOf

func(addr .uverse.address) int64

BalanceOf returns addr's claimable proceeds.

Open
OID
08caff…7a57:38
BalanceOf details

Inspect func

UsersTotal

func() int64

UsersTotal returns the sum of all claimable proceeds (the U term).

Open
OID
08caff…7a57:39
UsersTotal details

Inspect func

FeesAccrued

func() int64

FeesAccrued returns the fee pot (the F term).

Open
OID
08caff…7a57:40
FeesAccrued details

Inspect func

Liabilities

func() int64

Liabilities returns everything this realm owes: UsersTotal + FeesAccrued (listings hold no value by construction).

Open
OID
08caff…7a57:41
Liabilities details

Inspect func

Held

func() int64

Held returns the ugnot actually held at the realm address (H).

Open
OID
08caff…7a57:42
Held details

Inspect func

Surplus

func() int64

Surplus returns Held() - Liabilities() (the S term).

Open
OID
08caff…7a57:43
Surplus details

Inspect func

Render

func(path string) string

Render shows the market at "" and a listing detail at "\<id>". Titles are charset-restricted; descriptions pass through the ecosystem sanitizer.

Open
OID
08caff…7a57:45
Render details

Inspect func

renderListing

func(path string) string
Open
OID
08caff…7a57:46
renderListing details

Inspect func

assertNoSend

func()

assertNoSend refuses coins on non-payable entrypoints: an accidental -send would otherwise strand at the realm as sweep-only surplus (pattern from nsmarket/v4). Buy is the only payable function. NOTE: this reads the ORIGIN envelope — for EOA callers that is exactly "coins that landed here"; for realm callers it fails closed whenever the origin tx carried any -send (see the header caveat).

Open
OID
08caff…7a57:47
assertNoSend details

Inspect func

assertAdmin

func(caller .uverse.address)
Open
OID
08caff…7a57:48
assertAdmin details

Inspect func

mustGetListing

func(id int64) *market.listing
Open
OID
08caff…7a57:49
mustGetListing details

Inspect func

assertValidTitle

func(title string)

assertValidTitle bounds length and restricts the charset so titles are list-safe in Render without escaping.

Open
OID
08caff…7a57:50
assertValidTitle details

Inspect func

padID

func(id int64) string

padID renders an id as a fixed-width key so avl iteration order is numeric order.

Open
OID
08caff…7a57:51
padID details

Inspect func
Denom : untyped string ="ugnot"
MaxFeeBps : int64 =1000
StatusActive : untyped string ="active"
StatusSold : untyped string ="sold"
StatusCancelled : untyped string ="cancelled"
MaxTitleLen : untyped bigint =(80 <untyped> bigint)
MaxDescLen : untyped bigint =(2000 <untyped> bigint)
MinPrice : int64 =1
listing : type =market.listing
admin : .uverse.address =<gnolang.StringValue>
pendingAdmin : .uverse.address =<zero>
feeRecipient : .uverse.address =<gnolang.StringValue>
feeBps : int64 =0
self : .uverse.address =<gnolang.StringValue>
nextID : int64 =2
listings : *v0.Tree Inspect
ledger : *feeledger.Ledger Inspect
init.17 : func() Inspect
CreateListing : func(title string, description string, price int64, maxFeeBps int64) int64 Inspect
Buy : func(id int64) Inspect
CancelListing : func(id int64) Inspect
Claim : func(amount int64) Inspect
ClaimAll : func() Inspect
WithdrawFees : func() Inspect
SweepDenom : func(denom string) Inspect
SetFeeBps : func(bps int64) Inspect
SetFeeRecipient : func(next .uverse.address) Inspect
TransferAdmin : func(next .uverse.address) Inspect
AcceptAdmin : func() Inspect
ListingInfo : func(id int64) (seller .uverse.address, title string, price int64, feeBps int64, status string, buyer .uverse.address) Inspect
Description : func(id int64) string Inspect
Quote : func(id int64) (price int64, fee int64, toSeller int64) Inspect
Admin : func() .uverse.address Inspect
PendingAdmin : func() .uverse.address Inspect
FeeRecipient : func() .uverse.address Inspect
FeeBps : func() int64 Inspect
NumListings : func() int64 Inspect
BalanceOf : func(addr .uverse.address) int64 Inspect
UsersTotal : func() int64 Inspect
FeesAccrued : func() int64 Inspect
Liabilities : func() int64 Inspect
Held : func() int64 Inspect
Surplus : func() int64 Inspect
Address : func() .uverse.address Inspect
Render : func(path string) string Inspect
renderListing : func(path string) string Inspect
assertNoSend : func() Inspect
assertAdmin : func(caller .uverse.address) Inspect
mustGetListing : func(id int64) *market.listing Inspect
assertValidTitle : func(title string) Inspect
padID : func(id int64) string Inspect
itoa : func(n int64) string Inspect