RFP-004: DEX ecosystem behaviour appendix and vault accounting recommendation#41
Open
fryorcraken wants to merge 6 commits intomasterfrom
Open
RFP-004: DEX ecosystem behaviour appendix and vault accounting recommendation#41fryorcraken wants to merge 6 commits intomasterfrom
fryorcraken wants to merge 6 commits intomasterfrom
Conversation
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>
6c7458f to
7ba1e5e
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
appendix/dex-ecosystem-behaviour.mdsurveying how 7 production DEX protocols (Uniswap V2/V4, Balancer V3, Curve StableSwapNG, CoW Protocol, Raydium, Orca) implement behaviours required by RFP-004sync()(permissionless) andrecoverSurplus(to)(restricted to zero-liquidity pools)Test plan
🤖 Generated with Claude Code