Skip to content

feat(adapters): implement Across V3 parse_event#7

Open
Patrick-Ehimen wants to merge 1 commit into
mainfrom
feat/across-adapter
Open

feat(adapters): implement Across V3 parse_event#7
Patrick-Ehimen wants to merge 1 commit into
mainfrom
feat/across-adapter

Conversation

@Patrick-Ehimen

Copy link
Copy Markdown
Member

Summary

  • Implements parse_event on the Across adapter to decode V3FundsDeposited logs from Across SpokePool contracts (6 chains — no Avalanche)
  • V3FundsDeposited has 3 indexed params (destinationChainId, depositId, depositor) split across topics and 10 non-indexed params in data — decode_raw_log merges both in one call
  • correlation_id is scoped as across:{sourceChain}:{depositId} because depositId is a per-SpokePool monotonic counter, not globally unique across chains — two chains can both emit depositId=1
  • Maps raw EVM chainId (uint256) to internal ChainId for the destination chain
  • Tests in indexer/src/adapters/tests/across.rs

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test -p indexer — 9/9 pass (4 LayerZero V2 + 5 Across)
    • parses_valid_deposit — all fields map correctly end-to-end
    • rejects_wrong_topic — returns None without touching data
    • unknown_chain_id_gives_none_dest_chain — unmapped EVM chainId → dest_chain: None
    • correlation_id_includes_source_chain — same depositId on two chains produces different correlation_id
    • handles_large_amountu128::MAX amount encodes/decodes without overflow

Decodes V3FundsDeposited logs from Across SpokePool contracts. Handles the
three indexed params (destinationChainId, depositId, depositor) that land in
topics rather than data — alloy's decode_raw_log merges both in one call.

correlation_id is scoped as "across:{sourceChain}:{depositId}" to prevent
cross-chain collisions since depositId is per-SpokePool, not globally unique.
Maps raw EVM chainId (uint256) to internal ChainId for the destination chain.

5 unit tests: happy path, wrong topic, unknown dest chain, correlation_id
scoping across two source chains, large u128 amount without overflow.
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