Created
April 12, 2021 13:10
-
-
Save yuyasugano/3620333d6bd3ae1be994aea6ded6a994 to your computer and use it in GitHub Desktop.
HashMaskFlash flashloan
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 flashLoan( | |
uint256[] calldata _ids, | |
// uint256[] calldata _amounts, | |
address _operator, | |
bytes calldata _params | |
) external flashloansEnabled() { | |
require(_ids.length < 80, "To many NFTs"); | |
for (uint8 index; index < _ids.length; index++) { | |
IERC721(nftAddress).safeTransferFrom( | |
address(this), | |
_operator, | |
_ids[index] | |
); | |
} | |
require( | |
IFlashLoanReceiver(_operator).executeOperation( | |
_ids, | |
// _amounts, | |
msg.sender, | |
_params | |
), | |
"Execution Failed" | |
); | |
for (uint8 index; index < _ids.length; index++) { | |
IERC721(nftAddress).transferFrom( | |
_operator, | |
address(this), | |
_ids[index] | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment