Skip to main content

Crate fynd_core

Crate fynd_core 

Source
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 Algorithm trait and plug in via FyndBuilder::with_algorithm.
  • HTTP server — use the fynd-rpc crate, 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 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::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 and the pluggable Algorithm trait. 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 GraphManager trait and the reusable PetgraphStableDiGraphManager. Graph management for algorithms.
price_guard
External price validation for quotes. Price guard: validate solver outputs against external price sources.
solver
FyndBuilder assembles the full pipeline and returns a Solver. High-level solver setup via FyndBuilder.
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§

ComputationRequirements
Requirements for derived data computations.

Enums§

UserTransferType
Specifies the method for transferring user funds into Tycho execution.