Tests are still being written, assume bugs until tested. If you would like to help contribute on the tests or docs, feel free to open up an issue or make a PR.
cfmms-rs
is a vertically integrated library for interacting with CFMMs (constant function market makers) on Ethereum. Features include:
-
batch sync token pair data from Uniswap V2 and V3 through optimized smart contracts that minimize the number of RPC calls
-
calculate token pair spot prices and simulate token swaps
-
execute transactions Sync pairs simulate swaps, and interact with constant function market makers on Ethereum.
βββ src/
β βββ batch_requests/
|ββ uniswap_v2/
|ββ uniswap_v3/
β βββ dex/
|ββ mod.rs
|ββ uniswap_v2.rs
|ββ uniswap_v3.rs
β βββ pool/
|ββ mod.rs
|ββ uniswap_v2.rs
|ββ uniswap_v3.rs
β βββ abi.rs
β βββ checkpoint.rs
β βββ errors.rs
β βββ lib.rs
β βββ sync.rs
β βββ throttle.rs
βββ Cargo.lock
βββ Cargo.toml
βββ foundry.toml
βββ README.md
The core logic is contained in the following files:
- batch_requests - handles batch pool requests to the Ethereum endpoint using solidity contracts in
contracts/
- dex - contains interfaces that handle dex invariants
- pool - contains pool interfaces that handle pools based on dex invariants
- abi - generates bindings for the UniswapV2 and UniswapV3 contracts
- sync - syncs multiple pool states between all dexes
Dex | Status |
---|---|
UniswapV2 variants | β |
UniswapV3 | β |
-
In order to build, clone the github repo:
git clone https://github.com/paradigmxyz/artemis cd artemis
-
Run tests with cargo
cargo test --all
-
To run any of the examples, first set a local environment variable called
ETHEREUM_MAINNET_ENDPOINT
. Then you can simply runcargo run --example <example_name>
.