ConcentratedLiquidityPoolManager

Contract that creates and burns liquidity positions in the concentrated liquidity pool, and manages the pool's fee collection.

Overview

It is a contract that wraps the pool position in ERC721(NFT) format and includes the following functions :

  • mint position

  • add liquidity to existing position

  • burn position liquidity and withdraw

  • swap fee collection

A user can mint multiple position in a single pool and also transfer the position to other accounts.

Methods

approve

function approve(address to, uint256 positionId) external nonpayable

Gives permission to to to transfer positionId token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - positionId must exist. Emits an {Approval} event.

balanceOf

function balanceOf(address owner) external view returns (uint256 balance)

Returns the number of position NFTs in owner's account.

burn

function burn(uint256 positionId, uint128 amount, address recipient, uint256 minimumOut0, uint256 minimumOut1, bool unwrap) external nonpayable returns (uint256 token0Amount, uint256 token1Amount)

burn liquidity ( if burn all liquidity, delete position Id )

Parameters

Name

Type

Description

positionId

uint256

The ID of the NFT

amount

uint128

the amount by which liquidity will be burned

recipient

address

The account that should receive the tokens

minimumOut0

uint256

The minimum amount of token0 that should be accounted for the burned liquidity

minimumOut1

uint256

The minimum amount of token1 that should be accounted for the burned liquidity

unwrap

bool

unwrap or not if native token exists

collect

function collect(uint256 positionId, address recipient, bool unwrap) external nonpayable returns (uint256 token0amount, uint256 token1amount)

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

getApproved

function getApproved(uint256 positionId) external view returns (address operator)

Returns the account approved for positionId token. Requirements: - positionId must exist.

isApprovedForAll

function isApprovedForAll(address owner, address operator) external view returns (bool)

Returns if the operator is allowed to manage all of the assets of owner. See {setApprovalForAll}

mint

function mint(address pool, int24 lowerOld, int24 lower, int24 upperOld, int24 upper, uint128 amount0Desired, uint128 amount1Desired, uint256 minLiquidity, uint256 positionId) external nonpayable returns (uint256)

Create or add additional Liquidity to a given position of ERC20-ERC20 pair pool

Parameters

Name

Type

Description

pool

address

target pool

lowerOld

int24

previous lower tick

lower

int24

The lower end of the tick range for the position

upperOld

int24

previous upper tick

upper

int24

The upper end of the tick range for the position

amount0Desired

uint128

The amount of token0

amount1Desired

uint128

The amount of token1

minLiquidity

uint256

minimum liquidity to create

positionId

uint256

create position if position = 0, else add additional liquidity

mintNative

function mintNative(address pool, int24 lowerOld, int24 lower, int24 upperOld, int24 upper, uint128 amountDesired, uint256 minLiquidity, uint256 positionId) external payable returns (uint256)

Create or add additional Liquidity to a given position of ERC20-NATIVE pair pool

Parameters

Name

Type

Description

pool

address

target pool

lowerOld

int24

previous lower tick

lower

int24

The lower end of the tick range for the position

upperOld

int24

previous upper tick

upper

int24

The upper end of the tick range for the position

amountDesired

uint128

The amount of token

minLiquidity

uint256

minimum liquidity to create (slippage)

positionId

uint256

create position if position = 0, else add additional liquidity

ownerOf

function ownerOf(uint256 positionId) external view returns (address owner)

Returns the owner of the positionId token. Requirements: - positionId must exist.

positionFees

function positionFees(uint256 positionId) external view returns (uint256 token0amount, uint256 token1amount, uint256 feeGrowthInside0, uint256 feeGrowthInside1)

Returns the claimable fees and the fee growth accumulators of a given position

positions

function positions(uint256 positionId) external view returns (struct IConcentratedLiquidityPoolManagerStruct.Position)

return the position information associated with a given token ID.

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId) external nonpayable

Safely transfers tokenId token from from to to, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - from cannot be the zero address. - to cannot be the zero address. - tokenId token must exist and be owned by from. - If the caller is not from, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. - If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external nonpayable

Safely transfers tokenId token from from to to. Requirements: - from cannot be the zero address. - to cannot be the zero address. - tokenId token must exist and be owned by from. - If the caller is not from, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.

setApprovalForAll

function setApprovalForAll(address operator, bool _approved) external nonpayable

Approve or remove operator as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The operator cannot be the caller. Emits an {ApprovalForAll} event.

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.

tokenByIndex

function tokenByIndex(uint256 index) external view returns (uint256)

Returns a token ID at a given index of all the tokens stored by the contract. Use along with {totalSupply} to enumerate all tokens.

tokenOfOwnerByIndex

function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)

Returns a token ID owned by owner at a given index of its token list. Use along with {balanceOf} to enumerate all of owner's tokens.

totalSupply

function totalSupply() external view returns (uint256)

Returns the total amount of tokens stored by the contract.

transferFrom

function transferFrom(address from, address to, uint256 tokenId) external nonpayable

Transfers tokenId token from from to to. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - from cannot be the zero address. - to cannot be the zero address. - tokenId token must be owned by from. - If the caller is not from, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event.

Events

Approval

event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)

ApprovalForAll

event ApprovalForAll(address indexed owner, address indexed operator, bool approved)

CollectFee

event CollectFee(address indexed pool, address indexed recipient, uint256 indexed positionId, uint256 token0, uint256 token1)

DecreaseLiquidity

event DecreaseLiquidity(address indexed pool, address indexed owner, uint256 indexed positionId, uint256 amount0, uint256 amount1, uint128 liquidity);

IncreaseLiquidity

event IncreaseLiquidity(address indexed pool, address indexed owner, uint256 indexed positionId, uint256 amount0, uint256 amount1, uint128 liquidity);

Transfer

event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)

Last updated