Repository navigation
Feat/rh indexer buy with eth - #73
Conversation
…nhood stuck since 1000 launches) Robinhood Chain's RPC (Arbitrum Nitro) refuses an eth_getLogs filter with more than 1000 address and topic selectors: "1011 address and topic selectors specified in query, but only 1000 are allowed". The indexer sends every launched token (Transfer) and every pool id (Swap) in one filter, so the 1001st Robinhood launch (2026-10-05 17:22 UTC) made every sync range fail and indexing stopped: swaps, fees and holders froze while launches still arrived through their own receipts. - fetchBySelectors (log-range.ts) sends the list in slices under the chain's cap. Robinhood's cap is known (1000); any other chain learns its cap from its first refusal, and one with no cap (Base) still sends the whole list in one call, so no extra RPC cost there. Slices merge back in chain order. - /api/health: a failed run now records the chain head it read, so a stuck chain shows its real lag. head_block only moved on success, so Robinhood kept reporting a 2-block lag while 447k blocks behind. - Verified against the live Robinhood RPC on the stuck range with the real 1010 tokens and pool ids.
A launch quoted in TWIG or GITLAWB could only be bought with that token. Most buyers hold ETH, so the trade panel now routes ETH to the token in one Universal Router call through the deep markets (Base): GITLAWB pair: ETH → WETH → GITLAWB (the WETH/GITLAWB v4 pool) → token TWIG pair: ETH → WETH → GITLAWB → TWIG (Twigpine's wrap hook, 1:1, 0%) → token - lib/launchpad/eth-route.ts: the route (ending in the launch's own pool, only for TWIG/GITLAWB pairs on Base) and its encoding: WRAP_ETH to the router, then V4_SWAP SWAP_EXACT_IN ‖ SETTLE (from the router's WETH) ‖ TAKE_ALL (to the buyer, at least the minimum). ETH goes in as msg.value, so there is nothing to approve. Quotes use the V4 Quoter's quoteExactInput over the same path. - trade panel: "Pay with ETH | TWIG" (or GITLAWB) on buys, ETH by default; balance, presets, max, gas reserve and labels follow the pay asset; the quote key includes it; a one-line route note; the "Need TWIG?" hint only when paying in TWIG. The trade() lock/preflight order is unchanged. - Proven on a Base fork against live pools: OL (TWIG pair) and MUSEWORLD (GITLAWB pair) bought with 0.01 and 0.25 ETH, each receiving exactly the quote, no WETH/GITLAWB/TWIG left in the router, an unmeetable minimum reverts; and end to end through the real trade panel with a test wallet on the fork for both pairs. - tests: route, path pinning (the wrap pool id 0xe7d2…6320, initialised 1:1), encoding (v1 and v2 layouts), panel wiring.
The project and its GitHub org are Twigpine now (github.com/Twigpine/openlaunch). The GITLAWB ticker stays. - repository links: BRAND_GITHUB, the home page's contracts link (now from BRAND_GITHUB), llms.txt, README, CONTRIBUTING - about: "built by Twigpine", the source link reads Twigpine/openlaunch - GITLAWB copy says Twigpine's token (form, token page, rules, llms.txt, README); its link goes to twigpine.com; GITLAWB_NAME is "Twigpine" - comments only elsewhere; the on-chain GitlawbOFTAdapter name is a contract name and stays
- fetchBySelectors: the cap only ever comes down: to the cap a refusal states when below what was tried, else to
half of what was tried, until one item still refused gives up with the node's error. A wrong guess (no number
stated, or a cap learned too high) costs calls, never a stuck chain. Slices run in parallel.
- indexer: the selector split is now outside the block-range split, so a result-cap refusal bisects only the
slice that overflowed instead of refetching every slice.
- eth-route: the route starts in the WETH/GITLAWB pool's own currency0 (no second WETH literal); only the
layout Base's router decodes is encoded (the untested v2 branch is gone until a v2 chain gets a route);
router constants and PathKey live in swap.ts, quoteExactInput in abi.ts.
- GITLAWB's display name is "Twigpine's original token", not the same as TWIG's ("Twigpine").
- comments back where they belong (trade panel gas reserve, the TWIG logo constant).
- re-verified: ETH buys on the Base fork receive exactly the quote; the stuck Robinhood range syncs on the live RPC.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (20)
Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe pull request adds ETH-funded purchases for eligible Base launch pairs and changes indexer log fetching to handle selector limits. It also updates repository links and GITLAWB descriptions to use Twigpine branding. ChangesETH-funded launch purchases
Log indexing updates
Twigpine branding
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
actor User
participant TradePanel
participant ethRouteFor
participant Quoter
participant encodeEthRouteBuy
participant UniversalRouter
TradePanel->>ethRouteFor: Select eligible Base ETH route
TradePanel->>Quoter: Request exact-input route quote
User->>TradePanel: Submit ETH buy
TradePanel->>encodeEthRouteBuy: Encode route and minimum output
TradePanel->>UniversalRouter: Send commands, inputs, and ETH value
Merge Risk: ⚪ Minimal · up to No confirmed issue prevents merging after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 47.62% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 18 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Summary
Three changes, in order of urgency:
eth_getLogsfilter with more than 1000 address + topic selectors (1011 address and topic selectors specified in query, but only 1000 are allowed). The indexer sends every launched token (Transfer) and every pool id (Swap) in one filter, so the 1001st Robinhood launch made every sync range fail. Swaps, fees and holders froze; launches still arrived through their own receipts./api/healthhid it:head_blockonly moved on success, so it kept reporting a 2-block lag while 447,898 blocks behind.1. Indexer
fetchBySelectors(log-range.ts) sends long address/topic lists in slices under the chain's cap, in parallel. Robinhood's cap (1000) is known; any other chain learns its cap from its first refusal; a chain with no cap (Base) still sends one call, so no extra RPC cost there.2. Buy with ETH (Base)
eth-route.ts: one Universal Router call,WRAP_ETH→V4_SWAP[SWAP_EXACT_IN,SETTLEfrom the router's WETH,TAKE_ALLto the buyer with a minimum].msg.value, so there is nothing to approve. Quotes use the V4 Quoter'squoteExactInputover the same path. The route's last hop is the launch's own pool key.trade()lock/preflight order is unchanged.3. Rename
BRAND_GITHUB, the home page's contracts link, llms.txt, README and CONTRIBUTING all point to github.com/Twigpine/openlaunch.GitlawbOFTAdaptername stay.Tests
tsc,eslint,next buildNot in this PR
Deploy notes
Summary by CodeRabbit