Debt Auction House
1. Summary
Debt auctions are used to recapitalize the system by auctioning off protocol tokens for a fixed amount of system coins. In this process, bidders compete by offering to accept decreasing amounts of protocol tokens for the coins they will end up paying.
2. Contract Variables & Functions
Variables
contractEnabled
- settlement flag (1
or0
).AUCTION_HOUSE_TYPE
- flag set tobytes32("DEBT")
authorizedAccounts[usr: address]
- addresses allowed to callmodifyParameters()
anddisableContract()
.safeEngine
- storage of theSAFEEngine
's address.protocolToken
- token minted in exchange for system coins.accountingEngine
- address of theAccountingEngine
(receiver of system coins).bids[id: uint]
- storage of all bids.bidDuration
- bid lifetime.bidDecrease
- minimum bid decrease.amountSoldIncrease
- increase for size ofamountToSell
duringrestartAuction
(default to 50%).totalAuctionLength
- maximum auction duration.auctionsStarted
- number of auctions that have started up until now.
Data Structures
Bid
- state of a specific auction. Contains:bidAmount
- paid system coinsamountToSell
- quantity of protocol tokens up for auctionhighBidder
bidExpiry
- when a bid expires (and the auction ends)auctionDeadline
- max auction duration
Modifiers
isAuthorized
**** - checks whether an address is part ofauthorizedAddresses
(and thus can call authed functions).
Functions
-
modifyParameters(bytes32 parameter
,uint256 data)
- update auint256
parameter. -
modifyParameters(bytes32 parameter
,address data)
- update anaddress
parameter. -
startAuction(incomeReceiver: address
,amountToSell: uint256
,initialBid: uint256)
- start a new debt auction. -
restartAuction(id: uint256)
- restart an auction if there have been 0 bids and theauctionDeadline
has passed. -
decreaseSoldAmount(id: uint256
,amountToBuy: uint256
,bid: uint256)
- submit a fixed system coin bid with an increasingly lower amount of protocol tokens you are willing to accept in exchange. -
disableContract()
- disable the contract. -
settleAuction(id: uint256)
- claim a winning bid / settles a completed auction -
terminateAuctionPrematurely(id: uint256)
- used duringGlobalSettlement
to terminatedecreaseSoldAmount
phase auctions and repay system coins (usingsafeEngine.createUnbackedDebt
with theaccountingEngine
as thedebtDestination
) to the highest bidder.
Events
AddAuthorization
- emitted when a new address becomes authorized. Contains:account
- the new authorized account
RemoveAuthorization
- emitted when an address is de-authorized. Contains:account
- the address that was de-authorized
StartAuction
- emitted whenstartAuction(address
,uint256
,uint256)
is successfully executed. Contains:id
- auction idauctionsStarted
- total amount of auctions that have started up until nowamountToSell
- amount of protocol tokens sold in (to be minted after) the auction.initialBid
- starting bid for the auction.incomeReceiver
**** - address that receives the system coins from an auction (usually theAccountingEngine
)auctionDeadline
- deadline for the auction with IDid
activeDebtAuctions
- the current number of active debt auctions
ModifyParameters
- emitted after a parameter is modifiedRestartAuction
- emitted after an auction is restarted. Contains:id
- the ID of the auction being restartedauctionDeadline
- the new auction deadline
DecreaseSoldAmount
- emitted when someone bids a smaller amount of protocol tokens for the same amount of system coins given in return. Contains:id
- the ID of the auction that's being bid onhighBidder
- the new high bidderamountToBuy
- the protocol token bidbid
- the amount of system coins offeredbidExpiry
- the timestamp when the auction will end even if it's earlier than theauctionDeadline
SettleAuction
- emitted after an auction is settled. Contains:id
- the ID of the settled auctionactiveDebtAuctions
- the new number of active debt auctions
TerminateAuctionPrematurely
- emitted after an auction is settled before its official deadline. Contains:id
- the ID of the auction that was terminatedsender
- the address that terminated the auctionhighBidder
- the auction's high bidderbidAmount
- the auction's bid amountactiveDebtAuctions
- the new number of active debt auctions
DisableContract
- emitted after the contract is disabled. Contains:sender
- the address that disabled the contract
3. Walkthrough
The DebtAuctionHouse
is a reverse auction, meaning that participants bid with increasingly lower amounts of protocol tokens they are willing to accept for a fixed amount of system coins. The auction will end when the latest bid duration (bidDuration
) has passed since the last submitted bid or when the general auction deadline (auctionStartTime + totalAuctionLength
) has been reached.
The first bidder will pay back the system debt (that the auction tries to cover) and submit their preference for the amount of protocol tokens they would like to receive. Each subsequent bid will pay back the previous (no longer winning) bidder. When the auction is over, the process ends by cleaning up the bid and minting protocol tokens for the winning bidder.
If the auction expires without receiving any bids, anyone can restart the auction by calling restartAuction(uint auction_id)
. This will do two things:
- It resets
bids[id].auctionDeadline
tonow + totalAuctionLength
- It resets
bids[id].amountToSell
tobids[id].amountToSell * amountSoldIncrease / ONE
4. Gotchas (Potential Source of User Error)
Keepers
In the context of running a keeper (more info here) to perform bids within an auction, a primary failure mode would occur when a keeper specifies an unprofitable price for ODG.
- This failure mode is due to the fact that there is nothing the system can do stop a user from paying significantly more than the fair market value for the token in an auction (this goes for all auction types,
collateral
,debt
, andsurplus
). - This means, in the case of Flop, that since the Coin amount is fixed for the entire auction, the risk to the keeper is that they would make a "winning" bid that pays the bid amount in Coin but does not receive any ODG (
amountToSell
== 0). Subsequent executions of this bad strategy would be limited by the amount of Coin (not ODG) in their vat balance.
5. Failure Modes (Bounds on Operating Conditions & External Risk Factors)
DebtAuctionHouse
has the potential to issue an excessively huge amount of ODG and despite the mitigation efforts (the addition of the initialDebtAuctionMintedTokens
and amountSoldIncrease
parameters), if initialDebtAuctionMintedTokens
is not set correctly by governance, the huge issuance of ODG could still occur.