Skip to content

Feat/rh indexer buy with eth - #73

Merged
kevincodex1 merged 4 commits into
mainfrom
feat/rh-indexer-buy-with-eth
Oct 6, 2026
Merged

kevincodex1 merged 4 commits into
mainfrom
feat/rh-indexer-buy-with-eth

Conversation

@kevincodex1

@kevincodex1 kevincodex1 commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Three changes, in order of urgency:

  1. Fix: Robinhood indexing stuck since 2026-10-05 17:22 UTC. Robinhood Chain's RPC (Arbitrum Nitro) refuses an eth_getLogs filter 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/health hid it: head_block only moved on success, so it kept reporting a 2-block lag while 447,898 blocks behind.
  2. Feature: Buy with ETH for tokens paired with TWIG or GITLAWB on Base, in one swap, no approvals.
  3. Chore: Gitlawb → Twigpine in the site copy and every repository link (github.com/Twigpine/openlaunch).

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.
  • The cap only ever comes down (to the stated cap, else half of what was tried) until a single item is still refused, so a wrong guess costs calls, never a stuck chain.
  • The selector split sits outside the block-range split, so a result-cap refusal bisects only the slice that overflowed.
  • A failed run now records the chain head it read, so health shows a stuck chain's real lag.
  • Verified on the live Robinhood RPC over the stuck range with the real 1010 tokens and pool ids.

2. Buy with ETH (Base)

  • eth-route.ts: one Universal Router call, WRAP_ETH → V4_SWAP [SWAP_EXACT_IN, SETTLE from the router's WETH, TAKE_ALL to the buyer with a minimum].
    • 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
  • ETH goes in as msg.value, so there is nothing to approve. Quotes use the V4 Quoter's quoteExactInput over the same path. The route's last hop is the launch's own pool key.
  • 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 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, 0.02 and 0.25 ETH; each received exactly the quote
    • no WETH, GITLAWB or TWIG left in the router
    • an unmeetable minimum reverts
    • end to end through the real trade panel with a test wallet, both pairs

3. Rename

  • BRAND_GITHUB, the home page's contracts link, llms.txt, README and CONTRIBUTING all point to github.com/Twigpine/openlaunch.
  • About: "built by Twigpine". GITLAWB copy says Twigpine's token and links to twigpine.com. GITLAWB's display name is "Twigpine's original token" (TWIG's is "Twigpine"). The GITLAWB ticker and the on-chain GitlawbOFTAdapter name stay.

Tests

  • 773/773 unit tests (+10 new: selector caps, route, encoding, panel wiring), tsc, eslint, next build
  • Fork and live-RPC checks as above

Not in this PR

  • Buy with ETH for the creator's first buy at launch, and selling straight to ETH
  • Recognising "noice" or USDC on Base as pairs: recent data is 16 launches from 2 wallets with 2 trades, and 31 launches from 1 wallet with 0 trades

Deploy notes

  • No migration, no env change. Robinhood should catch up within about 30 minutes of deploy; health shows the real lag until then.

Summary by CodeRabbit

  • New Features
    • Buy eligible Base launches paired with GITLAWB or TWIG using ETH, with route details and payment-specific balance and cost estimates.
  • Updates
    • Updated project and token information across the app and documentation to reflect Twigpine branding, including links to Twigpine’s website and repository.

…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.
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 5cf7dd8b-5690-458d-b56f-8b480604844c
📥 Commits

Reviewing files that changed from the base of the PR and between e6e91dc and e76499d.

📒 Files selected for processing (20)
  • CONTRIBUTING.md
  • README.md
  • app/src/app/(home)/page.tsx
  • app/src/app/about/page.tsx
  • app/src/app/llms.txt/route.ts
  • app/src/app/rules/page.tsx
  • app/src/app/t/[chain]/[token]/page.tsx
  • app/src/components/launchpad/LaunchForm.tsx
  • app/src/components/launchpad/TradePanel.tsx
  • app/src/lib/brand.ts
  • app/src/lib/chainPublic.ts
  • app/src/lib/launchpad/abi.ts
  • app/src/lib/launchpad/eth-route.test.ts
  • app/src/lib/launchpad/eth-route.ts
  • app/src/lib/launchpad/gitlawb.ts
  • app/src/lib/launchpad/indexer.ts
  • app/src/lib/launchpad/log-range.test.ts
  • app/src/lib/launchpad/log-range.ts
  • app/src/lib/launchpad/swap.ts
  • app/src/lib/launchpad/twig.ts

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.


📝 Walkthrough

Walkthrough

The 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.

Changes

ETH-funded launch purchases

Layer / File(s) Summary
ETH route and router encoding
app/src/lib/launchpad/swap.ts, app/src/lib/launchpad/twig.ts, app/src/lib/launchpad/abi.ts, app/src/lib/launchpad/eth-route.ts, app/src/lib/launchpad/eth-route.test.ts
Adds route configuration and quote ABI support. Route selection supports eligible Base GITLAWB and TWIG pairs. The encoder wraps ETH to WETH and encodes the route swap. Tests cover routes and encoded calls.
TradePanel ETH payment flow
app/src/components/launchpad/TradePanel.tsx, app/src/lib/launchpad/eth-route.test.ts
Adds an ETH or quote-token payment toggle for eligible pairs. ETH buys use route quotes and route encoding without ERC-20 approvals. Balances, amount controls, USD estimates, and payment messages use the selected asset.

Log indexing updates

Layer / File(s) Summary
Selector caps and log ordering
app/src/lib/launchpad/log-range.ts, app/src/lib/launchpad/log-range.test.ts
Adds selector refusal detection, adaptive selector slicing, and log ordering by block number and log index. Tests cover cap handling, chunking, retries, and ordering.
Indexer fetching and failure state
app/src/lib/launchpad/indexer.ts
Fetches swap and transfer logs in selector slices while retaining block-range splitting. Records the chain head on read and persists it when a later indexing operation fails.

Twigpine branding

Layer / File(s) Summary
Repository and token attribution
app/src/lib/brand.ts, CONTRIBUTING.md, app/src/app/(home)/page.tsx, app/src/app/about/page.tsx, README.md, app/src/app/llms.txt/route.ts, app/src/app/rules/page.tsx, app/src/app/t/[chain]/[token]/page.tsx, app/src/components/launchpad/LaunchForm.tsx, app/src/lib/chainPublic.ts, app/src/lib/launchpad/gitlawb.ts
Updates the repository URL and displayed token and builder attribution to Twigpine. The GITLAWB ticker and decimals remain unchanged.

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
Loading

Merge Risk: ⚪ Minimal · up to e7649

No confirmed issue prevents merging after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title names the Robinhood indexer work and ETH purchases, which are two primary changes in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant