Skip to content

Instantly share code, notes, and snippets.

@Aboudjem
Last active March 30, 2026 08:00
Show Gist options
  • Select an option

  • Save Aboudjem/7e6656b39514210a2ac59184a9a7c9f0 to your computer and use it in GitHub Desktop.

Select an option

Save Aboudjem/7e6656b39514210a2ac59184a9a7c9f0 to your computer and use it in GitHub Desktop.
Integra PRD: 13-dex

DEX

Owner: Nawar | Ship: Week 2 | Est: 0.5-1d | Chain: integra-testnet-1 (EVM 26218) URL: dex.integralayer.com

Overview

AMM decentralized exchange for Integra — Uniswap V2 architecture adapted for IRL token pairs. Supports swaps, pool creation, and liquidity provision. Core pairs: IRL/IRWA, IRL/PT, IRL/YT. This is foundational plumbing — without swap infrastructure, bonding curve graduates have nowhere to trade, yield tokens can't be priced, and the lending app can't liquidate collateral.

Features

  • Token Swap — Swap between any listed token pair with real-time price quotes, slippage protection, and deadline enforcement
  • Multi-Hop Routing — Automatic routing through intermediate pairs when no direct pair exists (e.g., PT -> IRL -> YT)
  • Liquidity Pools — Deposit equal value of both tokens into a pool, receive LP tokens representing pool share
  • Pool Creation — Create new trading pairs by depositing initial liquidity, setting the starting price
  • Remove Liquidity — Burn LP tokens to withdraw proportional share of both tokens from any pool
  • Pool Stats Dashboard — TVL, 24h volume, 7d volume, fee APR, and price charts per pool
  • Price Impact Warning — Visual warning when trade size would cause significant price impact
  • Fee Structure — 0.3% swap fee split: 0.25% to LPs, 0.05% to protocol treasury
  • Constant Product AMM — x * y = k pricing formula ensures continuous liquidity at all price levels
  • Token Listing — Any ERC-20 on Integra can be paired and traded permissionlessly
  • LP Token Tracking — View all LP positions, current value, fees earned, and impermanent loss

Functions

  • swapExactTokensForTokens — Swap with exact input amount and minimum output guarantee
  • addLiquidity — Deposit both tokens into a pool, receive LP tokens
  • removeLiquidity — Burn LP tokens, receive proportional share of both tokens
  • getAmountsOut — Price quote for a given input amount and swap path
  • createPair — Deploy a new pair contract for two tokens
  • getPair — Look up the pair contract address for any two tokens

User Flow

  1. Connect wallet via Web3Auth
  2. Select token pair and enter swap amount
  3. Review price quote with slippage estimate, confirm swap
  4. For liquidity: select a pair, deposit equal value of both tokens, receive LP tokens
  5. Monitor pool stats — TVL, volume, earned fees
  6. Remove liquidity at any time by burning LP tokens

Deliverables

  • Factory contract deployed (creates and indexes all pairs)
  • Pair contract (holds reserves, executes swaps, mints/burns LP tokens)
  • Router contract (user-facing swap and liquidity functions with safety checks)
  • Swap interface with token selector, price quotes, and slippage settings
  • Add/remove liquidity interface
  • Pool creation flow for new pairs
  • Pool stats page with TVL, volume, and fee APR per pool
  • Multi-hop swap routing
  • On-chain event emissions for all actions

Integration Points

  • Depends on: IRL token, all ERC-20 tokens on Integra
  • Used by: Bonding Curve (spec #11) graduates tokens here, Yield Splitter (spec #12) PT/YT tokens trade here, Lending app uses DEX prices as oracle, Liquidator (spec #32) sells seized collateral via swaps, GOB can route orders here for better execution
  • Explorer: Integra Explorer

XP Rewards

Action Points
First swap 20 XP
Each swap 5 XP
Create a new pool 50 XP
Add liquidity 25 XP
Provide liquidity for 7+ days 100 XP bonus
Remove liquidity 5 XP

Success Metrics

Metric Target
Total swap transactions 1,000+ in first month
Unique traders 200+ wallets
Total Value Locked (TVL) 500K+ IRL across all pools
Active trading pairs 10+ pairs
Average swap completion time < 5 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment