Liquidity Provision
Mint
Function:
mintPull liquidity of a token pair from
msg.sender(should have approved enough amount), provide liquidity to Uniswap v3 pool, keep the liquidity position NFT in Particle contract. At the same time, createLiquidityPosition.Infoto bookkeep the ownership oftokenIdtomsg.sender.
Increase liquidity
Function:
increaseLiquidityIncrease liquidity to existing
tokenIdvia Uniswap’s NonfungiblePositionManager.Note: there are two internal functions of
increaseLiquidity. The external facing one (takeslpsstorage as calldata input) authenticates the caller. The inner function is used in two cases: (1) this external facing function for an LP to add liquidity and (2) returning liquidity back to LP when closing a position in_closePosition.
Decrease liquidity
Function:
decreaseLiquidityDecrease liquidity from existing
tokenIdvia Uniswap’s NonfungiblePositionManager.Note: the decreased liquidity is stored in owed tokens. Withdrawing the actual amount needs the
collectLiquidityfunction below.Note: similar to
increaseLiquidity, there are two internal functions ofdecreaseLiquidity. The external one (takeslpsstorage as calldata input) authenticates the caller. The inner function is used in two cases: (1) this external facing function for an LP to decrease liquidity and (2) borrowing liquidity from an LP position inopenPosition.
Collect liquidity
Function:
collectLiquidityCollect fees and liquidity from owed tokens to the caller (LP) wallet.
Note: there are two internal functions of
collectLiquidity. The external one (takeslpsstorage as calldata input) authenticates the caller. The inner function is used in two cases: (1) this external facing function for an LP to collect fees and (2) borrowing liquidity from an LP position inopenPosition.Note: this function imposes
amountMaxsuch that borrowing liquidity wouldn’t withdraw more amounts than requested.
Last updated