Skip to content

Commit

Permalink
feat(hubble): persist origin of token details (fmt)
Browse files Browse the repository at this point in the history
  • Loading branch information
qlp committed Jan 21, 2025
1 parent dc7156c commit 59f76d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion hubble/src/token_fetcher/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::fmt::Display;

mod client;
mod postgres;
mod fetcher;
mod postgres;

#[derive(Clone, Debug)]
pub struct TokenSource {
Expand Down
23 changes: 11 additions & 12 deletions hubble/src/token_fetcher/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ pub async fn upsert_token_representation(
decimals = excluded.decimals,
logo_url = excluded.logo_url
",
token_representation.token_source_id,
token_representation.internal_chain_id,
token_representation.address,
token_representation.symbol,
token_representation.name,
token_representation.decimals,
token_representation.token_source_id,
token_representation.internal_chain_id,
token_representation.address,
token_representation.symbol,
token_representation.name,
token_representation.decimals,
token_representation.logo_url,
)
.execute(tx.as_mut())
Expand All @@ -115,10 +115,10 @@ pub async fn update_token_source(
logo_url = $4
WHERE id = $1
",
token_source.id,
token_source.source_url,
token_source.name,
token_source.logo_url,
token_source.id,
token_source.source_url,
token_source.name,
token_source.logo_url,
)
.execute(tx.as_mut())
.await?;
Expand All @@ -133,8 +133,7 @@ pub async fn get_internal_chain_id_by_chain_id(
.fetch_all(tx.as_mut())
.await?;

let result: HashMap<String, i32> =
rows.into_iter().map(|row| (row.chain_id, row.id)).collect();
let result: HashMap<String, i32> = rows.into_iter().map(|row| (row.chain_id, row.id)).collect();

Ok(result)
}

0 comments on commit 59f76d0

Please sign in to comment.