All the actions we need to interact with are pretty well summarized here: https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/INonfungiblePositionManager.sol
-
constructor()
:-
Calls
mint
and creates a new NFTPosition, with a NFT position id, all the bellow params will be included (most of them part ofINonFungiblePositionManager
. -
Input params:
(token0, token1,fee, tickLower, tickUpper, amount0 desired , amount1 desired, amount0 min, amount1 min)
-
As a result fills
UNISWAP_NON_FUNGIBLE_POSITION_ID
, which is unique per EP.
-
-
addLiquidity(uint256 _amount)
Adds liquidity to a specificpositionId
(previously created) -
redeem(uint256 _amount)
: Removes liquidity from a specific tokenID -
collect()
: Collect the fees associated to the NFT -
burn¿?
: It is included inINonfungiblePositionManager.sol
, consider if it makes sense to include it
Compared to UniswapV2 pricing the external position will be simpler, while it is still unknown to me if it'll be expensive.
The reason for this simplicity is that we will know the amount of assets owed to the contract, so we can just use primitives, and we don't need to calc the price.
Pseudocoding:
uint256 UNISWAP_NON_FUNGIBLE_POSITION_ID;
address TOKEN_0;
address TOKEN_1;
function getManagedAsset() external override returns (address[] memory assets_, uint256[] amounts_ ) {
assets_ = new address[](2);
amounts_ = new address[](2);
assets_ = [TOKEN_0, TOKEN_1];
for(uint256 i; i< nftIds; i++) {
// To be checked if there is a better way to retrieve this data (more efficient)
(, , ... , ..., ,.... , tokensOwed0, tokensOwed1) = INonfungiblePositionManager(UNISWAP_NON_FUNGIBLE_POSITION_ID).positions(`UNISWAP_NON_FUNGIBLE_POSITION_ID`);
amounts_ = [tokensOwed0, tokensOwed1];
}
}