RFP-004: DEX ecosystem behaviour appendix and vault accounting recommendation#41
Conversation
6c7458f to
7ba1e5e
Compare
Add appendix documenting how existing DEX protocols implement behaviours required by RFP-004: constant-product AMM, immutable fee tiers, slippage protection, fee distribution, pool creation, single transaction operations, pool analytics, ATA usage, and vault accounting patterns. Recommend implementing sync() (permissionless) and recoverSurplus() (restricted to zero-liquidity pools) based on ecosystem analysis. Add requirement F.9 to RFP-004 referencing the appendix. Research source: github.com/marclawclaw/research-dex Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove recoverSurplus() recommendation. F.9 now requires only permissionless sync(); appendix section 10 describes ecosystem practice (Uniswap V2 sync/skim, V4/Balancer/Curve alternatives) without prescribing LEZ behaviour. - Reframe F.8: the DEX program must be compatible with ATAs but must not force them. Pool vaults may use PDAs (matching Raydium and Orca); user-side accepts any valid SPL token account owned by the caller. - Restructure appendix to describe what ecosystem DEXes do, not what LEZ should do. Recommendations belong in the RFP body. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Refresh Protocols Considered table from DeFiLlama (snapshot 2026-04-27): V2 ~$970M, V4 ~$720M (~16 chains, was >$1B/17), Balancer V3 ~$80M post 2025-11 V2 exploit, Curve ~$1.7B, Raydium ~$1.0B, Orca ~$255M. Replace unsourced ">$300B" Orca cumulative with "$36B+ all-time" from Orca's own dashboards. - Soften "over 100 forks" of V2 to a sourced characterisation. - Clarify V2 protocol fee: UNIfication passed 2025-12-26; LPs receive 0.25%, protocol takes 0.05% (1/6 of 0.3%). - Replace "98% gas reduction" round-number claim with the underlying TSTORE-vs-SSTORE gas costs (100 vs 20,000) per EIP-1153. - Tighten section-10 table: V4 has `PoolManager.sync()` for flash-accounting balance checkpointing (not reserve reconciliation); previous wording read as "no sync at all". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brings RFP-004 in line with RFP-000-template.md and the structure established by RFP-008: - Usability: add CLI requirement (template item 3); reorder so SDK, mini-app, CLI, IDL come first as standard items, RFP-specific items follow. - Supportability: split CI/test items, add doc packets for SDK and CLI, add Figma designs requirement. - Add Soft Requirements section with multi-hop routing, recoverSurplus() (moved from F.9 to a soft requirement), and compute-unit benchmarking. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Remove the soft requirement and add an Out of Scope note. Among surveyed protocols only Uniswap V2 implements a skim()-style instruction; Uniswap V4, Balancer V3, Curve StableSwapNG, Raydium, and Orca Whirlpools do not. Surplus reconciliation is handled exclusively by the permissionless sync(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The template lists compute-unit documentation as a hard Performance requirement. Consolidate it with the existing transaction-size documentation requirement and drop the redundant soft item. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Align RFP-004 with the Dependencies convention now used across RFPs 008, 012-017, 019, and 020. Document LP-0013 (token authorities, open) as the hard blocker for on-chain custody, and LP-0015/LP-0014/LP-0012 (all closed) as resolved dependencies, plus privacy primitives and the compute-budget risk. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Orca Whirlpools has 9 tick spacings / fee tiers, not 6 (tick spacings 1,2,4,8,16,32,64,128,256). - Curve LP positions are tracked by LP token balances, not admin_balances[] (which holds accrued admin fees, per section 9). - UNIfication proposal passed 2025-12-25 (on-chain vote close), not -26. - Uniswap V4: ~12 mainnet deployments, not ~16. - Qualify Uniswap V2 cumulative volume as V2-only DeFiLlama figure. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1c5ff49 to
1357d55
Compare
|
Rebased onto current master (conflict-free; master had not touched either file since the branch point) and made two additions: 1. Standardized Platform Dependencies section added to RFP-004. Aligns with the convention now used across RFPs 008, 012-017, 019, 020 (introduced in #64). RFP-004 was the last DeFi RFP missing it.
2. Fact-check pass on the appendix. Ran an independent verification of every claim against primary sources (protocol GitHub, official docs, EIP specs, DeFiLlama, governance records). ~35 claims checked; core thesis (Uniswap V2 is the only surveyed protocol with
|
Per README formatting instructions (mdformat + mdformat-gfm + mdformat-frontmatter, config in .mdformat.toml). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirror the structured dependencies list used in RFP-008 (id + reason). Statuses verified against logos-co/lambda-prize: LP-0013 open (hard blocker), LP-0015/LP-0014/LP-0012 closed (delivered). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Follow-up to the above: also added the structured All of the above is now consolidated into the PR description, so this thread is fully reflected there. Nothing outstanding. |
Summary
appendix/dex-ecosystem-behaviour.mdsurveying how 7 production DEX protocols (Uniswap V2/V4, Balancer V3, Curve StableSwapNG, CoW Protocol, Raydium, Orca Whirlpools) implement behaviours required by RFP-004.(owner, mint)) without forcing them; pool-side vaults may use PDAs.sync()that folds surplus vault balances into the pool for the benefit of LPs.skim()/recoverSurplus(to)instruction that extracts surplus to a caller-specified address. Among surveyed protocols only Uniswap V2 exposes this; reconciliation is handled exclusively bysync().logos-co/lambda-prize:sync()/skim()confirmed). Corrected: Orca fee tiers (9, not 6), Curve LP positions (LP token balances, notadmin_balances), UNIfication date (2025-12-25), Uniswap V4 chain count (~12), and qualified the Uniswap V2 cumulative volume figure.mdformatper the repo README.Research source: marclawclaw/research-dex
Test plan
sync()vsskim()) with implementorFix logos-co/ecosystem#111