MCPcopy Create free account
hub / github.com/dfinity/orbit / install_canisters

Function install_canisters

tests/integration/src/setup.rs:173–264  ·  view source on GitHub ↗
(
    env: &mut PocketIc,
    config: SetupConfig,
    controller: Principal,
)

Source from the content-addressed store, hash-verified

171}
172
173fn install_canisters(
174 env: &mut PocketIc,
175 config: SetupConfig,
176 controller: Principal,
177) -> CanisterIds {
178 // System canisters (ICP ledger, ICP index, and optionally CMC) are deployed by
179 // PocketIC via `with_icp_features` — use their well-known canister IDs.
180 let nns_ledger_canister_id = Principal::from_text("ryjl3-tyaaa-aaaaa-aaaba-cai").unwrap();
181 let nns_index_canister_id = Principal::from_text("r7inp-6aaaa-aaaaa-aaabq-cai").unwrap();
182 let cmc_canister_id = Principal::from_text("rkp4c-7iaaa-aaaaa-aaaca-cai").unwrap();
183
184 // Mint ICP to the controller so that tests can transfer ICP.
185 // The minting account for PocketIC's default ICP ledger is the governance canister.
186 use crate::interfaces::mint_icp;
187 use ic_ledger_types::{AccountIdentifier, DEFAULT_SUBACCOUNT};
188 let controller_account = AccountIdentifier::new(&controller, &DEFAULT_SUBACCOUNT);
189 mint_icp(
190 env,
191 NNS_GOVERNANCE_CANISTER_ID,
192 &controller_account,
193 1_000_000_000_000,
194 )
195 .unwrap();
196
197 let control_panel = create_canister_with_cycles(
198 env,
199 controller,
200 config.start_cycles.unwrap_or(CANISTER_INITIAL_CYCLES),
201 );
202 let station = create_canister_with_cycles(
203 env,
204 controller,
205 config.start_cycles.unwrap_or(CANISTER_INITIAL_CYCLES),
206 );
207
208 set_controllers(env, Some(controller), station, vec![controller, station]);
209
210 let control_panel_wasm = get_canister_wasm("control_panel").to_vec();
211 env.install_canister(
212 control_panel,
213 control_panel_wasm,
214 Encode!(&()).unwrap(),
215 Some(controller),
216 );
217
218 let upgrader_wasm = get_canister_wasm("upgrader").to_vec();
219 let station_wasm = get_canister_wasm("station").to_vec();
220 if config.upload_canister_modules {
221 upload_canister_modules(env, control_panel, controller);
222 }
223
224 let station_init_args = SystemInstallArg::Init(Box::new(SystemInitArg {
225 name: "Station".to_string(),
226
227 upgrader: station_api::SystemUpgraderInput::Deploy(
228 station_api::DeploySystemUpgraderInput {
229 wasm_module: upgrader_wasm,
230 initial_cycles: Some(5_000_000_000_000),

Callers 1

Calls 8

mint_icpFunction · 0.85
get_canister_wasmFunction · 0.85
await_station_healthyFunction · 0.85
to_vecMethod · 0.80
install_canisterMethod · 0.80
set_controllersFunction · 0.70
upload_canister_modulesFunction · 0.70

Tested by

no test coverage detected