Light
Dark
← Back to Portfolio
Automated Trading Bot

MIDAS

Modular Intelligence Designed to Automate Smart contracts. An automated crypto arbitrage bot that exploits price inefficiencies across decentralised exchanges using flash loan arbitrage on the Ethereum Virtual Machine. No upfront capital required. Fully autonomous. Executes in a single atomic transaction.

SolidityTypeScriptEthers.jsHardhatFlash LoansEVMDeFi
Overview

About the Project

Flash loan arbitrage is one of the most technically demanding strategies in decentralised finance. A flash loan is an uncollateralised loan that must be borrowed and repaid within the same blockchain transaction. If the loan is not repaid by the end of that transaction, the entire operation is reverted as though it never happened, meaning zero risk of lost capital. MIDAS exploits this by borrowing large sums, executing trades across multiple decentralised exchanges where price discrepancies exist, and repaying the loan plus fees, all within a single atomic transaction on the Ethereum blockchain.

The Ethereum Virtual Machine is the runtime environment that powers all smart contracts on Ethereum and EVM-compatible chains. Every transaction, token swap, and DeFi interaction is executed as bytecode on the EVM. MIDAS operates entirely on-chain through custom Solidity smart contracts that encode the full arbitrage logic: borrow from a lending protocol, swap across DEX pairs where prices are misaligned, capture the profit spread, repay the flash loan, and pocket the difference. The entire sequence executes in a single block with no human intervention.

The bot continuously monitors liquidity pools across decentralised exchanges like Uniswap, SushiSwap, and PancakeSwap, scanning for price inefficiencies in real time. When a profitable route is detected, MIDAS simulates the transaction off-chain to verify profitability after gas costs, then submits the transaction to the mempool. The modular architecture means new DEXs, lending protocols, and token pairs can be plugged in without rewriting core logic.

Features

Key Functionality

  • Flash Loan Execution
    Borrows uncollateralised capital, executes multi-hop swaps, and repays the loan in a single atomic transaction. If any step fails, the entire operation reverts.
    Flash Loan Execution
  • Cross-DEX Arbitrage
    Scans price discrepancies across Uniswap, SushiSwap, PancakeSwap, and other AMMs to find profitable swap routes between token pairs.
    Cross-DEX Arbitrage
  • Solidity Smart Contracts
    Custom on-chain contracts encoding the full arbitrage logic: borrow, swap, validate profit, repay. Immutable, trustless, and fully autonomous.
    Solidity Smart Contracts
  • EVM Execution
    Runs entirely on the Ethereum Virtual Machine. Every operation is executed as bytecode across EVM-compatible chains including Ethereum, BSC, and Polygon.
    EVM Execution
  • Real-Time Pool Monitoring
    Continuously monitors liquidity pool reserves and pricing across multiple decentralised exchanges, detecting profitable opportunities in milliseconds.
    Real-Time Pool Monitoring
  • Off-Chain Simulation
    Simulates transactions locally before submitting to the mempool. Verifies profitability after gas costs to avoid unprofitable executions.
    Off-Chain Simulation
  • Modular Architecture
    New DEXs, lending protocols, and token pairs plug in without rewriting core logic. Each module handles its own swap interface and routing.
    Modular Architecture
  • Atomic Risk Model
    Zero capital risk by design. Flash loans must be repaid within the same transaction or the entire operation reverts. No liquidation, no exposure.
    Atomic Risk Model
  • Multi-Chain Support
    Deploys across any EVM-compatible blockchain. One contract architecture that works on Ethereum mainnet, Binance Smart Chain, Polygon, and Arbitrum.
    Multi-Chain Support
Reflection

What I Learned

01Writing production Solidity smart contracts with gas optimisation and security-first design patterns.
02Understanding the Ethereum Virtual Machine at the bytecode level and how transactions are executed on-chain.
03Implementing flash loan integrations with Aave and dYdX lending protocols.
04Building real-time monitoring systems that track liquidity pool reserves across multiple DEX protocols.
05Designing modular contract architectures where new swap interfaces plug in without redeployment.
06Simulating complex multi-hop swap transactions off-chain to verify profitability before execution.
07Managing gas estimation and transaction pricing strategies to ensure profitable execution.
08Working with Ethers.js and Hardhat for contract deployment, testing, and mainnet interaction.
09Understanding automated market maker mechanics including constant product formulas and slippage calculation.
10Navigating mempool dynamics and front-running risks in competitive DeFi arbitrage environments.