Skip to main content

IBondAggregator

Git Source

Functions​

registerAuctioneer​

Register a auctioneer with the aggregator

Only Guardian

A auctioneer must be registered with an aggregator to create markets

function registerAuctioneer(IBondAuctioneer auctioneer_) external;

Parameters

NameTypeDescription
auctioneer_IBondAuctioneerAddress of the Auctioneer to register

registerMarket​

Register a new market with the aggregator

Only registered depositories

function registerMarket(ERC20 payoutToken_, ERC20 quoteToken_) external returns (uint256 marketId);

Parameters

NameTypeDescription
payoutToken_ERC20Token to be paid out by the market
quoteToken_ERC20Token to be accepted by the market

getAuctioneer​

Get the auctioneer for the provided market ID

function getAuctioneer(uint256 id_) external view returns (IBondAuctioneer);

Parameters

NameTypeDescription
id_uint256ID of Market

marketPrice​

Calculate current market price of payout token in quote tokens

Accounts for debt and control variable decay since last deposit (vs _marketPrice())

function marketPrice(uint256 id_) external view returns (uint256);

Parameters

NameTypeDescription
id_uint256ID of market

Returns

NameTypeDescription
<none>uint256Price for market (see the specific auctioneer for units)

marketScale​

Scale value to use when converting between quote token and payout token amounts with marketPrice()

function marketScale(uint256 id_) external view returns (uint256);

Parameters

NameTypeDescription
id_uint256ID of market

Returns

NameTypeDescription
<none>uint256Scaling factor for market in configured decimals

payoutFor​

Payout due for amount of quote tokens

Accounts for debt and control variable decay so it is up to date

function payoutFor(uint256 amount_, uint256 id_, address referrer_) external view returns (uint256);

Parameters

NameTypeDescription
amount_uint256Amount of quote tokens to spend
id_uint256ID of market
referrer_addressAddress of referrer, used to get fees to calculate accurate payout amount. Inputting the zero address will take into account just the protocol fee.

Returns

NameTypeDescription
<none>uint256amount of payout tokens to be paid

maxAmountAccepted​

Returns maximum amount of quote token accepted by the market

function maxAmountAccepted(uint256 id_, address referrer_) external view returns (uint256);

Parameters

NameTypeDescription
id_uint256ID of market
referrer_addressAddress of referrer, used to get fees to calculate accurate payout amount. Inputting the zero address will take into account just the protocol fee.

isInstantSwap​

Does market send payout immediately

function isInstantSwap(uint256 id_) external view returns (bool);

Parameters

NameTypeDescription
id_uint256Market ID to search for

isLive​

Is a given market accepting deposits

function isLive(uint256 id_) external view returns (bool);

Parameters

NameTypeDescription
id_uint256ID of market

liveMarketsBetween​

Returns array of active market IDs within a range

Should be used if length exceeds max to query entire array

function liveMarketsBetween(uint256 firstIndex_, uint256 lastIndex_) external view returns (uint256[] memory);

liveMarketsFor​

Returns an array of all active market IDs for a given quote token

function liveMarketsFor(address token_, bool isPayout_) external view returns (uint256[] memory);

Parameters

NameTypeDescription
token_addressAddress of token to query by
isPayout_boolIf true, search by payout token, else search for quote token

liveMarketsBy​

Returns an array of all active market IDs for a given owner

function liveMarketsBy(address owner_, uint256 firstIndex_, uint256 lastIndex_)
external
view
returns (uint256[] memory);

Parameters

NameTypeDescription
owner_addressAddress of owner to query by
firstIndex_uint256Market ID to start at
lastIndex_uint256Market ID to end at (non-inclusive)

marketsFor​

Returns an array of all active market IDs for a given payout and quote token

function marketsFor(address payout_, address quote_) external view returns (uint256[] memory);

Parameters

NameTypeDescription
payout_addressAddress of payout token
quote_addressAddress of quote token

findMarketFor​

Returns the market ID with the highest current payoutToken payout for depositing quoteToken

function findMarketFor(
address payout_,
address quote_,
uint256 amountIn_,
uint256 minAmountOut_,
uint256 maxExpiry_
) external view returns (uint256 id);

Parameters

NameTypeDescription
payout_addressAddress of payout token
quote_addressAddress of quote token
amountIn_uint256Amount of quote tokens to deposit
minAmountOut_uint256Minimum amount of payout tokens to receive as payout
maxExpiry_uint256Latest acceptable vesting timestamp for bond Inputting the zero address will take into account just the protocol fee.

getTeller​

Returns the Teller that services the market ID

function getTeller(uint256 id_) external view returns (IBondTeller);

currentCapacity​

Returns current capacity of a market

function currentCapacity(uint256 id_) external view returns (uint256);