Skip to content

Commit

Permalink
handle diff usdt pool naming (#3070)
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother authored Sep 27, 2024
1 parent b73ec36 commit 8c9ec8e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/ain-ocean/src/api/pool_pair/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ pub struct PoolSwapFromTo {
convert = r#"{ format!("getusdperdfi") }"#
)]
pub async fn get_usd_per_dfi(ctx: &Arc<AppContext>) -> Result<Decimal> {
let usdt = get_pool_pair_cached(ctx, "USDT-DFI".to_string()).await?;
let mut usdt = get_pool_pair_cached(ctx, "USDT-DFI".to_string()).await?;
if usdt.is_none() {
usdt = get_pool_pair_cached(ctx, "DFI-USDT".to_string()).await?;
}

let usdc = get_pool_pair_cached(ctx, "USDC-DFI".to_string()).await?;
let mut usdc = get_pool_pair_cached(ctx, "USDC-DFI".to_string()).await?;
if usdc.is_none() {
usdc = get_pool_pair_cached(ctx, "DFI-USDC".to_string()).await?;
}

let mut total_usd = dec!(0);
let mut total_dfi = dec!(0);
Expand Down

0 comments on commit 8c9ec8e

Please sign in to comment.