Skip to content

Instantly share code, notes, and snippets.

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

  • Save Aboudjem/22bc0915dd19e40a65ba066478a4cb25 to your computer and use it in GitHub Desktop.

Select an option

Save Aboudjem/22bc0915dd19e40a65ba066478a4cb25 to your computer and use it in GitHub Desktop.
Integra PRD: 13-dex (HTML)
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>PRD: DEX</title><style>*{margin:0;padding:0;box-sizing:border-box}body{background:#0A0A1A;color:#E8E8F0;font-family:'Inter',system-ui,sans-serif;line-height:1.7}a{color:#00CEC9;text-decoration:none}a:hover{text-decoration:underline}.hero{padding:48px 32px 36px;border-bottom:1px solid #2A2A4A;background:linear-gradient(135deg,#0A0A1A 0%,#1A1040 50%,#0A0A1A 100%)}.hero h1{font-size:2rem;font-weight:800;color:#fff;margin-bottom:8px}.hero .meta{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:12px}.badge{display:inline-block;padding:4px 12px;border-radius:6px;font-size:12px;font-weight:700}.badge-owner{background:rgba(108,92,231,0.15);color:#A29BFE;border:1px solid rgba(108,92,231,0.3)}.badge-week{background:rgba(0,206,201,0.15);color:#00CEC9;border:1px solid rgba(0,206,201,0.3)}.badge-est{background:rgba(0,184,148,0.15);color:#00B894;border:1px solid rgba(0,184,148,0.3)}.container{max-width:900px;margin:0 auto;padding:32px 24px}.section{background:#12122A;border:1px solid #2A2A4A;border-radius:12px;padding:24px;margin-bottom:20px}.section h2{font-size:0.8rem;font-weight:700;color:#8888AA;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:14px;padding-bottom:8px;border-bottom:1px solid #2A2A4A}.section h3{font-size:0.95rem;font-weight:600;color:#E8E8F0;margin:12px 0 6px}.section p{font-size:0.95rem;margin-bottom:8px}.section ul{list-style:none;padding:0}.section ul li{padding:6px 0 6px 20px;position:relative;font-size:0.95rem}.section ul li::before{content:'>';position:absolute;left:0;color:#A29BFE;font-weight:700;font-family:monospace}.section code{background:rgba(108,92,231,0.1);padding:2px 6px;border-radius:4px;font-size:0.88rem;color:#A29BFE}table{width:100%;border-collapse:collapse;font-size:0.9rem;margin:8px 0}th{text-align:left;padding:8px 12px;background:rgba(108,92,231,0.08);color:#A29BFE;font-size:0.75rem;text-transform:uppercase;letter-spacing:1px;border-bottom:1px solid #2A2A4A}td{padding:8px 12px;border-bottom:1px solid rgba(42,42,74,0.5)}.checklist li::before{content:'\2610' !important;color:#8888AA !important;font-family:inherit !important}.back{display:inline-block;margin-bottom:16px;color:#8888AA;font-size:0.9rem}.footer{text-align:center;padding:24px;color:#555577;font-size:0.82rem;border-top:1px solid #2A2A4A;margin-top:32px}</style></head><body><div class="hero"><a class="back" href="https://gist.githack.com/Aboudjem/0af8c2ce9d5b62038a18eeff09603553/raw/integra-testnet-master-plan.html">&larr; Back to Master Plan</a><h1>DEX</h1><div class="meta"><span class="badge badge-owner">Nawar</span><span class="badge badge-week">Week 2</span><span class="badge badge-est">0.5-1d</span></div><p style="color:#8888AA;font-size:0.9rem">dex.integralayer.com</p></div><div class="container"><div class="section"><h2>Overview</h2><div class=""><p>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.</p></div></div>
<div class="section"><h2>Features</h2><div class=""><ul><li><strong>Token Swap</strong> — Swap between any listed token pair with real-time price quotes, slippage protection, and deadline enforcement</li></ul><ul><li><strong>Multi-Hop Routing</strong> — Automatic routing through intermediate pairs when no direct pair exists (e.g., PT -> IRL -> YT)</li></ul><ul><li><strong>Liquidity Pools</strong> — Deposit equal value of both tokens into a pool, receive LP tokens representing pool share</li></ul><ul><li><strong>Pool Creation</strong> — Create new trading pairs by depositing initial liquidity, setting the starting price</li></ul><ul><li><strong>Remove Liquidity</strong> — Burn LP tokens to withdraw proportional share of both tokens from any pool</li></ul><ul><li><strong>Pool Stats Dashboard</strong> — TVL, 24h volume, 7d volume, fee APR, and price charts per pool</li></ul><ul><li><strong>Price Impact Warning</strong> — Visual warning when trade size would cause significant price impact</li></ul><ul><li><strong>Fee Structure</strong> — 0.3% swap fee split: 0.25% to LPs, 0.05% to protocol treasury</li></ul><ul><li><strong>Constant Product AMM</strong> — x * y = k pricing formula ensures continuous liquidity at all price levels</li></ul><ul><li><strong>Token Listing</strong> — Any ERC-20 on Integra can be paired and traded permissionlessly</li></ul><ul><li><strong>LP Token Tracking</strong> — View all LP positions, current value, fees earned, and impermanent loss</li></ul></div></div>
<div class="section"><h2>Functions</h2><div class=""><ul><li><code>swapExactTokensForTokens</code> — Swap with exact input amount and minimum output guarantee</li></ul><ul><li><code>addLiquidity</code> — Deposit both tokens into a pool, receive LP tokens</li></ul><ul><li><code>removeLiquidity</code> — Burn LP tokens, receive proportional share of both tokens</li></ul><ul><li><code>getAmountsOut</code> — Price quote for a given input amount and swap path</li></ul><ul><li><code>createPair</code> — Deploy a new pair contract for two tokens</li></ul><ul><li><code>getPair</code> — Look up the pair contract address for any two tokens</li></ul></div></div>
<div class="section"><h2>User Flow</h2><div class=""><ul><li>Connect wallet via Web3Auth</li></ul><ul><li>Select token pair and enter swap amount</li></ul><ul><li>Review price quote with slippage estimate, confirm swap</li></ul><ul><li>For liquidity: select a pair, deposit equal value of both tokens, receive LP tokens</li></ul><ul><li>Monitor pool stats — TVL, volume, earned fees</li></ul><ul><li>Remove liquidity at any time by burning LP tokens</li></ul></div></div>
<div class="section"><h2>Deliverables</h2><div class="checklist"><ul class="checklist"><li>Factory contract deployed (creates and indexes all pairs)</li></ul><ul class="checklist"><li>Pair contract (holds reserves, executes swaps, mints/burns LP tokens)</li></ul><ul class="checklist"><li>Router contract (user-facing swap and liquidity functions with safety checks)</li></ul><ul class="checklist"><li>Swap interface with token selector, price quotes, and slippage settings</li></ul><ul class="checklist"><li>Add/remove liquidity interface</li></ul><ul class="checklist"><li>Pool creation flow for new pairs</li></ul><ul class="checklist"><li>Pool stats page with TVL, volume, and fee APR per pool</li></ul><ul class="checklist"><li>Multi-hop swap routing</li></ul><ul class="checklist"><li>On-chain event emissions for all actions</li></ul></div></div>
<div class="section"><h2>Integration Points</h2><div class=""><ul><li><strong>Depends on:</strong> IRL token, all ERC-20 tokens on Integra</li></ul><ul><li><strong>Used by:</strong> 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</li></ul><ul><li><strong>Explorer:</strong> Integra Explorer</li></ul></div></div>
<div class="section"><h2>XP Rewards</h2><div class=""><table><thead><tr><th>Action</th><th>Points</th></tr></thead><tbody><tr><td>First swap</td><td>20 XP</td></tr><tr><td>Each swap</td><td>5 XP</td></tr><tr><td>Create a new pool</td><td>50 XP</td></tr><tr><td>Add liquidity</td><td>25 XP</td></tr><tr><td>Provide liquidity for 7+ days</td><td>100 XP bonus</td></tr><tr><td>Remove liquidity</td><td>5 XP</td></tr></tbody></table></div></div>
<div class="section"><h2>Success Metrics</h2><div class=""><table><thead><tr><th>Metric</th><th>Target</th></tr></thead><tbody><tr><td>Total swap transactions</td><td>1,000+ in first month</td></tr><tr><td>Unique traders</td><td>200+ wallets</td></tr><tr><td>Total Value Locked (TVL)</td><td>500K+ IRL across all pools</td></tr><tr><td>Active trading pairs</td><td>10+ pairs</td></tr><tr><td>Average swap completion time</td><td>< 5 seconds</td></tr></tbody></table></div></div>
</div><div class="footer">Integra Testnet PRD — DEX — Chain: integra-testnet-1 (EVM 26218)</div></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment