radix_engine_interface/blueprints/resource/
resource_manager.rs1use crate::blueprints::resource::*;
2
3use radix_common::prelude::*;
4
5pub const MINTER_ROLE: &str = "minter";
7pub const MINTER_UPDATER_ROLE: &str = "minter_updater";
8pub const BURNER_ROLE: &str = "burner";
9pub const BURNER_UPDATER_ROLE: &str = "burner_updater";
10pub const WITHDRAWER_ROLE: &str = "withdrawer";
11pub const WITHDRAWER_UPDATER_ROLE: &str = "withdrawer_updater";
12pub const DEPOSITOR_ROLE: &str = "depositor";
13pub const DEPOSITOR_UPDATER_ROLE: &str = "depositor_updater";
14pub const RECALLER_ROLE: &str = "recaller";
15pub const RECALLER_UPDATER_ROLE: &str = "recaller_updater";
16pub const FREEZER_ROLE: &str = "freezer";
17pub const FREEZER_UPDATER_ROLE: &str = "freezer_updater";
18pub const NON_FUNGIBLE_DATA_UPDATER_ROLE: &str = "non_fungible_data_updater";
19pub const NON_FUNGIBLE_DATA_UPDATER_UPDATER_ROLE: &str = "non_fungible_data_updater_updater";
20
21#[cfg_attr(feature = "fuzzing", derive(::arbitrary::Arbitrary))]
22#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, ScryptoSbor, ManifestSbor)]
23pub enum ResourceFeature {
24 Mint,
25 Burn,
26 Recall,
27 Freeze,
28}
29
30pub const RESOURCE_MANAGER_BURN_IDENT: &str = "burn";
31
32#[derive(Debug, Eq, PartialEq, ScryptoSbor)]
33pub struct ResourceManagerBurnInput {
34 pub bucket: Bucket,
35}
36
37#[derive(Debug, Eq, PartialEq, ManifestSbor, ScryptoDescribe)]
38pub struct ResourceManagerBurnManifestInput {
39 pub bucket: ManifestBucket,
40}
41
42pub type ResourceManagerBurnOutput = ();
43
44pub const RESOURCE_MANAGER_PACKAGE_BURN_IDENT: &str = "package_burn";
45
46#[derive(Debug, Eq, PartialEq, ScryptoSbor)]
47pub struct ResourceManagerPackageBurnInput {
48 pub bucket: Bucket,
49}
50
51#[derive(Debug, Eq, PartialEq, ManifestSbor, ScryptoDescribe)]
52pub struct ResourceManagerPackageBurnManifestInput {
53 pub bucket: ManifestBucket,
54}
55
56pub type ResourceManagerPackageBurnOutput = ();
57
58pub const RESOURCE_MANAGER_CREATE_EMPTY_VAULT_IDENT: &str = "create_empty_vault";
59
60#[derive(Debug, Clone, Eq, PartialEq, ScryptoSbor, ManifestSbor)]
61pub struct ResourceManagerCreateEmptyVaultInput {}
62
63pub type ResourceManagerCreateEmptyVaultManifestInput = ResourceManagerCreateEmptyVaultInput;
64
65pub type ResourceManagerCreateEmptyVaultOutput = Vault;
66
67pub const RESOURCE_MANAGER_CREATE_EMPTY_BUCKET_IDENT: &str = "create_empty_bucket";
68
69#[derive(Debug, Clone, Eq, PartialEq, ScryptoSbor, ManifestSbor)]
70pub struct ResourceManagerCreateEmptyBucketInput {}
71
72pub type ResourceManagerCreateEmptyBucketManifestInput = ResourceManagerCreateEmptyBucketInput;
73
74pub type ResourceManagerCreateEmptyBucketOutput = Bucket;
75
76pub const RESOURCE_MANAGER_DROP_EMPTY_BUCKET_IDENT: &str = "drop_empty_bucket";
77
78#[derive(Debug, Eq, PartialEq, ScryptoSbor)]
79pub struct ResourceManagerDropEmptyBucketInput {
80 pub bucket: Bucket,
81}
82
83#[derive(Debug, Eq, PartialEq, ManifestSbor, ScryptoDescribe)]
84pub struct ResourceManagerDropEmptyBucketManifestInput {
85 pub bucket: ManifestBucket,
86}
87
88pub type ResourceManagerDropEmptyBucketOutput = ();
89
90pub const RESOURCE_MANAGER_GET_RESOURCE_TYPE_IDENT: &str = "get_resource_type";
91
92#[derive(Debug, Clone, Eq, PartialEq, ScryptoSbor, ManifestSbor)]
93pub struct ResourceManagerGetResourceTypeInput {}
94
95pub type ResourceManagerGetResourceTypeManifestInput = ResourceManagerGetResourceTypeInput;
96
97pub type ResourceManagerGetResourceTypeOutput = ResourceType;
98
99pub const RESOURCE_MANAGER_GET_TOTAL_SUPPLY_IDENT: &str = "get_total_supply";
100
101#[derive(Debug, Clone, Eq, PartialEq, ScryptoSbor, ManifestSbor)]
102pub struct ResourceManagerGetTotalSupplyInput {}
103
104pub type ResourceManagerGetTotalSupplyManifestInput = ResourceManagerGetTotalSupplyInput;
105
106pub type ResourceManagerGetTotalSupplyOutput = Option<Decimal>;
107
108pub const RESOURCE_MANAGER_GET_AMOUNT_FOR_WITHDRAWAL_IDENT: &str = "amount_for_withdrawal";
109
110#[derive(Debug, Clone, Eq, PartialEq, ScryptoSbor, ManifestSbor)]
111pub struct ResourceManagerGetAmountForWithdrawalInput {
112 pub request_amount: Decimal,
113 pub withdraw_strategy: WithdrawStrategy,
114}
115
116pub type ResourceManagerGetAmountForWithdrawalManifestInput =
117 ResourceManagerGetAmountForWithdrawalInput;
118
119pub type ResourceManagerGetAmountForWithdrawalOutput = Decimal;