Skip to content

Commit

Permalink
Improve the 'how to buy urls' of the NS tokens (#6888)
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan authored Nov 25, 2024
1 parent 5000449 commit f8e5481
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/canisters/registry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
}
}
});
}
4 changes: 4 additions & 0 deletions backend/canisters/registry/impl/src/model/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ impl Tokens {
self.tokens.iter()
}

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut TokenDetails> {
self.tokens.iter_mut()
}

pub fn exists(&self, ledger_canister_id: CanisterId) -> bool {
self.get(ledger_canister_id).is_some()
}
Expand Down

0 comments on commit f8e5481

Please sign in to comment.