IDebtAuctionHouse

Git Source

Inherits: IAuthorizable, IModifiable, IDisableable

Functions

AUCTION_HOUSE_TYPE

Type of the auction house

function AUCTION_HOUSE_TYPE() external view returns (bytes32 _auctionHouseType);

Returns

NameTypeDescription
_auctionHouseTypebytes32Bytes32 representation of the auction house type

auctions

Data of an auction

function auctions(uint256 _id) external view returns (Auction memory _auction);

Parameters

NameTypeDescription
_iduint256Id of the auction

Returns

NameTypeDescription
_auctionAuctionAuction 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

NameTypeDescription
_iduint256Id of the auction

Returns

NameTypeDescription
_bidAmountuint256How much protocol tokens are to be minted [wad]
_amountToSelluint256How many system coins are raised [rad]
_highBidderaddressAddress of the highest bidder
_bidExpiryuint256Time when the latest bid expires and the auction can be settled
_auctionDeadlineuint256Time 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

NameTypeDescription
_dahParamsDebtAuctionHouseParamsAuction 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

NameTypeDescription
_bidDecreaseuint256Minimum bid increase compared to the last bid in order to take the new one in consideration [wad %]
_amountSoldIncreaseuint256Increase in protocol tokens sold in case an auction is restarted [wad %]
_bidDurationuint256How long the auction lasts after a new bid is submitted [seconds]
_totalAuctionLengthuint256Total length of the auction [seconds]

startAuction

Start a new debt auction

function startAuction(
  address _incomeReceiver,
  uint256 _amountToSell,
  uint256 _initialBid
) external returns (uint256 _id);

Parameters

NameTypeDescription
_incomeReceiveraddressWho receives the auction proceeds
_amountToSelluint256Initial amount of protocol tokens to be minted [wad]
_initialBiduint256Amount of debt to be sold [rad]

Returns

NameTypeDescription
_iduint256Id 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

NameTypeDescription
_iduint256Id 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, uint256 _bid) external;

Parameters

NameTypeDescription
_iduint256ID of the auction for which you want to submit a new bid
_amountToBuyuint256Amount of protocol tokens to buy (must be smaller than the previous proposed amount) [wad]
_biduint256New system coin bid (must always equal the total amount raised by the auction) [rad]

settleAuction

Settle an auction

Can only be called after the auction expired with a winning bid

function settleAuction(uint256 _id) external;

Parameters

NameTypeDescription
_iduint256Id 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

NameTypeDescription
_iduint256Id 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
);

RestartAuction

Emitted when an auction is restarted

event RestartAuction(uint256 indexed _id, uint256 _blockTimestamp, uint256 _auctionDeadline);

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
);

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);

TerminateAuctionPrematurely

Emitted when an auction is terminated prematurely

event TerminateAuctionPrematurely(
  uint256 indexed _id, uint256 _blockTimestamp, address _highBidder, uint256 _raisedAmount
);

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;
}