Skip to main content

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

NameTypeDescription
askTokensuint256The number of ask tokens to calculate
priceuint256The price, denominated in bidAssetDecimals

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
bidTokensuint256The number of bid tokens to calculate
priceuint256The price, denominated in bidAssetDecimals

Returns

NameTypeDescription
<none>uint256The equivalent value of ask tokens

max

determine the max of two numbers

function max(uint256 a, uint256 b) internal pure returns (uint256);

Parameters

NameTypeDescription
auint256the first number
buint256

Returns

NameTypeDescription
<none>uint256the maximum of the two numbers

min

determine the min of two numbers

function min(uint256 a, uint256 b) internal pure returns (uint256);

Parameters

NameTypeDescription
auint256the first number
buint256

Returns

NameTypeDescription
<none>uint256the minimum of the two numbers