DebtAuctionHouse
Inherits: Authorizable, Modifiable, Disableable, IDebtAuctionHouse
This contract enables the sell of newly minted protocol tokens in exchange for system coins to cover a protocol debt
State Variables
AUCTION_HOUSE_TYPE
Type of the auction house
bytes32 public constant AUCTION_HOUSE_TYPE = bytes32('DEBT');
_auctions
Unpacked data of an auction
mapping(uint256 _auctionId => Auction) public _auctions;
auctionsStarted
Total amount of debt auctions created
uint256 public auctionsStarted;
activeDebtAuctions
Total amount of simultaneous active debt auctions
uint256 public activeDebtAuctions;
safeEngine
Address of the SAFEEngine contract
ISAFEEngine public safeEngine;
protocolToken
Address of the ProtocolToken contract
IProtocolToken public protocolToken;
accountingEngine
Address of the AccountingEngine contract
address public accountingEngine;
_params
Getter for the unpacked contract parameters struct
DebtAuctionHouseParams public _params;
Functions
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 |
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 |
constructor
constructor(
address _safeEngine,
address _protocolToken,
DebtAuctionHouseParams memory _dahParams
) Authorizable(msg.sender) validParams;
Parameters
Name | Type | Description |
---|---|---|
_safeEngine | address | Address of the SAFEEngine contract |
_protocolToken | address | Address of the protocol governance token |
_dahParams | DebtAuctionHouseParams | Initial valid DebtAuctionHouse parameters struct |
_onContractDisable
Internal virtual method to be called when the contract is disabled
Sets the accountingEngine state var to the caller's address
function _onContractDisable() internal override;
startAuction
Start a new debt auction
function startAuction(
address _incomeReceiver,
uint256 _amountToSell,
uint256 _initialBid
) external isAuthorized whenEnabled 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 whenEnabled;
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 whenEnabled;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
terminateAuctionPrematurely
Terminate an auction prematurely
Can only be called after the contract is disabled
function terminateAuctionPrematurely(uint256 _id) external whenDisabled;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_modifyParameters
Internal function to be overriden with custom logic to modify parameters
This function is set to revert if not overriden
function _modifyParameters(bytes32 _param, bytes memory _data) internal override;
_validateParameters
Internal function to be overriden with custom logic to validate parameters
function _validateParameters() internal view override;