public sealed class AuctionHouseA market: an order book, a deposit, a fee, and settlement by mail.
Remarks
Doc 28's shape. The fee is "the primary currency sink", and settlement goes into mail because the seller is usually not online when their listing sells.
⚠ The goods leave the seller when the listing goes up — the same escrow rule mail has, and the same reason: a seller who could list a sword and then sell it to a vendor has listed something they no longer own.
⚠ A bid escrows the money, and outbidding refunds the previous bidder in the same intent. Two operations — take the new bid, then give the old one back — is a window in which the refund can fail and one player's gold is simply gone. One intent has no window.
⚠ The deposit comes back on a sale and is kept on an expiry. That asymmetry is the whole point of a deposit: it prices listing something nobody wants, which is the thing that makes an auction house unusable when it is free.
Fields and properties (4)
public float FeeRateWhat fraction of a sale is destroyed.
public IMarketModel? MarketWhere sales are recorded for pricing.
public IEnumerable<AuctionListing> ListingsEverything on the book, in id order so a page is stable.
public int CountHow many listings it has ever held.
Methods (9)
public AuctionHouse(IEconomyLedger ledger, PostOffice post, float feeRate = 0.05, IMarketModel? market = null)Makes one.
public AuctionListing? Find(ListingId id)One listing.
public IEnumerable<AuctionListing> For(DefId asset)Everything on the book of one asset.
public AuctionRefusal List(PlayerId seller, DefId asset, long count, DefId currency, long startingBid, long buyout, long deposit, float hours, float now, string operation, out AuctionListing? listing)Puts something up.
public AuctionRefusal Bid(PlayerId bidder, ListingId id, long amount, float now)Bids on something.
public AuctionRefusal Buyout(PlayerId buyer, ListingId id, float now)Ends a listing now at its buyout price.
public AuctionRefusal Withdraw(PlayerId seller, ListingId id, float now)Takes a listing down, which keeps the deposit.
public int Expire(float now)Closes whatever has run out, selling to the high bidder or sending it back.
public long FeeOn(long amount)What the fee on a sale is.
Used by (1)
- AuctionTestsVixen.Gameplay.Economy.Tests