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

v0 state

Back to all declarations

duelStatus

type

duelStatus tracks the lifecycle of a duel.

Value

v0.duelStatus

statusPending

v0.duelStatus

Value

<zero>

statusResolved

v0.duelStatus

Value

<zero>

statusCancelled

v0.duelStatus

Value

<zero>

duel

type

duel is one challenge from Challenger to Opponent over a single coin flip. The Challenger calls a side up front; the Opponent's only move is to accept, which triggers the flip.

Value

v0.duel

playerState

type

playerState is the persisted win/loss record for one address.

Value

v0.playerState

duels

v0.Tree

// duel ID -> \*duel

Open
OID
017272…c01b:4
duels details

Inspect ref

players

v0.Tree

// address string -> \*playerState

Open
OID
017272…c01b:6
players details

Inspect ref

nextID

int

Value

0

flipNonce

int

Value

0

totalDone

int

Value

0

champion

.uverse.address

Value

<zero>

championWins

int

Value

0

parseCall

func(s string) (string, bool)
Open
OID
017272…c01b:12
parseCall details

Inspect func

flipCoin

func(d *v0.duel) string

flipCoin derives a deterministic pseudo-random side from the current chain height, a monotonic per-realm nonce, and both duelists' addresses, so two duels resolved in the same block still diverge.

Open
OID
017272…c01b:14
flipCoin details

Inspect func

getOrCreate

func(addr .uverse.address) *v0.playerState
Open
OID
017272…c01b:15
getOrCreate details

Inspect func

recordResult

func(winner .uverse.address, loser .uverse.address)
Open
OID
017272…c01b:16
recordResult details

Inspect func

Challenge

func(opponentAddr string, call string) string

Challenge opens a new duel against opponentAddr, locking in the challenger's call of "heads"/"tails" ("h"/"t" also accepted). The opponent settles it by calling Accept with the returned duel ID.

Open
OID
017272…c01b:17
Challenge details

Inspect func

Accept

func(id string) string

Accept settles a pending duel. Only the challenged opponent may call it; the flip happens immediately and the result is final.

Open
OID
017272…c01b:18
Accept details

Inspect func

Cancel

func(id string) string

Cancel withdraws a still-pending duel. Only the challenger may cancel, and only before the opponent accepts.

Open
OID
017272…c01b:19
Cancel details

Inspect func

escapeInline

func(s string) string

escapeInline neutralizes markdown-active characters in untrusted text before it's embedded inline in Render output.

Open
OID
017272…c01b:20
escapeInline details

Inspect func

renderDuel

func(id string) string
Open
OID
017272…c01b:22
renderDuel details

Inspect func

renderPlayer

func(rawAddr string) string
Open
OID
017272…c01b:23
renderPlayer details

Inspect func

Render

func(path string) string

Render shows the duel arena at "", a specific duel when path is a numeric ID, or one player's record when path is their bech32 address.

Open
OID
017272…c01b:24
Render details

Inspect func
duelStatus : type =v0.duelStatus
statusPending : v0.duelStatus =<zero>
statusResolved : v0.duelStatus =<zero>
statusCancelled : v0.duelStatus =<zero>
duel : type =v0.duel
playerState : type =v0.playerState
duels : v0.Tree Inspect
players : v0.Tree Inspect
nextID : int =0
flipNonce : int =0
totalDone : int =0
champion : .uverse.address =<zero>
championWins : int =0
parseCall : func(s string) (string, bool) Inspect
flipCoin : func(d *v0.duel) string Inspect
getOrCreate : func(addr .uverse.address) *v0.playerState Inspect
recordResult : func(winner .uverse.address, loser .uverse.address) Inspect
Challenge : func(opponentAddr string, call string) string Inspect
Accept : func(id string) string Inspect
Cancel : func(id string) string Inspect
escapeInline : func(s string) string Inspect
renderHome : func() string Inspect
renderDuel : func(id string) string Inspect
renderPlayer : func(rawAddr string) string Inspect
Render : func(path string) string Inspect