Skip to content

Commit

Permalink
Update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles committed Dec 12, 2024
1 parent f1c9c99 commit 73ab743
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 40 deletions.
6 changes: 6 additions & 0 deletions backend/canisters/local_group_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Added

- Expose the cycles top ups of User/Group/Community canisters

## [[2.0.1505](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1505-local_group_index)] - 2024-12-09

### Changed

- Increase Windoge community canister's reserved cycles limit ([#7022](https://github.com/open-chat-labs/open-chat/pull/7022))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::{mutate_state, read_state, Data};
use crate::Data;
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk::api::management_canister::main::{CanisterSettings, UpdateSettingsArgument};
use ic_cdk::post_upgrade;
use local_group_index_canister::post_upgrade::Args;
use stable_memory::get_reader;
use std::time::Duration;
use tracing::info;
use types::{CanisterId, CyclesTopUp};
use utils::canister::deposit_cycles;
use utils::cycles::init_cycles_dispenser_client;

#[post_upgrade]
Expand All @@ -29,39 +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, || {
ic_cdk::spawn(increase_windoge_reserved_cycles_limit_public())
});
}

async fn increase_windoge_reserved_cycles_limit_public() {
let windoge_canister_id = CanisterId::from_text("ow6el-gyaaa-aaaar-av5na-cai").unwrap();

if read_state(|state| state.data.local_communities.get(&windoge_canister_id.into()).is_none()) {
return;
}

ic_cdk::api::management_canister::main::update_settings(UpdateSettingsArgument {
canister_id: windoge_canister_id,
settings: CanisterSettings {
reserved_cycles_limit: Some(20_000_000_000_000u128.into()),
..Default::default()
},
})
.await
.unwrap();

let amount = 20_000_000_000_000u128;
deposit_cycles(windoge_canister_id, amount).await.unwrap();

mutate_state(|state| {
state.data.local_communities.mark_cycles_top_up(
&windoge_canister_id.into(),
CyclesTopUp {
amount,
date: state.env.now(),
},
);
})
}

0 comments on commit 73ab743

Please sign in to comment.