Flash loan arbitrage
2
Steps (conceptual)
function flashArbitrage(uint256 amount) external {
address[] memory targets = new address[](5);
bytes[] memory datas = new bytes[](5);
// Step 1: Initiate flash loan
targets[0] = address(aave);
datas[0] = abi.encodeWithSelector(
Aave.flashLoan.selector,
address(upm),
address(WBTC),
amount,
// ... flash loan params
);
// Steps 2-4 are executed within the flash loan callback
upm.doBatchCalls(targets, datas);
}Last updated