Skip to content

Commit

Permalink
staking(undelegate): remove obsolete comment in balance impl
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Mar 20, 2024
1 parent 70a3ed2 commit b3774f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/core/component/stake/src/penalty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Penalty {

/// Compound this `Penalty` with another `Penalty`.
pub fn compound(&self, other: Penalty) -> Penalty {
Self((self.0 * other.0).expect("compounding penalities will not overflow"))
Self((self.0 * other.0).expect("compounding penalties will not overflow"))
}

/// Apply this `Penalty` to an `Amount` of unbonding tokens.
Expand Down
9 changes: 6 additions & 3 deletions crates/core/component/stake/src/undelegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ impl EffectingData for Undelegate {
impl Undelegate {
/// Return the balance after consuming delegation tokens, and producing unbonding tokens.
pub fn balance(&self) -> Balance {
let stake = Balance::from(Value {
// We produce undelegation tokens at a rate of 1:1 with their
// unbonded value. When these tokens are claimed, we carry over
// penalties accumulated during the unbonding window.
let undelegation = Balance::from(Value {
amount: self.unbonded_amount,
asset_id: self.unbonding_token().id(),
});
Expand All @@ -46,8 +49,8 @@ impl Undelegate {
asset_id: self.delegation_token().id(),
});

// We consume the delegation tokens and produce the staking tokens.
stake - delegation
// We consume the delegation tokens and produce the undelegation tokens.
undelegation - delegation
}

pub fn unbonding_token(&self) -> UnbondingToken {
Expand Down

0 comments on commit b3774f9

Please sign in to comment.