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

quote

type

quote is a single board entry. Author is stored as a plain string address (realm values are ephemeral and must never be persisted).

Value

v0.quote

board

[]v0.quote (len=4)

board is the persistent realm state. A plain slice is fine here: the list only ever grows by append and Render walks it in insertion order, which is deterministic.

Open
OID
01bebc…b06e:13
board details (len=4)

+4 more Inspect slice

AddQuote

func(text string)

AddQuote is the exported, state-mutating entry point. It follows the gno 0.9 interrealm crossing convention: the first parameter is \`cur realm\`. Callers invoke it as AddQuote(cross(cur), "...") over a MsgCall.

Open
OID
01bebc…b06e:6
AddQuote details

Inspect func

maxQuoteLen

untyped bigint

maxQuoteLen caps quote length to keep storage costs bounded and Render tidy.

Value

(280 <untyped> bigint)

validate

func(text string) .uverse.error

validate enforces basic content rules. Returns an error describing the problem, or nil when the text is acceptable.

Open
OID
01bebc…b06e:7
validate details

Inspect func

errEmpty

v0.quoteError

Sentinel errors for validation. Kept as package-level vars so tests can compare against them directly.

Value

<gnolang.StringValue>

errTooLong

v0.quoteError

Sentinel errors for validation. Kept as package-level vars so tests can compare against them directly.

Value

<gnolang.StringValue>

quoteError

type

quoteError is a trivial string-backed error type (the VM has no host stdlib errors package convenience beyond this).

Value

v0.quoteError

featuredIndex

func(height int64, count int) int

featuredIndex deterministically picks which quote is "of the moment" for a given block height. Pure function of (height, count) so it is fully deterministic and easy to test.

Open
OID
01bebc…b06e:10
featuredIndex details

Inspect func

Render

func(path string) string

Render produces the Markdown page shown in gnoweb. It is NOT a crossing function (no \`cur realm\` parameter) — it is a read-only view.

Open
OID
01bebc…b06e:11
Render details

Inspect func

authorLabel

func(q v0.quote) string

authorLabel renders a human-friendly author string. Seeded quotes (empty author) show as the house account.

Open
OID
01bebc…b06e:12
authorLabel details

Inspect func
quote : type =v0.quote
board : []v0.quote (len=4) Inspect
init.2 : func() Inspect
AddQuote : func(text string) Inspect
maxQuoteLen : untyped bigint =(280 <untyped> bigint)
validate : func(text string) .uverse.error Inspect
errEmpty : v0.quoteError =<gnolang.StringValue>
errTooLong : v0.quoteError =<gnolang.StringValue>
quoteError : type =v0.quoteError
featuredIndex : func(height int64, count int) int Inspect
Render : func(path string) string Inspect
authorLabel : func(q v0.quote) string Inspect