From fea158ee1dd8422547c3019d01570487d1bf621f Mon Sep 17 00:00:00 2001 From: 0xZensh Date: Fri, 11 Oct 2024 20:11:00 +0800 Subject: [PATCH] chore: add governance canister as controller --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- canister_ids.json | 6 ++++++ dfx.json | 10 ++++++++++ src/ic_message_channel/src/lib.rs | 5 ++++- src/ic_message_profile/src/lib.rs | 5 ++++- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c519a5..9de6aa0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1778,7 +1778,7 @@ dependencies = [ [[package]] name = "ic_message" -version = "2.5.0" +version = "2.5.1" dependencies = [ "candid", "ciborium", @@ -1798,7 +1798,7 @@ dependencies = [ [[package]] name = "ic_message_channel" -version = "2.5.0" +version = "2.5.1" dependencies = [ "candid", "ciborium", @@ -1813,7 +1813,7 @@ dependencies = [ [[package]] name = "ic_message_profile" -version = "2.5.0" +version = "2.5.1" dependencies = [ "candid", "ciborium", @@ -1829,7 +1829,7 @@ dependencies = [ [[package]] name = "ic_message_types" -version = "2.5.0" +version = "2.5.1" dependencies = [ "candid", "ic-oss-types 0.9.3", @@ -1873,7 +1873,7 @@ dependencies = [ [[package]] name = "ic_panda_luckypool" -version = "2.5.0" +version = "2.5.1" dependencies = [ "base64 0.21.7", "candid", @@ -4053,7 +4053,7 @@ dependencies = [ [[package]] name = "x-auth" -version = "2.5.0" +version = "2.5.1" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 8fedf49..75acabb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ opt-level = 's' [workspace.package] edition = "2021" -version = "2.5.0" +version = "2.5.1" repository = "https://github.com/ldclabs/ic-panda" keywords = ["canister", "icp", "panda"] categories = ["web-programming"] diff --git a/canister_ids.json b/canister_ids.json index 3519ac1..b6debb0 100644 --- a/canister_ids.json +++ b/canister_ids.json @@ -20,6 +20,12 @@ "ic_message_profile": { "ic": "ijyxz-wyaaa-aaaaj-qa4qa-cai" }, + "ic_oss_bucket": { + "ic": "532er-faaaa-aaaaj-qncpa-cai" + }, + "ic_oss_cluster": { + "ic": "5szpn-tiaaa-aaaaj-qncoq-cai" + }, "ic_panda_ai": { "ic": "bwwuq-byaaa-aaaan-qmk4q-cai" }, diff --git a/dfx.json b/dfx.json index 167e8d1..ef25c81 100644 --- a/dfx.json +++ b/dfx.json @@ -91,6 +91,16 @@ "type": "custom", "wasm": "https://github.com/ldclabs/ic-cose/releases/download/v0.3.2/ic_cose_canister.wasm.gz" }, + "ic_oss_cluster": { + "candid": "https://github.com/ldclabs/ic-oss/releases/download/v0.9.3/ic_oss_cluster.did", + "type": "custom", + "wasm": "https://github.com/ldclabs/ic-oss/releases/download/v0.9.3/ic_oss_cluster.wasm.gz" + }, + "ic_oss_bucket": { + "candid": "https://github.com/ldclabs/ic-oss/releases/download/v0.9.3/ic_oss_bucket.did", + "type": "custom", + "wasm": "https://github.com/ldclabs/ic-oss/releases/download/v0.9.3/ic_oss_bucket.wasm.gz" + }, "internet_identity": { "candid": "https://github.com/dfinity/internet-identity/releases/download/release-2024-06-07/internet_identity.did", "remote": { diff --git a/src/ic_message_channel/src/lib.rs b/src/ic_message_channel/src/lib.rs index 2f1bead..c5f2b4a 100644 --- a/src/ic_message_channel/src/lib.rs +++ b/src/ic_message_channel/src/lib.rs @@ -12,9 +12,12 @@ mod types; use crate::api_init::ChainArgs; +// "dwv6s-6aaaa-aaaaq-aacta-cai" ICPanda DAO canister id +static DAO_CANISTER: Principal = Principal::from_slice(&[0, 0, 0, 0, 2, 0, 0, 166, 1, 1]); + fn is_controller() -> Result<(), String> { let caller = ic_cdk::caller(); - if ic_cdk::api::is_controller(&caller) { + if caller == DAO_CANISTER || ic_cdk::api::is_controller(&caller) { Ok(()) } else { Err("user is not a controller".to_string()) diff --git a/src/ic_message_profile/src/lib.rs b/src/ic_message_profile/src/lib.rs index 47341bd..279b49a 100644 --- a/src/ic_message_profile/src/lib.rs +++ b/src/ic_message_profile/src/lib.rs @@ -13,9 +13,12 @@ mod types; use crate::api_init::ChainArgs; +// "dwv6s-6aaaa-aaaaq-aacta-cai" ICPanda DAO canister id +static DAO_CANISTER: Principal = Principal::from_slice(&[0, 0, 0, 0, 2, 0, 0, 166, 1, 1]); + fn is_controller() -> Result<(), String> { let caller = ic_cdk::caller(); - if ic_cdk::api::is_controller(&caller) { + if caller == DAO_CANISTER || ic_cdk::api::is_controller(&caller) { Ok(()) } else { Err("user is not a controller".to_string())