Skip to content

Commit

Permalink
Post release (#6956)
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan authored Dec 3, 2024
1 parent f1635f5 commit 1f8f4f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 43 deletions.
2 changes: 2 additions & 0 deletions backend/canisters/registry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1490](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1490-registry)] - 2024-12-03

### Added

- Add token ([#6953](https://github.com/open-chat-labs/open-chat/pull/6953))
Expand Down
45 changes: 2 additions & 43 deletions backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
use std::time::Duration;

use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::updates::add_token::add_token_impl;
use crate::{read_state, Data};
use candid::Principal;
use crate::Data;
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk::post_upgrade;
use registry_canister::post_upgrade::Args;
use stable_memory::get_reader;
use tracing::{error, info};
use tracing::info;
use utils::cycles::init_cycles_dispenser_client;

#[post_upgrade]
Expand All @@ -29,41 +25,4 @@ fn post_upgrade(args: Args) {
init_state(env, data, args.wasm_version);

info!(version = %args.wasm_version, "Post-upgrade complete");

ic_cdk_timers::set_timer(Duration::ZERO, add_token);
}

fn add_token() {
ic_cdk::spawn(add_token_inner());

async fn add_token_inner() {
if read_state(|state| state.data.test_mode) {
return;
}

let ledger_canister_id = Principal::from_text("npnnq-naaaa-aaaam-qb7va-cai").unwrap();
let payer = Principal::from_text("icbn4-5qaaa-aaaaf-bp72q-cai").unwrap().into();
let info_url = "https://info.icpswap.com/token/details/npnnq-naaaa-aaaam-qb7va-cai".to_string();
let how_to_buy_url =
"https://app.icpswap.com/swap?input=ryjl3-tyaaa-aaaaa-aaaba-cai&output=npnnq-naaaa-aaaam-qb7va-cai".to_string();
let transaction_url_format = "https://ic.house/token/npnnq-naaaa-aaaam-qb7va-cai".to_string();

let response = add_token_impl(
ledger_canister_id,
Some(payer),
None,
Some(info_url),
Some(how_to_buy_url),
Some(transaction_url_format),
None,
)
.await;

match response {
registry_canister::add_token::Response::Success => {
info!("AWB added");
}
_ => error!("Failed to add AWB: {response:?}"),
}
}
}

0 comments on commit 1f8f4f0

Please sign in to comment.