Created
April 13, 2021 00:19
-
-
Save yuyasugano/68761e141ad50849d6d5b61f90e36e66 to your computer and use it in GitHub Desktop.
HashMaskFlanloan executeOperation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function executeOperation( | |
uint256[] calldata _ids, | |
// uint256[] calldata _amounts, | |
address initiator, | |
bytes calldata params | |
) external override returns (bool) { | |
// obtain NCT of specific NFTs | |
NCT.claim(_ids); | |
// Sell it on uniswap | |
address[] memory uni_path = new address[](2); | |
uni_path[0] = address(NCT); | |
uni_path[1] = address(WETH); | |
ROUTER_V2.swapExactTokensForTokens( | |
NCT.balanceOf(address(this)), | |
0, | |
uni_path, | |
address(this), | |
block.timestamp + 1 | |
); | |
// Transfer back wETH | |
WETH.transfer( | |
address(0x6fBa46974b2b1bEfefA034e236A32e1f10C5A148), | |
(WETH.balanceOf(address(this)) * 10) / 100 | |
); //transfer 10% to dao | |
WETH.transfer(initiator, WETH.balanceOf(address(this))); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment