This repository contains an Oracle-informed AMM for the Miden blockchain.
You can find our testnet deployment here: https://zoroswap.com.
Zoro uses a pluggable curve implementation for AMM calculations. By default, it uses a simple
linear curve (DummyCurve) to demonstrate
its functionality.
| Curve | Feature Flag | Repository | Use Case |
|---|---|---|---|
DummyCurve |
default (always available) |
Public in zoro_primitives |
Development, testing, reference |
ZoroCurve |
--features zoro-curve-local |
Private | Production, proprietary algorithm |
The default build uses the DummyCurve implementation:
# Make sure that there is a placeholder crate in the folder above
# the clone of this repository.
#
# We need this folder structure:
# zoroswap/
# ├── Cargo.toml
# └── ...
# zoro-curve/
# ├── Cargo.toml
# └── ...
cargo new --name zoro_curve ../zoro-curve
cargo buildRequires a folder structure where both repositories (zoroswap
and zoro-curve) are checked out
on the same level:
zoroswap/
├── Cargo.toml
└── ...
zoro-curve/
├── Cargo.toml
└── ...
cargo run --bin server --features zoro-curve-local
cargo test --features zoro-curve-local
cargo install --features zoro-curve-localMake sure you have followed the above instructions for setting up the curve!
cp .env-example .env
cp config-example.toml config.toml
cp faucets-example.toml faucets.tomlcargo run --release --bin spawn_faucetsIt will print out 2 faucet ids. Put them in corresponding entries faucet_id under [[liquidity_pools]] section in config.toml file.
cargo run --release --bin spawn_poolsIt will print out pool id (at the start of program output). Put it into corresponding entry pool_account_id section in config.toml file.
cargo run --release --bin servercp store.sqlite3 testing_store.sqlite3This is required so client on server and client on test do not share the same store as then notes commited in test would go into output_notes but the server expects notes in input_notes.
Via public note:
cargo test --release e2e_public_note -- --exact --nocapturePrivate note via endpoint:
cargo test --release e2e_private_note -- --exact --nocapture- Create an account with a basic wallet component (user).
- Mint some token from faucets we created at setup.
- Create a
ZOROSWAPnote requesting a swap of minted assets in line with current oracle prices and send it as a public note to testnet or via endpoint. - Server should pick up the emitted note, consume it and execute against the pool we created earlier and emit new
P2IDtargeted at the user with swapped assets. - Consume the
P2IDemitted by the server concluding the test.