zeldhash_protocol/
store.rs

1use crate::types::{Balance, UtxoKey};
2
3/// Abstraction over the persistence layer used by `ZeldProtocol`.
4///
5/// Any backend that can read and write ZELD balances using the provided key can
6/// be used. Higher-level lifecycle management (transactions, staging, etc.) is
7/// left to concrete implementations.
8pub trait ZeldStore {
9    /// Fetches the stored ZELD balance attached to a given UTXO key.
10    ///
11    /// Positive values represent spendable ZELD, negative values are spent tombstones,
12    /// and `0` means either no entry or an empty balance.
13    fn get(&mut self, key: &UtxoKey) -> Balance;
14
15    /// Sets the stored ZELD balance assigned to a UTXO key.
16    /// Use negative values to mark spent UTXOs.
17    fn set(&mut self, key: UtxoKey, value: Balance);
18}