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:
- Store the slashing events consisting of the
index of the staking event after which they happened and the slashed fraction.
- 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.
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:
indexof the staking event after which they happened and the slashedfraction.amountwhen a user stakes or unstakes avaluefrom the currentamount + valuetoamount * product_of_slashed_fractions + valuewhereproduct_of_slashed_fractions = (1 - slashings[i].fraction) * (1 - slashings[i+1].fraction) * ... * (1 - slashings[slashings.length - 1].fraction)for the smallestisuch thatslashings[i].index >= stakingIndices[user][stakingIndices[user].length - 1].Note that the rewards are not directly impacted by slashing.