Skip to main content

eth_prices/
lib.rs

1/*!
2`eth-prices` is a pricing library & routing engine for EVM assets.
3
4This crate currently exposes protocol-specific quoters that can read a rate at a
5specific block height.
6
7# Overview
8
9Here is a simple example showing off some of the features of `eth-prices`:
10```rust,ignore
11use eth_prices::{quoter::Quoter, token::Token};
12use alloy::primitives::address;
13
14let quoter = UniswapV3Quoter::from_pool(address!());
15```
16
17Today, the main building blocks are:
18- [`quoter::Quoter`] for single-hop quote sources.
19- [`quoter::QuoterInstance`] for storing heterogeneous quote sources together.
20- [`token::TokenIdentifier`] for identifying ERC-20, fiat, and native assets.
21- [`token::Token`] for token metadata and amount formatting helpers.
22# Quoters
23Currently supported quoters include:
24- [`quoter::fixed`] for static conversion rates.
25- [`quoter::uniswap_v2`] for Uniswap v2 pairs.
26- [`quoter::uniswap_v3`] for Uniswap v3 pools.
27- [`quoter::erc4626`] for ERC-4626 vaults.
28
29# Routing
30
31Routing is currently in-progress and will be available in a future release.
32
33# Examples
34
35You can find more examples in the [examples](https://github.com/v3xlabs/eth-prices/tree/master/examples) directory.
36*/
37
38pub mod error;
39pub use error::{EthPricesError, Result};
40
41pub mod config;
42pub mod quoter;
43pub mod router;
44pub mod token;
45
46#[cfg(target_arch = "wasm32")]
47pub mod js;
48
49#[cfg(test)]
50pub mod tests;