Expand description
Pure solving logic for the Fynd DEX router.
This crate contains the route-finding algorithms, market-data pipeline, and encoder that powers Fynd. It has no HTTP dependencies and can be embedded directly in any application.
For documentation, guides, and API reference see https://docs.fynd.xyz/.
§Use cases
- Standalone routing — embed Fynd’s algorithms directly without running an HTTP server.
- Custom algorithms — implement the
Algorithmtrait and plug in viaFyndBuilder::with_algorithm. - HTTP server — use the
fynd-rpccrate, which wraps this crate with Actix Web.
§Quick start
See the Fynd quickstart to run a local instance, or the custom algorithm guide to implement your own routing strategy.
Re-exports§
pub use algorithm::Algorithm;pub use algorithm::AlgorithmConfig;pub use algorithm::AlgorithmError;pub use algorithm::MostLiquidAlgorithm;pub use algorithm::PathFrankWolfeAlgorithm;pub use feed::events::MarketEvent;pub use feed::market_data::StateLabel;pub use price_guard::config::PriceGuardConfig;pub use price_guard::provider::ExternalPrice;pub use price_guard::provider::PriceProvider;pub use price_guard::provider::PriceProviderError;pub use solver::FyndBuilder;pub use solver::PoolConfig;pub use solver::Solver;pub use solver::SolverBuildError;pub use solver::SolverParts;pub use solver::WaitReadyError;pub use types::BlockInfo;pub use types::ClientFeeParams;pub use types::ComponentId;pub use types::EncodingOptions;pub use types::FeeBreakdown;pub use types::Order;pub use types::OrderQuote;pub use types::OrderSide;pub use types::OrderValidationError;pub use types::PermitDetails;pub use types::PermitSingle;pub use types::Quote;pub use types::QuoteOptions;pub use types::QuoteRequest;pub use types::QuoteStatus;pub use types::Route;pub use types::RouteValidationError;pub use types::SingleOrderQuote;pub use types::SolveError;pub use types::SolveParams;pub use types::SolveResult;pub use types::Swap;pub use types::TaskId;pub use types::Transaction;pub use worker_pool::pool::WorkerPool;pub use worker_pool::pool::WorkerPoolBuilder;pub use worker_pool::pool::WorkerPoolConfig;pub use worker_pool::registry::UnknownAlgorithmError;pub use worker_pool::TaskQueueHandle;pub use worker_pool_router::config::WorkerPoolRouterConfig;pub use worker_pool_router::SolverPoolHandle;pub use worker_pool_router::WorkerPoolRouter;
Modules§
- algorithm
- Route-finding algorithms. Includes
MostLiquidAlgorithm,algorithm::BellmanFordAlgorithm,PathFrankWolfeAlgorithm, and the pluggableAlgorithmtrait. Route-finding algorithms. - derived
- Derived data computations: spot prices, pool depths, and gas prices. Derived data computation system.
- encoding
- Encodes solved routes into ABI-encoded on-chain calldata via Tycho’s router contracts.
- feed
- Market data feed: Tycho WebSocket integration, gas price fetching, and protocol registry.
- graph
- Graph management for algorithms. Provides
GraphManagertrait and the reusablePetgraphStableDiGraphManager. Graph management for algorithms. - price_
guard - External price validation for quotes. Price guard: validate solver outputs against external price sources.
- solver
FyndBuilderassembles the full pipeline and returns aSolver. High-level solver setup viaFyndBuilder.- types
- Core domain types:
Order,Route,Quote, etc. Core type definitions for Fynd. - worker_
pool - Multi-threaded solver pool management with pluggable algorithm registry.
- worker_
pool_ router - Request orchestration: fans out orders to all solver pools and selects the best result. Orchestrates multiple solver pools to find the best quote per request.
Structs§
- Computation
Requirements - Requirements for derived data computations.
- Pending
Block Processor - Processes ephemeral pending bundles against live Tycho market state. Obtained by calling
FyndBuilder::build_with_pending. Wires one or moreTxDeltaIndexers to an existingTychoStreamDecoder, enabling ephemeral simulation of candidate transaction bundles against the correct parent state for a specific target block. - Pending
Update - A pending transaction bundle passed to
PendingBlockProcessorfor simulation. An ephemeralUpdatetagged with a caller-supplied label.
Enums§
- Pending
Error - Error type produced by
PendingBlockProcessorwhen simulating a pending bundle. - User
Transfer Type - Specifies the method for transferring user funds into Tycho execution.
Traits§
- TxDelta
Indexer - Implement this trait and register it via
FyndBuilder::with_pending_indexerto receive raw transaction deltas during pending-block simulation. Indexes protocol state deltas from raw EVM transactions.