AuctionConversions
Inherits: IAuctionConversions, AuctionImmutableArgs
Defines some helper conversion functions for dual auctions
Functions
toAskTokenId
Transforms a price into an ask token id
ask token ids are just the price, with the top bit equal to 1
function toAskTokenId(uint256 price) public pure returns (uint256);
toBidTokenId
Transforms a price into a bid token id
bid token ids are just the price, with the top bit equal to 0
function toBidTokenId(uint256 price) public pure returns (uint256);
isBidTokenId
Checks if tokenId is a bid token id
function isBidTokenId(uint256 tokenId) public pure returns (bool);
toPrice
Transforms a tokenId into a normal price
function toPrice(uint256 tokenId) public pure returns (uint256);
askToBid
helper to translate ask tokens to bid tokens at a given price
function askToBid(uint256 askTokens, uint256 price) public pure returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
askTokens | uint256 | The number of ask tokens to calculate |
price | uint256 | The price, denominated in bidAssetDecimals |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The equivalent value of bid tokens |
bidToAsk
helper to translate bid tokens to ask tokens at a given price
function bidToAsk(uint256 bidTokens, uint256 price) public pure returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
bidTokens | uint256 | The number of bid tokens to calculate |
price | uint256 | The price, denominated in bidAssetDecimals |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The equivalent value of ask tokens |
max
determine the max of two numbers
function max(uint256 a, uint256 b) internal pure returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
a | uint256 | the first number |
b | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | the maximum of the two numbers |
min
determine the min of two numbers
function min(uint256 a, uint256 b) internal pure returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
a | uint256 | the first number |
b | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | the minimum of the two numbers |