Verified contractExactMIT
AaveV3FlashLoan714
Address0x285abb95abb7c17b0e82db7ef8108710df98ca38
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.24
- Same code
Only this contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- No
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,408,158
- Creation transaction
- 0x112adcf350…e4993ec4c8
FXRP.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/* ============================================================================
* AAVE V3 FLASH LOAN — 750,000 USDC — LIVE MAINNET VERSION
*
* Flow (mirrors your FXRP attack step structure):
* Step 1: requestFlashLoan() → gets 750,000 USDC temp liquidity
* Steps 2–4: executeAttackOperation() → YOUR manipulation/oracle logic
* Step 5: repay in same tx (or the whole thing reverts atomically)
*
* Deploy: no constructor args. Works in Remix with Injected Provider
* (MetaMask) on Ethereum Mainnet, Sepolia, or any chain with Aave V3
* (change the POOL + USDC constants below for non-Ethereum chains).
* ==========================================================================*/
/* ------------------------------ Interfaces ------------------------------- */
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount)
external returns (bool);
function balanceOf(address account) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function decimals() external view returns (uint8);
}
interface IPool {
/**
* @dev Flash loan (simple/single-asset version).
* @param receiverAddress contract that receives funds + callback
* @param asset token to borrow (USDC)
* @param amount amount to borrow
* @param params arbitrary data forwarded to callback
* @param referralCode 0 is fine
*/
function flashLoanSimple(
address receiverAddress,
address asset,
uint256 amount,
bytes calldata params,
uint16 referralCode
) external;
}
/* ╔════════════════════════════════════════════════════════════════════════╗
║ ⚙️ CREDENTIALS — ETHEREUM MAINNET ║
╚════════════════════════════════════════════════════════════════════════╝ */
address constant POOL_ADDRESS =
0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2; // ✅ Aave V3 Pool (live)
address constant USDC_ADDRESS =
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; // ✅ USDC (6 decimals, live)
uint256 constant FLASH_LOAN_AMOUNT = 750_000e6; // ✅ 750,000 USDC — attack Step 1
/* ══════════════════════════════════════════════════════════════════════════
CONTRACT
══════════════════════════════════════════════════════════════════════════ */
contract AaveV3FlashLoan714 {
address payable public immutable owner;
IERC20 private immutable usdc;
IPool private immutable pool;
// Bookkeeping / events
uint256 public lastFlashAmount;
uint256 public lastPremium;
address public attackTarget; // optional target vault (FXRP lending vault)
event FlashLoanReceived(uint256 amount, uint256 premium);
event FlashLoanRepaid(uint256 totalRepaid);
event ProfitsWithdrawn(uint256 usdcAmount, uint256 ethAmount);
event AttackLogicExecuted(uint256 usdcInHand);
modifier onlyOwner() {
require(msg.sender == owner, "NOT_OWNER");
_;
}
constructor() {
owner = payable(msg.sender); // deployer wallet = admin
usdc = IERC20(USDC_ADDRESS);
pool = IPool(POOL_ADDRESS);
}
/* ╔════════════════════════════════════════════════════════════╗
║ STEP 1 — Obtain temporary liquidity (750,000 USDC) ║
╚════════════════════════════════════════════════════════════╝ */
/// @notice Start the flow. Pass 0 to use the default 750,000 USDC,
/// or pass a custom amount (e.g. 1000e6 for a small test).
function requestFlashLoan(uint256 customAmount) external {
uint256 amount = customAmount == 0 ? FLASH_LOAN_AMOUNT : customAmount;
require(amount > 0, "ZERO_AMOUNT");
pool.flashLoanSimple(
address(this),
USDC_ADDRESS,
amount,
bytes(""),
0
);
}
/* ╔════════════════════════════════════════════════════════════╗
║ STEP 2–4 — manipulation / oracle / borrow logic goes here ║
╚════════════════════════════════════════════════════════════╝ */
/**
* @dev Aave V3 callback. You have `amount` USDC in-hand right now.
* - Price oracle desync / TWAP window / pump attack happens here
* - You MUST end with enough USDC to repay `amount + premium`,
* or the ENTIRE transaction reverts (atomic safety).
*/
function executeOperation(
address ,
uint256 amount,
uint256 premium,
address initiator,
bytes calldata /* params */
) external returns (bool) {
require(msg.sender == POOL_ADDRESS, "CALLER_NOT_POOL"); // Aave security check
require(initiator == address(this), "BAD_INITIATOR");
lastFlashAmount = amount;
lastPremium = premium;
emit FlashLoanReceived(amount, premium);
// ---- YOUR STRATEGY GOES HERE (Steps 2–4) ----
//
// Example placeholders (all safe to keep; only runs what's enabled):
//
// 1. Swap / pump a shallow FXRP pool:
// IRouter(someDex).swapExactTokensForTokens(amount/2, ...);
//
// 2. Read an oracle to detect desynchronization:
// uint256 p = IFXRPOracle(attackTarget).getManipulationResistantPrice();
//
// 3. Borrow against collateral in the FXRP vault (attack step 5):
// IFXRPVault(attackTarget).borrowUSDC(...);
//
// For now, just prove the loan arrived:
emit AttackLogicExecuted(usdc.balanceOf(address(this)));
/* ╔════════════════════════════════════════════════════════════╗
║ STEP 5 — Repay (amount + premium) in the SAME transaction ║
╚════════════════════════════════════════════════════════════╝ */
uint256 totalDebt = amount + premium;
require(
usdc.balanceOf(address(this)) >= totalDebt,
"CANNOT_REPAY_FLASH_LOAN" // must profit elsewhere first
);
usdc.approve(POOL_ADDRESS, totalDebt);
emit FlashLoanRepaid(totalDebt);
return true;
}
/* ╔════════════════════════════════════════════════════════════╗
║ Utilities & admin ║
╚════════════════════════════════════════════════════════════╝ */
/// @notice Connect this contract to your FXRP vault for attack/defense tests.
function setAttackTarget(address target) external onlyOwner {
attackTarget = target;
}
/// @notice Withdraw leftover USDC (profit) to owner.
function withdrawUSDC() external onlyOwner {
uint256 bal = usdc.balanceOf(address(this));
require(bal > 0, "NO_USDC");
require(usdc.transfer(owner, bal), "USDC_TRANSFER_FAILED");
emit ProfitsWithdrawn(bal, 0);
}
/// @notice Withdraw any ETH stuck here (e.g., WETH unwraps).
function withdrawETH() external onlyOwner {
uint256 bal = address(this).balance;
require(bal > 0, "NO_ETH");
(bool sent, ) = owner.call{value: bal}(""); // modern .call pattern
require(sent, "ETH_TRANSFER_FAILED");
emit ProfitsWithdrawn(0, bal);
}
/// @notice Let the contract receive ETH.
receive() external payable {}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.