IDebtAuctionHouse
Inherits: IAuthorizable, IDisableable, IModifiable
Functions
AUCTION_HOUSE_TYPE
Type of the auction house
function AUCTION_HOUSE_TYPE() external view returns (bytes32 _auctionHouseType);
Returns
Name | Type | Description |
---|---|---|
_auctionHouseType | bytes32 | Bytes32 representation of the auction house type |
auctions
Data of an auction
function auctions(uint256 _id) external view returns (Auction memory _auction);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
Returns
Name | Type | Description |
---|---|---|
_auction | Auction | Auction data struct |
_auctions
Unpacked data of an auction
function _auctions(uint256 _id)
external
view
returns (uint256 _bidAmount, uint256 _amountToSell, address _highBidder, uint256 _bidExpiry, uint256 _auctionDeadline);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
Returns
Name | Type | Description |
---|---|---|
_bidAmount | uint256 | How much protocol tokens are to be minted [wad] |
_amountToSell | uint256 | How many system coins are raised [rad] |
_highBidder | address | Address of the highest bidder |
_bidExpiry | uint256 | Time when the latest bid expires and the auction can be settled |
_auctionDeadline | uint256 | Time when the auction expires |
auctionsStarted
Total amount of debt auctions created
function auctionsStarted() external view returns (uint256 _auctionsStarted);
activeDebtAuctions
Total amount of simultaneous active debt auctions
function activeDebtAuctions() external view returns (uint256 _activeDebtAuctions);
safeEngine
Address of the SAFEEngine contract
function safeEngine() external view returns (ISAFEEngine _safeEngine);
protocolToken
Address of the ProtocolToken contract
function protocolToken() external view returns (IProtocolToken _protocolToken);
accountingEngine
Address of the AccountingEngine contract
function accountingEngine() external view returns (address _accountingEngine);
params
Getter for the contract parameters struct
function params() external view returns (DebtAuctionHouseParams memory _dahParams);
Returns
Name | Type | Description |
---|---|---|
_dahParams | DebtAuctionHouseParams | Auction house parameters struct |
_params
Getter for the unpacked contract parameters struct
function _params()
external
view
returns (uint256 _bidDecrease, uint256 _amountSoldIncrease, uint256 _bidDuration, uint256 _totalAuctionLength);
Returns
Name | Type | Description |
---|---|---|
_bidDecrease | uint256 | Minimum bid increase compared to the last bid in order to take the new one in consideration [wad %] |
_amountSoldIncrease | uint256 | Increase in protocol tokens sold in case an auction is restarted [wad %] |
_bidDuration | uint256 | How long the auction lasts after a new bid is submitted [seconds] |
_totalAuctionLength | uint256 | Total length of the auction [seconds] |
startAuction
Start a new debt auction
function startAuction(
address _incomeReceiver,
uint256 _amountToSell,
uint256 _initialBid
) external returns (uint256 _id);
Parameters
Name | Type | Description |
---|---|---|
_incomeReceiver | address | Who receives the auction proceeds |
_amountToSell | uint256 | Initial amount of protocol tokens to be minted [wad] |
_initialBid | uint256 | Amount of debt to be sold [rad] |
Returns
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
restartAuction
Restart an auction if no bids were placed
An auction can be restarted if the auction expired with no bids
function restartAuction(uint256 _id) external;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
decreaseSoldAmount
Decrease the protocol token amount you're willing to receive in exchange for providing the same amount of system coins being raised by the auction
function decreaseSoldAmount(uint256 _id, uint256 _amountToBuy) external;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | ID of the auction for which you want to submit a new bid |
_amountToBuy | uint256 | Amount of protocol tokens to buy (must be smaller than the previous proposed amount) [wad] |
settleAuction
Settle an auction
Can only be called after the auction expired with a winning bid
function settleAuction(uint256 _id) external;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
terminateAuctionPrematurely
Terminate an auction prematurely
Can only be called after the contract is disabled
The method creates an unbacked debt position in the AccountingEngine for the remaining debt
function terminateAuctionPrematurely(uint256 _id) external;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
Events
StartAuction
Emitted when a new auction is started
event StartAuction(
uint256 indexed _id,
address indexed _auctioneer,
uint256 _blockTimestamp,
uint256 _amountToSell,
uint256 _amountToRaise,
uint256 _auctionDeadline
);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_auctioneer | address | Address who started the auction |
_blockTimestamp | uint256 | Time when the auction was started |
_amountToSell | uint256 | How much protocol tokens are initially offered [wad] |
_amountToRaise | uint256 | Amount of system coins to raise [rad] |
_auctionDeadline | uint256 | Time when the auction expires |
RestartAuction
Emitted when an auction is restarted
event RestartAuction(uint256 indexed _id, uint256 _blockTimestamp, uint256 _auctionDeadline);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_blockTimestamp | uint256 | Time when the auction was restarted |
_auctionDeadline | uint256 | New time when the auction expires |
DecreaseSoldAmount
Emitted when a bid is made in an auction
event DecreaseSoldAmount(
uint256 indexed _id,
address _bidder,
uint256 _blockTimestamp,
uint256 _raisedAmount,
uint256 _soldAmount,
uint256 _bidExpiry
);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_bidder | address | Who made the bid |
_blockTimestamp | uint256 | Time when the bid was made |
_raisedAmount | uint256 | Amount of system coins raised in the bid [rad] |
_soldAmount | uint256 | Amount of protocol tokens offered to buy in the bid [wad] |
_bidExpiry | uint256 | Time when the bid expires |
SettleAuction
Emitted when an auction is settled
An auction is settled after the winning bid or the auction expire
event SettleAuction(uint256 indexed _id, uint256 _blockTimestamp, address _highBidder, uint256 _raisedAmount);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_blockTimestamp | uint256 | Time when the auction was settled |
_highBidder | address | Who won the auction |
_raisedAmount | uint256 | Amount of system coins raised in the auction [rad] |
TerminateAuctionPrematurely
Emitted when an auction is terminated prematurely
event TerminateAuctionPrematurely(
uint256 indexed _id, uint256 _blockTimestamp, address _highBidder, uint256 _raisedAmount
);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_blockTimestamp | uint256 | Time when the auction was terminated |
_highBidder | address | Who won the auction |
_raisedAmount | uint256 | Amount of system coins raised in the auction [rad] |
Errors
DAH_AuctionNeverStarted
Throws when trying to restart an auction that never started
error DAH_AuctionNeverStarted();
DAH_AuctionNotFinished
Throws when trying to restart an auction that is still active
error DAH_AuctionNotFinished();
DAH_BidAlreadyPlaced
Throws when trying to restart an auction that already has a winning bid
error DAH_BidAlreadyPlaced();
DAH_AuctionAlreadyExpired
Throws when trying to bid in an auction that already has expired
error DAH_AuctionAlreadyExpired();
DAH_BidAlreadyExpired
Throws when trying to bid in an auction that has a bid already expired
error DAH_BidAlreadyExpired();
DAH_NotMatchingBid
Throws when trying to bid in an auction with a bid that doesn't match the current bid
error DAH_NotMatchingBid();
DAH_AmountBoughtNotLower
Throws when trying to place a bid that is not lower than the current bid
error DAH_AmountBoughtNotLower();
DAH_InsufficientDecrease
Throws when trying to place a bid not lower than the current bid threshold
error DAH_InsufficientDecrease();
DAH_HighBidderNotSet
Throws when prematurely terminating an auction that has no bids
error DAH_HighBidderNotSet();
Structs
Auction
struct Auction {
uint256 bidAmount;
uint256 amountToSell;
address highBidder;
uint256 bidExpiry;
uint256 auctionDeadline;
}
DebtAuctionHouseParams
struct DebtAuctionHouseParams {
uint256 bidDecrease;
uint256 amountSoldIncrease;
uint256 bidDuration;
uint256 totalAuctionLength;
}