Struct chain_impl_mockchain::stake::StakeControl
source · pub struct StakeControl {
assigned: Stake,
unassigned: Stake,
control: Hamt<DefaultHasher, Identifier, Stake>,
}
Fields§
§assigned: Stake
§unassigned: Stake
§control: Hamt<DefaultHasher, Identifier, Stake>
Implementations§
source§impl StakeControl
impl StakeControl
pub fn new() -> Self
fn update_accounts(&self, accounts: &Ledger) -> Self
fn update_utxos(&self, utxos: &Ledger<Address>) -> Self
pub fn new_with(accounts: &Ledger, utxos: &Ledger<Address>) -> Self
pub fn total(&self) -> Stake
pub fn assigned(&self) -> Stake
pub fn unassigned(&self) -> Stake
sourcepub fn by(&self, identifier: &Identifier) -> Option<Stake>
pub fn by(&self, identifier: &Identifier) -> Option<Stake>
get the total stake controlled by the given account
sourcepub fn ratio_by(&self, identifier: &Identifier) -> Ratio
pub fn ratio_by(&self, identifier: &Identifier) -> Ratio
get the ratio controlled by the given account
the ratio is based on the total assigned stake, stake that is not controlled (that is in UTxO without account keys) are not part of the equation.
pub fn add_unassigned(&self, stake: Stake) -> Self
pub fn remove_unassigned(&self, stake: Stake) -> Self
sourcepub fn add_to(&self, identifier: Identifier, stake: Stake) -> Self
pub fn add_to(&self, identifier: Identifier, stake: Stake) -> Self
add the given amount of stake to the given identifier
also update the total stake
sourcepub fn remove_from(&self, identifier: Identifier, stake: Stake) -> Self
pub fn remove_from(&self, identifier: Identifier, stake: Stake) -> Self
add the given amount of stake to the given identifier
also update the total stake
Trait Implementations§
source§impl Clone for StakeControl
impl Clone for StakeControl
source§fn clone(&self) -> StakeControl
fn clone(&self) -> StakeControl
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for StakeControl
impl Debug for StakeControl
source§impl Default for StakeControl
impl Default for StakeControl
source§fn default() -> StakeControl
fn default() -> StakeControl
Returns the “default value” for a type. Read more
source§impl PartialEq<StakeControl> for StakeControl
impl PartialEq<StakeControl> for StakeControl
source§fn eq(&self, other: &StakeControl) -> bool
fn eq(&self, other: &StakeControl) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for StakeControl
impl StructuralEq for StakeControl
impl StructuralPartialEq for StakeControl
Auto Trait Implementations§
impl RefUnwindSafe for StakeControl
impl Send for StakeControl
impl Sync for StakeControl
impl Unpin for StakeControl
impl UnwindSafe for StakeControl
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more