Aggregator Contract

The Aggregator Contract implements the functions required in the Aggregator Interface.

Additionally, it implements state variables for the management of markets across multiple Auctioneers, tracking whitelisted Auctioneers.

The Aggregator contract keeps a unique set of market IDs across multiple Tellers and Auctioneers. Additionally, it aggregates market data from multiple Auctioneers in convenient view functions for front-end interfaces.

Methods

currentCapacity

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

Returns current capacity of a market

Parameters

Returns

findMarketFor

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

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

Parameters

Returns

getAuctioneer

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

Get the auctioneer for the provided market ID

Parameters

Returns

getTeller

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

Returns the Teller that services the market ID

Parameters

Returns

isInstantSwap

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

Does market send payout immediately

Parameters

Returns

isLive

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

Is a given market accepting purchases

Parameters

Returns

liveMarketsBetween

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

Returns array of active market IDs within a range

Should be used if length exceeds max to query entire array

Parameters

Returns

liveMarketsBy

function liveMarketsBy(address owner_) external view returns (uint256[])

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

Parameters

Returns

liveMarketsFor

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

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

Parameters

Returns

marketCounter

function marketCounter() external view returns (uint256)

Counter for bond markets on approved auctioneers

Returns

marketPrice

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

Calculate current market price of payout token in quote tokens

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

Parameters

Returns

marketScale

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

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

Parameters

Returns

marketsFor

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

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

Parameters

Returns

marketsForPayout

function marketsForPayout(address, uint256) external view returns (uint256)

Market IDs for payout token

Parameters

Returns

marketsForQuote

function marketsForQuote(address) external view returns (uint256)

Market IDs for quote token

Parameters

Returns

marketsToAuctioneers

function marketsToAuctioneers(uint256) external view returns (contract IBondAuctioneer)

Auctioneer for Market ID

Parameters

Returns

maxAmountAccepted

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

Returns maximum amount of quote token accepted by the market

Parameters

Returns

payoutFor

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

Payout due for amount of quote tokens

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

Parameters

Returns

registerAuctioneer

function registerAuctioneer(contract IBondAuctioneer auctioneer_) external nonpayable

Register a auctioneer with the aggregatorOnly Guardian

A auctioneer must be registered with an aggregator to create markets

Parameters

registerMarket

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

Register a new market with the aggregatorOnly registered depositories

Parameters

Returns

Errors

Aggregator_OnlyAuctioneer

error Aggregator_OnlyAuctioneer()

Last updated