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

quizstreak/v1 package

Overview

Package quizstreak is a multiple-choice trivia quiz where every player runs their own independent streak instead of racing others for a single shared question.

Each address gets its own current question, picked deterministically from the address and the block height of its first answer so different players don't all start on the same question. A correct answer extends the player's streak and advances them to their next question; a wrong answer breaks the streak back to zero but leaves the same question live so they can retry. The realm tracks each player's best-ever streak on a global leaderboard.

Functions

Answer

func Answer(cur realm, choiceIdx int) string

Answer submits a choice (0..3) for the caller's current question. Crossing function: caller invokes as Answer(cross(cur), choiceIdx).

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/x/daily/quizstreak/v1" -func "Answer" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/daily/quizstreak/v1" -func "Answer" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Render

func Render(path string) string

Render produces the gnoweb Markdown view. The root path shows the rules and the leaderboard; a path of a bech32 address shows that player's current question and stats.

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/moul/x/daily/quizstreak/v1.Render()"

Result