← Code LabSolidity0/50 solved · 0%
DeFi · hard

43. Flash loan provider

Lend within a single tx.

Given `interface IBorrower { function onFlashLoan(uint256 amt, uint256 fee) external; }`, implement `flashLoan(IBorrower b, uint256 amt)` that transfers ether, calls back, then requires the contract balance has grown by `fee` (1% of `amt`).
Required in your answer: address(b).call{value: amt}b.onFlashLoan(amt, fee)address(this).balance >= before + fee