/ starknet / src / db / state.rs
state.rs
 1  //! State update data.
 2  
 3  use apibara_core::starknet::v1alpha2;
 4  use apibara_node::db::Table;
 5  
 6  use crate::core::GlobalBlockId;
 7  
 8  use super::block::ContractAtBlockId;
 9  
10  /// Store state updates without storage diffs.
11  #[derive(Debug, Clone, Copy, Default)]
12  pub struct StateUpdateTable {}
13  
14  /// Store storage diffs for a given block.
15  #[derive(Debug, Clone, Copy, Default)]
16  pub struct StorageDiffTable {}
17  
18  impl Table for StateUpdateTable {
19      type Key = GlobalBlockId;
20      type Value = v1alpha2::StateUpdate;
21  
22      fn db_name() -> &'static str {
23          "StateUpdate"
24      }
25  }
26  
27  impl Table for StorageDiffTable {
28      type Key = ContractAtBlockId;
29      type Value = v1alpha2::StorageDiff;
30  
31      fn db_name() -> &'static str {
32          "StorageDiff"
33      }
34  }