radix_common/constants/
native_addresses.rs

1use crate::types::*;
2
3//=========================================================================
4// Please see and update REP-71 along with changes to this file
5//=========================================================================
6
7//=========================================================================
8// FUNGIBLES
9//=========================================================================
10
11/// XRD is the native token of the Radix ledger.
12/// It is a fungible token, measured in attos (`10^-18`).
13///
14/// It is used for paying fees and staking.
15pub const XRD: ResourceAddress = ResourceAddress::new_or_panic([
16    93, 166, 99, 24, 198, 49, 140, 97, 245, 166, 27, 76, 99, 24, 198, 49, 140, 247, 148, 170, 141,
17    41, 95, 20, 230, 49, 140, 99, 24, 198,
18]);
19
20//=========================================================================
21// IMPLICIT PROOF RESOURCES BADGES
22//=========================================================================
23
24/// The non-fungible badge resource which is used for proofs of ECDSA Secp256k1 transacton signatures in the transaction processor.
25pub const SECP256K1_SIGNATURE_RESOURCE: ResourceAddress = ResourceAddress::new_or_panic([
26    154, 76, 99, 24, 198, 49, 140, 104, 103, 1, 130, 12, 99, 24, 198, 49, 140, 247, 215, 81, 57,
27    213, 170, 213, 230, 49, 140, 99, 24, 198,
28]);
29
30/// The non-fungible badge resource which is used for proofs of EdDSA Ed25519 transacton signatures in the transaction processor.
31pub const ED25519_SIGNATURE_RESOURCE: ResourceAddress = ResourceAddress::new_or_panic([
32    154, 76, 99, 24, 198, 49, 140, 108, 181, 84, 130, 12, 99, 24, 198, 49, 140, 247, 169, 81, 215,
33    169, 229, 71, 198, 49, 140, 99, 24, 198,
34]);
35
36/// The non-fungible badge resource which is used for proofs which represent the package of
37/// the immediate caller - ie the actor which made the latest (global or internal) call.
38///
39/// For example, if there is a global component A containing an internal component A2, and A2 makes a global call to B,
40/// then the access check for that global call will see a proof of this `PACKAGE_OF_DIRECT_CALLER_RESOURCE` for the package of A2.
41pub const PACKAGE_OF_DIRECT_CALLER_RESOURCE: ResourceAddress = ResourceAddress::new_or_panic([
42    154, 76, 99, 24, 198, 49, 140, 96, 219, 31, 248, 204, 99, 24, 198, 49, 140, 247, 199, 84, 86,
43    171, 162, 251, 198, 49, 140, 99, 24, 198,
44]);
45
46/// The non-fungible badge resource which is used for proofs which represent the global ancestor
47/// of the actor which made the latest global call.
48///
49/// For example, if there is a global component A containing an internal component A2, and A2 makes a global call to B,
50/// then the access check for that global call will see a proof of this `GLOBAL_CALLER_RESOURCE` for the global component A.
51pub const GLOBAL_CALLER_RESOURCE: ResourceAddress = ResourceAddress::new_or_panic([
52    154, 76, 99, 24, 198, 49, 140, 100, 127, 31, 248, 204, 99, 24, 198, 49, 140, 247, 170, 52, 123,
53    223, 170, 81, 230, 49, 140, 99, 24, 198,
54]);
55
56//=========================================================================
57// TRANSACTION BADGES
58//=========================================================================
59
60/// The non-fungible badge resource which is used for proofs representing the fact that the current transaction is
61/// a system transaction.
62///
63/// The following ids have meanings:
64/// * `0` is used to represent a full-authority system transaction such as genesis, or a protocol update
65/// * `1` is used to represent a consensus-authrority transaction, such as a round change
66pub const SYSTEM_EXECUTION_RESOURCE: ResourceAddress = ResourceAddress::new_or_panic([
67    154, 76, 99, 24, 198, 49, 140, 104, 18, 11, 52, 204, 99, 24, 198, 49, 140, 247, 171, 71, 140,
68    85, 71, 199, 198, 49, 140, 99, 24, 198,
69]);
70
71//=========================================================================
72// ENTITY OWNER BADGES
73//=========================================================================
74
75/// The non-fungible badge resource which is used for package ownership when creating packages with the simple package creation set-up.
76pub const PACKAGE_OWNER_BADGE: ResourceAddress = ResourceAddress::new_or_panic([
77    154, 76, 99, 24, 198, 49, 140, 96, 217, 14, 152, 204, 99, 24, 198, 49, 140, 247, 170, 148, 61,
78    41, 26, 62, 134, 49, 140, 99, 24, 198,
79]);
80
81/// The non-fungible badge resource which is used for validator ownership.
82pub const VALIDATOR_OWNER_BADGE: ResourceAddress = ResourceAddress::new_or_panic([
83    154, 76, 99, 24, 198, 49, 140, 102, 52, 110, 152, 204, 99, 24, 198, 49, 140, 247, 214, 58, 162,
84    169, 19, 198, 166, 49, 140, 99, 24, 198,
85]);
86
87/// The non-fungible badge resource which is used for account ownership, if accounts have been set up with simple account creation, or have been securified.
88pub const ACCOUNT_OWNER_BADGE: ResourceAddress = ResourceAddress::new_or_panic([
89    154, 76, 99, 24, 198, 49, 140, 110, 227, 14, 152, 204, 99, 24, 198, 49, 140, 247, 235, 90, 171,
90    212, 167, 233, 70, 49, 140, 99, 24, 198,
91]);
92
93/// The non-fungible badge resource which is used for identity ownership, if identities have been set up with simple account creation, or have been securified.
94pub const IDENTITY_OWNER_BADGE: ResourceAddress = ResourceAddress::new_or_panic([
95    154, 76, 99, 24, 198, 49, 140, 102, 205, 110, 152, 204, 99, 24, 198, 49, 140, 247, 168, 254,
96    213, 107, 82, 168, 230, 49, 140, 99, 24, 198,
97]);
98
99//=========================================================================
100// PACKAGES
101//=========================================================================
102
103/// The native package for package deployment.
104pub const PACKAGE_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
105    13, 144, 99, 24, 198, 49, 140, 96, 247, 22, 70, 76, 99, 24, 198, 49, 140, 247, 191, 202, 214,
106    163, 21, 43, 70, 49, 140, 99, 24, 198,
107]);
108
109/// The native package for resource managers, proofs, buckets, vaults etc.
110pub const RESOURCE_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
111    13, 144, 99, 24, 198, 49, 140, 97, 230, 3, 198, 76, 99, 24, 198, 49, 140, 247, 190, 145, 61,
112    99, 170, 251, 198, 49, 140, 99, 24, 198,
113]);
114
115/// The native package for accounts.
116pub const ACCOUNT_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
117    13, 144, 99, 24, 198, 49, 140, 110, 227, 19, 89, 140, 99, 24, 198, 49, 140, 247, 188, 170, 46,
118    149, 74, 150, 38, 49, 140, 99, 24, 198,
119]);
120
121/// The native package for identities.
122pub const IDENTITY_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
123    13, 144, 99, 24, 198, 49, 140, 102, 205, 100, 49, 140, 99, 24, 198, 49, 140, 247, 158, 154,
124    127, 143, 23, 156, 166, 49, 140, 99, 24, 198,
125]);
126
127/// The native package for the consensus manager.
128pub const CONSENSUS_MANAGER_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
129    13, 144, 99, 24, 198, 49, 140, 108, 78, 27, 64, 204, 99, 24, 198, 49, 140, 247, 191, 213, 212,
130    95, 72, 198, 134, 49, 140, 99, 24, 198,
131]);
132
133/// The native package for access controllers.
134pub const ACCESS_CONTROLLER_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
135    13, 144, 99, 24, 198, 49, 140, 108, 77, 99, 248, 204, 99, 24, 198, 49, 140, 247, 191, 85, 61,
136    60, 165, 22, 134, 49, 140, 99, 24, 198,
137]);
138
139/// The native package for pools.
140pub const POOL_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
141    13, 144, 99, 24, 198, 49, 140, 96, 252, 198, 49, 140, 99, 24, 198, 49, 140, 245, 62, 62, 42,
142    148, 250, 42, 166, 49, 140, 99, 24, 198,
143]);
144
145/// The native package for the transaction processor.
146pub const TRANSACTION_PROCESSOR_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
147    13, 144, 99, 24, 198, 49, 140, 101, 154, 97, 48, 204, 99, 24, 198, 49, 140, 247, 168, 186, 82,
148    149, 234, 191, 70, 49, 140, 99, 24, 198,
149]);
150
151/// The native package for the metadata module.
152pub const METADATA_MODULE_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
153    13, 144, 99, 24, 198, 49, 140, 109, 173, 189, 95, 76, 99, 24, 198, 49, 140, 247, 209, 85, 213,
154    61, 229, 104, 166, 49, 140, 99, 24, 198,
155]);
156
157/// The native package for the royalty module.
158pub const ROYALTY_MODULE_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
159    13, 144, 99, 24, 198, 49, 140, 97, 147, 191, 89, 12, 99, 24, 198, 49, 140, 247, 196, 245, 45,
160    61, 24, 151, 70, 49, 140, 99, 24, 198,
161]);
162
163/// The native package for the role assignment module.
164pub const ROLE_ASSIGNMENT_MODULE_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
165    13, 144, 99, 24, 198, 49, 140, 110, 143, 159, 204, 12, 99, 24, 198, 49, 140, 247, 170, 47, 173,
166    116, 162, 158, 38, 49, 140, 99, 24, 198,
167]);
168
169/// The native package for test utils.
170pub const TEST_UTILS_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
171    13, 249, 211, 192, 59, 233, 186, 23, 2, 154, 130, 219, 206, 96, 108, 18, 236, 85, 32, 194, 145,
172    11, 130, 158, 239, 6, 118, 153, 103, 15,
173]);
174
175/// The scrypto package for the genesis helper.
176pub const GENESIS_HELPER_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
177    13, 144, 99, 24, 198, 49, 140, 100, 102, 112, 129, 140, 99, 24, 198, 49, 140, 247, 214, 62, 86,
178    170, 175, 122, 38, 49, 140, 99, 24, 198,
179]);
180/// The name of the genesis helper blueprint under the `GENESIS_HELPER_PACKAGE`.
181pub const GENESIS_HELPER_BLUEPRINT: &str = "GenesisHelper";
182
183/// The scrypto package for the faucet
184pub const FAUCET_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
185    13, 144, 99, 24, 198, 49, 140, 100, 247, 152, 202, 204, 99, 24, 198, 49, 140, 247, 189, 241,
186    172, 105, 67, 234, 38, 49, 140, 99, 24, 198,
187]);
188/// The name of the faucet blueprint under the `FAUCET_PACKAGE`.
189pub const FAUCET_BLUEPRINT: &str = "Faucet";
190
191pub const TRANSACTION_TRACKER_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
192    13, 144, 99, 24, 198, 49, 140, 101, 153, 99, 237, 140, 99, 24, 198, 49, 140, 247, 190, 133,
193    161, 125, 72, 188, 166, 49, 140, 99, 24, 198,
194]);
195pub const TRANSACTION_TRACKER_BLUEPRINT: &str = "TransactionTracker";
196
197/// The native package for lockers.
198pub const LOCKER_PACKAGE: PackageAddress = PackageAddress::new_or_panic([
199    13, 144, 99, 24, 198, 49, 140, 111, 226, 217, 25, 140, 99, 24, 198, 49, 140, 247, 189, 79, 59,
200    245, 85, 87, 198, 49, 140, 99, 24, 198,
201]);
202
203//=========================================================================
204// SYSTEM SINGLETON COMPONENTS - NATIVE
205//=========================================================================
206
207/// The consensus manager native component - in charge of validators, consensus and epochs.
208pub const CONSENSUS_MANAGER: ComponentAddress = ComponentAddress::new_or_panic([
209    134, 12, 99, 24, 198, 49, 140, 108, 78, 27, 64, 204, 99, 24, 198, 49, 140, 247, 188, 165, 46,
210    181, 74, 106, 134, 49, 140, 99, 24, 198,
211]);
212
213//=========================================================================
214// SYSTEM SINGLETON COMPONENTS - SCRYPTO
215//=========================================================================
216
217/// The genesis helper scrypto component - used for sorting out genesis.
218pub const GENESIS_HELPER: ComponentAddress = ComponentAddress::new_or_panic([
219    192, 86, 99, 24, 198, 49, 140, 100, 102, 112, 129, 140, 99, 24, 198, 49, 140, 247, 188, 190,
220    244, 94, 170, 68, 166, 49, 140, 99, 24, 198,
221]);
222
223/// The faucet native component - use this on testnets for getting XRD and locking fee.
224pub const FAUCET: ComponentAddress = ComponentAddress::new_or_panic([
225    192, 86, 99, 24, 198, 49, 140, 100, 247, 152, 202, 204, 99, 24, 198, 49, 140, 247, 190, 138,
226    247, 138, 120, 248, 166, 49, 140, 99, 24, 198,
227]);
228// Export an alias for backwards compatibility of dApp developer tests
229pub use FAUCET as FAUCET_COMPONENT;
230
231/// The intent hash store component
232pub const TRANSACTION_TRACKER: ComponentAddress = ComponentAddress::new_or_panic([
233    130, 204, 99, 24, 198, 49, 140, 101, 153, 99, 237, 140, 99, 24, 198, 49, 140, 247, 232, 245,
234    174, 143, 74, 150, 166, 49, 140, 99, 24, 198,
235]);
236
237// Use TRANSACTION_TRACKER's NodeId as frame-owned object marker
238pub const FRAME_OWNED_GLOBAL_MARKER: GlobalAddress =
239    GlobalAddress::new_or_panic(TRANSACTION_TRACKER.into_node_id().0);
240
241//=========================================================================
242//=========================================================================
243
244#[cfg(test)]
245mod tests {
246    use super::*;
247    use radix_common::{address::AddressBech32Encoder, network::NetworkDefinition};
248
249    #[test]
250    fn test_mainnet_vanity_addresses() {
251        // Fungible Resources
252        check_address(
253            XRD.as_ref(),
254            EntityType::GlobalFungibleResourceManager,
255            "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd",
256        );
257
258        // Virtual Badges
259        check_address(
260            SECP256K1_SIGNATURE_RESOURCE.as_ref(),
261            EntityType::GlobalNonFungibleResourceManager,
262            "resource_rdx1nfxxxxxxxxxxsecpsgxxxxxxxxx004638826440xxxxxxxxxsecpsg",
263        );
264        check_address(
265            ED25519_SIGNATURE_RESOURCE.as_ref(),
266            EntityType::GlobalNonFungibleResourceManager,
267            "resource_rdx1nfxxxxxxxxxxed25sgxxxxxxxxx002236757237xxxxxxxxxed25sg",
268        );
269        check_address(
270            PACKAGE_OF_DIRECT_CALLER_RESOURCE.as_ref(),
271            EntityType::GlobalNonFungibleResourceManager,
272            "resource_rdx1nfxxxxxxxxxxpkcllrxxxxxxxxx003652646977xxxxxxxxxpkcllr",
273        );
274        check_address(
275            GLOBAL_CALLER_RESOURCE.as_ref(),
276            EntityType::GlobalNonFungibleResourceManager,
277            "resource_rdx1nfxxxxxxxxxxglcllrxxxxxxxxx002350006550xxxxxxxxxglcllr",
278        );
279
280        // Transaction badges
281        check_address(
282            SYSTEM_EXECUTION_RESOURCE.as_ref(),
283            EntityType::GlobalNonFungibleResourceManager,
284            "resource_rdx1nfxxxxxxxxxxsystxnxxxxxxxxx002683325037xxxxxxxxxsystxn",
285        );
286
287        // Entity owner badges
288        check_address(
289            PACKAGE_OWNER_BADGE.as_ref(),
290            EntityType::GlobalNonFungibleResourceManager,
291            "resource_rdx1nfxxxxxxxxxxpkgwnrxxxxxxxxx002558553505xxxxxxxxxpkgwnr",
292        );
293        check_address(
294            VALIDATOR_OWNER_BADGE.as_ref(),
295            EntityType::GlobalNonFungibleResourceManager,
296            "resource_rdx1nfxxxxxxxxxxvdrwnrxxxxxxxxx004365253834xxxxxxxxxvdrwnr",
297        );
298        check_address(
299            ACCOUNT_OWNER_BADGE.as_ref(),
300            EntityType::GlobalNonFungibleResourceManager,
301            "resource_rdx1nfxxxxxxxxxxaccwnrxxxxxxxxx006664022062xxxxxxxxxaccwnr",
302        );
303        check_address(
304            IDENTITY_OWNER_BADGE.as_ref(),
305            EntityType::GlobalNonFungibleResourceManager,
306            "resource_rdx1nfxxxxxxxxxxdntwnrxxxxxxxxx002876444928xxxxxxxxxdntwnr",
307        );
308
309        // Packages
310        check_address(
311            PACKAGE_PACKAGE.as_ref(),
312            EntityType::GlobalPackage,
313            "package_rdx1pkgxxxxxxxxxpackgexxxxxxxxx000726633226xxxxxxxxxpackge",
314        );
315        check_address(
316            RESOURCE_PACKAGE.as_ref(),
317            EntityType::GlobalPackage,
318            "package_rdx1pkgxxxxxxxxxresrcexxxxxxxxx000538436477xxxxxxxxxresrce",
319        );
320        check_address(
321            ACCOUNT_PACKAGE.as_ref(),
322            EntityType::GlobalPackage,
323            "package_rdx1pkgxxxxxxxxxaccntxxxxxxxxxx000929625493xxxxxxxxxaccntx",
324        );
325        check_address(
326            IDENTITY_PACKAGE.as_ref(),
327            EntityType::GlobalPackage,
328            "package_rdx1pkgxxxxxxxxxdntyxxxxxxxxxxx008560783089xxxxxxxxxdntyxx",
329        );
330        check_address(
331            CONSENSUS_MANAGER_PACKAGE.as_ref(),
332            EntityType::GlobalPackage,
333            "package_rdx1pkgxxxxxxxxxcnsmgrxxxxxxxxx000746305335xxxxxxxxxcnsmgr",
334        );
335        check_address(
336            ACCESS_CONTROLLER_PACKAGE.as_ref(),
337            EntityType::GlobalPackage,
338            "package_rdx1pkgxxxxxxxxxcntrlrxxxxxxxxx000648572295xxxxxxxxxcntrlr",
339        );
340        check_address(
341            POOL_PACKAGE.as_ref(),
342            EntityType::GlobalPackage,
343            "package_rdx1pkgxxxxxxxxxplxxxxxxxxxxxxx020379220524xxxxxxxxxplxxxx",
344        );
345        check_address(
346            TRANSACTION_PROCESSOR_PACKAGE.as_ref(),
347            EntityType::GlobalPackage,
348            "package_rdx1pkgxxxxxxxxxtxnpxrxxxxxxxxx002962227406xxxxxxxxxtxnpxr",
349        );
350        check_address(
351            METADATA_MODULE_PACKAGE.as_ref(),
352            EntityType::GlobalPackage,
353            "package_rdx1pkgxxxxxxxxxmtdataxxxxxxxxx005246577269xxxxxxxxxmtdata",
354        );
355        check_address(
356            ROYALTY_MODULE_PACKAGE.as_ref(),
357            EntityType::GlobalPackage,
358            "package_rdx1pkgxxxxxxxxxryaltyxxxxxxxxx003849573396xxxxxxxxxryalty",
359        );
360        check_address(
361            ROLE_ASSIGNMENT_MODULE_PACKAGE.as_ref(),
362            EntityType::GlobalPackage,
363            "package_rdx1pkgxxxxxxxxxarulesxxxxxxxxx002304462983xxxxxxxxxarules",
364        );
365        check_address(
366            GENESIS_HELPER_PACKAGE.as_ref(),
367            EntityType::GlobalPackage,
368            "package_rdx1pkgxxxxxxxxxgenssxxxxxxxxxx004372642773xxxxxxxxxgenssx",
369        );
370        check_address(
371            FAUCET_PACKAGE.as_ref(),
372            EntityType::GlobalPackage,
373            "package_rdx1pkgxxxxxxxxxfaucetxxxxxxxxx000034355863xxxxxxxxxfaucet",
374        );
375        check_address(
376            TRANSACTION_TRACKER_PACKAGE.as_ref(),
377            EntityType::GlobalPackage,
378            "package_rdx1pkgxxxxxxxxxtxtrakxxxxxxxxx000595975309xxxxxxxxxtxtrak",
379        );
380
381        // System singleton components - native
382        check_address(
383            CONSENSUS_MANAGER.as_ref(),
384            EntityType::GlobalConsensusManager,
385            "consensusmanager_rdx1scxxxxxxxxxxcnsmgrxxxxxxxxx000999665565xxxxxxxxxcnsmgr",
386        );
387
388        // System singleton components - scrypto
389        check_address(
390            FAUCET.as_ref(),
391            EntityType::GlobalGenericComponent,
392            "component_rdx1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxfaucet",
393        );
394        check_address(
395            GENESIS_HELPER.as_ref(),
396            EntityType::GlobalGenericComponent,
397            "component_rdx1cptxxxxxxxxxgenssxxxxxxxxxx000977302539xxxxxxxxxgenssx",
398        );
399        check_address(
400            TRANSACTION_TRACKER.as_ref(),
401            EntityType::GlobalTransactionTracker,
402            "transactiontracker_rdx1stxxxxxxxxxxtxtrakxxxxxxxxx006844685494xxxxxxxxxtxtrak",
403        );
404    }
405
406    fn check_address(address_bytes: &[u8], entity_type: EntityType, address_string: &str) {
407        assert_eq!(address_bytes[0], entity_type as u8);
408        let encoded_address = AddressBech32Encoder::new(&NetworkDefinition::mainnet())
409            .encode(address_bytes)
410            .unwrap();
411        assert_eq!(encoded_address.as_str(), address_string);
412    }
413}