OracleSlippage
Functions
getBlockStartingAndCurrentTick
Returns the tick as of the beginning of the current block, and as of right now, for the given pool.
getPoolAddress
Virtual function to get pool addresses that can be overridden in tests.
getSyntheticTicks
Returns the synthetic time-weighted average tick as of secondsAgo, as well as the current tick, for the given path. Returned synthetic ticks always represent tokenOut/tokenIn prices, meaning lower ticks are worse.
toInt24
Cast a int256 to a int24, revert on overflow or underflow
getSyntheticTicks
For each passed path, fetches the synthetic time-weighted average tick as of secondsAgo, as well as the current tick. Then, synthetic ticks from all paths are subjected to a weighted average, where the weights are the fraction of the total input amount allocated to each path. Returned synthetic ticks always represent tokenOut/tokenIn prices, meaning lower ticks are worse. Paths must all start and end in the same token.
checkOracleSlippage
Ensures that the current (synthetic) tick over the path is no worse than maximumTickDivergence
ticks away from the average as of secondsAgo
Parameters
Name | Type | Description |
---|---|---|
|
| The path to fetch prices over |
|
| The maximum number of ticks that the price can degrade by |
|
| The number of seconds ago to compute oracle prices against |
checkOracleSlippage
Ensures that the current (synthetic) tick over the path is no worse than maximumTickDivergence
ticks away from the average as of secondsAgo
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| The maximum number of ticks that the price can degrade by |
|
| The number of seconds ago to compute oracle prices against |
Last updated