A Rust SDK for building applications on top of Uniswap V4. Rewrite of the TypeScript V4 SDK.
It is feature-complete with matching unit tests.
-
Opinionated Rust implementation of the Uniswap V4 SDK with a focus on readability and performance
-
Usage of alloy-rs types
-
An
extensionsfeature for additional functionalities related to Uniswap V4, including:pool: Create Pool structs from on-chain dataposition: Fetch position data from NFT token IDs and parse eventspool_manager_lens: Query pool manager state (similar toStateView)simple_tick_data_provider: Fetch tick data via RPC
The current MSRV (minimum supported Rust version) is 1.88.
To avoid transitive dependencies requiring a newer rustc, use edition 2024 or add to .cargo/config.toml:
[resolver]
incompatible-rust-versions = "fallback"Add the following to your Cargo.toml file:
uniswap-v4-sdk = { version = "1.0.0", features = ["extensions", "std"] }The package structure follows that of the TypeScript SDK, but with snake_case instead of camelCase.
For easy import, use the prelude:
use uniswap_v4_sdk::prelude::*;By default, this library does not depend on the standard library (std). However, the std feature can be enabled.
Contributions are welcome. Please open an issue if you have any questions or suggestions.
Tests are run with
cargo testLinting is done with clippy and rustfmt. To run the linter, use:
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt --all -- --checkThis project is licensed under the MIT License.
This project is inspired by and adapted from the following projects: