TermAuction.sol
This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract calculates a clearing price in a blind double auction and manages auction clearing
TermAuction
This contract calculates a clearing price in a blind double auction and manages auction clearing and settlement
This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment
ClearingPriceState
THREESIXTY_DAYCOUNT_SECONDS
ADMIN_ROLE
DEVOPS_ROLE
INITIALIZER_ROLE
termRepoId
termAuctionId
auctionEndTime
dayCountFractionMantissa
termRepoServicer
termAuctionBidLocker
termAuctionOfferLocker
purchaseToken
emitter
clearingPrice
clearingPricePostProcessingOffset
auctionCompleted
auctionCancelledForWithdrawal
completeAuctionPaused
termContractPaired
onlyWhileAuctionClosed
This only runs if the auction is closed (after auction end time)
This uses the block timestamp to determine if the auction is closed
whenCompleteAuctionNotPaused
notTermContractPaired
constructor
initialize
Initializes the contract
See: https://docs.openzeppelin.com/contracts/4.x/upgradeable
pairTermContracts
completeAuction
Calculates an auction's clearing price, assigns bids/offers, and returns unassigned funds
Parameters
cancelAuction
Cancels an auction and returns all funds to bidders and fulfillBiders
Parameters
cancelAuctionForWithdrawal
Cancels an auction and sets auctionCancelledForWithdrawal to true to open unlocking tenders
_increaseCumSumBids
_decreaseCumSumBids
_minUint256
Returns the min of two uint256
values
Parameters
Return Values
_calculateClearingPrice
Calculates the intersection between bid/offer schedules to arrive at a clearing price
Imagine a graph with price along the X-axis and cumsum(bid/offerAmount*price) along the Y-axis. This function finds the point where the supply line crosses the demand line using binary search
Parameters
Return Values
_findFirstIndexForPrice
Finds the index of the first bid with a bidPrice of price
and calculate the cumsum of the bid amounts up to that index
Parameters
Return Values
_findLastIndexForPrice
Finds the index of the last offer with a offerPrice of price
and calculate the cumsum of the offer amounts up to that index
Parameters
Return Values
_fullyAssignBid
Fully assigns a bid
Parameters
Return Values
_fullyAssignOffer
Fully assigns an offer
Parameters
Return Values
_partiallyAssignBid
Partially assigns a bid
Parameters
Return Values
_partiallyAssignOffer
Partially assigns an offer
Parameters
Return Values
_assignRolloverBid
_markRolloverAsProcessed
_assignBids
Assigns bids up to maxAssignable
This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single bid
Parameters
Return Values
_assignOffers
Assigns offers up to maxAssignable
This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single offer
Parameters
Return Values
_calculateRepurchasePrice
Calculates repurchase price given a purchase price (equivalent to principal plus interest)
Parameters
Return Values
_calculateAndStoreClearingPrice
pauseCompleteAuction
_This function pauses the TermAuction contract preventing public state changes See {Pausable-pause}.
unpauseCompleteAuction
Unpuses the TermAuction contract allowing public state changes
_See {Pausable-unpause}.
_authorizeUpgrade
required override by the OpenZeppelin UUPS module
Parameters
Last updated