iota_types/timelock/
stardust_upgrade_label.rs

1// Copyright (c) 2024 IOTA Stiftung
2// Modifications Copyright (c) 2024 IOTA Stiftung
3// SPDX-License-Identifier: Apache-2.0
4
5use move_core_types::{ident_str, identifier::IdentStr, language_storage::StructTag};
6
7use crate::STARDUST_ADDRESS;
8
9pub const STARDUST_UPGRADE_MODULE_NAME: &IdentStr = ident_str!("stardust_upgrade_label");
10pub const STARDUST_UPGRADE_STRUCT_NAME: &IdentStr = ident_str!("STARDUST_UPGRADE_LABEL");
11
12pub const STARDUST_UPGRADE_LABEL_VALUE: &str = "000000000000000000000000000000000000000000000000000000000000107a::stardust_upgrade_label::STARDUST_UPGRADE_LABEL";
13
14/// Get the stardust upgrade label `type`.
15pub fn stardust_upgrade_label_type() -> StructTag {
16    StructTag {
17        address: STARDUST_ADDRESS,
18        module: STARDUST_UPGRADE_MODULE_NAME.to_owned(),
19        name: STARDUST_UPGRADE_STRUCT_NAME.to_owned(),
20        type_params: vec![],
21    }
22}
23
24/// Is this other StructTag representing a stardust upgrade label?
25pub fn is_stardust_upgrade(other: &StructTag) -> bool {
26    other.address == STARDUST_ADDRESS
27        && other.module.as_ident_str() == STARDUST_UPGRADE_MODULE_NAME
28        && other.name.as_ident_str() == STARDUST_UPGRADE_STRUCT_NAME
29}