Skip to content

Commit

Permalink
formatted source
Browse files Browse the repository at this point in the history
  • Loading branch information
shufps committed Oct 6, 2023
1 parent 6fe2bb9 commit 72a8925
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/bin/inx-chronicle/api/explorer/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ use crate::api::{
ApiResult,
};

use std::time::{Instant, Duration};
use tokio::sync::{RwLock};
use once_cell::sync::Lazy;
use std::time::{Duration, Instant};
use tokio::sync::RwLock;

pub fn routes() -> Router {
Router::new()
Expand Down Expand Up @@ -370,15 +370,20 @@ async fn richest_addresses_ledger_analytics(
.top
.into_iter()
.map(|stat| AddressStatDto {
address: iota_sdk::types::block::address::Address::from(stat.address).to_bech32(hrp).to_string(),
address: iota_sdk::types::block::address::Address::from(stat.address)
.to_bech32(hrp)
.to_string(),
balance: stat.balance,
})
.collect(),
ledger_index,
};

// Store the response in the cache
*RICHEST_ADDRESSES_CACHE.write().await = Some(RichestCacheData { last_updated: Instant::now(), data: response.clone() });
*RICHEST_ADDRESSES_CACHE.write().await = Some(RichestCacheData {
last_updated: Instant::now(),
data: response.clone(),
});

Ok(response)
}
Expand Down Expand Up @@ -409,7 +414,10 @@ async fn token_distribution_ledger_analytics(
};

// Store the response in the cache
*TOKEN_DISTRIBUTION_CACHE.write().await = Some(TokenCacheData { last_updated: Instant::now(), data: response.clone() });
*TOKEN_DISTRIBUTION_CACHE.write().await = Some(TokenCacheData {
last_updated: Instant::now(),
data: response.clone(),
});

Ok(response)
}
Expand Down

0 comments on commit 72a8925

Please sign in to comment.