diem_types/account_config/resources/
vasp.rs

1// Copyright (c) The Diem Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2021 Conflux Foundation. All rights reserved.
5// Conflux is free software and distributed under GNU General Public License.
6// See http://www.gnu.org/licenses/
7
8use crate::account_address::AccountAddress;
9use move_core_types::move_resource::MoveResource;
10#[cfg(any(test, feature = "fuzzing"))]
11use proptest_derive::Arbitrary;
12use serde::{Deserialize, Serialize};
13
14#[derive(Debug, Serialize, Deserialize)]
15pub struct ParentVASP {
16    num_children: u64,
17}
18
19impl ParentVASP {
20    pub fn num_children(&self) -> u64 { self.num_children }
21}
22
23#[derive(Debug, Serialize, Deserialize)]
24#[cfg_attr(any(test, feature = "fuzzing"), derive(Arbitrary))]
25pub struct ChildVASP {
26    parent_vasp_addr: AccountAddress,
27}
28
29impl ChildVASP {
30    pub fn parent_vasp_addr(&self) -> AccountAddress { self.parent_vasp_addr }
31}
32
33impl MoveResource for ParentVASP {
34    const MODULE_NAME: &'static str = "VASP";
35    const STRUCT_NAME: &'static str = "ParentVASP";
36}
37
38impl MoveResource for ChildVASP {
39    const MODULE_NAME: &'static str = "VASP";
40    const STRUCT_NAME: &'static str = "ChildVASP";
41}