From 59f76d0bd688d57584e902eaaf209c3a4e9715be Mon Sep 17 00:00:00 2001 From: jurriaan Date: Tue, 21 Jan 2025 13:46:25 +0100 Subject: [PATCH] feat(hubble): persist origin of token details (fmt) --- hubble/src/token_fetcher/mod.rs | 2 +- hubble/src/token_fetcher/postgres.rs | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/hubble/src/token_fetcher/mod.rs b/hubble/src/token_fetcher/mod.rs index 5a4ed48a00..3e5bc4acab 100644 --- a/hubble/src/token_fetcher/mod.rs +++ b/hubble/src/token_fetcher/mod.rs @@ -1,8 +1,8 @@ use std::fmt::Display; mod client; -mod postgres; mod fetcher; +mod postgres; #[derive(Clone, Debug)] pub struct TokenSource { diff --git a/hubble/src/token_fetcher/postgres.rs b/hubble/src/token_fetcher/postgres.rs index 072c14f3e8..a6b53e0564 100644 --- a/hubble/src/token_fetcher/postgres.rs +++ b/hubble/src/token_fetcher/postgres.rs @@ -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()) @@ -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?; @@ -133,8 +133,7 @@ pub async fn get_internal_chain_id_by_chain_id( .fetch_all(tx.as_mut()) .await?; - let result: HashMap = - rows.into_iter().map(|row| (row.chain_id, row.id)).collect(); + let result: HashMap = rows.into_iter().map(|row| (row.chain_id, row.id)).collect(); Ok(result) }