waterpump-evm-pool-sdk 0.1.0

EVM pool SDK — viewers, infusers, harvesters, swappers for Uniswap V3/V4, PancakeSwap, Slipstream, Shadow, Algebra
Documentation
//! Uniswap V4 StateView contract interface
//!
//! StateView is a view-only contract from v4-periphery that wraps StateLibrary
//! for reading storage in v4-core. See:
//! https://github.com/Uniswap/v4-periphery/blob/main/src/lens/StateView.sol

use alloy::sol;

sol! {
    #[sol(rpc)]
    #[allow(missing_docs)]
    interface IStateView {
        /// @notice Get slot0 data for a pool
        /// @param poolId The pool ID
        /// @return sqrtPriceX96 The current sqrt price in Q96 format
        /// @return tick The current tick
        /// @return protocolFee The protocol fee rate
        /// @return lpFee The liquidity provider fee rate
        function getSlot0(bytes32 poolId) external view returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint24 protocolFee,
            uint24 lpFee
        );

        /// @notice Get tick information for a pool
        /// @param poolId The pool ID
        /// @param tick The tick value
        /// @return liquidityGross Total liquidity referencing this tick
        /// @return liquidityNet Net liquidity change when crossing this tick
        /// @return feeGrowthOutside0X128 Fee growth per unit of liquidity outside this tick for token0
        /// @return feeGrowthOutside1X128 Fee growth per unit of liquidity outside this tick for token1
        function getTickInfo(bytes32 poolId, int24 tick) external view returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128
        );

        /// @notice Get fee growth globals for a pool
        /// @param poolId The pool ID
        /// @return feeGrowthGlobal0 Fee growth global for token0
        /// @return feeGrowthGlobal1 Fee growth global for token1
        function getFeeGrowthGlobals(bytes32 poolId) external view returns (
            uint256 feeGrowthGlobal0,
            uint256 feeGrowthGlobal1
        );

        /// @notice Get liquidity for a pool
        /// @param poolId The pool ID
        /// @return liquidity The current liquidity
        function getLiquidity(bytes32 poolId) external view returns (uint128 liquidity);


        /// @notice Get position information
        /// @param poolId The pool ID
        /// @param positionId The position ID (bytes32)
        /// @return liquidity The position liquidity
        /// @return feeGrowthInside0LastX128 Fee growth inside last for token0
        /// @return feeGrowthInside1LastX128 Fee growth inside last for token1
        function getPositionInfo(bytes32 poolId, bytes32 positionId) external view returns (
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128
        );
    }
}