feat(substreams): add BopAMM VM integration#1081
Closed
tvinagre wants to merge 4 commits into
Closed
Conversation
Index Bebop's BopAMM PMM as a VM protocol. Books (asset/USDC) are discovered from the pricing module's asset-config storage writes, since the contracts emit no config events. Tracks the full storage of the settlement, pricing module, and registry contracts; the maker wallet's token balances as per-book TVL; the per-book committed quote timestamp and block decoded from updateState/batch calldata; and pause/unpause state from the settlement. Deployment addresses and storage slots are passed as params so the module can target another deployment without code changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Capture the protocol design, on-chain interfaces, storage layout, the indexing model, verification, and remaining work (simulation adapter, quote-override stream, extractor registration). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tycho-simulation hex-decodes component ids into the adapter's bytes32
poolId (string_to_bytes32), so the previous 0x{settlement}-{assetId}
format failed before reaching any adapter. Ids are now the 32-byte
settlement (20) || assetId (12, BE) packing.
Replace the committed_ts/committed_block attributes with a single
override_block_timestamp (8-byte BE u64): tycho-simulation pins
block.timestamp from this attribute when simulating, which passes the
registry's exact-timestamp StaleUpdate() gate without a separate
quote-override stream.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ntegration test The PrioUpdateRegistry was deployed before the test's block range, so within range it only emits storage updates, never an account creation. The indexer crashed with Account NotFound when applying those updates. Add it to initialized_accounts so its account is fetched from RPC and seeded before indexing, matching how other VM integrations bootstrap pre-existing contracts. Verified: the protocol-testing harness now passes test_book_discovery 1/1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
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.
Adds an
ethereum-bopammSubstreams package that indexes Bebop's BopAMM PMM as a Tycho VM protocol.What it does
asset/USDC, one component perassetId) from the pricing module's asset-config storage writes — the contracts emit no config events.ts/blockdecoded fromupdateState/batchUpdateStateWithSignaturecalldata, andPaused/Unpausedstate.params, so the package can target another deployment without code changes.Pricing is a pure function of the indexed storage (no external calls, no DCI). One module per file under
src/modules/; shared helpers insrc/common.rs; config insrc/config.rs.Verification
updateStatecalldata decode,bookId == assetIdcross-lock,asset_config_slotkeccak vs on-chain, batch decode, token-index regression, params parse).clippy -D warningsand nightlyfmtclean; host + wasm32 build;substreams packsucceeds.substreams runagainst mainnet over the book-creation and an active-trading range: both books created with the expected ids/tokens/attributes/creation_tx, committed_ts/block on quote updates, maker balances, andbalance_ownerall emitted as expected.See
HANDOVER.mdfor the protocol design, interfaces, storage layout, and lifecycle.Not included (follow-ups)
tycho-simulationBopAMMSwapAdapter(get_amount_out) + the quote-override stream that pinsblock.timestamp/block.numberand injects the maker balance — needed becauseMAX_UPDATE_AGE() == 0(exact-timestamp gate).extractors.yamlvm:bopammentry (8 fields) — gated on releasing the spkg to S3 viarelease.sh ethereum-bopamm.🤖 Generated with Claude Code