Smart TWAPer

Smart TWAPer splits big swaps into secure, automated trades using 1inch and EIP-7702 smart accounts.

Smart TWAPer

Created At

ETHGlobal Prague

Winner of

1inch - Extend Limit Order Protocol 1st place

Project Description

๐ŸŒ Smart TWAPer

Smart TWAPer is a decentralized application (dApp) proof of concept designed to empower DeFi users to execute large token swaps intelligently by splitting them into smaller, time-scheduled trades. Built atop the robust 1inch limit order protocol and leveraging EIP-7702 smart accounts alongside ERC-1271 signatures, Smart TWAPer delivers secure, efficient, and automated trade execution crafted specifically for todayโ€™s dynamic DeFi ecosystem.

 

๐Ÿ’ก What is Smart TWAPer?

Smart TWAPer allows users to swap large amounts of tokens over time, following a time-weighted average price (TWAP) strategy. Instead of performing a single, potentially market-disrupting transaction, the system breaks the trade into smaller limit orders placed at regular intervals. These scheduled trades run automatically through smart account logic, eliminating the need for users to monitor or sign each individual step.

At its core, Smart TWAPer integrates:

  • 1inchโ€™s deep aggregated liquidity for optimal routing and best prices
  • EIP-7702 smart accounts for programmable and gas-efficient trade management
  • ERC-1271 signatures for secure off-chain authorization without requiring repetitive on-chain approvals

 

๐Ÿ” Why Does It Matter?

In todayโ€™s fast-paced DeFi markets, executing large trades comes with several challenges:

  • High slippage can erode returns by worsening the execution price
  • Market impact often moves the price unfavorably during execution
  • Visibility to bots opens up the risk of front-running and MEV (maximum extractable value) attacks
  • Manual execution burdens force traders to constantly watch the market to avoid missed opportunities or mistakes

Smart TWAPer addresses these pain points by providing a secure, automated execution layer that:

  • Minimizes slippage
  • Reduces MEV risks
  • Optimizes trade outcomes
  • Gives the user full control through a programmable smart account

 

โš™ How Does It Work?

  1. Smart Account Setup
    The user connects their wallet and either deploys or links an EIP-7702 smart account, a programmable on-chain entity capable of holding tokens and executing advanced logic.

  2. Configure TWAP Order
    The user defines the swap details:

    • Which tokens to swap
    • How much to trade
    • Over what duration and frequency
    • Under what price or slippage conditions
  3. Sign Once, Execute Many
    Instead of manually signing every individual trade, the user signs a master intent or authorization. The smart account verifies this using ERC-1271, enabling secure off-chain signature validation.

  4. Automated Execution
    Smart TWAPer executes each scheduled trade chunk via the 1inch limit order protocol, checking current market prices and conditions at every interval. Execution can be triggered by backend bots or decentralized automation networks like Gelato or Chainlink Automation.

  5. Completion and Settlement
    After the TWAP schedule completes, the swapped tokens are collected and (optionally) sent back to the userโ€™s main wallet. Users can monitor, adjust, or cancel the strategy at any time.

 

๐ŸŒŸ Key Benefits

  • Better Prices, Less Slippage โ†’ Breaking up large trades into smaller pieces reduces price impact
  • MEV and Front-Running Resistance โ†’ Smaller, less predictable orders lower the risk of exploitation
  • Non-Custodial, User-Controlled โ†’ Smart accounts hold the assets, ensuring users remain in full control at all times
  • Gas-Efficient Execution โ†’ ERC-1271 signatures eliminate the need for repetitive on-chain approvals
  • Deep Liquidity Access โ†’ 1inchโ€™s sophisticated routing delivers the best aggregated prices across the DeFi landscape
  • Hands-Off Automation โ†’ Once configured, execution runs automatically without requiring constant user oversight

How it's Made

๐Ÿ”ง Technical Deep Dive

 

Smart Contract Infrastructure

At the heart of Smart TWAPer is our flagship DelegatedWallet contract (1,674 lines of behemoth Solidity), providing the backbone for execution:

  • EIP-1271 integration for smart contract signatures enabling seamless 1inch limit order creation
  • Dutch Auction Engine for sophisticated price discovery and optimal execution
  • Batch Swap Orchestration to split large trades into customizable chunks
  • On-Chain TWAP Registry for fully decentralized order management and transparent execution tracking

 

EIP-7702: The Game Changer

  • Turns EOAs into programmable smart wallets without giving up custody
  • One-time signature enables repeated TWAP strategy execution
  • Sponsors can subsidize gas for a truly gasless user experience
  • Contract state lives directly at the userโ€™s address, preserving full self-sovereignty

 

๐Ÿค Partner Technology Integration

 

1inch Limit Order Protocol

  • Direct integration with OrderRegistrator (0x2339f78e2Ec15C47Cf042F2460C532C0D7ff1CCE)
  • Smart contract acts as an advanced market maker
  • Each TWAP slice becomes an independent, incentivized limit order
  • Dual execution:
    • On-chain via AggregationRouterV6
    • Off-chain via OrderRegistrator

 

Development Stack

  • Foundry/Forge for blazing-fast development and testing
  • 1inch API to integrate real-time price feeds during order executions
  • Automation bots for monitoring and execution triggers
  • Blockscout integration for enhanced EIP-7702 transaction visibility and tracking

 

๐Ÿš€ Notable Technical Innovations

  1. Real-Time Price Integration (FFI)
  2. Just-In-Time Token Approvals
  3. Dynamic Order Generation:
    • Precision-calculated executor incentives
    • Time-windowed execution constraints
    • Price deviation protection relative to benchmarks
    • Cryptographically unique salts to prevent order collisions

 

๐Ÿ”„ Execution Flow

  1. Delegation โ†’ User authorizes DelegatedWallet (one-time EIP-7702 setup)
  2. Registration โ†’ TWAP parameters committed on-chain
  3. Monitoring โ†’ Decentralized executor network scans for opportunities
  4. Execution โ†’ Time-triggered 1inch limit orders
  5. Settlement โ†’ Orders filled through 1inch liquidity
  6. Tracking โ†’ Full on-chain event logging for transparency

 

๐Ÿ›ก๏ธ Security Architecture

  • Replay protection using unique nonces for each order
  • Time-based distribution to prevent front-running attacks
  • Price oracles to verify market conditions and protect against manipulation
  • Economic incentives rewarding reliable executor behavior
  • EIP-7702 guarantees full custody stays with the user at all times

 

๐ŸŒŸ Why This Matters

Smart TWAPer represents a paradigm shift in DeFi execution:

  • Zero custody risk โ†’ assets never leave the userโ€™s control
  • Gasless trading โ†’ made possible through sponsor subsidies
  • MEV protection โ†’ limit orders provide robust execution guarantees
  • Decentralized execution โ†’ anyone can be a resolver, no central authority required
  • Wallet agnostic โ†’ works with any EOA, no migration needed

By combining EIP-7702โ€™s delegation powers with 1inchโ€™s proven limit order protocol, weโ€™ve built a trustless execution layer that makes sophisticated trading strategies simple, secure, and accessible. Users sign once, and the protocol handles everything else โ€” all while the user retains complete control.

 

๐Ÿ”€ Execution Flexibility

  • On-chain execution via AggregationRouterV6 for atomic swaps
  • Off-chain execution via OrderRegistrator for gas-efficient limit orders

Resolvers can dynamically choose the best execution path based on prevailing market conditions, ensuring optimal outcomes for users.

background image mobile

Join the mailing list

Get the latest news and updates