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

dutchauction/v0 package

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

Buy

func Buy(cur realm, id string) int64

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.

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/dutchauction/v0" -func "Buy" -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/daily/dutchauction/v0" -func "Buy" -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
  

Cancel

func Cancel(cur realm, id string)

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

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/dutchauction/v0" -func "Cancel" -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/daily/dutchauction/v0" -func "Cancel" -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
  

CurrentPrice

func CurrentPrice(id string) int64

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/dutchauction/v0.CurrentPrice()"

Result

List

func List(cur realm, item string, startPrice, floorPrice, durationBlocks int64) string

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.

Params

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/dutchauction/v0" -func "List" -args $'' -args $'' -args $'' -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/daily/dutchauction/v0" -func "List" -args $'' -args $'' -args $'' -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
  

Render

func Render(path string) string

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/daily/dutchauction/v0.Render()"

Result