Cross-chain DCA on 1inch chains: WETH→WBTC on Base & beyond, live fills & cancel anytime
This project is a cross‐chain Dollar-Cost Averaging (DCA) platform built end-to-end on 1inch-compatible networks. Users deposit WETH into a custom Vault on Base, and a Node.js orchestrator slices that deposit into timed Limit Orders on 1inch’s orderbook, automatically accumulating WBTC over days or weeks. The Next.js/React UI shows your live vault balance, real-time price ratio, fill history, and lets you cancel any active DCA and withdraw immediately. We also include a Python HTLC demo for non-EVM bidirectional swaps. All token transfers and order executions happen on Base Sepolia (with testnet Limit Order Protocol contracts deployed), ready to demo on-chain flows in real time.
Frontend: Next.js + React + Tailwind CSS, with SWR hooks for polling /api/price and /api/fill. Wagmi/Viem handle on-chain reads (vaultBalanceOf, currentOrder, dcaParamsOf) and writes (deposit, cancelOrder, withdraw).
Orchestrator: Node.js service using ethers.js + @1inch/limit-order-sdk to:
Watch for Vault’s DCAStarted event
Compute slice parameters & sign TWAP orders
Submit to 1inch orderbook and stream fills via WebSocket
POST each fill back to the frontend /api/fill
Vault contract: Solidity on Base Sepolia, stores per‐user WETH balances, HTLC-style timelock, and emits DCAStarted/DCACancelled.
Non-EVM demo: Python script with python-bitcoinlib builds a P2WSH HTLC script, showing bidirectional swap on Bitcoin testnet.
Tech stack: React hooks, SWR, wagmi/Viem, Ethers.js, 1inch SDK, Chainlink price guard, OpenZeppelin ReentrancyGuard, Python-Bitcoinlib for HTLC.