Skip to content

[DO NOT MERGE] feat: pure-RPC on-chain position discovery (no subgraph) - #711

Draft
dglowinski wants to merge 1 commit into
developmentfrom
feat/onchain-position-discovery
Draft

dglowinski wants to merge 1 commit into
developmentfrom
feat/onchain-position-discovery

Conversation

@dglowinski

Copy link
Copy Markdown
Contributor

⚠️ DO NOT MERGE — depends on an unmerged SDK branch and is up for review/discussion only.

Summary

Adds a pure-RPC alternative to subgraph-based sub-account & position discovery. Previously the SDK's "onchain" account adapter still relied on a subgraph (trackingActiveAccounts) to learn which sub-accounts and vaults an owner touches. This flips the onchain account path to discover positions entirely over RPC.

This lite change is a one-line config: the onchain adapter now sets accountPositionDiscovery: 'onchain', so the plan-time/fresh SDK instance (which the portfolio loads through) uses the new discovery path.

How it works (SDK side)

The heavy lifting lives in the SDK — branch feat/onchain-account-discovery in euler-xyz/euler-sdks (must be linked/published for this to run):

  • A deployless discovery lens (AccountDiscoveryLens.sol) called via eth_call with no to and data = creationCode ++ abi.encode(owner, subAccountIds, vaults, evc); the constructor brute-forces vault.balanceOf(subAccount) for deposits and EVC.getControllers/debtOf for borrows, returning (address[][] deposits, address[][] borrows).
  • The subAccounts × vaults workload is split into chunks and fired as parallel unbatched eth_calls so the RPC provider spreads them; no single call approaches the eth_call gas ceiling.
  • Vault set defaults to a labels-based resolver (product + earn vaults, including deprecated); borrows are 100% complete via getControllers regardless of the vault set.

Validation (0x8A54C278D117854486db0F6460D901a180Fff517, mainnet, 21 active sub-accounts)

  • Discovery ~0.7 s (labels warm) + ~0.3 s one-time labels fetch (cached in-app) — well under the 5 s target
  • 21/21 sub-accounts, 19/19 borrows vs the subgraph baseline; verified live in the app (spy mode) — full portfolio rendered, no trackingActiveAccounts subgraph query
  • 405 SDK tests pass, incl. new adapter unit tests

Notes

  • Requires the linked SDK build (feat/onchain-account-discovery); not mergeable until that lands and is versioned.
  • Vault-type classification still uses the subgraph (vaultTypeAdapter: 'subgraph'), unchanged.

🤖 Generated with Claude Code

Sets accountPositionDiscovery='onchain' so the plan-time/fresh SDK instance
discovers sub-accounts and positions via the SDK's deployless brute-force lens
instead of the subgraph. Requires the linked euler-v2-sdk build with the
AccountVaultsOnchainAdapter.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: euler-xyz/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b55018cb-536d-4a86-83fd-9dc598787217

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/onchain-position-discovery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@railway-app

railway-app Bot commented Jul 9, 2026

Copy link
Copy Markdown

🚅 Deployed to the euler-lite-pr-711 environment in euler-lite(dev,PR previews)

Service Status Web Updated (UTC)
dev-build ❌ Build Failed (View Logs) Web Jul 31, 2026 at 9:58 am

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant