From a24a40f4bc597bdb161c8e69575d92513c3220bb Mon Sep 17 00:00:00 2001 From: Oleksandr Pravdyvyi Date: Mon, 14 Jul 2025 13:25:40 +0300 Subject: [PATCH] fix: docs added --- sequencer_core/src/config.rs | 3 ++- sequencer_core/src/sequencer_store/accounts_store.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sequencer_core/src/config.rs b/sequencer_core/src/config.rs index 707b8b9..374a940 100644 --- a/sequencer_core/src/config.rs +++ b/sequencer_core/src/config.rs @@ -2,8 +2,9 @@ use serde::{Deserialize, Serialize}; use std::path::PathBuf; #[derive(Debug, Serialize, Deserialize, Clone)] +///Helperstruct for account serialization pub struct AccountInitialData { - ///Hex encoded AccountAddress + ///Hex encoded `AccountAddress` pub addr: String, pub balance: u64, } diff --git a/sequencer_core/src/sequencer_store/accounts_store.rs b/sequencer_core/src/sequencer_store/accounts_store.rs index bc65565..49df8ea 100644 --- a/sequencer_core/src/sequencer_store/accounts_store.rs +++ b/sequencer_core/src/sequencer_store/accounts_store.rs @@ -40,19 +40,27 @@ impl SequencerAccountsStore { Self { accounts } } + ///Register new account in accounts store + /// + ///Starts with zero public balance pub fn register_account(&mut self, account_addr: AccountAddress) { self.accounts .insert(account_addr, AccountPublicData::new(account_addr)); } + ///Check, if `account_addr` present in account store pub fn contains_account(&self, account_addr: &AccountAddress) -> bool { self.accounts.contains_key(account_addr) } + ///Check `account_addr` balance, + /// + ///returns `None`, if account address not found pub fn get_account_balance(&self, account_addr: &AccountAddress) -> Option { self.accounts.get(account_addr).map(|acc| acc.balance) } + ///Remove account from storage pub fn unregister_account(&mut self, account_addr: AccountAddress) { self.accounts.remove(&account_addr); }