ZeldStore

Trait ZeldStore 

Source
pub trait ZeldStore {
    // Required methods
    fn get(&mut self, key: &UtxoKey) -> Balance;
    fn set(&mut self, key: UtxoKey, value: Balance);
}
Expand description

Abstraction over the persistence layer used by ZeldProtocol.

Any backend that can read and write ZELD balances using the provided key can be used. Higher-level lifecycle management (transactions, staging, etc.) is left to concrete implementations.

Required Methods§

Source

fn get(&mut self, key: &UtxoKey) -> Balance

Fetches the stored ZELD balance attached to a given UTXO key.

Positive values represent spendable ZELD, negative values are spent tombstones, and 0 means either no entry or an empty balance.

Source

fn set(&mut self, key: UtxoKey, value: Balance)

Sets the stored ZELD balance assigned to a UTXO key. Use negative values to mark spent UTXOs.

Implementors§