-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathILiquidityOracle.sol
35 lines (32 loc) · 1.84 KB
/
ILiquidityOracle.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;
import "./IUpdateable.sol";
import "./IQuoteToken.sol";
/**
* @title ILiquidityOracle
* @notice An interface that defines a liquidity oracle with a single quote token (or currency) and many exchange
* tokens.
*/
abstract contract ILiquidityOracle is IUpdateable, IQuoteToken {
/// @notice Gets the liquidity levels of the token and the quote token in the underlying pool.
/// @param token The token to get liquidity levels of (along with the quote token).
/// @return tokenLiquidity The amount of the token that is liquid in the underlying pool, in wei.
/// @return quoteTokenLiquidity The amount of the quote token that is liquid in the underlying pool, in wei.
function consultLiquidity(
address token
) public view virtual returns (uint112 tokenLiquidity, uint112 quoteTokenLiquidity);
/**
* @notice Gets the liquidity levels of the token and the quote token in the underlying pool, reverting if the
* quotation is older than the maximum allowable age.
* @dev Using maxAge of 0 can be gas costly and the returned data is easier to manipulate.
* @param token The token to get liquidity levels of (along with the quote token).
* @param maxAge The maximum age of the quotation, in seconds. If 0, the function gets the instant rates as of the
* latest block, straight from the source. WARNING: Using a maxAge of 0 is expensive and is generally insecure.
* @return tokenLiquidity The amount of the token that is liquid in the underlying pool, in wei.
* @return quoteTokenLiquidity The amount of the quote token that is liquid in the underlying pool, in wei.
*/
function consultLiquidity(
address token,
uint256 maxAge
) public view virtual returns (uint112 tokenLiquidity, uint112 quoteTokenLiquidity);
}