-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v3.0.0-beta.1'
- Loading branch information
Showing
21 changed files
with
3,028 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
contracts/interfaces/IHistoricalLiquidityAccumulationOracle.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity >=0.5.0 <0.9.0; | ||
|
||
import "../libraries/AccumulationLibrary.sol"; | ||
|
||
/** | ||
* @title IHistoricalLiquidityAccumulationOracle | ||
* @notice An interface that defines an oracle contract that stores historical liquidity accumulations. | ||
*/ | ||
interface IHistoricalLiquidityAccumulationOracle { | ||
/// @notice Gets a liquidity accumulation for a token at a specific index. | ||
/// @param token The address of the token to get the accumulation for. | ||
/// @param index The index of the accumulation to get, where index 0 contains the latest accumulation, and the last | ||
/// index contains the oldest accumulation (uses reverse chronological ordering). | ||
/// @return The accumulation for the token at the specified index. | ||
function getLiquidityAccumulationAt( | ||
address token, | ||
uint256 index | ||
) external view returns (AccumulationLibrary.LiquidityAccumulator memory); | ||
|
||
/// @notice Gets the latest liquidity accumulations for a token. | ||
/// @param token The address of the token to get the accumulations for. | ||
/// @param amount The number of accumulations to get. | ||
/// @return The latest accumulations for the token, in reverse chronological order, from newest to oldest. | ||
function getLiquidityAccumulations( | ||
address token, | ||
uint256 amount | ||
) external view returns (AccumulationLibrary.LiquidityAccumulator[] memory); | ||
|
||
/// @notice Gets the latest liquidity accumulations for a token. | ||
/// @param token The address of the token to get the accumulations for. | ||
/// @param amount The number of accumulations to get. | ||
/// @param offset The index of the first accumulations to get (default: 0). | ||
/// @param increment The increment between accumulations to get (default: 1). | ||
/// @return The latest accumulations for the token, in reverse chronological order, from newest to oldest. | ||
function getLiquidityAccumulations( | ||
address token, | ||
uint256 amount, | ||
uint256 offset, | ||
uint256 increment | ||
) external view returns (AccumulationLibrary.LiquidityAccumulator[] memory); | ||
|
||
/// @notice Gets the number of liquidity accumulations for a token. | ||
/// @param token The address of the token to get the number of accumulations for. | ||
/// @return count The number of accumulations for the token. | ||
function getLiquidityAccumulationsCount(address token) external view returns (uint256); | ||
|
||
/// @notice Gets the capacity of liquidity accumulations for a token. | ||
/// @param token The address of the token to get the capacity of accumulations for. | ||
/// @return capacity The capacity of accumulations for the token. | ||
function getLiquidityAccumulationsCapacity(address token) external view returns (uint256); | ||
|
||
/// @notice Sets the capacity of liquidity accumulations for a token. | ||
/// @param token The address of the token to set the capacity of accumulations for. | ||
/// @param amount The new capacity of accumulations for the token. | ||
function setLiquidityAccumulationsCapacity(address token, uint256 amount) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity >=0.5.0 <0.9.0; | ||
|
||
import "../libraries/ObservationLibrary.sol"; | ||
|
||
/** | ||
* @title IHistoricalOracle | ||
* @notice An interface that defines an oracle contract that stores historical observations. | ||
*/ | ||
interface IHistoricalOracle { | ||
/// @notice Gets an observation for a token at a specific index. | ||
/// @param token The address of the token to get the observation for. | ||
/// @param index The index of the observation to get, where index 0 contains the latest observation, and the last | ||
/// index contains the oldest observation (uses reverse chronological ordering). | ||
/// @return observation The observation for the token at the specified index. | ||
function getObservationAt( | ||
address token, | ||
uint256 index | ||
) external view returns (ObservationLibrary.Observation memory); | ||
|
||
/// @notice Gets the latest observations for a token. | ||
/// @param token The address of the token to get the observations for. | ||
/// @param amount The number of observations to get. | ||
/// @return observations The latest observations for the token, in reverse chronological order, from newest to oldest. | ||
function getObservations( | ||
address token, | ||
uint256 amount | ||
) external view returns (ObservationLibrary.Observation[] memory); | ||
|
||
/// @notice Gets the latest observations for a token. | ||
/// @param token The address of the token to get the observations for. | ||
/// @param amount The number of observations to get. | ||
/// @param offset The index of the first observation to get (default: 0). | ||
/// @param increment The increment between observations to get (default: 1). | ||
/// @return observations The latest observations for the token, in reverse chronological order, from newest to oldest. | ||
function getObservations( | ||
address token, | ||
uint256 amount, | ||
uint256 offset, | ||
uint256 increment | ||
) external view returns (ObservationLibrary.Observation[] memory); | ||
|
||
/// @notice Gets the number of observations for a token. | ||
/// @param token The address of the token to get the number of observations for. | ||
/// @return count The number of observations for the token. | ||
function getObservationsCount(address token) external view returns (uint256); | ||
|
||
/// @notice Gets the capacity of observations for a token. | ||
/// @param token The address of the token to get the capacity of observations for. | ||
/// @return capacity The capacity of observations for the token. | ||
function getObservationsCapacity(address token) external view returns (uint256); | ||
|
||
/// @notice Sets the capacity of observations for a token. | ||
/// @param token The address of the token to set the capacity of observations for. | ||
/// @param amount The new capacity of observations for the token. | ||
function setObservationsCapacity(address token, uint256 amount) external; | ||
} |
57 changes: 57 additions & 0 deletions
57
contracts/interfaces/IHistoricalPriceAccumulationOracle.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity >=0.5.0 <0.9.0; | ||
|
||
import "../libraries/AccumulationLibrary.sol"; | ||
|
||
/** | ||
* @title IHistoricalPriceAccumulationOracle | ||
* @notice An interface that defines an oracle contract that stores historical price accumulations. | ||
*/ | ||
interface IHistoricalPriceAccumulationOracle { | ||
/// @notice Gets a price accumulation for a token at a specific index. | ||
/// @param token The address of the token to get the accumulation for. | ||
/// @param index The index of the accumulation to get, where index 0 contains the latest accumulation, and the last | ||
/// index contains the oldest accumulation (uses reverse chronological ordering). | ||
/// @return The accumulation for the token at the specified index. | ||
function getPriceAccumulationAt( | ||
address token, | ||
uint256 index | ||
) external view returns (AccumulationLibrary.PriceAccumulator memory); | ||
|
||
/// @notice Gets the latest price accumulations for a token. | ||
/// @param token The address of the token to get the accumulations for. | ||
/// @param amount The number of accumulations to get. | ||
/// @return The latest accumulations for the token, in reverse chronological order, from newest to oldest. | ||
function getPriceAccumulations( | ||
address token, | ||
uint256 amount | ||
) external view returns (AccumulationLibrary.PriceAccumulator[] memory); | ||
|
||
/// @notice Gets the latest price accumulations for a token. | ||
/// @param token The address of the token to get the accumulations for. | ||
/// @param amount The number of accumulations to get. | ||
/// @param offset The index of the first accumulations to get (default: 0). | ||
/// @param increment The increment between accumulations to get (default: 1). | ||
/// @return The latest accumulations for the token, in reverse chronological order, from newest to oldest. | ||
function getPriceAccumulations( | ||
address token, | ||
uint256 amount, | ||
uint256 offset, | ||
uint256 increment | ||
) external view returns (AccumulationLibrary.PriceAccumulator[] memory); | ||
|
||
/// @notice Gets the number of price accumulations for a token. | ||
/// @param token The address of the token to get the number of accumulations for. | ||
/// @return count The number of accumulations for the token. | ||
function getPriceAccumulationsCount(address token) external view returns (uint256); | ||
|
||
/// @notice Gets the capacity of price accumulations for a token. | ||
/// @param token The address of the token to get the capacity of accumulations for. | ||
/// @return capacity The capacity of accumulations for the token. | ||
function getPriceAccumulationsCapacity(address token) external view returns (uint256); | ||
|
||
/// @notice Sets the capacity of price accumulations for a token. | ||
/// @param token The address of the token to set the capacity of accumulations for. | ||
/// @param amount The new capacity of accumulations for the token. | ||
function setPriceAccumulationsCapacity(address token, uint256 amount) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.