NonfungiblePositionManager
NonfungiblePositionManager.sol
Wraps AMM positions in the ERC721 non-fungible token interface.
Table of Contents
Variables
lockedUntil
Unix timestamps, in seconds, for each position describing when they can be unlocked (without paying an early withdrawal fee).
timelock
The full duration of the most recent timelock applied to a position.
timelockExcluded
Whether an address is excluded from having timelocks applied. Useful for some integrations.
Events
IncreaseLiquidity
Emitted by mint()
and increaseLiquidity()
.
Parameters | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position being increased. |
liquidity |
| Amount of liquidity added. |
amount0 |
| Amount of token0 deposited. |
amount1 |
| Amount of token1 deposited. |
DecreaseLiquidity
Emitted by decreaseLiquidity()
.
Parameters | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position being decreased. |
liquidity |
| Amount of liquidity removed. |
amount0 |
| Amount of token0 removed. |
amount1 |
| Amount of token1 removed. |
Collect
Emitted by collect()
.
Parameters | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position. |
recipient |
| Address that collected tokens. |
amount0 |
| Amount of token0 sent. |
amount1 |
| Amount of token1 sent. |
Write Functions
increaseLiquidity
Increases liquidity of a position.
Parameters | Type | Description |
---|---|---|
params |
| See table below. |
|
| Amount of ETH sent. |
IncreaseLiquidityParams | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position. |
amount0Desired |
| Desired token0 deposit amount. |
amount1Desired |
| Desired token1 deposit amount. |
amount0Min |
| Minimum required token0 deposit amount. |
amount1Min |
| Minimum required token0 deposit amount. |
Return values | Type | Description |
---|---|---|
liquidity |
| Amount of liquidity added. |
amount0 |
| Amount of token0 added. |
amount1 |
| Amount of token1 added. |
decreaseLiquidity
Decreases the liquidity of a position. Tokens removed from liquidity are not actually transferred; they are simply accounted for as tokens owed to the position's owner, should they decide to call collect()
.
DecreaseLiquidityParams | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position. |
liquidity |
| Amount of liquidity to remove. |
amount0Min |
| Minimum required token0 removal. |
amount1Min |
| Minimum required token1 removal. |
deadline |
| Unix timestamp in seconds after which the transaction will not succeed. |
Return values | Type | Description |
---|---|---|
amount0 |
| Amount of token0 removed. |
amount1 |
| Amount of token1 removed. |
collect
Retrieves tokens from a liquidity position (from fees earned and any liquidity removed).
CollectParams | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position. |
recipient |
| Address to receive tokens. |
amount0Max |
| Maximum token0 amount to withdraw. |
amount1Max |
| Maximum token1 amount to withdraw. |
Return values | Type | Description |
---|---|---|
amount0 |
| Amount of token0 sent. |
amount1 |
| Amount of token1 sent. |
burn
Burns a liquidity position. The position must have zero liquidity and zero tokens owed.
Parameters | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position to burn. |
Owner Functions
setTimelockExcluded
Sets whether an address is excluded from having timelocks imposed on new positions.
Parameters | Type | Description |
---|---|---|
addr |
| Address to be excluded (or un-excluded). |
isExcluded |
| True to exclude, false to un-exclude. |
Read Functions
positions
Returns the position data of a liquidity position ID.
Parameters | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position. |
Return values | Type | Description |
---|---|---|
nonce |
| The nonce for permits. |
operator |
| Address that is approved for spending. |
token0 |
| Address of token0. |
token1 |
| Address of token1. |
fee |
| Swap fee tier of the pool. |
tickLower |
| Lower bound tick of price range. |
tickUpper |
| Upper bound tick of price range. |
liquidity |
| Liquidity of position. |
feeGrowthInside0LastX128 |
| Fee growth of token0 since the last action on the position. |
feeGrowthInside1LastX128 |
| Fee growth of token1 since the last action on the position. |
tokensOwed0 |
| Uncollected amount of token0 owed to the position. |
tokensOwed1 |
| Uncollected amount of token1 owed to the position. |
tokenURI
Returns a liquidity position's NFT tokenURI.
Parameters | Type | Description |
---|---|---|
tokenId |
| ID of liquidity position. |
Return values | Type | Description |
---|---|---|
unnamed |
| TokenURI string. |
getApproved
Returns the operator
of a liquidity position.
Parameters | Type | Description |
---|---|---|
tokenId |
| Liquidity position ID. |
Return values | Type | Description |
---|---|---|
unnamed |
| Operator of position. |
Last updated