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

v1 state

Back to all declarations

Auction

type

Auction is a single ascending-bid auction. It carries no ID field: the id belongs to the store, which hands it back on lookup and iteration.

Value

v1.Auction

pending

v0.Tree

// "\<id>:\<addr>" -> uint64 refundable amount

Open
OID
0ea9cc…1fd2:8
pending details

Inspect ref

pendKey

func(id int64, bidder .uverse.address) string

pendKey formats the refund key for a given auction id and bidder. It uses the decimal id rather than the store key: pending is only ever point-read, never iterated, so it needs a readable key and not an ordered one.

Open
OID
0ea9cc…1fd2:9
pendKey details

Inspect func

Start

func(item string, durationBlocks int64) int64

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

Open
OID
0ea9cc…1fd2:11
Start details

Inspect func

Bid

func(id int64, amount uint64)

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.

Open
OID
0ea9cc…1fd2:12
Bid details

Inspect func

Withdraw

func(id int64) uint64

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

Open
OID
0ea9cc…1fd2:13
Withdraw details

Inspect func

End

func(id int64)

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

Open
OID
0ea9cc…1fd2:14
End details

Inspect func

mustGet

func(id int64) *v1.Auction

mustGet returns the auction for \`id\`, panicking if it does not exist. The store's label puts the id in the message, which v0's fixed string ("englishauction: no such auction") left out.

Open
OID
0ea9cc…1fd2:15
mustGet details

Inspect func

pendingOf

func(id int64, bidder .uverse.address) uint64

pendingOf returns the refundable amount owed to \`bidder\` for auction \`id\`.

Open
OID
0ea9cc…1fd2:16
pendingOf details

Inspect func

blocksLeft

func(a *v1.Auction, height int64) int64

blocksLeft returns how many blocks remain before \`a\` can be ended (0 if the end height has been reached).

Open
OID
0ea9cc…1fd2:17
blocksLeft details

Inspect func

hasWinner

func(a *v1.Auction) bool

hasWinner reports whether the auction received at least one bid.

Open
OID
0ea9cc…1fd2:18
hasWinner details

Inspect func

Render

func(path string) string

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

Open
OID
0ea9cc…1fd2:19
Render details

Inspect func
Auction : type =v1.Auction
auctions : *v0.Store Inspect
pending : v0.Tree Inspect
pendKey : func(id int64, bidder .uverse.address) string Inspect
Start : func(item string, durationBlocks int64) int64 Inspect
Bid : func(id int64, amount uint64) Inspect
Withdraw : func(id int64) uint64 Inspect
End : func(id int64) Inspect
mustGet : func(id int64) *v1.Auction Inspect
pendingOf : func(id int64, bidder .uverse.address) uint64 Inspect
blocksLeft : func(a *v1.Auction, height int64) int64 Inspect
hasWinner : func(a *v1.Auction) bool Inspect
Render : func(path string) string Inspect