diff --git a/backend/canisters/registry/CHANGELOG.md b/backend/canisters/registry/CHANGELOG.md index 112f3dc261..b3ced700e9 100644 --- a/backend/canisters/registry/CHANGELOG.md +++ b/backend/canisters/registry/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +### Changed + +- Improve the 'how to buy urls' of the NS tokens ([#6888](https://github.com/open-chat-labs/open-chat/pull/6888)) + ## [[2.0.1455](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1455-registry)] - 2024-11-15 ### Added diff --git a/backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs index 2b1c02e4ab..5d2d59084c 100644 --- a/backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs @@ -1,6 +1,6 @@ use crate::lifecycle::{init_env, init_state}; use crate::memory::get_upgrades_memory; -use crate::Data; +use crate::{mutate_state, Data}; use canister_logger::LogEntry; use canister_tracing_macros::trace; use ic_cdk::post_upgrade; @@ -25,4 +25,16 @@ fn post_upgrade(args: Args) { init_state(env, data, args.wasm_version); info!(version = %args.wasm_version, "Post-upgrade complete"); + + mutate_state(|state| { + for token in state.data.tokens.iter_mut() { + if token.symbol == "CHAT" { + token.how_to_buy_url = "https://oc.app/faq?q=buychat".to_string(); + } else if token.symbol == "ICP" { + token.how_to_buy_url = "https://oc.app/faq?q=buyicp".to_string(); + } else if token.how_to_buy_url == "https://3ezrj-4yaaa-aaaam-abcha-cai.ic0.app/sns/faq#how-can-i-get-sns-tokens" { + token.how_to_buy_url = "https://internetcomputer.org/sns/faq#how-can-i-get-sns-tokens".to_string(); + } + } + }); } diff --git a/backend/canisters/registry/impl/src/model/tokens.rs b/backend/canisters/registry/impl/src/model/tokens.rs index f3b9b2dcf3..2ad39e2aea 100644 --- a/backend/canisters/registry/impl/src/model/tokens.rs +++ b/backend/canisters/registry/impl/src/model/tokens.rs @@ -122,6 +122,10 @@ impl Tokens { self.tokens.iter() } + pub fn iter_mut(&mut self) -> impl Iterator { + self.tokens.iter_mut() + } + pub fn exists(&self, ledger_canister_id: CanisterId) -> bool { self.get(ledger_canister_id).is_some() }