PostSettlementSurplusAuctionHouse

Git Source

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

NameTypeDescription
_iduint256Id of the auction

Returns

NameTypeDescription
_auctionAuctionAuction data struct

params

Getter for the contract parameters struct

function params() external view returns (PostSettlementSAHParams memory _pssahParams);

Returns

NameTypeDescription
_pssahParamsPostSettlementSAHParamsThe contract parameters struct

constructor

constructor(
  address _safeEngine,
  address _protocolToken,
  PostSettlementSAHParams memory _pssahParams
) Authorizable(msg.sender) validParams;

Parameters

NameTypeDescription
_safeEngineaddressAddress of the SAFEEngine contract
_protocolTokenaddressAddress of the ProtocolToken contract
_pssahParamsPostSettlementSAHParamsInitial valid PostSettlementSAH parameters struct

startAuction

Start a new surplus auction

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

Parameters

NameTypeDescription
_amountToSelluint256Total amount of system coins to sell [rad]
_initialBiduint256Initial protocol token bid [wad]

Returns

NameTypeDescription
_iduint256ID of the started auction

restartAuction

Restart an auction if no bids were submitted for it

function restartAuction(uint256 _id) external;

Parameters

NameTypeDescription
_iduint256ID of the auction to restart

increaseBidSize

Submit a higher protocol token bid for the same amount of system coins

function increaseBidSize(uint256 _id, uint256 _amountToBuy, uint256 _bid) external;

Parameters

NameTypeDescription
_iduint256ID of the auction you want to submit the bid for
_amountToBuyuint256Amount of system coins to buy [rad]
_biduint256New bid submitted [wad]

settleAuction

Settle/finish an auction

function settleAuction(uint256 _id) external;

Parameters

NameTypeDescription
_iduint256ID 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;