Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created April 12, 2021 13:10
Show Gist options
  • Save yuyasugano/3620333d6bd3ae1be994aea6ded6a994 to your computer and use it in GitHub Desktop.
Save yuyasugano/3620333d6bd3ae1be994aea6ded6a994 to your computer and use it in GitHub Desktop.
HashMaskFlash flashloan
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