Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

markets state

Back to all declarations

scale

int64

Value

1000000

maxInt64

int64

Value

9223372036854775807

Market

type

All amounts are integer ugnot. One million micro-shares is one share; a winning micro-share pays one ugnot (one whole share pays one GNOT).

Value

markets.Market

QuotePoint

type

QuotePoint records one published fixed quote. The history contains the creation quote and every later administrator requote, in block-time order.

Value

markets.QuotePoint

Position

type

Value

markets.Position

marketRecord

type

Value

markets.marketRecord

maxHistory

untyped bigint

Value

(240 <untyped> bigint)

administrator

.uverse.address

OriginCaller is used only at package initialization, to capture the deployer. Entry-point authorization always uses the live immediate caller.

Value

<gnolang.StringValue>

pendingAdministrator

.uverse.address

Value

<gnolang.StringValue>

records

map[string]*markets.marketRecord
Open
OID
06bd31…69a1:6
records details

Inspect map

totalEscrowUgnot

int64

Value

323500000

Administrator

func() .uverse.address
Open
OID
06bd31…69a1:9
Administrator details

Inspect func

PendingAdministrator

func() .uverse.address
Open
OID
06bd31…69a1:11
PendingAdministrator details

Inspect func

ProposeAdministrator

func(next .uverse.address)

ProposeAdministrator starts a two-step handover. The proposed address must accept from its own direct user call, so a mistyped address cannot take over. Each market keeps the oracle it was created with.

Open
OID
06bd31…69a1:12
ProposeAdministrator details

Inspect func

AcceptAdministrator

func()

AcceptAdministrator completes the handover started by ProposeAdministrator.

Open
OID
06bd31…69a1:13
AcceptAdministrator details

Inspect func

CreateMarket

func(id string, question string, rules string, conditionID string, yesTokenID string, noTokenID string, closesAt int64, yesPricePpm int64, oracle .uverse.address)

CreateMarket freezes every field used to match an external result. There are deliberately no question/rules/source/oracle/price update functions.

Open
OID
06bd31…69a1:14
CreateMarket details

Inspect func

SetQuote

func(id string, yesPricePpm int64, expectedVersion int64)

SetQuote publishes a new fixed quote while trading is open. expectedVersion prevents an operator from overwriting a quote it has not seen. Every Buy still checks the exact price its buyer reviewed.

Open
OID
06bd31…69a1:15
SetQuote details

Inspect func

Fund

func(id string)

Fund adds non-refundable reserve capital, allocated solely to this market. No withdrawal or banker capability is exposed, even to the administrator.

Open
OID
06bd31…69a1:16
Fund details

Inspect func

Buy

func(id string, outcome string, microShares int64, expectedPricePpm int64)

Buy creates positions only after exact payment and full market-specific collateral coverage. expectedPricePpm is the selected outcome's captured price.

Open
OID
06bd31…69a1:17
Buy details

Inspect func

FinalizeByOracle

func(id string, conditionID string, rulesHash string, yesTokenID string, noTokenID string, winner string, evidenceHash string)

FinalizeByOracle accepts only the pinned oracle and the entire immutable source binding. EvidenceHash commits to an externally verified final record. Neither a price threshold nor an unverified API response can call this by itself. A source can resolve before the planned closing date. Oracle finalization therefore closes trading immediately, without waiting for that deadline.

Open
OID
06bd31…69a1:18
FinalizeByOracle details

Inspect func

Claim

func(id string) int64

Claim pays only the immediate caller's winning shares. Repeated calls abort; a losing position can be closed once with zero payout. A panic rolls back both state and bank effects in the Gno transaction.

Open
OID
06bd31…69a1:19
Claim details

Inspect func

GetMarket

func(id string) markets.Market
Open
OID
06bd31…69a1:20
GetMarket details

Inspect func

GetPosition

func(id string, owner .uverse.address) markets.Position
Open
OID
06bd31…69a1:21
GetPosition details

Inspect func

Quote

func(id string, outcome string, microShares int64) int64
Open
OID
06bd31…69a1:22
Quote details

Inspect func

ListMarkets

func() []markets.Market
Open
OID
06bd31…69a1:23
ListMarkets details

Inspect func

MarketJSON

func(id string) string

Gno 1.5.0 does not include encoding/json. These read-only projections use explicit fields and JSON string escaping, without an external package.

Open
OID
06bd31…69a1:24
MarketJSON details

Inspect func

MarketsJSON

func() string

MarketsJSON returns every market in creation order as one JSON array.

Open
OID
06bd31…69a1:25
MarketsJSON details

Inspect func

PositionsJSON

func(owner .uverse.address) string

PositionsJSON returns the owner's positions across all markets, in market creation order. Markets where the owner never bought are omitted.

Open
OID
06bd31…69a1:26
PositionsJSON details

Inspect func

historyJSON

func(points []markets.QuotePoint) string
Open
OID
06bd31…69a1:27
historyJSON details

Inspect func

QuoteHistory

func(id string) []markets.QuotePoint

QuoteHistory returns a detached copy of the published quotes.

Open
OID
06bd31…69a1:28
QuoteHistory details

Inspect func

ppmPrice

func(value int64) string

ppmPrice formats an integer in millionths with six fixed decimals.

Open
OID
06bd31…69a1:29
ppmPrice details

Inspect func

PositionJSON

func(id string, owner .uverse.address) string
Open
OID
06bd31…69a1:30
PositionJSON details

Inspect func

jsonString

func(value string) string
Open
OID
06bd31…69a1:32
jsonString details

Inspect func

BindingHash

func(question string, rules string) string

Hash UTF-8 length-framed text, shared exactly with the backend source binding.

Open
OID
06bd31…69a1:33
BindingHash details

Inspect func

assertUser

func(int, context .uverse.realm)
Open
OID
06bd31…69a1:34
assertUser details

Inspect func

assertBankCoverage

func(int, context .uverse.realm, required int64)
Open
OID
06bd31…69a1:37
assertBankCoverage details

Inspect func

mustMarket

func(id string) *markets.marketRecord
Open
OID
06bd31…69a1:38
mustMarket details

Inspect func

outcomePrice

func(m markets.Market, outcome string) int64
Open
OID
06bd31…69a1:39
outcomePrice details

Inspect func

quoteCost

func(microShares int64, price int64) int64
Open
OID
06bd31…69a1:40
quoteCost details

Inspect func

checkedAdd

func(a int64, b int64) int64
Open
OID
06bd31…69a1:41
checkedAdd details

Inspect func

maximum

func(a int64, b int64) int64
Open
OID
06bd31…69a1:42
maximum details

Inspect func

require

func(ok bool, message string)
Open
OID
06bd31…69a1:43
require details

Inspect func

appURL

untyped string

appURL is the exchange interface; the realm page links to it for trading.

Value

"https://six-seven-67-phi.vercel.app"

pagePath

string

pagePath is this realm's gnoweb path ("/r/\<namespace>/markets"), captured at deployment so links between its pages work on any chain and namespace.

Value

"/r/nym-sixseven067/markets"

historyRows

untyped bigint

historyRows is how many recent quotes a market page lists.

Value

(10 <untyped> bigint)

Render

func(path string) string

Render draws the realm's public page on gnoweb: the market list at the root and one page per market at ":\<id>". It is informational; the app reads JSON.

Open
OID
06bd31…69a1:47
Render details

Inspect func

renderMarket

func(r *markets.marketRecord) string
Open
OID
06bd31…69a1:50
renderMarket details

Inspect func

status

func(m markets.Market) string
Open
OID
06bd31…69a1:51
status details

Inspect func

priceText

func(value int64) string

priceText formats millionths like the app: at least two decimals, no trailing zeros beyond them (420000 is "0.42", 425000 is "0.425").

Open
OID
06bd31…69a1:52
priceText details

Inspect func

timeText

func(unix int64) string
Open
OID
06bd31…69a1:54
timeText details

Inspect func

countText

func(n int64, one string, many string) string
Open
OID
06bd31…69a1:55
countText details

Inspect func

escapeText

func(s string) string

escapeText keeps question and rules text literal in Markdown, tables included.

Open
OID
06bd31…69a1:56
escapeText details

Inspect func

escapeCode

func(s string) string

escapeCode keeps an untrusted path inside one inline code span.

Open
OID
06bd31…69a1:57
escapeCode details

Inspect func
scale : int64 =1000000
maxInt64 : int64 =9223372036854775807
Market : type =markets.Market
QuotePoint : type =markets.QuotePoint
Position : type =markets.Position
marketRecord : type =markets.marketRecord
maxHistory : untyped bigint =(240 <untyped> bigint)
administrator : .uverse.address =<gnolang.StringValue>
pendingAdministrator : .uverse.address =<gnolang.StringValue>
records : map[string]*markets.marketRecord Inspect
marketIDs : []string (len=43) Inspect
totalEscrowUgnot : int64 =323500000
Administrator : func() .uverse.address Inspect
PendingAdministrator : func() .uverse.address Inspect
ProposeAdministrator : func(next .uverse.address) Inspect
AcceptAdministrator : func() Inspect
CreateMarket : func(id string, question string, rules string, conditionID string, yesTokenID string, noTokenID string, closesAt int64, yesPricePpm int64, oracle .uverse.address) Inspect
SetQuote : func(id string, yesPricePpm int64, expectedVersion int64) Inspect
Fund : func(id string) Inspect
Buy : func(id string, outcome string, microShares int64, expectedPricePpm int64) Inspect
FinalizeByOracle : func(id string, conditionID string, rulesHash string, yesTokenID string, noTokenID string, winner string, evidenceHash string) Inspect
Claim : func(id string) int64 Inspect
GetMarket : func(id string) markets.Market Inspect
GetPosition : func(id string, owner .uverse.address) markets.Position Inspect
Quote : func(id string, outcome string, microShares int64) int64 Inspect
ListMarkets : func() []markets.Market Inspect
MarketJSON : func(id string) string Inspect
MarketsJSON : func() string Inspect
PositionsJSON : func(owner .uverse.address) string Inspect
historyJSON : func(points []markets.QuotePoint) string Inspect
QuoteHistory : func(id string) []markets.QuotePoint Inspect
ppmPrice : func(value int64) string Inspect
PositionJSON : func(id string, owner .uverse.address) string Inspect
decimal : func(value int64) string Inspect
jsonString : func(value string) string Inspect
BindingHash : func(question string, rules string) string Inspect
assertUser : func(int, context .uverse.realm) Inspect
assertNoSend : func() Inspect
singleSend : func() int64 Inspect
assertBankCoverage : func(int, context .uverse.realm, required int64) Inspect
mustMarket : func(id string) *markets.marketRecord Inspect
outcomePrice : func(m markets.Market, outcome string) int64 Inspect
quoteCost : func(microShares int64, price int64) int64 Inspect
checkedAdd : func(a int64, b int64) int64 Inspect
maximum : func(a int64, b int64) int64 Inspect
require : func(ok bool, message string) Inspect
isHash : func(s string) bool Inspect
isTokenID : func(s string) bool Inspect
appURL : untyped string ="https://six-seven-67-phi.vercel.app"
pagePath : string ="/r/nym-sixseven067/markets"
historyRows : untyped bigint =(10 <untyped> bigint)
Render : func(path string) string Inspect
renderIndex : func() string Inspect
renderMarket : func(r *markets.marketRecord) string Inspect
status : func(m markets.Market) string Inspect
priceText : func(value int64) string Inspect
dayText : func(unix int64) string Inspect
timeText : func(unix int64) string Inspect
countText : func(n int64, one string, many string) string Inspect
escapeText : func(s string) string Inspect
escapeCode : func(s string) string Inspect