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
Returns current capacity of a market
Parameters
id_
uint256
Market ID
Returns
capacity
uint256
Current capacity of the market
findMarketFor
Returns the market ID with the highest current payoutToken payout for depositing quoteToken
Parameters
payout_
address
Address of payout token
quote_
address
Address of quote token
amountIn_
uint256
Amount of quote tokens to deposit
minAmountOut_
uint256
Minimum amount of payout tokens to receive as payout
maxExpiry_
uint256
Latest acceptable vesting timestamp for bond Inputting the zero address will take into account just the protocol fee.
Returns
id_
uint256
Market ID
getAuctioneer
Get the auctioneer for the provided market ID
Parameters
id_
uint256
Market ID
Returns
auctioneer
contract IBondAuctioneer
Address of the auctioneer that provides the market
getTeller
Returns the Teller that services the market ID
Parameters
id_
uint256
Market ID
Returns
teller
contract IBondTeller
Address of the teller that services the market
isInstantSwap
Does market send payout immediately
Parameters
id_
uint256
Market ID to search for
Returns
isInstant
bool
Whether the market is instant swap (true) or has vesting of the payout (false)
isLive
Is a given market accepting purchases
Parameters
id_
uint256
ID of market
Returns
isLive
bool
Whether the market is accepting purchases
liveMarketsBetween
Returns array of active market IDs within a range
Should be used if length exceeds max to query entire array
Parameters
firstIndex_
uint256
Start index of market range
lastIndex_
uint256
End index of market range
Returns
ids
uint256[]
IDs of markets
liveMarketsBy
Returns an array of all active market IDs for a given owner
Parameters
owner_
address
Address of owner to query by
Returns
ids
uint256[]
IDs of markets
liveMarketsFor
Returns an array of all active market IDs for a given quote token
Parameters
token_
address
Address of token to query by
isPayout_
bool
If true, search by payout token, else search for quote token
Returns
ids
uint256[]
IDs of markets
marketCounter
Counter for bond markets on approved auctioneers
Returns
nextId
uint256
Next market ID to be assigned
marketPrice
Calculate current market price of payout token in quote tokens
Accounts for debt and control variable decay since last deposit (vs _marketPrice())
Parameters
id_
uint256
ID of market
Returns
price
uint256
Price for market (see the specific auctioneer for units)
marketScale
Scale value to use when converting between quote token and payout token amounts with marketPrice()
Parameters
id_
uint256
ID of market
Returns
scale
uint256
Scaling factor for market in configured decimals (see auctioneer for units)
marketsFor
Returns an array of all active market IDs for a given payout and quote token
Parameters
payout_
address
Address of payout token
quote_
address
Address of quote token
Returns
ids
uint256[]
IDs of markets
marketsForPayout
Market IDs for payout token
Parameters
payoutToken_
address
Address of payout token
Returns
ids
uint256
IDs of markets
marketsForQuote
Market IDs for quote token
Parameters
quoteToken_
address
Address of quote token
Returns
ids
uint256
IDs of markets
marketsToAuctioneers
Auctioneer for Market ID
Parameters
id_
uint256
ID of market
Returns
auctioneer
contract IBondAuctioneer
Auctioneer that provides market
maxAmountAccepted
Returns maximum amount of quote token accepted by the market
Parameters
id_
uint256
ID of market
referrer_
address
Address of referrer, used to get fees to calculate accurate payout amount. Inputting the zero address will take into account just the protocol fee.
Returns
amountIn
uint256
Max amount of quote token that can currently be exchanged with the market
payoutFor
Payout due for amount of quote tokens
Accounts for debt and control variable decay so it is up to date
Parameters
amount_
uint256
Amount of quote tokens to spend
id_
uint256
ID of market
referrer_
address
Address of referrer, used to get fees to calculate accurate payout amount. Inputting the zero address will take into account just the protocol fee.
Returns
payout
uint256
amount of payout tokens to be paid
registerAuctioneer
Register a auctioneer with the aggregatorOnly Guardian
A auctioneer must be registered with an aggregator to create markets
Parameters
auctioneer_
contract IBondAuctioneer
Address of the Auctioneer to register
registerMarket
Register a new market with the aggregatorOnly registered depositories
Parameters
payoutToken_
contract ERC20
Token to be paid out by the market
quoteToken_
contract ERC20
Token to be accepted by the market
Returns
marketId
uint256
ID of market
Errors
Aggregator_OnlyAuctioneer
Last updated