hackquest logo

Metacow

First social DEX with ERC-7715 automated copy trading. Follow traders, auto-copy swaps in <5s via MetaMask permissions. Real-time indexing by Envio. Fully non-custodial.

Videos

Description

MetaCow DEX - Social Trading with Automated Copy Trading

The First Social DEX with Under 5 Second Automated Copy Trading

metacow.vercel.app | Twitter @metacowdex | YouTube Demo

Powered by ERC-7715 Advanced Permissions & Envio Real-Time Indexing


What is MetaCow DEX?

A revolutionary decentralized exchange combining social trading with automated copy trading - follow successful traders and automatically replicate their trades in under 5 seconds without manual approvals.

The Magic

Trader swaps, Envio indexes in under 1 second, your trade executes automatically, all non-custodial.

One permission. Zero approvals. Infinite trades.


Hackathon Qualifications

Most Creative Use of Advanced Permissions ($3,000)

Novel Innovation: First-ever automated social copy trading using ERC-7715

  • Real Problem Solved: Eliminates approval fatigue (users normally need 10-20 approvals per day)

  • Session Account Pattern: Backend bot executes trades via delegated permissions

  • Fine-Grained Control: Daily spend limits per token (e.g., 10 USDC per day)

  • Time-Bounded Security: 30-day expiration with instant revocation

  • Production Ready: Fully functional demo with real blockchain transactions

The Flow:

User grants permission, session account created, bot monitors Envio, trader swaps, bot executes copy in under 5 seconds, user earns automatically.

Best Use of Envio

Critical Dependency: Copy trading impossible without Envio's speed

5 Key Integrations:

  1. Copy Trade Triggers: WebSocket notifications enable under 5 second execution

  2. Real-Time Social Feed: All swaps indexed instantly for transparent tracking

  3. Price Charts: Historical data powers trading analytics

  4. Volume Tracking: 24 hour volume and APR calculations

  5. User History: Complete trade history via GraphQL

Performance:

  • Sub-second indexing enables our core feature

  • GraphQL plus WebSockets for maximum flexibility

  • Indexes 4 event types: Swapped, LiquidityAdded, LiquidityRemoved, PairCreated

Best Social Media Presence

Active journey documentation on Twitter @metacowdex:

  • Development progress updates

  • ERC-7715 benefits showcases

  • Community engagement with @MetaMaskDev tags

  • Screenshots and demo videos


The Problem We Solve

Traditional Copy Trading:

  • 30-60 second execution delays

  • Manual approval per trade

  • Centralized custody

  • Opaque track records

  • Price slippage losses

MetaCow DEX:

  • Under 5 second execution

  • One-time permission

  • 100% non-custodial

  • On-chain reputation

  • Minimal slippage


Key Features

Automated Copy Trading

  • Set & Forget: Grant permission once with daily limits

  • Lightning Fast: Sub-5 second trade replication

  • Your Keys: Funds never leave your smart account

  • Full Control: Pause or revoke anytime

Social Trading Feed

  • Real-Time: Every trade appears instantly

  • Follow Top Traders: See their moves first

  • Engage: Like, comment, share strategies

  • Transparent: All trades on-chain and verified

Full DEX Functionality

  • Swap: Any token pair, 0.3% fees

  • Liquidity: Earn fees as LP provider

  • Rewards: Claim and auto-reinvest

  • Charts: Live price data

Reputation System

  • On-Chain Scores: Based on LP provision, profit and loss, engagement

  • Trust Badges: Identify top performers

  • Rankings: Discover best traders


Tech Stack

Core Technologies

  • ERC-7715 Advanced Permissions - Delegated transaction execution

  • MetaMask Smart Accounts Kit - Account abstraction (ERC-4337)

  • Envio - Sub-second blockchain indexing and GraphQL API

  • Pimlico - ERC-4337 bundler for gas optimization

Stack

  • Frontend: Next.js 14, TypeScript, Tailwind CSS, Viem

  • Backend: Railway, Node.js, MongoDB

  • Blockchain: Solidity 0.8.22, OpenZeppelin Upgradeable, UUPS Proxy

  • Network: BNB Testnet (EIP-7702 supported)


Architecture

User Interface (Next.js) connects to MongoDB plus Railway Backend, which connects to Envio Indexer (under 1 second latency), which connects to BNB Testnet Blockchain containing Factory Contract (UUPS), Pair Contracts (UUPS), and Smart Accounts (ERC-4337 plus 7715), which connects to Pimlico Bundler.

Copy Trading Flow

  1. Trader swaps

  2. Envio indexes event (under 1 second)

  3. Backend bot receives WebSocket notification

  4. Bot checks copy permissions

  5. Session account executes trade via ERC-7715

  6. Follower's trade completed (under 5 seconds total)

  7. Social feed updates in real-time


ERC-7715 Implementation

Permission Grant

User grants permission via MetaMask Flask with the following parameters: chain ID 97, expiry of 30 days from current time, session account address as signer, and permission type "erc20-token-periodic" with token address, period amount of 10 tokens per day, period duration of 1 day, and justification "Auto-copy trades with 10 USDC daily limit."

Security Features

  • Daily spending caps

  • Time-limited (30 days)

  • Revocable anytime

  • Token-specific

  • Non-custodial


Envio Integration

Configuration

Networks include BNB Testnet with ID 97 starting at block 44826265.

Contracts include MiniDexPair with events: Swapped, LiquidityAdded, and LiquidityRemoved.

GraphQL Queries

Queries retrieve latest swaps with user, input token, output token, input amount, output amount, and transaction hash data.

Real-Time Updates

WebSocket listens for incoming swap messages, retrieves copy permissions for the trader, and executes copy trades for all copiers automatically.


Smart Contracts

Files

  • MiniDexFactoryUpgradeable.sol - Pair creation and reputation management

  • MiniDexPairUpgradeable.sol - AMM logic, swaps, liquidity, rewards

Key Features

  • UUPS Upgradeable - Future-proof without redeployment

  • Constant Product AMM - x times y equals k formula

  • 0.3% Trading Fees - Distributed to LP providers

  • On-Chain Reputation - Score calculation in contract

  • LP Rewards - Claimable plus auto-reinvest

Core Functions

Trading functions include swap. Liquidity functions include add liquidity and claim and reinvest. Analytics functions include get reputation score and get APR.


Tokenomics

Fee Structure

Swap Fee: 0.3%, with 100% going to LP Providers.

Reputation Scoring

Score equals LP Share divided by 1e14 (maximum 10,000 points), plus Rewards Claimed divided by 1e16 (engagement bonus), plus Trading Profit divided by 1e16 (success bonus), minus Trading Loss divided by 1e16 (risk penalty).

Example: User with 10% LP, 50 USDC rewards, 200 USDC profit, 30 USDC loss receives a score of 32,000 points (10,000 plus 5,000 plus 20,000 minus 3,000).


Deployment

Live URLs

  • Frontend: metacow.vercel.app

  • Backend: Railway (session accounts plus copy bot)

  • Envio: GraphQL endpoint plus WebSocket

Network

BNB Smart Chain Testnet (Chain ID: 97) with Factory and Pairs (TKA/TKB, TKA/USD, TKB/USD), verified on BscScan.


Demo Guide

Quick Start

  1. Install MetaMask Flask

  2. Visit metacow.vercel.app

  3. Connect wallet

  4. Make a swap or enable copy trading

Copy Trading Setup

  1. Find a trader in Social feed

  2. Click "Auto Copy"

  3. Set daily limit (e.g., 10 USDC)

  4. Approve permission in MetaMask Flask

  5. Done! Future trades auto-copy in under 5 seconds


Developer

Dhruv Pancholi - Solo Developer


Resources

Documentation

  • MetaMask Smart Accounts Kit

  • ERC-7715 Specification

  • Envio Docs


Acknowledgments

  • MetaMask Team - ERC-7715 innovation

  • Envio Team - Blazing-fast indexing

  • OpenZeppelin - Secure contract libraries

  • Pimlico - ERC-4337 infrastructure


Trade Smarter, Not Harder

Built for MetaMask Advanced Permissions Dev Cook-Off

Last Updated: December 26, 2025 | Version: 1.0.0 | Status: Live

Progress During Hackathon

95% build is done

Tech Stack

Ethers
Web3
Next
Node
Solidity
Metamask Flask

Fundraising Status

50$ in Fair3hackathon

Team Leader
DDHRUV PANCHOLI
Sector
DeFiSocialFiOther