Price Monitor
Cross-DEX liquidity and raw spread tracker. No execution capability.
Gas-Aware Arbitrage Simulator
Simulate trade execution accounting for DEX fees, slippage, and live network gas costs.
Flash Loan Mechanics
Theoretical overview of uncollateralized atomic borrowing.
What is a Flash Loan?
A flash loan allows you to borrow a massive amount of liquidity (up to the entire protocol's reserves) without providing upfront collateral, provided that the loan principal plus a small fee is returned within the exact same Ethereum transaction.
If your transaction fails to return the funds by the end of execution, the entire transaction reverts. To the blockchain, it is as if the loan never happened—meaning the only risk is the gas fee spent attempting the transaction.
The Execution Flow
- User triggers contract: You call your deployed smart contract.
- Request Loan: Your contract calls
flashLoanSimple()on Aave Pool. - Callback: Aave sends funds and invokes
executeOperation()on your contract. - Arbitrage logic: Inside the callback, trade on DEX A, then DEX B.
- Repayment: Aave pulls Principal + 0.05% fee via approval.
Smart Contract Anatomy (Theoretical)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import {FlashLoanSimpleReceiverBase} from "@aave/core-v3/contracts/flashloan/base/FlashLoanSimpleReceiverBase.sol";
contract FlashLoanArbitrage is FlashLoanSimpleReceiverBase {
function startArbitrage(address asset, uint256 amount) external {
// 1. Request the flash loan from Aave V3 Pool
// This will trigger Aave to send us funds and call executeOperation
POOL.flashLoanSimple(
address(this),
asset,
amount,
"",
0
);
}
// 2. Aave invokes this callback after sending us the requested asset
function executeOperation(
address asset,
uint256 amount,
uint256 premium,
address initiator,
bytes calldata params
) external override returns (bool) {
// 3. => Execute Arbitrage Logic Here <=
// swapExactTokensForTokens (DEX A) -> swapTokensForExactTokens (DEX B)
// 4. Approve Aave to pull the repayment (Principal + 0.05% premium)
uint256 amountToOwe = amount + premium;
IERC20(asset).approve(address(POOL), amountToOwe);
// Any remaining tokens in this contract constitute pure profit.
return true;
}
}* Note: You must deploy a smart contract implementing the receiver interface because an Externally Owned Account (EOA/wallet) cannot handle the synchronous callback required by Aave.
MEV & Flashbots Education
Understanding the dark forest of Ethereum transaction ordering.
The MEV Invisible Hand
Maximal Extractable Value (MEV) refers to the maximum value that can be extracted from block production in excess of the standard block reward and gas fees, achieved by including, excluding, or changing the order of transactions.
When you submit a profitable arbitrage transaction using MetaMask, it enters the public mempool. Sophisticated bots (Searchers) monitor this mempool constantly.
If they spot your profitable transaction, they will dynamically simulate it, calculate the exact profit, copy your transaction data, and submit it themselves with a massive tip.
Flashbots & The Supply Chain
Standard mempool gas-bidding wars (PGAs) severely congested the Ethereum network. The modern solution is an off-chain auction system.
Why Retail Cannot Compete
A retail trader using a web dashboard cannot execute traditional MEV arbitrage effectively for three reasons:
Searchers colocate their bare-metal servers physically near validator nodes in AWS/GCP data centers, saving precious milliseconds.
Top searchers write heavily optimized, multi-threaded bots in Rust or Go, bypassing slow Web3.js / Ethers.js wrappers.
Searchers execute via private endpoints (like Flashbots) so their bundles bypass the public mempool entirely, preventing theft.
Liquidation Analytics
How searchers profit from under-collateralized lending positions.
The Liquidation Mechanism
In DeFi lending protocols, loans are over-collateralized. Users deposit volatile assets (like ETH) to borrow stable ones (like USDC).
The protocol calculates a Health Factor (HF).
If HF > 1.0, the position is safe.
If HF < 1.0, the position becomes eligible for liquidation.
Like arbitrage, liquidations are executed by Searchers. When HF drops below 1.0, a searcher repays the user's debt on their behalf. In return, the protocol allows the searcher to seize a portion of the user's collateral at a significant discount (e.g., 5-10% below market price).
(Total Borrows)
Live Market Reserves (Aave V3 Mainnet)
| Market | Liquidity Risk | Total Supplied | Total Borrowed |
|---|---|---|---|
| Aave V3 (WETH) | Connecting... | Loading... | Loading... |
| Aave V3 (USDC) | Connecting... | Loading... | Loading... |
| Aave V3 (WBTC) | Connecting... | Loading... | Loading... |