Skip to content

smolmusk/arbi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arbi

Production-grade arbitrage executor with flash loans (Morpho, Balancer) and a Node.js strategy bot leveraging 0x Swap API.

Components

  • contracts: Solidity Executor with OpenZeppelin security (Ownable2Step, Pausable, ReentrancyGuard, SafeERC20).
  • bot: Typescript bot scanning pairs, sizing, quoting with 0x, and submitting private txs.
  • ops: Systemd service example.

Prerequisites

  • Foundry (forge 1.2+), Node.js 20+
  • Mainnet RPC and 0x API key (optional but recommended)

Deploy

cd contracts
forge build
export PRIVATE_KEY=0x...
export PAYOUT_WALLET=0xYourTreasury
export BOT_EXECUTOR=0xYourBotEOA
forge script script/Deploy.s.sol:Deploy --rpc-url $RPC_URL --broadcast -vvvv

Bot configuration

Create bot/.env:

RPC_URL=...
PROTECT_RPC=https://protect.flashbots.net
BOT_PRIVATE_KEY=0x...
EXECUTOR=0xDeployedExecutor
ZRX_API=https://api.0x.org/swap/v1/quote
ZRX_ORDERBOOK=https://api.0x.org/orderbook/v1
ZRX_API_KEY=your_key_optional
USDC=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
WETH=0xC02aaA39b223FE8D0a0e5C4F27eAD9083C756Cc2
MIN_PROFIT_USD=100000000
MAX_FLASH_USD=100000000000
GAS_BUFFER_USD=2000000
FLASH_SOURCE=morpho

Build and run:

cd bot
npm i
npm run build
node dist/index.js

Notes

  • Executor whitelists 0x ExchangeProxy and AllowanceTarget and restricts execute to configured bot EOAs.
  • Balancer flash loan is repaid explicitly; Morpho pull is approved once via forceApprove.
  • Profits are enforced in USDC and swept to payoutWallet each run.
  • Use private transactions to avoid frontrunning.

About

Arbitrage Flashloan Executor - For Orderbooks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published