# English Auction
> ⚠️ **Experimental — generated with no human supervision** by the daily MCP pipeline (Solidity→Gno port). Not audited. See [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md).
---
An idiomatic gno.land port of the classic Solidity **English (ascending-bid)
auction**. It ports the core mechanics — a seller opens an auction, bidders
submit strictly increasing bids, the displaced top bid becomes refundable, and
after a block deadline anyone can settle it — into a single realm that hosts
many concurrent auctions.
Solidity's `msg.sender` maps to `unsafe.PreviousRealm().Address()`, `block.number`
to `runtime.ChainHeight()`, `require` to `panic`, and events to `chain.Emit`.
There is no real coin transfer: bid amounts and refunds are tracked as plain
`uint64` accounting in ordered `avl.Tree`s (mirroring Solidity's `pendingReturns`
withdraw pattern). Auctions and pending refunds are keyed so `Render` can iterate
deterministically.
## Transactions
- `Start(cur, item string, durationBlocks int64) int64` — open an auction (caller
becomes the seller); ends at `ChainHeight() + durationBlocks`. Returns the id.
- `Bid(cur, id int64, amount uint64)` — bid; must strictly exceed the current
highest. The prior top bid becomes refundable.
- `Withdraw(cur, id int64) uint64` — reclaim your displaced bids for an auction.
- `End(cur, id int64)` — after the deadline, award the item to the top bidder.
## Example calls
```
# open a 100-block auction for a painting -> returns id 1
Start("Vintage painting", 100)
# two bidders compete (amounts are accounting units, not real coins)
Bid(1, 500) # alice
Bid(1, 750) # bob outbids -> alice's 500 is now refundable
Withdraw(1) # alice reclaims 500
# once ChainHeight() >= endHeight, anyone settles it
End(1) # item awarded to bob at 750
```
Visit the realm to see the live table of auctions: item, highest bid + bidder,
blocks remaining or ended, and the winner.
<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->
---
Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
**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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).
<!-- END GNOCONTRACTS FOOTER -->
Bid(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int64, amount uint64)
End(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int64)
Render(path string) string
Start(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, item string, durationBlocks int64) int64
Withdraw(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int64) uint64
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.