metrom_resolver_commons/
lib.rs1use alloy::primitives::U256;
2use metrom_commons::types::{
3 address::Address, amm::Amm, amm_pool_liquidity_type::AmmPoolLiquidityType,
4};
5use serde::{Deserialize, Serialize};
6
7pub use metrom_chain_adapter_commons::Token;
9
10#[derive(Serialize, Deserialize, Debug, Clone)]
11#[serde(rename_all = "camelCase")]
12#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
13pub struct TokenWithAddress {
15 pub address: Address,
17 #[cfg_attr(feature = "utoipa", schema(example = 18))]
18 pub decimals: i32,
20 #[cfg_attr(feature = "utoipa", schema(example = "Foo"))]
21 pub symbol: String,
23 #[cfg_attr(feature = "utoipa", schema(example = "Foobar"))]
24 pub name: String,
26}
27
28#[derive(Serialize, Deserialize, Debug, Clone)]
29#[serde(rename_all = "camelCase")]
30#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
31pub struct AmmPool {
32 #[cfg_attr(feature = "utoipa", schema(example = "uniswap-v3"))]
33 pub dex: String,
35 #[cfg_attr(feature = "utoipa", schema(example = "uniswap-v3"))]
36 pub amm: Amm,
38 #[cfg_attr(feature = "utoipa", schema(example = "concentrated"))]
39 pub liquidity_type: AmmPoolLiquidityType,
41 pub tokens: Vec<TokenWithAddress>,
43 #[serde(skip_serializing_if = "Option::is_none")]
44 pub fee: Option<f64>,
46 #[serde(skip_serializing_if = "Option::is_none")]
47 pub usd_tvl: Option<f64>,
49 #[serde(skip_serializing_if = "Option::is_none")]
50 #[cfg_attr(feature = "utoipa", schema(value_type = String, example = "100288918"))]
51 pub liquidity: Option<U256>,
53}
54
55#[derive(Serialize, Deserialize, Debug, Clone)]
56#[serde(rename_all = "camelCase")]
57pub struct LiquityV2Collateral {
58 pub decimals: i32,
59 pub symbol: String,
60 pub name: String,
61 pub tvl: U256,
62 pub usd_tvl: f64,
63 pub usd_price: f64,
64 pub minted_debt: f64,
65 pub stability_pool_debt: f64,
66}
67
68#[derive(Serialize, Deserialize, Debug, Clone)]
69#[serde(rename_all = "camelCase")]
70pub struct GmxV1Collateral {
71 pub decimals: i32,
72 pub symbol: String,
73 pub name: String,
74 pub tvl: U256,
75 pub usd_tvl: f64,
76 pub usd_price: f64,
77}
78
79#[derive(Serialize, Deserialize, Clone, Debug)]
80#[serde(rename_all = "camelCase")]
81pub struct ResolveTokensQuery {
82 pub with_usd_prices: Option<bool>,
83}
84
85#[derive(Serialize, Deserialize, Clone, Debug)]
86#[serde(rename_all = "camelCase")]
87pub struct ResolveAmmPoolsQuery {
88 pub with_usd_tvls: Option<bool>,
89 pub with_liquidity: Option<bool>,
90}