Skip to content

Add support for DEX swaps for blockchain adapter #2683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 3, 2025

Conversation

filipmacek
Copy link
Member

@filipmacek filipmacek commented Jun 2, 2025

Pull Request

NautilusTrader prioritizes correctness and reliability, please follow existing patterns for validation and testing.

Summary

  • Introduced a new Swap domain entity that captures token swap transactions with properties including chain, DEX, pool, block number, sender, side (buy/sell), quantity, price, and timestamp
  • Implemented Swap event processing - added infrastructure to decode and process swap events emitted by AMM smart contracts, converting raw blockchain event data into structured swap records
  • Implemented block-to-timestamp mapping to accurately timestamp swap transactions, with database persistence and caching for efficient lookups
  • Added methods to sync historical swap data from specific liquidity pools, enabling backfilling of trading history from any starting block
  • Extended the Hypersync client to support swap event queries with proper filtering by pool addresses
  • Added swap event decoding logic for UniswapV3
  • Added database schema for persisting swaps with proper foreign key relationships to pools and blocks
  • Created a new binary sync_pool_events for synchronizing swap data from specific pools
  • Enhanced the cache layer to support swap storage and retrieval
  • Extended validation utilities to handle Ethereum addresses
  • Added streaming support for processing large volumes of swap events efficiently
  • Integrated swap processing into the existing exchange abstraction layer
  • Blockchain(EVM) adapter #1335

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (impacts existing behavior)
  • Documentation update
  • Maintenance / chore

@filipmacek filipmacek requested a review from cjdsellers June 2, 2025 20:41
@filipmacek filipmacek self-assigned this Jun 2, 2025
@filipmacek filipmacek added the rust Relating to the Rust core label Jun 2, 2025
@filipmacek filipmacek force-pushed the blockchain-adapter-swaps branch from fb805e2 to 1de9822 Compare June 2, 2025 21:32
Copy link
Member

@cjdsellers cjdsellers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@cjdsellers cjdsellers merged commit a28625b into develop Jun 3, 2025
17 checks passed
@cjdsellers cjdsellers deleted the blockchain-adapter-swaps branch June 3, 2025 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Relating to the Rust core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants