
Compute optimal input amounts, profit thresholds, and gas costs for cross-DEX flash loan arbitrage on Polygon Mainnet. Uses the AMM constant-product formula for Uniswap V2-compatible liquidity pairs.
Calculation Output
Learn the core concepts behind cross-DEX flash loan arbitrage on Polygon Mainnet. Each concept below is essential for configuring and operating emerald-bot profitably.
The Constant Product AMM formula x × y = k governs Uniswap V2 and SushiSwap pools on Polygon. When you swap token A for token B, the pool reserves shift along this hyperbolic curve — the price at any point is the ratio of the two reserves. Our calculator computes the optimal input amount using real-time pool data to maximize arbitrage profit across multiple DEX hops.
Slippage is the difference between the expected trade price and the executed price. Large swaps shift the pool reserve ratio significantly, causing higher price impact on each hop. Setting the correct slippage tolerance ensures your transaction completes without reverting, while protecting against excessive price movement during execution on Polygon Mainnet.
Every transaction on Polygon Mainnet costs MATIC for gas. Our calculator estimates total gas based on current network conditions, Solidity contract complexity, and the number of swap hops in your arbitrage path. Optimizing gas usage is critical — a profitable arbitrage on paper can become a net loss after execution costs are deducted.
The minProfitThreshold is a safeguard hardcoded into the emerald-bot smart contract. After the Balancer V2 flash loan is repaid and all swaps complete, the contract verifies that your ending token balance exceeds the starting balance plus this threshold. Set it based on your risk tolerance, gas environment, and expected market volatility.
Explore the full documentation, study real arbitrage patterns on Polygon, and configure your bot for maximum profitability.
Learn More
No comments yet. Be the first!