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 source realm

Package dutchauction ports the classic Solidity Dutch-auction pattern to gno.land: a seller lists an item at a high s...

Readme View source

dutchauction

⚠️ Experimental — generated with no human supervision. This realm was produced automatically by an MCP-driven agent to exercise the gno MCP server and tooling, and to generate test content for gno compilers, linters and formatters. Not audited. Not for production. Full context & folder README: r/moul/x/daily


A Gno port of the classic Solidity Dutch-auction pattern: list an item at a high starting price that decays linearly, block by block, down to a floor. The first buyer to call Buy gets it at whatever the price is at that exact block — no bidding war, just a clock ticking against the seller. Payment is real ugnot, escrowed by the chain with the transaction; overpayment is refunded automatically and the settled price is forwarded straight to the seller.

Realm path: gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/dutchauction

Example calls

# list an item: 1000 ugnot down to a 100 ugnot floor over 100 blocks
List(cur, "vintage synth", 1000, 100, 100) -> "1"

# anyone can check the live price without paying anything
CurrentPrice("1") -> 1000, decaying toward 100 as blocks pass

# buy at the current price, sending >= CurrentPrice("1") ugnot with the tx;
# any excess is refunded in the same call
Buy(cur, "1") -> price actually paid

# the seller can pull a listing before anyone buys it
Cancel(cur, "1")

Render("") lists every auction with its live price, floor, start price, and status.

Toolchain status

gno test . passes (7/7) against gnolang/gno master (master.3130+bf5b31eda) with GNOROOT pointed at a full checkout — the local gno on PATH ships without a bundled stdlib tree, so GNOROOT had to be set explicitly to resolve chain, chain/banker, chain/runtime, and gno.land/p/nt/avl/v0/testutils/v0. gno lint . is clean. Target chain is sapphire (gno 0.9); code sticks to the documented chain/* stdlib family and crossing-function (cur realm) convention used by the other realms in this batch.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/daily/dutchauction/v0 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.

Overview

Package dutchauction ports the classic Solidity Dutch-auction pattern to gno.land: a seller lists an item at a high starting price that decays linearly, block by block, down to a floor price. The first buyer to call Buy pays whatever the price is at that moment — real ugnot, escrowed by the chain with the transaction and forwarded to the seller on settlement. Overpayment is refunded automatically. State-mutating functions are crossing functions (`cur realm`) per the gno 0.9 interrealm convention.

Functions 5

func Buy

crossing Action
1func Buy(cur realm, id string) int64
source

Buy purchases auction id at its current price. The caller must send at least that many ugnot with the transaction; any excess is refunded immediately. Only a direct EOA transaction (MsgCall) may buy, so the payment envelope can't be spoofed via an ephemeral MsgRun realm. Returns the price actually paid. Crossing function.

func Cancel

crossing Action
1func Cancel(cur realm, id string)
source

Cancel withdraws an active auction. Only the seller may cancel, and only before it's bought. Crossing function.

func CurrentPrice

Action
1func CurrentPrice(id string) int64
source

CurrentPrice returns id's price at the current chain height.

func List

crossing Action
1func List(cur realm, item string, startPrice, floorPrice, durationBlocks int64) string
source

List creates a new Dutch auction for item, starting at startPrice ugnot and falling linearly to floorPrice over durationBlocks. Returns the new auction's ID. Crossing function.

func Render

1func Render(path string) string
source

Render produces the gnoweb Markdown view: a table of every auction, newest first, with live prices. Not a crossing function.

Imports 8

  • chain stdlib
  • chain/banker stdlib
  • chain/runtime stdlib
  • chain/runtime/unsafe stdlib
  • errors stdlib
  • gno.land/p/nt/avl/v0 package
  • strconv stdlib
  • strings stdlib

Source Files 3