Deadline
Deadline returns the height the slot closes at.
Command
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/games/lastwords/v0.Deadline()"
Result
Package lastwords is one string, on chain, forever.
There is a single message slot. Pay more than the last writer paid and the slot is yours; when the clock finally runs out, whatever is in it stays there permanently. The artefact at the end is the point, so the game is a bidding war over an epitaph rather than over a prize.
The three rules exist because the obvious version of this game does not end and does not pay:
Nothing is ever pushed: payouts are credited to an internal ledger and swept by Withdraw. A realm that pays inside a loop over its roster is a gas bomb that eventually bricks, and the bigger the game gets the more certain that is.
The pieces are libraries, and the realm is the wiring: p/moul/x/games/clock(/p/moul/x/games/clock/v0) owns the deadline and its guards, p/moul/x/games/prorata(/p/moul/x/games/prorata/v0) owns the split, and p/moul/x/daily/pullpayment(/p/moul/x/daily/pullpayment/v0) owns the credit ledger.
Deadline returns the height the slot closes at.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/games/lastwords/v0.Deadline()"
Message returns the slot's current contents, raw. Render is what escapes it.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/games/lastwords/v0.Message()"
Owed returns what an address can Withdraw right now.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/games/lastwords/v0.Owed()"
Pot returns what settlement will split.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/games/lastwords/v0.Pot()"
Price returns what msg costs to write right now, in ugnot: a base, plus a charge per byte, and always at least one ugnot more than the current holder paid. Query it before sending; an underpaying write is refused, not refunded.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/games/lastwords/v0.Price()"
Render shows the slot, the clock and the money. The message is caller-typed text, so it goes through ui.Inline: a stored string that renders as markdown is a phishing link on a page nobody can edit, and this realm's whole product is a string somebody else wrote.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/games/lastwords/v0.Render()"
Settle closes the game once the clock has run out, splitting the pot among every writer EXCEPT the one holding the slot, pro rata to what each paid.
Anyone may call it: leaving settlement to an interested party is how a pot stays unclaimed. It moves no coins, it credits the ledger; Withdraw is what pays. If the holder is the only writer there is nobody else to split with, so the pot returns to them.
# 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/games/lastwords/v0" -func "Settle" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/games/lastwords/v0" -func "Settle" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
Withdraw pays the caller everything credited to them and returns the amount. Dividends are claimable while the game runs; settlement shares only after Settle.
# 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/games/lastwords/v0" -func "Withdraw" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/games/lastwords/v0" -func "Withdraw" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
Write puts msg in the slot and makes the caller its holder. The caller must send at least Price(msg) ugnot with the transaction.
Half of the payment is credited to the writer being displaced and the rest joins the pot. The deadline is pushed a fifth of the way toward the hard end, never past it, and never to less than Floor from now.
Only a direct user transaction may write, so the payment envelope cannot be spoofed by an ephemeral MsgRun realm.
# 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/games/lastwords/v0" -func "Write" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/games/lastwords/v0" -func "Write" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx