feat(smoke): v4 stable-pool seeding script + guide for Arc#149
Closed
david-uniswap wants to merge 1 commit into
Closed
feat(smoke): v4 stable-pool seeding script + guide for Arc#149david-uniswap wants to merge 1 commit into
david-uniswap wants to merge 1 commit into
Conversation
Adds tooling for partners (Arc / LI.FI) to create and fund a v4 stable pair (e.g. USDC/EURC) without a UI: - SeedStablePoolV4.s.sol: USD-native interface (no ticks/sqrtPrice). Takes token addresses, USD prices, and a USD budget per side; derives the sqrtPrice, full-range ticks, amounts, and liquidity. Supports staged funding: first run initializes at the USD-derived price, later runs top up at the pool's live price without re-pricing. Encoding mirrors the Arc-proven V4SmokeNativeIsERC20 (MINT_POSITION + SETTLE_PAIR), uint128.max mint caps, equal-decimals guard. - SEED_POOL_GUIDE.md: step-by-step (verify tokens, dry-run, broadcast small, quote-test, top up) with Arc 5042 addresses and gas notes. - LocalV4Deploy.s.sol: local harness that stands up the full v4 stack + two fake stablecoins from precompiled bytecode for end-to-end testing. Validated on a local anvil run: pool created at the correct USD-derived price, small seed then top-up at unchanged price, and a quote confirming routability. Co-Authored-By: Claude Opus 4.8 (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.
What
Tooling for partners (Arc / LI.FI) to create and fund a Uniswap v4 stable pair (e.g. USDC/EURC) on a new chain without a UI. Motivated by Arc needing a single non-trivial pool to test same-chain swaps against.
Files
script/smoke/SeedStablePoolV4.s.sol— the seeding script. USD-native interface: the operator only provides token addresses, USD prices, and a USD budget per side. The script derives the sqrtPrice, full-range ticks, token amounts, and liquidity (no ticks or Q64.96 values exposed). Supports staged funding: the first run initializes the pool at the USD-derived price; later runs detect the pool is initialized and top up at the pool's live price without re-pricing it. v4 encoding (MINT_POSITION+SETTLE_PAIR,modifyLiquidities) mirrors the Arc-provenV4SmokeNativeIsERC20.s.solbyte-for-byte. Usestype(uint128).maxmint caps and an equal-decimals guard.script/smoke/SEED_POOL_GUIDE.md— operator guide: verify tokens, dry-run, broadcast small, quote-test, top up. Includes Arc (5042) addresses and gas notes.script/smoke/LocalV4Deploy.s.sol— local test harness that stands up the full v4 stack + two fake stablecoins from precompiled bytecode, so the seed script can be exercised end-to-end on anvil.Why a USD-native + staged design
A v4 pool's price floats with swaps, but the starting price is set once at initialization and can't be reset. Initializing at a wrong price gets the pool arbitraged, and the loss scales with posted liquidity. So the script is built to seed a small amount first (cheap to get wrong), confirm routing, then top up at the established price.
Validation
Ran locally on anvil with fake ABC ($1.00) / BBC ($0.95) stablecoins:
log(0.95)/log(1.0001)), liquidity 0 → ~2M.Notes for reviewers
forge scriptdoes a full-project build, which hits the repo's cross-package solc-version conflict (permit2 0.8.17 vs v4 0.8.26). Run these scripts with--skip 'src/pkgs/**' --skip 'test/**'; both compile standalone, andLocalV4Deploydeploys protocol contracts from precompiledout/bytecode viavm.getCodeto avoid pulling that source into its compile unit. The guide could alternatively live in Notion if we'd rather not keep partner-onboarding docs in the contracts repo.🤖 Generated with Claude Code