IDualAuction
Inherits: IAuctionConversions
Functions
maxBid
The highest bid received so far
function maxBid() external view returns (uint256);
minAsk
The lowest ask received so far
function minAsk() external view returns (uint256);
clearingPrice
The clearing price of the auction, set after settlement
function clearingPrice() external view returns (uint256);
settled
True if the auction has been settled, eles false
function settled() external view returns (bool);
bid
Places a bid using amountIn bidAsset tokens, for askAsset tokens at the given price
function bid(uint256 amountIn, uint256 price) external returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
amountIn | uint256 | The amount to bid, in bidAsset |
price | uint256 | the price at which to bid, denominated in terms of bidAsset per askAsset |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The number of shares output |
ask
Places an ask using amountIn askAsset tokens, for bidAsset tokens at the given price
function ask(uint256 amountIn, uint256 price) external returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
amountIn | uint256 | The amount to sell, in askAsset |
price | uint256 | the price at which to ask, denominated in terms of bidAsset per askAsset |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The number of shares output |
settle
Settles the auction after the end date
iterates through the bids and asks to determine The clearing price, setting the clearingPrice variable afterwards
function settle() external returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The settled clearing price, or 0 if none |
redeem
Redeems bid/ask slips after the auction has concluded
function redeem(uint256 tokenId, uint256 amount) external returns (uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The id of the bid/ask slip to redeem |
amount | uint256 | The amount of slips to redeem |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The number of tokens received |
<none> | uint256 |
Events
Bid
Event declaring that a bid was made
event Bid(address indexed actor, uint256 amountIn, uint256 amountOut, uint256 indexed price);
Ask
Event declaring that an ask was made
event Ask(address indexed actor, uint256 amountIn, uint256 amountOut, uint256 indexed price);
Settle
Event notifying about the settlement of an auction
event Settle(address indexed actor, uint256 clearingPrice);
Redeem
Event notifying about the redemption of share tokens
event Redeem(address indexed actor, uint256 indexed tokenId, uint256 shareAmount, uint256 bidValue, uint256 askValue);
Errors
ZeroAddressAsset
Zero address given for asset
error ZeroAddressAsset();
MatchingAssets
Matching buy/sell assets
error MatchingAssets();
ZeroAmount
Zero amount of asset given
error ZeroAmount();
AuctionIsActive
The end date has not yet passed
error AuctionIsActive();
AuctionHasEnded
The end date has passed
error AuctionHasEnded();
AuctionHasNotSettled
The auction has not been settled
error AuctionHasNotSettled();
AuctionHasSettled
The auction has already been settled
error AuctionHasSettled();
NoClearingPrice
The auction ended with no clearing price
error NoClearingPrice();
SettleHasFailed
The settlement somehow ended with cleared tokens but no clearing price
error SettleHasFailed();