diff --git a/backend/canisters/user/CHANGELOG.md b/backend/canisters/user/CHANGELOG.md index ef66390b02..203b4e8ac9 100644 --- a/backend/canisters/user/CHANGELOG.md +++ b/backend/canisters/user/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +### Changed + +- Debug potential swap slippage for single user ([#5957](https://github.com/open-chat-labs/open-chat/pull/5957)) + ## [[2.0.1211](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1211-user)] - 2024-06-21 ### Added diff --git a/backend/canisters/user/impl/src/lib.rs b/backend/canisters/user/impl/src/lib.rs index 6988e79467..e9fca6bca0 100644 --- a/backend/canisters/user/impl/src/lib.rs +++ b/backend/canisters/user/impl/src/lib.rs @@ -18,6 +18,7 @@ use fire_and_forget_handler::FireAndForgetHandler; use model::chit::ChitEarnedEvents; use model::contacts::Contacts; use model::favourite_chats::FavouriteChats; +use model::token_swaps::TokenSwap; use notifications_canister::c2c_push_notification; use serde::{Deserialize, Serialize}; use serde_bytes::ByteBuf; @@ -146,6 +147,22 @@ impl RuntimeState { } pub fn metrics(&self) -> Metrics { + // TODO: Remove token_swaps from Metrics after next release + let mut token_swaps: Vec = Vec::new(); + let my_user_id: UserId = self.env.canister_id().into(); + let debug_user: UserId = Principal::from_text("pzg6u-5qaaa-aaaar-azjpa-cai").unwrap().into(); + + if my_user_id == debug_user { + // Show swaps from 2024/06/06 12:00 to 2024/06/07 12:00 + token_swaps = self + .data + .token_swaps + .iter() + .filter(|ts| ts.started > 1717671600000 && ts.started < 1717758000000) + .cloned() + .collect(); + } + Metrics { heap_memory_used: utils::memory::heap(), stable_memory_used: utils::memory::stable(), @@ -171,6 +188,7 @@ impl RuntimeState { escrow: self.data.escrow_canister_id, icp_ledger: Cryptocurrency::InternetComputer.ledger_canister_id().unwrap(), }, + token_swaps, } } } @@ -335,6 +353,7 @@ pub struct Metrics { pub video_call_operators: Vec, pub timer_jobs: u32, pub canister_ids: CanisterIds, + pub token_swaps: Vec, } fn run_regular_jobs() { diff --git a/frontend/app/src/components/SignInWithMagicLink.svelte b/frontend/app/src/components/SignInWithMagicLink.svelte index 6856d4204a..9c72139e5b 100644 --- a/frontend/app/src/components/SignInWithMagicLink.svelte +++ b/frontend/app/src/components/SignInWithMagicLink.svelte @@ -1,5 +1,5 @@