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

Method is_external_canister

core/station/impl/src/core/validation.rs:196–210  ·  view source on GitHub ↗

Known ledger canisters, the management canister, the orbit station, and the upgrader are NOT external canisters.

(principal: Principal)

Source from the content-addressed store, hash-verified

194impl EnsureExternalCanister {
195 // Known ledger canisters, the management canister, the orbit station, and the upgrader are NOT external canisters.
196 pub fn is_external_canister(principal: Principal) -> bool {
197 // Check if the target canister is a ledger canister of an asset.
198 let principal_str = principal.to_text();
199 let is_ledger_canister_id = ASSET_REPOSITORY.list().iter().any(|asset| {
200 asset
201 .metadata
202 .get(TokenStandard::METADATA_KEY_LEDGER_CANISTER_ID)
203 .is_some_and(|canister_id| canister_id == principal_str)
204 });
205
206 !(is_ledger_canister_id
207 || principal == Principal::management_canister()
208 || principal == crate::core::ic_cdk::api::id()
209 || principal == SYSTEM_SERVICE.get_upgrader_canister_id())
210 }
211
212 pub fn ensure_external_canister(
213 principal: Principal,

Callers

nothing calls this directly

Calls 5

idFunction · 0.85
iterMethod · 0.80
listMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected