# amm v3 positionmanager

## Overview

Position manager address supplied for the AMM V3 deployment.

* Contract name: `NonfungiblePositionManager`
* Address: `0x2b70C4e7cA8E920435A5dB191e066E9E3AFd8DB3`
* Network: Mantle Mainnet (`chainId 5000`)
* Explorer API: [`address payload`](https://explorer.mantle.xyz/api/v2/addresses/0x2b70C4e7cA8E920435A5dB191e066E9E3AFd8DB3)
* [`Mantlescan code page`](https://mantlescan.xyz/address/0x2b70C4e7cA8E920435A5dB191e066E9E3AFd8DB3#code)
* [`NonfungiblePositionManager.sol`](https://github.com/Uniswap/v3-periphery/blob/main/contracts/NonfungiblePositionManager.sol)
* [`PoolInitializer.sol`](https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/PoolInitializer.sol)
* [`ERC721Permit.sol`](https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/ERC721Permit.sol)

***

## Read Functions

The matched source also inherits standard ERC-721 read methods such as `balanceOf`, `ownerOf`, `name`, `symbol`, and `supportsInterface`.

### factory

```solidity
function factory() external view returns (address factory)
```

Returns the V3 factory address used by the position manager.

Return Values

| Name      | Type      | Description                                        |
| --------- | --------- | -------------------------------------------------- |
| `factory` | `address` | Factory address used for pool lookup and creation. |

***

### WETH9

```solidity
function WETH9() external view returns (address weth9)
```

Returns the wrapped native token address configured for the periphery contract.

Return Values

| Name    | Type      | Description                   |
| ------- | --------- | ----------------------------- |
| `weth9` | `address` | Wrapped native token address. |

***

### positions

```solidity
function positions(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)
```

Returns the full on-chain state for a position NFT.

Parameters

| Name      | Type      | Description              |
| --------- | --------- | ------------------------ |
| `tokenId` | `uint256` | Position NFT identifier. |

Return Values

| Name                       | Type      | Description                                           |
| -------------------------- | --------- | ----------------------------------------------------- |
| `nonce`                    | `uint96`  | Permit nonce for the NFT.                             |
| `operator`                 | `address` | Approved operator address.                            |
| `token0`                   | `address` | Lower-sorted token address for the pool.              |
| `token1`                   | `address` | Higher-sorted token address for the pool.             |
| `fee`                      | `uint24`  | Pool fee tier.                                        |
| `tickLower`                | `int24`   | Lower tick boundary for the position.                 |
| `tickUpper`                | `int24`   | Upper tick boundary for the position.                 |
| `liquidity`                | `uint128` | Current liquidity held by the position.               |
| `feeGrowthInside0LastX128` | `uint256` | Last recorded fee growth for token0 inside the range. |
| `feeGrowthInside1LastX128` | `uint256` | Last recorded fee growth for token1 inside the range. |
| `tokensOwed0`              | `uint128` | Uncollected token0 fees owed to the position.         |
| `tokensOwed1`              | `uint128` | Uncollected token1 fees owed to the position.         |

***

### tokenURI

```solidity
function tokenURI(uint256 tokenId) external view returns (string uri)
```

Returns the metadata URI for a position NFT.

Parameters

| Name      | Type      | Description              |
| --------- | --------- | ------------------------ |
| `tokenId` | `uint256` | Position NFT identifier. |

Return Values

| Name  | Type     | Description           |
| ----- | -------- | --------------------- |
| `uri` | `string` | ERC-721 metadata URI. |

***

### DOMAIN\_SEPARATOR

```solidity
function DOMAIN_SEPARATOR() public view returns (bytes32 separator)
```

Returns the EIP-712 domain separator used by the NFT permit flow.

Return Values

| Name        | Type      | Description                                             |
| ----------- | --------- | ------------------------------------------------------- |
| `separator` | `bytes32` | Current EIP-712 domain separator for permit signatures. |

***

### PERMIT\_TYPEHASH

```solidity
function PERMIT_TYPEHASH() external view returns (bytes32 typehash)
```

Returns the type hash used to build permit signatures for position NFTs.

Return Values

| Name       | Type      | Description                                |
| ---------- | --------- | ------------------------------------------ |
| `typehash` | `bytes32` | EIP-712 type hash for NFT permit messages. |

***

### getApproved

```solidity
function getApproved(uint256 tokenId) public view returns (address operator)
```

Returns the approved operator for a position NFT.

Parameters

| Name      | Type      | Description              |
| --------- | --------- | ------------------------ |
| `tokenId` | `uint256` | Position NFT identifier. |

Return Values

| Name       | Type      | Description                            |
| ---------- | --------- | -------------------------------------- |
| `operator` | `address` | Approved operator address for the NFT. |

***

## Write Functions

The matched source also inherits standard ERC-721 approval and transfer methods, periphery payment helpers, `selfPermit*` methods, and `multicall`. The list below focuses on the position-management and signature flows that are most protocol-specific.

### createAndInitializePoolIfNecessary

```solidity
function createAndInitializePoolIfNecessary(address token0, address token1, uint24 fee, uint160 sqrtPriceX96) external payable returns (address pool)
```

Creates a pool if needed and initializes it with the supplied square-root price.

Parameters

| Name           | Type      | Description                                  |
| -------------- | --------- | -------------------------------------------- |
| `token0`       | `address` | First pool token.                            |
| `token1`       | `address` | Second pool token.                           |
| `fee`          | `uint24`  | Fee tier for the pool.                       |
| `sqrtPriceX96` | `uint160` | Initial square-root price encoded as Q64.96. |

Return Values

| Name   | Type      | Description                            |
| ------ | --------- | -------------------------------------- |
| `pool` | `address` | Pool address after creation or lookup. |

***

### mint

```solidity
function mint((address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min, address recipient, uint256 deadline) params) external payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)
```

Creates a new concentrated-liquidity position and wraps it in an NFT.

Parameters

| Name                    | Type      | Description                       |
| ----------------------- | --------- | --------------------------------- |
| `params.token0`         | `address` | First pool token.                 |
| `params.token1`         | `address` | Second pool token.                |
| `params.fee`            | `uint24`  | Pool fee tier.                    |
| `params.tickLower`      | `int24`   | Lower tick boundary.              |
| `params.tickUpper`      | `int24`   | Upper tick boundary.              |
| `params.amount0Desired` | `uint256` | Desired token0 amount to deposit. |
| `params.amount1Desired` | `uint256` | Desired token1 amount to deposit. |
| `params.amount0Min`     | `uint256` | Minimum acceptable token0 amount. |
| `params.amount1Min`     | `uint256` | Minimum acceptable token1 amount. |
| `params.recipient`      | `address` | Recipient of the minted NFT.      |
| `params.deadline`       | `uint256` | Latest valid execution timestamp. |

Return Values

| Name        | Type      | Description                         |
| ----------- | --------- | ----------------------------------- |
| `tokenId`   | `uint256` | Minted position NFT identifier.     |
| `liquidity` | `uint128` | Liquidity minted into the position. |
| `amount0`   | `uint256` | Actual token0 amount deposited.     |
| `amount1`   | `uint256` | Actual token1 amount deposited.     |

***

### increaseLiquidity

```solidity
function increaseLiquidity((uint256 tokenId, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min, uint256 deadline) params) external payable returns (uint128 liquidity, uint256 amount0, uint256 amount1)
```

Adds more liquidity to an existing position NFT.

Parameters

| Name                    | Type      | Description                       |
| ----------------------- | --------- | --------------------------------- |
| `params.tokenId`        | `uint256` | Position NFT identifier.          |
| `params.amount0Desired` | `uint256` | Desired token0 amount to add.     |
| `params.amount1Desired` | `uint256` | Desired token1 amount to add.     |
| `params.amount0Min`     | `uint256` | Minimum acceptable token0 amount. |
| `params.amount1Min`     | `uint256` | Minimum acceptable token1 amount. |
| `params.deadline`       | `uint256` | Latest valid execution timestamp. |

Return Values

| Name        | Type      | Description                                  |
| ----------- | --------- | -------------------------------------------- |
| `liquidity` | `uint128` | Additional liquidity minted to the position. |
| `amount0`   | `uint256` | Actual token0 amount deposited.              |
| `amount1`   | `uint256` | Actual token1 amount deposited.              |

***

### decreaseLiquidity

```solidity
function decreaseLiquidity((uint256 tokenId, uint128 liquidity, uint256 amount0Min, uint256 amount1Min, uint256 deadline) params) external payable returns (uint256 amount0, uint256 amount1)
```

Removes liquidity from a position and credits the withdrawn amounts to the position for later collection.

Parameters

| Name                | Type      | Description                       |
| ------------------- | --------- | --------------------------------- |
| `params.tokenId`    | `uint256` | Position NFT identifier.          |
| `params.liquidity`  | `uint128` | Liquidity amount to remove.       |
| `params.amount0Min` | `uint256` | Minimum acceptable token0 amount. |
| `params.amount1Min` | `uint256` | Minimum acceptable token1 amount. |
| `params.deadline`   | `uint256` | Latest valid execution timestamp. |

Return Values

| Name      | Type      | Description                              |
| --------- | --------- | ---------------------------------------- |
| `amount0` | `uint256` | Token0 amount accounted to the position. |
| `amount1` | `uint256` | Token1 amount accounted to the position. |

***

### collect

```solidity
function collect((uint256 tokenId, address recipient, uint128 amount0Max, uint128 amount1Max) params) external payable returns (uint256 amount0, uint256 amount1)
```

Collects accrued fees and withdrawn tokens owed to a position.

Parameters

| Name                | Type      | Description                       |
| ------------------- | --------- | --------------------------------- |
| `params.tokenId`    | `uint256` | Position NFT identifier.          |
| `params.recipient`  | `address` | Recipient of collected tokens.    |
| `params.amount0Max` | `uint128` | Maximum token0 amount to collect. |
| `params.amount1Max` | `uint128` | Maximum token1 amount to collect. |

Return Values

| Name      | Type      | Description              |
| --------- | --------- | ------------------------ |
| `amount0` | `uint256` | Token0 amount collected. |
| `amount1` | `uint256` | Token1 amount collected. |

***

### burn

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

Burns a position NFT after its liquidity has been removed and all owed tokens have been collected.

Parameters

| Name      | Type      | Description                      |
| --------- | --------- | -------------------------------- |
| `tokenId` | `uint256` | Position NFT identifier to burn. |

This function does not return a value.

***

### permit

```solidity
function permit(address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external payable
```

Approves `spender` for a position NFT using an EIP-712 signature instead of an on-chain approval transaction.

Parameters

| Name       | Type      | Description                      |
| ---------- | --------- | -------------------------------- |
| `spender`  | `address` | Operator to approve for the NFT. |
| `tokenId`  | `uint256` | Position NFT identifier.         |
| `deadline` | `uint256` | Permit expiration timestamp.     |
| `v`        | `uint8`   | Signature recovery byte.         |
| `r`        | `bytes32` | Signature `r` value.             |
| `s`        | `bytes32` | Signature `s` value.             |

This function does not return a value.

***

### multicall

```solidity
function multicall(bytes[] data) external payable returns (bytes[] results)
```

Batches multiple position-manager calls into a single transaction.

Parameters

| Name   | Type      | Description                              |
| ------ | --------- | ---------------------------------------- |
| `data` | `bytes[]` | Encoded calldata for each internal call. |

Return Values

| Name      | Type      | Description                        |
| --------- | --------- | ---------------------------------- |
| `results` | `bytes[]` | Return data for each batched call. |


---

# 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://fluxion-network.gitbook.io/fluxion-network/developer-resources/technical-overview-and-api/amm-v3-positionmanager.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.
