# PositionMigrator

&#x20;This contract migrates position. This contract helps to deposit the assets deposited in the position and deposit them in the new position.

## Code

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

## Address

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

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

{% tabs %}
{% tab title="Events" %}

## Events

**MigratePosition**

```solidity
event MigratePosition(
    address user, 
    address token0, 
    address token1, 
    uint24 fee, 
    uint256 burnId, 
    uint256 mintId
)
```

**Parameters:**

<table><thead><tr><th width="134.66666666666666">Name</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>user</code></td><td>address</td><td>user address</td></tr><tr><td><code>token0</code></td><td>address</td><td>token0 address</td></tr><tr><td><code>token1</code></td><td>address</td><td>token1 address</td></tr><tr><td><code>fee</code></td><td>uint24</td><td>fee </td></tr><tr><td><code>burnId</code></td><td>uint256</td><td>tokenId of migrated position</td></tr><tr><td><code>mintId</code></td><td>uint256</td><td>tokenId of the newly minted position</td></tr></tbody></table>

**Zap**

```solidity
event Zap(
    address user, 
    address token0, 
    address token1, 
    uint24 fee, 
    uint256 amount, 
    bool zeroForOne, 
    uint256 tokenId
)
```

**Parameters:**

<table><thead><tr><th width="160.66666666666666">Name</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>user</code></td><td>address</td><td>user address</td></tr><tr><td><code>token0</code></td><td>address</td><td>token0 address</td></tr><tr><td><code>token1</code></td><td>address</td><td>token1 address</td></tr><tr><td><code>fee</code></td><td>uint24</td><td>fee </td></tr><tr><td><code>amount</code></td><td>uint256</td><td>amount to deposit</td></tr><tr><td><code>zeroForOne</code></td><td>bool</td><td><p>When depositing with token0: <code>true</code> </p><p>When depositing with token1: <code>false</code></p></td></tr><tr><td><code>tokenId</code></td><td>uint256</td><td>tokenId of the newly issued position</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Structs" %}

## Parameter Struct

**MigrationParams**

```solidity
struct MigrationParams {
    uint256 tokenId;
    // Burn
    uint256 burnAmount0Min;
    uint256 burnAmount1Min;
    // Swap
    address tokenIn;
    uint256 swapAmountIn;
    uint256 swapAmountOutMin;
    // Mint
    int24 tickLower;
    int24 tickUpper;
    uint256 mintAmount0Min;
    uint256 mintAmount1Min;
    uint256 deadline;
    bool compoundFee;
}
```

**Parameters:**

<table><thead><tr><th width="211.66666666666666">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>uint256</td><td>tokenId to migrate</td></tr><tr><td><code>burnAmount0Min</code></td><td>uint256</td><td>The minimum value of token0 you will receive upon withdrawal</td></tr><tr><td><code>burnAmount1Min</code></td><td>uint256</td><td>The minimum value of token1 you will receive upon withdrawal</td></tr><tr><td><code>tokenIn</code></td><td>address</td><td>Address of token to be swapped</td></tr><tr><td><code>swapAmountIn</code></td><td>uint256</td><td>token amount to be swapped</td></tr><tr><td><code>swapAmountOutMin</code></td><td>uint256</td><td>Minimum value of tokens to be received in swap</td></tr><tr><td><code>tickLower</code></td><td>int24</td><td>Minimum ticks of new positions to be minted</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>Minimum ticks of new positions to be minted</td></tr><tr><td><code>mintAmount0Min</code></td><td>uint256</td><td>Minimum value of token0 to be minted in the new position</td></tr><tr><td><code>mintAmount1Min</code></td><td>uint256</td><td>Minimum value of token1 to be minted in the new position</td></tr><tr><td><code>deadline</code></td><td>uint256</td><td>deadline</td></tr><tr><td><code>compoundFee</code></td><td>bool</td><td>Whether to deposit with fees</td></tr></tbody></table>

**ZappingParams**

```solidity
struct ZappingParams {
    contract IUniswapV3Pool pool;
    uint256 amount;
    int24 tickLower;
    int24 tickUpper;
    bool zeroForOne;
    uint256 mintAmount0Min;
    uint256 mintAmount1Min;
    uint256 tokenId;
    uint256 deadline;
}
```

**Parameters:**

<table><thead><tr><th width="211.66666666666666">Name</th><th width="135">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>pool</code></td><td><code>contract IUniswapV3Pool</code></td><td>pool address to deposit</td></tr><tr><td><code>amount</code></td><td>uint256</td><td>token amount to deposit</td></tr><tr><td><code>tickLower</code></td><td>int24</td><td>Minimum tick of position to deposit</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>Maximum tick of position to deposit</td></tr><tr><td><code>zeroForOne</code></td><td>bool</td><td>Whether the token to be deposited is token0</td></tr><tr><td><code>mintAmount0Min</code></td><td>uint256</td><td>Minimum value of token0 to be minted in the position to be minted</td></tr><tr><td><code>mintAmount1Min</code></td><td>uint256</td><td>Minimum value of token1 to be minted in the position to be minted</td></tr><tr><td><code>tokenId</code></td><td>uint256</td><td><p>tokenId to mint as Zap </p><p>'0' on first mint</p></td></tr><tr><td><code>deadline</code></td><td>uint256</td><td>deadline</td></tr></tbody></table>
{% endtab %}

{% tab title="State-Changing Functions" %}

## **State-Changing Functions**

**migrate**

```solidity
function migrate(
    struct MigrationParams calldata params
) external
```

&#x20;Deposit the assets deposited in the position and deposit them in the new position.

**zapWithETH**

```solidity
function zapWithETH(
    struct ZappingParams memory params
) external
```

A function that helps you deposit into a pool with ETH

**zapWithToken**

```solidity
function zapWithToken(
    struct ZappingParams memory params
) external 
```

A function that helps you deposit into a pool with one asset token
{% 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/positionmigrator.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.
