best_path/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2
3#[cfg(not(feature = "std"))]
4extern crate alloc;
5
6#[cfg(not(feature = "std"))]
7use alloc::collections::BTreeMap;
8#[cfg(feature = "std")]
9use std::collections::BTreeMap;
10
11mod best_path_calculator;
12mod types;
13use types::*;
14
15pub type PricePathGraph<C, A, P> = BTreeMap<Pair<C>, PricePath<C, A, P>>;
16
17/// Interface for calculating best PricePathGraph, which consists of PricePath chained in most trade efficient manner.
18pub trait BestPathCalculator<C: Currency, A: Amount, P: Provider> {
19    fn calc_best_paths(pairs_and_prices: &[(ProviderPair<C, P>, A)]) -> Result<PricePathGraph<C, A, P>, CalculatorError>;
20}
21
22pub mod prelude {
23    pub use super::best_path_calculator::*;
24    pub use super::types::*;
25    pub use super::*;
26}