github.com/status-im/status-go@v1.1.0/contracts/uniswapV3/interfaces/pool/IUniswapV3PoolDerivedState.sol (about) 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 pragma solidity >=0.5.0; 3 4 /// @title Pool state that is not stored 5 /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the 6 /// blockchain. The functions here may have variable gas costs. 7 interface IUniswapV3PoolDerivedState { 8 /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp 9 /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing 10 /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, 11 /// you must call it with secondsAgos = [3600, 0]. 12 /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in 13 /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. 14 /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned 15 /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp 16 /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block 17 /// timestamp 18 function observe(uint32[] calldata secondsAgos) 19 external 20 view 21 returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); 22 23 /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range 24 /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. 25 /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first 26 /// snapshot is taken and the second snapshot is taken. 27 /// @param tickLower The lower tick of the range 28 /// @param tickUpper The upper tick of the range 29 /// @return tickCumulativeInside The snapshot of the tick accumulator for the range 30 /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range 31 /// @return secondsInside The snapshot of seconds per liquidity for the range 32 function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) 33 external 34 view 35 returns ( 36 int56 tickCumulativeInside, 37 uint160 secondsPerLiquidityInsideX128, 38 uint32 secondsInside 39 ); 40 }