ICommonSurplusAuctionHouse

Git Source

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

Raw 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 many system coins are offered for the protocol tokens [rad]
_amountToSelluint256How protocol tokens are sold to buy the surplus system coins [wad]
_highBidderaddressWho the high bidder is
_bidExpiryuint256When the latest bid expires and the auction can be settled [timestamp]
_auctionDeadlineuint256Hard deadline for the auction after which no more bids can be placed [timestamp]

auctionsStarted

Total amount of surplus auctions created

function auctionsStarted() external view returns (uint256 _auctionsStarted);

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

startAuction

Start a new surplus auction

function startAuction(uint256 _amountToSell, uint256 _initialBid) external 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 _bid) external;

Parameters

NameTypeDescription
_iduint256ID of the auction you want to submit the bid for
_biduint256New bid submitted [wad]

settleAuction

Settle/finish an auction

function settleAuction(uint256 _id) external;

Parameters

NameTypeDescription
_iduint256ID of the auction to settle

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

Parameters

NameTypeDescription
_iduint256Id of the auction
_auctioneeraddressAddress who started the auction
_blockTimestampuint256Time when the auction was started
_amountToSelluint256How many protocol tokens are initially bidded [wad]
_amountToRaiseuint256Amount of system coins to raise [rad]
_auctionDeadlineuint256Time when the auction expires

RestartAuction

Emitted when an auction is restarted

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

Parameters

NameTypeDescription
_iduint256Id of the auction
_blockTimestampuint256Time when the auction was restarted
_auctionDeadlineuint256New time when the auction expires

IncreaseBidSize

Emitted when a bid is made in an auction

event IncreaseBidSize(
  uint256 indexed _id,
  address _bidder,
  uint256 _blockTimestamp,
  uint256 _raisedAmount,
  uint256 _soldAmount,
  uint256 _bidExpiry
);

Parameters

NameTypeDescription
_iduint256Id of the auction
_bidderaddressWho made the bid
_blockTimestampuint256Time when the bid was made
_raisedAmountuint256Amount of system coins raised in the bid [rad]
_soldAmountuint256Amount of protocol tokens offered to buy in the bid [wad]
_bidExpiryuint256Time when the bid expires

SettleAuction

Emitted when an auction is settled

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

Parameters

NameTypeDescription
_iduint256Id of the auction
_blockTimestampuint256Time when the auction was settled
_highBidderaddressWho won the auction
_raisedAmountuint256Amount of system coins raised in the auction [rad]

Errors

SAH_AuctionNeverStarted

Throws when trying to bid in an auction that hasn't started yet

error SAH_AuctionNeverStarted();

SAH_AuctionNotFinished

Throws when trying to settle an auction that hasn't finished yet

error SAH_AuctionNotFinished();

SAH_AuctionAlreadyExpired

Throws when trying to bid in an auction that has already expired

error SAH_AuctionAlreadyExpired();

SAH_BidAlreadyExpired

Throws when trying to bid in an auction that has an expired bid

error SAH_BidAlreadyExpired();

SAH_BidAlreadyPlaced

Throws when trying to restart an auction that has an active bid

error SAH_BidAlreadyPlaced();

SAH_AmountsNotMatching

Throws when trying to place a bid that differs from the amount to raise

error SAH_AmountsNotMatching();

SAH_BidNotHigher

Throws when trying to place a bid that is not higher than the previous one

error SAH_BidNotHigher();

SAH_InsufficientIncrease

Throws when trying to place a bid that is not higher than the previous one by the minimum increase

error SAH_InsufficientIncrease();

SAH_HighBidderNotSet

Throws when trying to prematurely terminate an auction that has no bids

error SAH_HighBidderNotSet();

Structs

Auction

struct Auction {
  uint256 bidAmount;
  uint256 amountToSell;
  address highBidder;
  uint256 bidExpiry;
  uint256 auctionDeadline;
}