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

englishauction source realm

Package englishauction is an idiomatic gno.land port of the classic Solidity English (ascending-bid) auction. Anyone ...

Overview

Package englishauction is an idiomatic gno.land port of the classic Solidity English (ascending-bid) auction. Anyone can Start an auction for a named item with a duration in blocks; bidders call Bid with a strictly increasing amount. The previous highest bid becomes refundable (claim it with Withdraw). After the auction's end height anyone may call End, awarding the item to the highest bidder. Auctions and pending refunds live in ordered avl trees so Render can iterate deterministically.

Functions 5

func Bid

crossing Action
1func Bid(cur realm, id int64, amount uint64)
source

Bid places a bid of `amount` on auction `id`. It must strictly exceed the current highest bid. The displaced highest bid becomes refundable to its bidder via Withdraw.

func End

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

End closes auction `id` once its end height is reached, awarding the item to the highest bidder (if any). Anyone may call it.

func Render

1func Render(path string) string
source

Render lists every auction with item, top bid + bidder, time left, and winner.

func Start

crossing Action
1func Start(cur realm, item string, durationBlocks int64) int64
source

Start opens a new auction for `item` running for `durationBlocks` blocks from the current height. The caller becomes the seller. Returns the auction id.

func Withdraw

crossing Action
1func Withdraw(cur realm, id int64) uint64
source

Withdraw refunds the caller's accumulated displaced bids for auction `id`. Returns the amount refunded (0 if nothing pending).

Types 1

type Auction

struct
1type Auction struct {
2	ID            int64
3	Seller        address
4	Item          string
5	EndHeight     int64
6	HighestBid    uint64
7	HighestBidder address
8	Ended         bool
9}
source

Auction is a single ascending-bid auction.

Imports 5

Source Files 2