radix_engine/blueprints/package/
substates.rs1use super::*;
2use crate::internal_prelude::*;
3
4declare_native_blueprint_state! {
5 blueprint_ident: Package,
6 blueprint_snake_case: package,
7 features: {
8 package_royalty: {
9 ident: PackageRoyalty,
10 description: "Enables the package royalty substate",
11 }
12 },
13 fields: {
14 royalty: {
15 ident: RoyaltyAccumulator,
16 field_type: {
17 kind: StaticSingleVersioned,
18 },
19 condition: Condition::if_feature(PackageFeature::PackageRoyalty),
20 }
21 },
22 collections: {
23 blueprint_version_definitions: KeyValue {
24 entry_ident: BlueprintVersionDefinition,
25 key_type: {
26 kind: Static,
27 content_type: BlueprintVersionKey,
28 },
29 value_type: {
30 kind: StaticSingleVersioned,
31 },
32 allow_ownership: false,
33 },
34 blueprint_version_dependencies: KeyValue {
35 entry_ident: BlueprintVersionDependencies,
36 key_type: {
37 kind: Static,
38 content_type: BlueprintVersionKey,
39 },
40 value_type: {
41 kind: StaticSingleVersioned,
42 },
43 allow_ownership: false,
44 },
45 schemas: KeyValue {
46 entry_ident: Schema,
47 mapped_physical_partition: SCHEMAS_PARTITION,
48 key_type: {
49 kind: Static,
50 content_type: SchemaHash,
51 },
52 value_type: {
53 kind: Static,
54 content_type: VersionedScryptoSchema,
55 },
56 allow_ownership: false,
57 },
58 blueprint_version_royalty_configs: KeyValue {
59 entry_ident: BlueprintVersionRoyaltyConfig,
60 key_type: {
61 kind: Static,
62 content_type: BlueprintVersionKey,
63 },
64 value_type: {
65 kind: StaticSingleVersioned,
66 },
67 allow_ownership: false,
68 },
69 blueprint_version_auth_configs: KeyValue {
70 entry_ident: BlueprintVersionAuthConfig,
71 key_type: {
72 kind: Static,
73 content_type: BlueprintVersionKey,
74 },
75 value_type: {
76 kind: StaticSingleVersioned,
77 },
78 allow_ownership: false,
79 },
80 code_vm_type: KeyValue {
81 entry_ident: CodeVmType,
82 key_type: {
83 kind: Static,
84 content_type: CodeHash,
85 },
86 value_type: {
87 kind: StaticSingleVersioned,
88 },
89 allow_ownership: false,
90 },
91 code_original_code: KeyValue {
92 entry_ident: CodeOriginalCode,
93 key_type: {
94 kind: Static,
95 content_type: CodeHash,
96 },
97 value_type: {
98 kind: StaticSingleVersioned,
99 },
100 allow_ownership: false,
101 },
102 code_instrumented_code: KeyValue {
103 entry_ident: CodeInstrumentedCode,
104 key_type: {
105 kind: Static,
106 content_type: CodeHash,
107 },
108 value_type: {
109 kind: StaticSingleVersioned,
110 },
111 allow_ownership: false,
112 },
113 }
114}
115
116#[derive(Debug, PartialEq, Eq, ScryptoSbor)]
121pub struct PackageRoyaltyAccumulatorV1 {
122 pub royalty_vault: Vault,
124}
125
126pub type PackageBlueprintVersionDefinitionV1 = BlueprintDefinition;
131pub type PackageBlueprintVersionDependenciesV1 = BlueprintDependencies;
132pub type PackageBlueprintVersionRoyaltyConfigV1 = PackageRoyaltyConfig;
133pub type PackageBlueprintVersionAuthConfigV1 = AuthConfig;
134
135#[derive(Debug, PartialEq, Eq, ScryptoSbor)]
140#[sbor(transparent)]
141pub struct PackageCodeVmTypeV1 {
142 pub vm_type: VmType,
143}
144
145#[derive(PartialEq, Eq, ScryptoSbor)]
146#[sbor(transparent)]
147pub struct PackageCodeOriginalCodeV1 {
148 pub code: Vec<u8>,
149}
150
151impl Debug for PackageCodeOriginalCodeV1 {
152 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
153 f.debug_struct("PackageCodeOriginalCodeValueV1")
154 .field("len", &self.code.len())
155 .finish()
156 }
157}
158
159#[derive(PartialEq, Eq, ScryptoSbor)]
160#[sbor(transparent)]
161pub struct PackageCodeInstrumentedCodeV1 {
162 pub instrumented_code: Vec<u8>,
163}
164
165impl Debug for PackageCodeInstrumentedCodeV1 {
166 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
167 f.debug_struct("PackageCodeInstrumentedCodeValueV1")
168 .field("len", &self.instrumented_code.len())
169 .finish()
170 }
171}