anvil_zksync_core/node/
keys.rs

1use zksync_types::{Address, StorageKey};
2
3#[derive(Copy, Clone)]
4pub enum StorageKeyLayout {
5    ZkEra,
6    BoojumOs,
7}
8
9impl StorageKeyLayout {
10    pub fn get_nonce_key(&self, account: &Address) -> StorageKey {
11        match self {
12            StorageKeyLayout::ZkEra => zksync_types::get_nonce_key(account),
13            StorageKeyLayout::BoojumOs => crate::node::boojumos::boojumos_get_nonce_key(account),
14        }
15    }
16
17    pub fn get_storage_key_for_base_token(&self, address: &Address) -> StorageKey {
18        match self {
19            StorageKeyLayout::ZkEra => zksync_types::utils::storage_key_for_eth_balance(address),
20            StorageKeyLayout::BoojumOs => {
21                crate::node::boojumos::boojumos_storage_key_for_eth_balance(address)
22            }
23        }
24    }
25}