Known ledger canisters, the management canister, the orbit station, and the upgrader are NOT external canisters.
(principal: Principal)
| 194 | impl 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, |
nothing calls this directly
no test coverage detected