From 3fb91b6136d671f70ad1d918955952bf026f1902 Mon Sep 17 00:00:00 2001 From: cryptoDev222 Date: Tue, 10 Aug 2021 10:18:33 -0500 Subject: [PATCH] implement burn function --- contracts/mainnet/connectors/uniswapV3/events.sol | 2 ++ contracts/mainnet/connectors/uniswapV3/helpers.sol | 10 ++++++++++ contracts/mainnet/connectors/uniswapV3/main.sol | 13 +++++++++++++ 3 files changed, 25 insertions(+) diff --git a/contracts/mainnet/connectors/uniswapV3/events.sol b/contracts/mainnet/connectors/uniswapV3/events.sol index 0e64e70b..2be7aac0 100644 --- a/contracts/mainnet/connectors/uniswapV3/events.sol +++ b/contracts/mainnet/connectors/uniswapV3/events.sol @@ -28,4 +28,6 @@ contract Events { uint256 amtIn, uint256 amtOut ); + + event burn(uint256 tokenId); } diff --git a/contracts/mainnet/connectors/uniswapV3/helpers.sol b/contracts/mainnet/connectors/uniswapV3/helpers.sol index 9c098756..306b1dab 100644 --- a/contracts/mainnet/connectors/uniswapV3/helpers.sol +++ b/contracts/mainnet/connectors/uniswapV3/helpers.sol @@ -127,6 +127,9 @@ abstract contract Helpers is DSMath, Basic { (tokenId, liquidity, amount0, amount1) = nftManager.mint(params); } + /** + * @dev Check if token address is etherAddr and convert it to weth + */ function _checkETH( uint256 _tokenId, uint256 _amount0, @@ -233,4 +236,11 @@ abstract contract Helpers is DSMath, Basic { ); amountOut = swapRouter.exactInputSingle(params); } + + /** + * @dev Burn Function + */ + function _burn(uint256 _tokenId) internal { + nftManager.burn(_tokenId); + } } diff --git a/contracts/mainnet/connectors/uniswapV3/main.sol b/contracts/mainnet/connectors/uniswapV3/main.sol index cda8576b..40987e17 100644 --- a/contracts/mainnet/connectors/uniswapV3/main.sol +++ b/contracts/mainnet/connectors/uniswapV3/main.sol @@ -183,6 +183,19 @@ abstract contract UniswapResolver is Helpers, Events { _eventName = "collect(uint256,uint256,uint256)"; _eventParam = abi.encode(tokenId, amount0, amount1); } + + /** + * @dev Burn Function + */ + function burnNFT(uint256 tokenId) + external + payable + returns (string memory _eventName, bytes memory _eventParam) + { + _burn(tokenId); + _eventName = "burnPosition(uint256)"; + _eventParam = abi.encode(tokenId); + } } contract ConnectV2UniswapV3 is UniswapResolver {