anvil_polkadot/substrate_node/service/
storage.rs1use polkadot_sdk::{frame_system, pallet_balances::AccountData, parachains_common::Nonce};
2use substrate_runtime::Balance;
3
4pub use pallet_revive_eth_rpc::subxt_client::runtime_types::pallet_revive::{
5 storage::{AccountInfo as ReviveAccountInfo, AccountType, ContractInfo},
6 vm::{BytecodeType, CodeInfo},
7};
8
9pub type SystemAccountInfo = frame_system::AccountInfo<Nonce, AccountData<Balance>>;
10
11pub mod well_known_keys {
12 use codec::Encode;
13 use polkadot_sdk::{
14 parachains_common::AccountId,
15 sp_core::{H160, H256, blake2_128, twox_128},
16 };
17
18 pub const TOTAL_ISSUANCE: [u8; 32] = [
20 194, 38, 18, 118, 204, 157, 31, 133, 152, 234, 75, 106, 116, 177, 92, 47, 87, 200, 117,
21 228, 207, 247, 65, 72, 228, 98, 143, 38, 75, 151, 76, 128,
22 ];
23
24 pub const CHAIN_ID: [u8; 16] = [
26 149u8, 39u8, 54u8, 105u8, 39u8, 71u8, 142u8, 113u8, 13u8, 63u8, 127u8, 183u8, 124u8, 109u8,
27 31u8, 137u8,
28 ];
29
30 pub const TIMESTAMP: [u8; 32] = [
32 240, 195, 101, 195, 207, 89, 214, 113, 235, 114, 218, 14, 122, 65, 19, 196, 159, 31, 5, 21,
33 244, 98, 205, 207, 132, 224, 241, 214, 4, 93, 252, 187,
34 ];
35
36 pub const BLOCK_NUMBER_KEY: [u8; 32] = [
40 38u8, 170u8, 57u8, 78u8, 234u8, 86u8, 48u8, 224u8, 124u8, 72u8, 174u8, 12u8, 149u8, 88u8,
41 206u8, 247u8, 2u8, 165u8, 193u8, 177u8, 154u8, 183u8, 160u8, 79u8, 83u8, 108u8, 81u8,
42 154u8, 202u8, 73u8, 131u8, 172u8,
43 ];
44
45 pub const AURA_AUTHORITIES: [u8; 32] = [
47 87, 248, 220, 47, 90, 176, 148, 103, 137, 111, 71, 48, 15, 4, 36, 56, 94, 6, 33, 196, 134,
48 154, 166, 12, 2, 190, 154, 220, 201, 138, 13, 29,
49 ];
50
51 pub const NEXT_FEE_MULTIPLIER: [u8; 32] = [
53 63, 20, 103, 160, 150, 188, 215, 26, 91, 106, 12, 129, 85, 226, 8, 16, 63, 46, 223, 59,
54 223, 56, 29, 235, 227, 49, 171, 116, 70, 173, 223, 220,
55 ];
56
57 pub fn system_account_info(account_id: AccountId) -> Vec<u8> {
58 let mut key = Vec::new();
59 key.extend_from_slice(&twox_128("System".as_bytes()));
60 key.extend_from_slice(&twox_128("Account".as_bytes()));
61 key.extend_from_slice(&blake2_128(account_id.as_ref()));
62 key.extend_from_slice(&account_id.encode());
63
64 key
65 }
66
67 pub fn revive_account_info(address: H160) -> Vec<u8> {
68 let mut key = Vec::new();
69 key.extend_from_slice(&twox_128("Revive".as_bytes()));
70 key.extend_from_slice(&twox_128("AccountInfoOf".as_bytes()));
71 key.extend_from_slice(&address.encode());
72
73 key
74 }
75
76 pub fn pristine_code(code_hash: H256) -> Vec<u8> {
77 let mut key = Vec::new();
78 key.extend_from_slice(&twox_128("Revive".as_bytes()));
79 key.extend_from_slice(&twox_128("PristineCode".as_bytes()));
80 key.extend_from_slice(&code_hash.encode());
81
82 key
83 }
84
85 pub fn code_info(code_hash: H256) -> Vec<u8> {
86 let mut key = Vec::new();
87 key.extend_from_slice(&twox_128("Revive".as_bytes()));
88 key.extend_from_slice(&twox_128("CodeInfoOf".as_bytes()));
89 key.extend_from_slice(&code_hash.encode());
90
91 key
92 }
93
94 pub fn immutable_data_of(address: H160) -> Vec<u8> {
95 let mut key = Vec::new();
96 key.extend_from_slice(&twox_128("Revive".as_bytes()));
97 key.extend_from_slice(&twox_128("ImmutableDataOf".as_bytes()));
98 key.extend_from_slice(&address.encode());
99
100 key
101 }
102}