Video thumbnail

Deport The Dip

Telegram bot + mini-app for one-click DeFi copy-trading with delegated wallets using Privy

Deport The Dip

Created At

ETHGlobal Cannes

Project Description

Deport-the-Dip turns a Telegram chat into a full-stack copy-trading platform:

  1. On-ramp – Users launch the bot, deep-link into a Telegram Mini-App, and connect any EVM wallet.
  2. Trade once, copy many – When the leader swaps tokens, followers’ wallets reproduce the exact swap seconds later, gas-adjusted.
  3. Real-time feedback – Both leader and followers receive instant DM confirmations with BscScan links plus a live leaderboard.

Behind the scenes a Next.js UI handles approvals/swaps, a gRPC DeFi server builds & (optionally) broadcasts raw PancakeSwap transactions, and a Telegraf bot stitches the flow together. Because signing is delegated to Privy server-auth, followers never expose their private keys yet still trade in lock-step with the leader. The result: social trading that feels as simple as pressing “Copy-trade ✅” in chat.

How it's Made

Telegram Bot: Bun + Express + Telegraf => Sets webhooks via ngrok, pipes swap events back to chat; mirrors Mini-App state changes. Mini-App: Next.js 14, React-Server Components, shadcn/ui => Runs inside Telegram Web Apps. Uses Privy React hooks for wallet connect, streams tx status with SSE. DeFi gRPC Server: Bun runtime, TypeScript, protobuf-gRPC => Two services: TransactionService (build/submit raw tx) and SwapService.ExecuteSwap (delegated copy). PancakeSwap router ABIs loaded at runtime. Persistence: Supabase Postgres and The Graph => Stores users & follower graph; row-level security locks each bot instance. Indexing / Stats: The Graph => not finished

Notable hacks & optimisations:

  • Allowance Helper auto-detects “already known” nonce-0 dup-tx errors, fires a self-transfer to consume the stuck nonce, bumps gas, then retries—zero manual babysitting.
  • Privy delegated wallets let followers sign server-side; we wrap it in getDelegatedSigner() so the same swap path works for both self-signed and copy-signed flows.
  • gRPC over Unix domain sockets inside the Bun process eliminates JSON encoding overhead between server handlers.
  • Cloudflared tunnels the Mini-App locally while preserving Telegram’s origin check—no need to deploy just for the demo.
background image mobile

Join the mailing list

Get the latest news and updates