Disclaimer: This project is an open-source arbitrage agent prototype for educational and research purposes only. It is NOT production-ready software. Use at your own risk. See RISK_DISCLOSURE.md for full details.
MantleArb is a research prototype that explores automated arbitrage strategies on the Mantle Network. It demonstrates how an AI-assisted agent can identify potential arbitrage opportunities across DEXs on the Mantle blockchain.
This is NOT:
- A guaranteed profit-making tool
- A production-grade trading system
- Financial advice of any kind
This software is provided for educational and research purposes only. Cryptocurrency trading and arbitrage carry significant financial risk, including but not limited to: total loss of funds, smart contract exploits, impermanent loss, slippage, gas costs, and market volatility. The authors and contributors accept no liability for any financial losses incurred through the use of this software. You are solely responsible for your own trading decisions and any resulting financial outcomes.
The AI components in this system operate under the following constraints:
- AI decisions are advisory only — all AI-generated trade recommendations are suggestions, not autonomous actions
- Human approval is required — no trade is executed without explicit human confirmation (or a pre-configured execution policy set by the user)
- AI does not control funds — the AI module never has direct access to private keys or wallet signing authority
- AI recommendations may be wrong — models can hallucinate, miscalculate, or be misled by market anomalies
- Deterministic safety checks override AI — profit threshold checks, slippage limits, and whitelist validations always take precedence over AI suggestions
┌─────────────────────────────────────────────────────┐
│ MantleArb Agent │
├──────────┬──────────┬──────────┬────────────────────┤
│ Market │ AI │ Safety │ Execution │
│ Monitor │ Advisor │ Layer │ Engine │
│ │ │ │ │
│ • Price │ • LLM/ │ • Router │ • Tx Builder │
│ Feed │ Model │ Whitelist│ • Gas Estimator │
│ • Pool │ • Signal │ • Token │ • Nonce Manager │
│ Scanner│ Gen │ Whitelist│ • Retry Logic │
│ • Depth │ • Risk │ • Profit │ • MEV Protection │
│ Book │ Score │ Check │ │
├──────────┴──────────┴──────────┴────────────────────┤
│ Mantle Network (Chain RPC) │
└─────────────────────────────────────────────────────┘
| Component | Role | Autonomy Level |
|---|---|---|
| Market Monitor | Fetches real-time prices and pool states from DEXs | Fully automated |
| AI Advisor | Analyzes market data and suggests potential arbitrage routes | Advisory only — outputs are suggestions |
| Safety Layer | Validates all trades against whitelists and profit thresholds | Hard block — overrides all other components |
| Execution Engine | Constructs, signs, and submits transactions | User-configurable auto/manual mode |
The Safety Layer is the most important component and operates independently of the AI:
- Router Whitelist: Only pre-approved DEX router contracts can be interacted with
- Token Whitelist: Only approved tokens can be included in arbitrage paths
- Profit Check: Trades below a minimum profit threshold (configurable) are rejected
- Slippage Protection: Maximum slippage is enforced per-trade
- Gas Limit: Maximum gas cost is enforced to prevent unprofitable trades
All API endpoints follow a unified path structure under /api/v1/:
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/status |
System health and status |
GET |
/api/v1/opportunities |
List detected arbitrage opportunities |
POST |
/api/v1/execute |
Execute an arbitrage trade (requires auth) |
GET |
/api/v1/config |
Get current configuration |
PUT |
/api/v1/config |
Update configuration (requires auth) |
GET |
/api/v1/history |
Trade history |
GET |
/api/v1/whitelist/routers |
Get router whitelist |
GET |
/api/v1/whitelist/tokens |
Get token whitelist |
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your settings
# Run in development mode (NO real trades)
npm run dev
# Run safety checks only
npm run checkSee config/default.json for all configuration options. Key safety settings:
{
"safety": {
"routerWhitelist": ["0x..."],
"tokenWhitelist": ["0x..."],
"minProfitThresholdBps": 50,
"maxSlippageBps": 100,
"maxGasCostWei": "100000000000000000"
}
}See FEATURE_STATUS.md for current implementation status of all features.
See SECURITY.md for security policies and vulnerability reporting.
See RISK_DISCLOSURE.md for full risk disclosure and financial disclaimers.
MIT — See LICENSE for details.
Contributions are welcome! Please read the security policy before submitting PRs.