Video thumbnail

ChainGains

dApp for options arbitrage trading secured by smart contracts.

ChainGains

Created At

ETHGlobal Cannes

Project Description

This project is a decentralized application (dApp) that enables users to perform options arbitrage trading secured by smart contracts. Users can identify profitable options-based arbitrage opportunities across multiple blockchains, buy into existing trades, or list their own for others to execute. All funds are locked and managed through trustless smart contract escrow, ensuring automatic settlement, profit distribution, or refunds if conditions are not met. The dApp integrates with the 1inch Limit Order Protocol to source optimal liquidity for swaps, execute limit orders efficiently, and maximize arbitrage profits. Additionally, the platform allows users to pay network gas fees with USDC stablecoins instead of native chain tokens, improving usability and simplifying transactions. The application connects to wallets like MetaMask and WalletConnect, supports Ethereum, Polygon, Arbitrum, and Optimism, and provides a responsive, intuitive interface built with React, TypeScript, Vite, Zustand, and Tailwind CSS. Users can track active trades, monitor their portfolio, configure risk settings such as slippage and trade limits, and use a demo mode for simulated strategies. Inspired by the Scaffold-ETH architecture, this dApp combines robust DeFi usability, secure cross-chain execution, and real-time arbitrage detection to make options arbitrage accessible, transparent, and trustless for everyday crypto users.

How it's Made

We built this project as a modular, trustless cross-chain options arbitrage dApp inspired by the Scaffold-ETH architecture. The core technologies include a React 18 frontend powered by Vite and TypeScript for fast development and hot module reloading. We use Tailwind CSS for responsive, utility-first styling, Zustand for state management, and React Query for data fetching and caching. Wallet connectivity is handled with Wagmi and RainbowKit, allowing users to connect via MetaMask, WalletConnect, or other EVM-compatible wallets.

On the smart contract side, our arbitrage logic is written in Solidity and designed to lock funds in escrow while enforcing trade execution conditions and settlement flows. We integrated the 1inch Limit Order Protocol to source the best available liquidity across DEXs for swaps within an arbitrage sequence — which significantly improves capital efficiency and reduces slippage for complex trades. For cross-chain scenarios, we utilize trusted bridging protocols to atomically move assets between chains where price spreads exist.

A notable usability feature is that users can pay gas fees in USDC stablecoins, which we implemented by wrapping the gas payment logic within our smart contract calls and leveraging existing paymaster patterns where supported — making the process simpler for users who don’t always hold native chain tokens.

On the frontend, trade opportunities are indexed using React Query hooks, and we designed a clear step-by-step flow for creating, listing, buying, and monitoring arbitrage trades. We simulate live price updates for demo mode, so users can test strategies risk-free. We also built fallback logic to handle failed bridging or expired opportunities gracefully, ensuring funds are safely returned.

One of our biggest hacky but clever moves was adapting the Scaffold-ETH example escrow contracts to support multi-party arbitrage trades with options pricing logic, bridging needs, and automated refunds — all with minimal gas cost by carefully structuring on-chain storage. We also used the 1inch SDK directly in our frontend to get live limit order quotes during trade simulation.

Overall, the combination of a flexible frontend stack, secure smart contract escrow, the 1inch Limit Order Protocol for optimal liquidity routing, cross-chain bridge support, and gas payments in stablecoins results in a seamless, trustless options arbitrage experience for DeFi traders.

background image mobile

Join the mailing list

Get the latest news and updates