ICollateralAuctionHouse
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 _auctionId) external view returns (Auction memory _auction);
Parameters
Name | Type | Description |
---|---|---|
_auctionId | uint256 | Id of the auction |
Returns
Name | Type | Description |
---|---|---|
_auction | Auction | Auction data struct |
_auctions
Unpacked data of an auction
function _auctions(uint256 _auctionId)
external
view
returns (
uint256 _amountToSell,
uint256 _amountToRaise,
uint256 _initialTimestamp,
address _forgoneCollateralReceiver,
address _auctionIncomeRecipient
);
Parameters
Name | Type | Description |
---|---|---|
_auctionId | uint256 | Id of the auction |
Returns
Name | Type | Description |
---|---|---|
_amountToSell | uint256 | How much collateral is sold in an auction [wad] |
_amountToRaise | uint256 | Total/max amount of coins to raise [rad] |
_initialTimestamp | uint256 | Time when the auction was created |
_forgoneCollateralReceiver | address | Who receives leftover collateral that is not sold in the auction (usually the liquidated SAFE) |
_auctionIncomeRecipient | address | Who receives the coins raised by the auction (usually the AccountingEngine) |
params
Getter for the contract parameters struct
function params() external view returns (CollateralAuctionHouseParams memory _cahParams);
Returns
Name | Type | Description |
---|---|---|
_cahParams | CollateralAuctionHouseParams | Auction house parameters struct |
_params
Getter for the unpacked contract parameters struct
function _params()
external
view
returns (uint256 _minimumBid, uint256 _minDiscount, uint256 _maxDiscount, uint256 _perSecondDiscountUpdateRate);
Returns
Name | Type | Description |
---|---|---|
_minimumBid | uint256 | Minimum acceptable bid [wad] |
_minDiscount | uint256 | Minimum discount at which collateral is being sold [wad %] |
_maxDiscount | uint256 | Maximum discount at which collateral is being sold [wad %] |
_perSecondDiscountUpdateRate | uint256 | Rate at which the discount will be updated in an auction [ray] |
safeEngine
Address of the SAFEEngine contract
function safeEngine() external view returns (ISAFEEngine _safeEngine);
liquidationEngine
Address of the LiquidationEngine contract
function liquidationEngine() external view returns (ILiquidationEngine _liquidationEngine);
oracleRelayer
Address of the OracleRelayer contract
function oracleRelayer() external view returns (IOracleRelayer _oracleRelayer);
collateralType
The collateral type of the auctions created by this contract
function collateralType() external view returns (bytes32 _cType);
Returns
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 representation of the collateral type |
auctionsStarted
Total amount of collateral auctions created
function auctionsStarted() external view returns (uint256 _auctionsStarted);
getAuctionDiscount
Calculates the current discount of an auction
function getAuctionDiscount(uint256 _id) external view returns (uint256 _auctionDiscount);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
Returns
Name | Type | Description |
---|---|---|
_auctionDiscount | uint256 | Current discount of the auction [wad %] |
getCollateralBought
Calculates the amount of collateral that will be bought with a given bid
function getCollateralBought(
uint256 _id,
uint256 _wad
) external view returns (uint256 _collateralBought, uint256 _adjustedBid);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_wad | uint256 | Bid amount [wad] |
Returns
Name | Type | Description |
---|---|---|
_collateralBought | uint256 | Amount of collateral that will be bought [wad] |
_adjustedBid | uint256 | Adjusted bid amount [wad] |
buyCollateral
Buys collateral from an auction
function buyCollateral(uint256 _id, uint256 _wad) external returns (uint256 _boughtCollateral, uint256 _adjustedBid);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_wad | uint256 | Bid amount [wad] |
Returns
Name | Type | Description |
---|---|---|
_boughtCollateral | uint256 | Amount of collateral that was bought [wad] |
_adjustedBid | uint256 | Adjusted bid amount [wad] |
startAuction
Starts a new collateral auction
function startAuction(
address _forgoneCollateralReceiver,
address _auctionIncomeRecipient,
uint256 _amountToRaise,
uint256 _collateralToSell
) external returns (uint256 _id);
Parameters
Name | Type | Description |
---|---|---|
_forgoneCollateralReceiver | address | Who receives leftover collateral that is not sold in the auction (usually the liquidated SAFE) |
_auctionIncomeRecipient | address | Who receives the coins raised by the auction (usually the AccountingEngine) |
_amountToRaise | uint256 | Total/max amount of coins to raise [rad] |
_collateralToSell | uint256 | How much collateral is sold in an auction [wad] |
Returns
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the started auction |
terminateAuctionPrematurely
Terminates an auction prematurely
Transfers collateral and coins to the authorized caller address
function terminateAuctionPrematurely(uint256 _auctionId) external;
Parameters
Name | Type | Description |
---|---|---|
_auctionId | 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
);
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 collateral is sold in an auction [wad] |
_amountToRaise | uint256 | Total/max amount of coins to raise [rad] |
BuyCollateral
Emitted when a bid is made in an auction
event BuyCollateral(
uint256 indexed _id, address _bidder, uint256 _blockTimestamp, uint256 _raisedAmount, uint256 _soldAmount
);
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 coins raised in the bid [rad] |
_soldAmount | uint256 | Amount of collateral sold in the bid [wad] |
SettleAuction
Emitted when an auction is settled
An auction is settled when either all collateral is sold or all coins are raised
event SettleAuction(
uint256 indexed _id, uint256 _blockTimestamp, address _leftoverReceiver, uint256 _leftoverCollateral
);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_blockTimestamp | uint256 | Time when the auction was settled |
_leftoverReceiver | address | Who receives leftover collateral that is not sold in the auction (usually the liquidated SAFE) |
_leftoverCollateral | uint256 | Amount of leftover collateral that is not sold in the auction [wad] |
TerminateAuctionPrematurely
Emitted when an auction is terminated prematurely
event TerminateAuctionPrematurely(
uint256 indexed _id, uint256 _blockTimestamp, address _leftoverReceiver, uint256 _leftoverCollateral
);
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | Id of the auction |
_blockTimestamp | uint256 | Time when the auction was terminated |
_leftoverReceiver | address | Who receives leftover collateral that is not sold in the auction (usually the liquidated SAFE) |
_leftoverCollateral | uint256 | Amount of leftover collateral that is not sold in the auction [wad] |
Errors
CAH_InvalidRedemptionPriceProvided
Throws when the redemption price is invalid
error CAH_InvalidRedemptionPriceProvided();
CAH_CollateralOracleInvalidValue
Throws when the collateral price is invalid
error CAH_CollateralOracleInvalidValue();
CAH_NoCollateralForSale
Throws when trying to start an auction without collateral to sell
error CAH_NoCollateralForSale();
CAH_NothingToRaise
Throws when trying to start an auction without coins to raise
error CAH_NothingToRaise();
CAH_DustyAuction
Throws when trying to start an auction with a dusty amount to raise
error CAH_DustyAuction();
CAH_InexistentAuction
Throws when trying to bid in a nonexistent auction
error CAH_InexistentAuction();
CAH_InvalidBid
Throws when trying to bid an invalid amount
error CAH_InvalidBid();
CAH_NullBoughtAmount
Throws when the resulting bid amount is null
error CAH_NullBoughtAmount();
CAH_InvalidLeftToRaise
Throws when the resulting bid leftover to raise is invalid
error CAH_InvalidLeftToRaise();
Structs
CollateralAuctionHouseParams
struct CollateralAuctionHouseParams {
uint256 minimumBid;
uint256 minDiscount;
uint256 maxDiscount;
uint256 perSecondDiscountUpdateRate;
}
Auction
struct Auction {
uint256 amountToSell;
uint256 amountToRaise;
uint256 initialTimestamp;
address forgoneCollateralReceiver;
address auctionIncomeRecipient;
}