pub trait StakeRegistry: Send + Sync {
// Required methods
fn get_stake(&self, did: &Did) -> Result<u64, Error>;
fn set_stake(&mut self, did: &Did, amount: u64) -> Result<(), Error>;
fn total_stake(&self) -> Result<u64, Error>;
// Provided methods
fn has_sufficient_stake(
&self,
did: &Did,
minimum: u64,
) -> Result<bool, Error> { ... }
fn stake_weight(&self, did: &Did) -> Result<f64, Error> { ... }
}Expand description
Trait for stake registry implementations
A stake registry tracks staked amounts for DIDs and can be used for weighted consensus and reputation systems.
Required Methods§
Sourcefn set_stake(&mut self, did: &Did, amount: u64) -> Result<(), Error>
fn set_stake(&mut self, did: &Did, amount: u64) -> Result<(), Error>
Set the staked amount for a DID
Sourcefn total_stake(&self) -> Result<u64, Error>
fn total_stake(&self) -> Result<u64, Error>
Get total staked amount across all DIDs