V3Estimator

This contract estimates v3 swap amounts

Code

Github Link: (Will be updated after official launch)

Address

Events, Read-Only Functions, and State-Changing Functions

Read-Only Functions

estimatePos

function estimatePos(
    struct IUniswapV3Pool pool, 
    address token, 
    uint256 amountIn
) external view returns (
    uint256 amountOut, 
    uint160 sqrtPriceX96After
)

Parameters:

Name
Type
Description

pool

contract IUniswapV3Pool

The address of the pool

token

address

The token being swapped in

amountIn

uint256

The desired input amount

Return Values:

Name
Type
Description

amountOut

uint256

The amount of the token that would be received

sqrtPriceX96After

uint160

The sqrt price after the swap

estimateNeg

Parameters:

Name
Type
Description

pool

contract IUniswapV3Pool

The address of the pool

token

address

The token being swapped out

amountOut

uint256

The desired output amount

Return Values:

Name
Type
Description

amountIn

uint256

The amount required as the input for the swap in order to receive amountOut

sqrtPriceX96After

uint160

The sqrt price after the swap

estimate

Parameters:

Name
Type
Description

pool

contract IUniswapV3Pool

The address of the pool

zeroForOne

bool

Is swap direction 0 -> 1?

amountSpecified

int256

The specified amount of token

Return Values:

Name
Type
Description

amount0

int256

The changed amount of token0

amount1

int256

The changed amount of token1

sqrtPriceX96After

uint160

The sqrt price after the swap