# NonfungiblePositionManager

&#x20;This contract wraps KLAYswap V3 positions in the ERC721 non-fungible token interface

## Code

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

## Address

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

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

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

## Events

**IncreaseLiquidity**

```solidity
event IncreaseLiquidity(
    uint256 indexed tokenId, 
    uint128 liquidity, 
    uint256 amount0, 
    uint256 amount1
);
```

Emitted when liquidity is increased for a position NFT

Also emitted when a token is minted

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/INonfungiblePositionManager#parameters-7)

<table><thead><tr><th width="170.66666666666666">Name</th><th width="116">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>uint256</td><td>The ID of the token for which liquidity was increased</td></tr><tr><td><code>liquidity</code></td><td>uint128</td><td>The amount by which liquidity for the NFT position was increased</td></tr><tr><td><code>amount0</code></td><td>uint256</td><td>The amount of token0 that was paid for the increase in liquidity</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>The amount of token1 that was paid for the increase in liquidity</td></tr></tbody></table>

**DecreaseLiquidity**

```solidity
event DecreaseLiquidity(
    uint256 indexed tokenId, 
    uint128 liquidity, 
    uint256 amount0, 
    uint256 amount1
);
```

Emitted when liquidity is decreased for a position NFT

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/INonfungiblePositionManager#parameters-8)

<table><thead><tr><th width="159.66666666666666">Name</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>uint256</td><td>The ID of the token for which liquidity was decreased</td></tr><tr><td><code>liquidity</code></td><td>uint128</td><td>The amount by which liquidity for the NFT position was decreased</td></tr><tr><td><code>amount0</code></td><td>uint256</td><td>The amount of token0 that was accounted for the decrease in liquidity</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>The amount of token1 that was accounted for the decrease in liquidity</td></tr></tbody></table>

**Collect**

```solidity
event Collect(
    uint256 indexed tokenId, 
    address recipient,
    uint256 amount0, 
    uint256 amount1,
    uint256 reward
);
```

Emitted when tokens are collected for a position NFT

The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/INonfungiblePositionManager#parameters-9)

<table><thead><tr><th width="147.66666666666666">Name</th><th width="119">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>uint256</td><td>The ID of the token for which underlying tokens were collected</td></tr><tr><td><code>recipient</code></td><td>address</td><td>The address of the account that received the collected tokens</td></tr><tr><td><code>amount0</code></td><td>uint256</td><td>The amount of token0 owed to the position that was collected</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>The amount of token1 owed to the position that was collected</td></tr></tbody></table>
{% endtab %}

{% tab title="Parameter Structs" %}

## Parameter Structs

#### MintParams[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/INonfungiblePositionManager#mintparams) <a href="#mintparams" id="mintparams"></a>

```solidity
struct MintParams {
    address token0;
    address token1;
    uint24 fee;
    int24 tickLower;
    int24 tickUpper;
    uint256 amount0Desired;
    uint256 amount1Desired;
    uint256 amount0Min;
    uint256 amount1Min;
    address recipient;
    uint256 deadline;
}
```

#### IncreaseLiquidityParams[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/INonfungiblePositionManager#increaseliquidityparams) <a href="#increaseliquidityparams" id="increaseliquidityparams"></a>

```solidity
struct IncreaseLiquidityParams {
   uint256 tokenId;
   uint256 amount0Desired;
   uint256 amount1Desired;
   uint256 amount0Min;
   uint256 amount1Min;
   uint256 deadline;
}
```

#### DecreaseLiquidityParams[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/INonfungiblePositionManager#decreaseliquidityparams) <a href="#decreaseliquidityparams" id="decreaseliquidityparams"></a>

```solidity
struct DecreaseLiquidityParams {
    uint256 tokenId;
    uint128 liquidity;
    uint256 amount0Min;
    uint256 amount1Min;
    uint256 deadline;
}
```

#### CollectParams[​](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/INonfungiblePositionManager#collectparams) <a href="#collectparams" id="collectparams"></a>

```solidity
struct CollectParams {
    uint256 tokenId;
    address recipient;
    uint128 amount0Max;
    uint128 amount1Max;
}
```

{% endtab %}

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

## Read-Only Functions

#### positions[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#positions) <a href="#positions" id="positions"></a>

<pre class="language-solidity"><code class="lang-solidity"><strong>function positions(
</strong>    uint256 tokenId
) external view returns (
    uint96 nonce, 
    address operator, 
    address token0, 
    address token1, 
    uint24 fee, 
    int24 tickLower, 
    int24 tickUpper, 
    uint128 liquidity, 
    uint256 feeGrowthInside0LastX128, 
    uint256 feeGrowthInside1LastX128, 
    uint128 tokensOwed0, 
    uint128 tokensOwed1
)
</code></pre>

Returns the position information associated with a given token ID.

Throws if the token ID is not valid.

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#parameters)

| Name      | Type    | Description                                      |
| --------- | ------- | ------------------------------------------------ |
| `tokenId` | uint256 | The ID of the token that represents the position |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#return-values)

<table><thead><tr><th width="209.66666666666663">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>nonce</code></td><td>uint96</td><td>The nonce for permits</td></tr><tr><td><code>operator</code></td><td>address</td><td>The address that is approved for spending</td></tr><tr><td><code>token0</code></td><td>address</td><td>The address of the token0 for a specific pool</td></tr><tr><td><code>token1</code></td><td>address</td><td>The address of the token1 for a specific pool</td></tr><tr><td><code>fee</code></td><td>uint24</td><td>The fee associated with the pool</td></tr><tr><td><code>tickLower</code></td><td>int24</td><td>The lower end of the tick range for the position</td></tr><tr><td><code>tickUpper</code></td><td>int24</td><td>The higher end of the tick range for the position</td></tr><tr><td><code>liquidity</code></td><td>uint128</td><td>The liquidity of the position</td></tr><tr><td><code>feeGrowthInside0LastX128</code></td><td>uint256</td><td>The fee growth of token0 as of the last action on the individual position</td></tr><tr><td><code>feeGrowthInside1LastX128</code></td><td>uint256</td><td>The fee growth of token1 as of the last action on the individual position</td></tr><tr><td><code>tokensOwed0</code></td><td>uint128</td><td>The uncollected amount of token0 owed to the position as of the last computation</td></tr><tr><td><code>tokensOwed1</code></td><td>uint128</td><td>The uncollected amount of token1 owed to the position as of the last computation</td></tr></tbody></table>

#### positionRewards <a href="#positions" id="positions"></a>

```solidity
function positionRewards(uint256 tokenId)
external
view
returns (
    uint256 rewardGrowthInsideLastX128,
    uint128 reward,
    uint128 fee0Sum,
    uint128 fee1Sum,
    uint128 rewardSum
);
```

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#parameters)

<table><thead><tr><th width="137.66666666666666">Name</th><th width="106">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>uint256</td><td>The ID of the token that represents the position</td></tr></tbody></table>

**Return Values:**

<table><thead><tr><th width="209.66666666666663">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>rewardGrowthInsideLastX128</code></td><td>uint256</td><td>The reward growth as of the last action on the individual position</td></tr><tr><td><code>reward</code></td><td>uint128</td><td>The uncollected amount of reward</td></tr><tr><td><code>fee0Sum</code></td><td>uint128</td><td>The cumulated amountof fee0</td></tr><tr><td><code>fee1Sum</code></td><td>uint128</td><td>The cumulated amountof fee1</td></tr><tr><td><code>rewardSum</code></td><td>uint128</td><td>The collected amount of reward</td></tr></tbody></table>

#### getApproved[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#getapproved) <a href="#getapproved" id="getapproved"></a>

```solidity
  function getApproved() public view returns (address)
```

Returns the account approved for `tokenId` token. Requirements:

* `tokenId` must exist.

#### tokenURI[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#tokenuri) <a href="#tokenuri" id="tokenuri"></a>

```solidity
  function tokenURI(uint256 tokenId) public view returns (string)
```

Returns a URI describing a particular token ID

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#parameters-2)

<table><thead><tr><th width="136.66666666666666">Name</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>uint256</td><td>The ID of the token that represents the minted position</td></tr></tbody></table>

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#return-values-2)

A base64 string with the URI data.

#### baseURI[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#baseuri) <a href="#baseuri" id="baseuri"></a>

```solidity
  function baseURI() public returns (string)
```

{% endtab %}

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

## **State-Changing Functions**

#### mint[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#mint) <a href="#mint" id="mint"></a>

```solidity
function mint(
    struct INonfungiblePositionManager.MintParams params
) external returns (
    uint256 tokenId, 
    uint128 liquidity, 
    uint256 amount0, 
    uint256 amount1
)
```

Creates a new position wrapped in a NFT

Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized a method does not exist, i.e. the pool is assumed to be initialized.

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#parameters-1)

<table><thead><tr><th width="126.66666666666666">Name</th><th width="238">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>params</code></td><td><code>struct INonfungiblePositionManager.MintParams</code></td><td>The params necessary to mint a position, encoded as <code>MintParams</code> in calldata</td></tr></tbody></table>

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#return-values-1)

<table><thead><tr><th width="142.66666666666666">Name</th><th width="134">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>uint256</td><td>The ID of the token that represents the minted position</td></tr><tr><td><code>liquidity</code></td><td>uint128</td><td>The amount of liquidity for this position</td></tr><tr><td><code>amount0</code></td><td>uint256</td><td>The amount of token0</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>The amount of token1</td></tr></tbody></table>

#### increaseLiquidity[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#increaseliquidity) <a href="#increaseliquidity" id="increaseliquidity"></a>

```solidity
function increaseLiquidity(
    struct INonfungiblePositionManager.IncreaseLiquidityParams params
) external returns (
    uint128 liquidity, 
    uint256 amount0, 
    uint256 amount1
)
```

Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#parameters-3)

<table><thead><tr><th width="120.66666666666666">Name</th><th width="233">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>params</code></td><td><code>struct INonfungiblePositionManager.IncreaseLiquidityParams</code></td><td>The params necessary to increase liquidity on the position, encoded as <code>IncreaseLiquidityParams</code> in calldata</td></tr></tbody></table>

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#return-values-3)

<table><thead><tr><th width="144.66666666666666">Name</th><th width="104">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>liquidity</code></td><td>uint128</td><td>The new liquidity amount as a result of the increase</td></tr><tr><td><code>amount0</code></td><td>uint256</td><td>The amount of token0 to achieve resulting liquidity</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>The amount of token1 to achieve resulting liquidity</td></tr></tbody></table>

#### decreaseLiquidity[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#decreaseliquidity) <a href="#decreaseliquidity" id="decreaseliquidity"></a>

<pre class="language-solidity"><code class="lang-solidity">function decreaseLiquidity(
<strong>    struct INonfungiblePositionManager.DecreaseLiquidityParams params
</strong>) external returns (uint256 amount0, uint256 amount1)
</code></pre>

Decreases the amount of liquidity in a position and accounts it to the position

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#parameters-4)

<table><thead><tr><th width="130.66666666666666">Name</th><th width="231">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>params</code></td><td><code>struct INonfungiblePositionManager.DecreaseLiquidityParams</code></td><td>The params necessary to decrease liquidity on the position, encoded as <code>IncreaseLiquidityParams</code> in calldata</td></tr></tbody></table>

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#return-values-4)

<table><thead><tr><th width="129.66666666666666">Name</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount0</code></td><td>uint256</td><td>The amount of token0 accounted to the position's tokens owed</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>The amount of token1 accounted to the position's tokens owed</td></tr></tbody></table>

#### collect[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#collect) <a href="#collect" id="collect"></a>

```solidity
function collect(
    struct INonfungiblePositionManager.CollectParams params
) external returns (uint256 amount0, uint256 amount1)
```

Collects up to a maximum amount of fees owed to a specific position to the recipient

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#parameters-5)

<table><thead><tr><th width="143.66666666666666">Name</th><th width="241">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>params</code></td><td><code>struct INonfungiblePositionManager.CollectParams</code></td><td>The params necessary to collect, encoded as <code>CollectParams</code> in calldata</td></tr></tbody></table>

recipient The account that should receive the tokens, amount0Max The maximum amount of token0 to collect, amount1Max The maximum amount of token1 to collect

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#return-values-5)

<table><thead><tr><th width="136.66666666666666">Name</th><th width="138">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>amount0</code></td><td>uint256</td><td>The amount of fees collected in token0</td></tr><tr><td><code>amount1</code></td><td>uint256</td><td>The amount of fees collected in token1</td></tr></tbody></table>

#### burn[​](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#burn) <a href="#burn" id="burn"></a>

```solidity
function burn(uint256 tokenId) external
```

Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens must be collected first.

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/NonfungiblePositionManager#parameters-6)

<table><thead><tr><th width="140.66666666666666">Name</th><th width="134">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code></td><td>uint256</td><td>The ID of the token that is being burned</td></tr></tbody></table>
{% endtab %}
{% endtabs %}
