Skip to content

cdw3lch/triangleArbitrageBot

Repository files navigation

Triangle Arbitrage Bot (Solidity + JavaScript)

A cross-exchange triangle-arbitrage system for Uniswap V3 and PancakeSwap V3: a Solidity execution contract plus a Node.js event listener that watches for price discrepancies across three token pairs and executes the trade on-chain when it is profitable. Includes a Hardhat test suite and configurable tokens, fees, and thresholds.

What this demonstrates: on-chain and off-chain integration (a smart contract driven by a JavaScript monitor), pricing with Uniswap/PancakeSwap Quoter contracts, and a configurable, testable multi-file project structure.

Educational implementation. Not audited; do not use with real funds.

Features

  • Monitors real-time swap events on Uniswap V3 and PancakeSwap V3.
  • Detects price differences across token pairs between exchanges.
  • Simulates trades with Quoter contracts before committing.
  • Executes profitable trades through a deployed arbitrage contract.
  • Fully configurable token pairs, fees, and minimum price-difference thresholds.
  • Structured to run across multiple EVM chains (Polygon, Arbitrum, BSC, and others).

Tech stack

Solidity (arbitrage contract) · Hardhat (dev, local chain, tests) · Ethers.js (chain interaction) · Node.js (bot and helper scripts) · Uniswap V3 and PancakeSwap V3 · optional Balancer flash loans for on-chain liquidity.

Project structure

triangleArbitrageBot/
├── contracts/          # Arbitrage smart contract(s)
├── helpers/            # Setup, initialization, and utility modules
├── scripts/            # Deploy and manipulation scripts
├── test/               # Hardhat tests
├── bot.js              # Main monitoring and execution loop
├── config.json         # Token pairs, exchanges, and thresholds
├── hardhat.config.js   # Hardhat configuration
└── .env.example        # Environment variable template

Run it locally

npm install
cp .env.example .env     # add your RPC / provider keys
npx hardhat test         # run the test suite
node bot.js              # start the monitor (uses config.json)

Token pairs, exchange addresses, fee tiers, and the profit threshold are all set in config.json, so the same bot can target different pairs or chains without code changes.

About

A cryptocurrency trading bot for triangle arbitrage on decentralized exchanges.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors