SurplusAuctionHouse
Inherits: Authorizable, Modifiable, Disableable, ISurplusAuctionHouse
This contract enables the sell of system coins in exchange for protocol tokens
A percentage of the protocol tokens raised in the auction are sent to a receiver, the rest is burnt
State Variables
AUCTION_HOUSE_TYPE
Type of the auction house
bytes32 public constant AUCTION_HOUSE_TYPE = bytes32('SURPLUS');
_auctions
Raw data of an auction
mapping(uint256 _auctionId => Auction) public _auctions;
auctionsStarted
Total amount of surplus auctions created
uint256 public auctionsStarted;
safeEngine
Address of the SAFEEngine contract
ISAFEEngine public safeEngine;
protocolToken
Address of the ProtocolToken contract
IProtocolToken public protocolToken;
_params
Getter for the unpacked contract parameters struct
SurplusAuctionHouseParams 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 (SurplusAuctionHouseParams memory _sahParams);
Returns
Name | Type | Description |
---|---|---|
_sahParams | SurplusAuctionHouseParams | Auction house parameters struct |
constructor
constructor(
address _safeEngine,
address _protocolToken,
SurplusAuctionHouseParams memory _sahParams
) Authorizable(msg.sender) validParams;
Parameters
Name | Type | Description |
---|---|---|
_safeEngine | address | Address of the SAFEEngine contract |
_protocolToken | address | Address of the protocol governance token |
_sahParams | SurplusAuctionHouseParams | Initial valid SurplusAuctionHouse parameters struct |
_onContractDisable
Internal virtual method to be called when the contract is disabled
Transfer all system coins back to the caller's address (usually the AccountingEngine)
function _onContractDisable() internal override;
startAuction
Start a new surplus auction
function startAuction(
uint256 _amountToSell,
uint256 _initialBid
) external isAuthorized whenEnabled returns (uint256 _id);
Parameters
Name | Type | Description |
---|---|---|
_amountToSell | uint256 | Total amount of system coins to sell [rad] |
_initialBid | uint256 | Initial protocol token bid [wad] |
Returns
Name | Type | Description |
---|---|---|
_id | uint256 | ID of the started auction |
restartAuction
Restart an auction if no bids were submitted for it
function restartAuction(uint256 _id) external;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | ID of the auction to restart |
increaseBidSize
Submit a higher protocol token bid for the same amount of system coins
function increaseBidSize(uint256 _id, uint256 _bid) external whenEnabled;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | ID of the auction you want to submit the bid for |
_bid | uint256 | New bid submitted [wad] |
settleAuction
Settle/finish an auction
function settleAuction(uint256 _id) external whenEnabled;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | ID of the auction to settle |
terminateAuctionPrematurely
Terminate an auction prematurely.
function terminateAuctionPrematurely(uint256 _id) external whenDisabled;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | ID of the auction to settle/terminate |
_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;