UniformPriceDualCapBatchAuction
Collects ETH bids under ETH-raise and REP-sale caps, computes one clearing result, and supports paged settlement. AVL, cumulative-allocation, and refund-prefix mechanics live in UniformPriceDualCapBatchAuctionStorage, an internal storage library. UniformPriceDualCapBatchAuction source contract
Read surface
Auction summary getters are maxAttoRepBeingSold, attoEthRaiseCap, finalized, clearingTick, ethFilledAtClearingAttoEth, attoEthRaised, totalAttoRepPurchased, auctionStarted, minBidSizeAttoEth, owner, underfunded, underfundedThreshold, underfundedWinningAttoEth, and activeTickCount. pendingEthRefundsAttoEth reports ETH credited during settlement and available for the bidder to pull. Use computeClearing, previewFinalization, tickToPrice, getTickSummary, getTickCount, getTickPage, getActiveTickPage, getBidCountAtTick, getBidPageAtTick, getBidderBidCount, and getBidderBidPage before finalizing or submitting settlement indexes.
State-changing interactions
| Transaction | Caller | Main prerequisites | State or asset effect | Primary signals |
|---|---|---|---|---|
startAuction(attoEthRaiseCap, maxAttoRepBeingSold) |
Auction owner (SecurityPoolForker) only |
Auction not previously started; both caps are positive; the REP cap does not exceed 11 million REP; the ETH cap fits in uint128; the block timestamp fits in uint48. |
Starts the one-week auction and fixes its two caps and minimum bid. | AuctionStarted |
submitBid(tick) with ETH |
Any bidder | Auction active and unfinalized; before one-week deadline; bid meets minBidSizeAttoEth; tick maps to nonzero price; the individual bid and the resulting cumulative ETH at that tick each fit in uint128. |
Adds ETH demand at the selected positive-price tick while extending that tick's append-only cumulative bid and refund history, including when a fully refunded tick becomes active again. | BidSubmitted |
refundLosingBids(tickIndices) |
Bidder for its own bids | Auction started and unfinalized; auction has reached a clearing price. Nonempty indexes additionally belong to the caller and are strictly losing and unrefunded. | A nonempty list marks the caller's bids already provably below the current clearing tick and credits their ETH to pendingEthRefundsAttoEth without calling the bidder. An empty list changes no bids. |
BidSettled per refunded bid; one aggregate EthRefundCredited per call when total credited ETH is positive |
refundLosingBidsFor(bidder, tickIndices) |
Auction owner (SecurityPoolForker) only; public callers use settleAuctionBids |
Named bidder is nonzero; auction started and unfinalized; auction has reached a clearing price. Nonempty indexes additionally belong to that bidder and are strictly losing and unrefunded. | A nonempty list marks a named bidder's bids already provably below the current clearing tick and credits their ETH to pendingEthRefundsAttoEth without calling the bidder. An empty list changes no bids. |
BidSettled per refunded bid; one aggregate EthRefundCredited per call when total credited ETH is positive |
finalize() |
Auction owner (SecurityPoolForker) only; users reach it through finalizeTruthAuction |
Auction started, not finalized, and one-week deadline reached; owner accepts the proceeds ETH call, including zero value. | Fixes the clearing mode, clearing tick, ETH totals, and aggregate REP allocation, then calls the owner with the resulting proceeds, including when zero. A rejected call reverts finalization and its event. | AuctionFinalized |
withdrawBids(withdrawFor, tickIndices, proRataTotal, secondaryProRataTotal, repBackingUnitsTotal) |
Auction owner only | Auction finalized; caller is owner. Nonempty indexes belong to withdrawFor and remain unsettled. |
Returns five uint256 values in ABI order: totalFilledAttoRep (filled REP), totalRefundAttoEth (ETH refund), totalProRataAllocation (capacity), totalSecondaryProRataAllocation (bad debt), and totalRepBackingUnitsAllocation (REP backing units). The forker credits backing and capacity to the bidder vault and credits bad debt only while the recorded auction debt generation is current; the auction credits refunds to the beneficiary pull-payment balance without calling recipient code. Capacity and debt use fixed cumulative ETH positions. Backing units use the corresponding cumulative filled-REP positions to exhaust repBackingUnitsTotal without claim-order dependence. An empty list returns five zeros without changing bids or emitting events. |
BidSettled per processed bid; one EthRefundCredited for the call when aggregate totalRefundAttoEth is positive |
withdrawPendingEthRefund() |
Bidder with credited ETH | Caller has a positive pendingEthRefundsAttoEth balance and currently accepts ETH. |
Clears the caller's complete credited refund and emits its withdrawal before transferring. A rejected pull reverts the transfer, clear, and event, preserving the credit. Checks-effects-interactions makes callback reentry observe a zero balance. | PendingEthRefundWithdrawn |
Accounting examples
Tick pricing
Bids are placed at integer ticks between MIN_TICK (-524288) and MAX_TICK (524288). tickToPrice(0) is PRICE_PRECISION, one ETH per REP. Each tick above zero multiplies the price by 1.0001 through a binary-exponentiation table of _powerOf1Point0001; negative ticks take the reciprocal. The price at tick t is therefore approximately:
A tick whose price rounds to zero is rejected. Within one tick, the uniform-clearing branch fills bids first in, first out, so earlier same-tick bids are consumed before later ones.