Skip to content

Implement slashing of non-liquid delegated stake #63

@DrZoltanFazekas

Description

@DrZoltanFazekas

While slashed deposits are automatically reflected in the LST price of liquid delegated staking, the non-liquid variant needs to implement slashing explicitly. It requires the following changes:

  1. Store the slashing events consisting of the index of the staking event after which they happened and the slashed fraction.
  2. Adjust the staked amount when a user stakes or unstakes a value from the current amount + value to amount * product_of_slashed_fractions + value where product_of_slashed_fractions = (1 - slashings[i].fraction) * (1 - slashings[i+1].fraction) * ... * (1 - slashings[slashings.length - 1].fraction) for the smallest i such that slashings[i].index >= stakingIndices[user][stakingIndices[user].length - 1].

Note that the rewards are not directly impacted by slashing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions