# V3Estimator

&#x20;This contract estimates v3 swap amounts

## Code

Github Link: (Will be updated after official launch)<br>

## Address

* Cypress : [0x09067f1b4E1a1CD08C91519D811F3D04c69a5a5f](https://scope.klaytn.com/account/0x09067f1b4E1a1CD08C91519D811F3D04c69a5a5f?tabId=internalTx)

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

{% tabs %}
{% tab title="Read-Only Functions" %}

## Read-Only Functions

**estimatePos**

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

**Parameters:**

<table><thead><tr><th width="134.66666666666666">Name</th><th width="178">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>pool</code></td><td><code>contract IUniswapV3Pool</code></td><td>The address of the pool</td></tr><tr><td><code>token</code></td><td>address</td><td>The token being swapped in</td></tr><tr><td><code>amountIn</code></td><td>uint256</td><td>The desired input amount</td></tr></tbody></table>

[**​**](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool#parameters)**Return Values:**

<table><thead><tr><th width="219.66666666666666">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amountOut</code></td><td>uint256</td><td>The amount of the token that would be received</td></tr><tr><td><code>sqrtPriceX96After</code></td><td>uint160</td><td>The sqrt price after the swap </td></tr></tbody></table>

**estimateNeg**

```solidity
function estimateNeg(
    contract IUniswapV3Pool pool, 
    address token, 
    uint256 amountOut
) external view returns (
    uint256 amountIn, 
    uint160 sqrtPriceX96After
)
```

**Parameters:**

<table><thead><tr><th width="145.66666666666666">Name</th><th width="178">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>pool</code></td><td><code>contract IUniswapV3Pool</code></td><td>The address of the pool</td></tr><tr><td><code>token</code></td><td>address</td><td>The token being swapped out</td></tr><tr><td><code>amountOut</code></td><td>uint256</td><td>The desired output amount</td></tr></tbody></table>

[**​**](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool#parameters)**Return Values:**

<table><thead><tr><th width="219.66666666666666">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amountIn</code></td><td>uint256</td><td>The amount required as the input for the swap in order to receive <code>amountOut</code></td></tr><tr><td><code>sqrtPriceX96After</code></td><td>uint160</td><td>The sqrt price after the swap </td></tr></tbody></table>

**estimate**

```solidity
function estimate(
    contract IUniswapV3Pool pool,
    bool zeroForOne,
    int256 amountSpecified
) public view returns (int256 amount0, int256 amount1, uint160 sqrtPriceX96After) {
```

**Parameters:**

<table><thead><tr><th width="202.66666666666666">Name</th><th width="178">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>pool</code></td><td><code>contract IUniswapV3Pool</code></td><td>The address of the pool</td></tr><tr><td><code>zeroForOne</code></td><td>bool</td><td>Is swap direction 0 -> 1?</td></tr><tr><td><code>amountSpecified</code></td><td>int256</td><td>The specified amount of token</td></tr></tbody></table>

[**​**](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool#parameters)**Return Values:**

<table><thead><tr><th width="219.66666666666666">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount0</code></td><td>int256</td><td>The changed amount of token0</td></tr><tr><td><code>amount1</code></td><td>int256</td><td>The changed amount of token1 </td></tr><tr><td><code>sqrtPriceX96After</code></td><td>uint160</td><td>The sqrt price after the swap </td></tr></tbody></table>

[**​**](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool#parameters)
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.klayswap.com/developers/contract/v3/v3estimator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
