Uniswap V3 LP NFT Wrapper
Structure of NaftaWrapper
/// @notice Wraps Uniswap V3 NFT
/// @param tokenId The ID of the uniswap nft (minted wrappedNFT will have the same ID)
function wrap(uint256 tokenId) external {
nftOwners[tokenId] = msg.sender;
_safeMint(msg.sender, tokenId);
IERC721(uniV3Address).safeTransferFrom(msg.sender, address(this), tokenId);
}
/// @notice Unwraps Uniswap V3 NFT
/// @param tokenId The ID of the uniswap nft (minted wrappedNFT has the same ID)
function unwrap(uint256 tokenId) external {
require(nftOwners[tokenId] == msg.sender, "Only owner can unwrap NFT");
require(ownerOf(tokenId) == msg.sender, "You must hold wrapped NFT to unwrap");
_burn(tokenId);
IERC721(uniV3Address).safeTransferFrom(address(this), msg.sender, tokenId);
}Last updated
Was this helpful?