ZeldStore

Trait ZeldStore 

Source
pub trait ZeldStore {
    // Required methods
    fn get(&mut self, key: &UtxoKey) -> Amount;
    fn pop(&mut self, key: &UtxoKey) -> Amount;
    fn set(&mut self, key: UtxoKey, value: Amount);
}
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) -> Amount

Fetches the ZELD balance attached to a given UTXO key.

Source

fn pop(&mut self, key: &UtxoKey) -> Amount

Removes the entry for the UTXO key, returning its current ZELD balance. Implementations should return 0 if the key is not present.

Source

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

Sets the ZELD balance assigned to a UTXO key.

Implementors§