mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Fill out code for the rest of the Substrate events
This commit is contained in:
@@ -11,6 +11,20 @@ impl<D: Db> MainDb<D> {
|
||||
D::key(b"MAIN", dst, key)
|
||||
}
|
||||
|
||||
fn substrate_block_key() -> Vec<u8> {
|
||||
Self::main_key(b"substrate_block", [])
|
||||
}
|
||||
pub fn set_last_substrate_block(&mut self, block: u64) {
|
||||
let mut txn = self.0.txn();
|
||||
txn.put(Self::substrate_block_key(), block.to_le_bytes());
|
||||
txn.commit();
|
||||
}
|
||||
pub fn last_substrate_block(&self) -> u64 {
|
||||
u64::from_le_bytes(
|
||||
self.0.get(Self::substrate_block_key()).unwrap_or(vec![0; 8]).try_into().unwrap(),
|
||||
)
|
||||
}
|
||||
|
||||
fn event_key(id: &[u8], index: u32) -> Vec<u8> {
|
||||
Self::main_key(b"event", [id, index.to_le_bytes().as_ref()].concat())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user