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

lastwords/v0 package

Overview

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:

  1. THE CLOCK TERMINATES. Every write pushes the deadline a fifth of the way to a hard end fixed when the slot opened, and no write can push it past that. A constant extension per action has no end: the pot grows faster than the price of the next write, so there is always a rational next write and the game runs until everyone is bored or broke.
  2. THE LAST WRITER DOES NOT TAKE THE POT. They take the slot, which is what they were bidding for. The pot is split among everyone ELSE who wrote, pro rata to what they paid. Winner-takes-all makes the second-to-last writer the mark and everyone knows it, which is why nobody joins.
  3. HALF OF EVERY PAYMENT GOES TO THE WRITER BEING DISPLACED, immediately. A zero-sum game minus gas has no reason for a second player. Overwriting somebody pays them, so being overwritten early is not a loss.

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.

Function

Withdraw

func Withdraw(cur realm) int64

Withdraw pays the caller everything credited to them and returns the amount. Dividends are claimable while the game runs; settlement shares only after Settle.

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/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