nautilus_blockchain/exchanges/base/
mod.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2025 Posei Systems Pty Ltd. All rights reserved.
3//  https://poseitrader.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16use std::collections::HashMap;
17
18use crate::exchanges::extended::DexExtended;
19
20mod aerodrome_slipstream;
21mod aerodrome_v1;
22mod baseswap_v2;
23mod basex;
24mod maverick_v1;
25mod maverick_v2;
26mod pancakeswap_v3;
27mod sushiswap_v3;
28mod uniswap_v2;
29mod uniswap_v3;
30mod uniswap_v4;
31
32pub use aerodrome_slipstream::AERODROME_SLIPSTREAM;
33pub use aerodrome_v1::AERODROME_V1;
34pub use baseswap_v2::BASESWAP_V2;
35pub use basex::BASEX;
36pub use maverick_v1::MAVERICK_V1;
37pub use maverick_v2::MAVERICK_V2;
38pub use pancakeswap_v3::PANCAKESWAP_V3;
39pub use sushiswap_v3::SUSHISWAP_V3;
40pub use uniswap_v2::UNISWAP_V2;
41pub use uniswap_v3::UNISWAP_V3;
42pub use uniswap_v4::UNISWAP_V4;
43
44/// Returns a vector of references to all Base Dexes
45#[must_use]
46pub fn all() -> Vec<&'static DexExtended> {
47    vec![
48        &*AERODROME_SLIPSTREAM,
49        &*AERODROME_V1,
50        &*UNISWAP_V2,
51        &*UNISWAP_V3,
52        &*UNISWAP_V4,
53        &*PANCAKESWAP_V3,
54        &*MAVERICK_V1,
55        &*MAVERICK_V2,
56        &*SUSHISWAP_V3,
57        &*BASEX,
58        &*BASESWAP_V2,
59    ]
60}
61
62/// Returns a map of Base DEX name to Dex reference for easy lookup
63#[must_use]
64pub fn dex_map() -> HashMap<&'static str, &'static DexExtended> {
65    let mut map = HashMap::new();
66    map.insert("aerodrome_slipstream", &*AERODROME_SLIPSTREAM);
67    map.insert("aerodrome_v1", &*AERODROME_V1);
68    map.insert("uniswap_v2", &*UNISWAP_V2);
69    map.insert("uniswap_v3", &*UNISWAP_V3);
70    map.insert("uniswap_v4", &*UNISWAP_V4);
71    map.insert("pancakeswap_v3", &*PANCAKESWAP_V3);
72    map.insert("maverick_v1", &*MAVERICK_V1);
73    map.insert("maverick_v2", &*MAVERICK_V2);
74    map.insert("sushiswap_v3", &*SUSHISWAP_V3);
75    map.insert("basex", &*BASEX);
76    map.insert("baseswap_v2", &*BASESWAP_V2);
77    map
78}