Assessment reports>Singularity>Discussion>Removed Uniswap positions are kept

Removed Uniswap positions are kept in the ERC-721 pool

When a Uniswap liquidity position is removed by the user, the Uniswap NonfungiblePositionManager NFT for that (now empty) position is not burned but transferred back to the ERC-721 asset pool, as can be seen in the UniswapLiquidityAssetManager contract's uniswapRemoveLiquidity function:

function uniswapRemoveLiquidity(
    UniswapRemoveLiquidityArgs memory args,
    bytes calldata proof
)
    public
    returns (
        TransferFundsToVaultWithFeesAndCreateNoteData memory dataToken1,
        TransferFundsToVaultWithFeesAndCreateNoteData memory dataToken2
    )
{

    // ...

    nonfungiblePositionManager.decreaseLiquidity(
        _prepareRemoveLiquidityParams(args, liquidity)
    );

    (uint256 amount0, uint256 amount1) = nonfungiblePositionManager.collect(
        _prepareCollectFeeParams(args.positionNote.amount)
    );

    _transferERC721PositixonToVault(args.positionNote.amount);

    // ...
}

As there will be no notes associated to this NFT — and as even if there were, there would be no way to add liquidity to an existing position — it is unnecessary to keep the NonfungiblePositionManager NFT around. It might thus be cleaner to burn it instead:

nonfungiblePositionManager.decreaseLiquidity(
    _prepareRemoveLiquidityParams(args, liquidity)
);

(uint256 amount0, uint256 amount1) = nonfungiblePositionManager.collect(
    _prepareCollectFeeParams(args.positionNote.amount)
);

- _transferERC721PositixonToVault(args.positionNote.amount);
+ nonfungiblePositionManager.burn(args.positionNote.amount);

Singularity changed the contract to instead burn NFTs when a position is removed. The changes were implemented in

Zellic © 2024Back to top ↑