iota_types/
system_admin_cap.rs

1// Copyright (c) 2024 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use move_core_types::{ident_str, identifier::IdentStr};
5
6pub const IOTA_SYSTEM_ADMIN_CAP_MODULE_NAME: &IdentStr = ident_str!("system_admin_cap");
7pub const IOTA_SYSTEM_ADMIN_CAP_STRUCT_NAME: &IdentStr = ident_str!("IotaSystemAdminCap");
8
9pub use checked::*;
10
11#[iota_macros::with_checked_arithmetic]
12mod checked {
13    use move_core_types::language_storage::StructTag;
14    use serde::{Deserialize, Serialize};
15
16    use super::*;
17    use crate::IOTA_FRAMEWORK_ADDRESS;
18
19    /// Rust version of the IotaSystemAdminCap type.
20    #[derive(Debug, Default, Serialize, Deserialize, Clone, Eq, PartialEq)]
21    pub struct IotaSystemAdminCap {
22        // This field is required to make a Rust struct compatible with an empty Move one.
23        // An empty Move struct contains a 1-byte dummy bool field because empty fields are not
24        // allowed in the bytecode.
25        dummy_field: bool,
26    }
27
28    impl IotaSystemAdminCap {
29        pub fn type_() -> StructTag {
30            StructTag {
31                address: IOTA_FRAMEWORK_ADDRESS,
32                module: IOTA_SYSTEM_ADMIN_CAP_MODULE_NAME.to_owned(),
33                name: IOTA_SYSTEM_ADMIN_CAP_STRUCT_NAME.to_owned(),
34                type_params: Vec::new(),
35            }
36        }
37    }
38}