PostSettlementSurplusAuctionHouse
Inherits: Authorizable, Modifiable, IPostSettlementSurplusAuctionHouse
This contract enables the sell of system coins in exchange for protocol tokens after Global Settlement is triggered
The reason to auction the post settlement surplus is to avoid incentives to trigger Global Settlement if the system has a surplus
State Variables
AUCTION_HOUSE_TYPE
bytes32 public constant AUCTION_HOUSE_TYPE = bytes32('SURPLUS');
_auctions
Raw data of an auction
mapping(uint256 => 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
PostSettlementSAHParams 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 (PostSettlementSAHParams memory _pssahParams);
Returns
Name | Type | Description |
---|---|---|
_pssahParams | PostSettlementSAHParams | The contract parameters struct |
constructor
constructor(
address _safeEngine,
address _protocolToken,
PostSettlementSAHParams memory _pssahParams
) Authorizable(msg.sender) validParams;
Parameters
Name | Type | Description |
---|---|---|
_safeEngine | address | Address of the SAFEEngine contract |
_protocolToken | address | Address of the ProtocolToken contract |
_pssahParams | PostSettlementSAHParams | Initial valid PostSettlementSAH parameters struct |
startAuction
Start a new surplus auction
function startAuction(uint256 _amountToSell, uint256 _initialBid) external isAuthorized 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;
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;
Parameters
Name | Type | Description |
---|---|---|
_id | uint256 | ID of the auction to settle |
_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;