Skip to content

Commit

Permalink
update hub canister
Browse files Browse the repository at this point in the history
  • Loading branch information
eliezhao committed May 22, 2022
1 parent 1fa1074 commit 01a4eaa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Hub.mo
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ shared(installer) actor class hub() = this{
type CycleInterface = Types.CycleInterface;
type UpdateSettingsArgs = Types.UpdateSettingsArgs;
type InstallArgs = Types.InstallArgs;
let CYCLE_MINTING_CANISTER = Principal.fromText("rkp4c-7iaaa-aaaaa-aaaca-cai");
let ledger : Ledger = actor("ryjl3-tyaaa-aaaaa-aaaba-cai");
let management : Management = actor("aaaaa-aa");

stable var owners : TrieSet.Set<Principal> = TrieSet.fromArray<Principal>([installer.caller], Principal.hash, Principal.equal);
stable var cycle_wasm : [Nat8] = [];
stable var canisters_entries : [(Principal, Canister)] = [];

let CYCLE_MINTING_CANISTER = Principal.fromText("rkp4c-7iaaa-aaaaa-aaaca-cai");
let ledger : Ledger = actor("ryjl3-tyaaa-aaaaa-aaaba-cai");
let management : Management = actor("aaaaa-aa");
let CURRENT_VERSION : Nat = 4;
var canisters : TrieMap.TrieMap<Principal, Canister> = TrieMap.fromEntries(canisters_entries.vals(), Principal.equal, Principal.hash);
let CURRENT_VERSION : Nat = 3;


public query func getVersion() : async Nat{
CURRENT_VERSION
Expand Down Expand Up @@ -102,7 +105,7 @@ shared(installer) actor class hub() = this{
return #err(#Invalid_Caller)
};
// inspect if hub canister is one of the controllers
ignore management.canister_status({ canister_id = c.canister_id });
ignore await management.canister_status({ canister_id = c.canister_id });
canisters.put(c.canister_id, c);
#ok(())
};
Expand Down Expand Up @@ -217,7 +220,7 @@ shared(installer) actor class hub() = this{
let from : CycleInterface = actor(Principal.toText(id));
await from.withdraw_cycles();
};
ignore management.stop_canister({ canister_id = id });
await management.stop_canister({ canister_id = id });
ignore management.delete_canister({ canister_id = id });
canisters.delete(id);
#ok(())
Expand Down
Binary file modified src/latest_wasm/hub.wasm
Binary file not shown.

0 comments on commit 01a4eaa

Please sign in to comment.