[−][src]Struct casperlabs_proof_of_stake::Stakes
The stakes map, assigning the staked amount of motes to each bonded validator.
Methods
impl Stakes
[src]
pub fn new(map: BTreeMap<PublicKey, U512>) -> Stakes
[src]
pub fn iter(&self) -> Iter<PublicKey, U512>
[src]
pub fn values(&self) -> Values<PublicKey, U512>
[src]
pub fn strings(&self) -> impl Iterator<Item = String> + '_
[src]
pub fn total_bonds(&self) -> U512
[src]
pub fn unbond(
&mut self,
validator: &PublicKey,
maybe_amount: Option<U512>
) -> Result<U512>
[src]
&mut self,
validator: &PublicKey,
maybe_amount: Option<U512>
) -> Result<U512>
If maybe_amount
is None
, removes all the validator's stakes,
otherwise subtracts the given amount. If the stakes are lower than
the specified amount, it also subtracts all the stakes.
Returns the amount that was actually subtracted from the stakes, or an error if
- unbonding the specified amount is not allowed,
- tries to unbond last validator,
- validator was not bonded.
pub fn bond(&mut self, validator: &PublicKey, amount: U512)
[src]
Adds amount
to the validator's stakes.
pub fn validate_bonding(
&self,
validator: &PublicKey,
amount: U512
) -> Result<()>
[src]
&self,
validator: &PublicKey,
amount: U512
) -> Result<()>
Returns an error if bonding the specified amount is not allowed.
Trait Implementations
impl Clone for Stakes
[src]
fn clone(&self) -> Stakes
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Stakes
[src]
impl PartialEq<Stakes> for Stakes
[src]
impl StructuralPartialEq for Stakes
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,