Files
staking-reward-streamer/certora
r4bbit 44700264f5 feat(Karma): add ability to slash Karma
This commit introduces the ability for accounts with the necessary
privileges to slash other accounts. The amount to be slashed is
controlled via the `slashPercentage`.

The amount to be slashed will be calculated from the account's current
Karma balance, which is the total Karma across all distributors, minus
the known `slashAmount` for that account.
Under the hood, it calculates the slash amount for each item
(distributor or internal balance). This ensure we reduce the slash
amount correctly, if a reward distributor is removed.

**Example**:

For example, if the account has 100 Karma and hasn't been slashed
before, the account's balances would look like this:

```
rawBalance: 100
slashAmount: 0
balance: 100
```

Therefore, `balanceOf(account)` will return `100`.
If slashing burns 10% of the account's balance, then, after calling
`slash(account)`, the `slashAmount` will be increased accordingly:

```
rawBalance: 100
slashAmount: 10
balance: 90
```

Notice that `rawBalance` isn't actually a new contract property, but
there's a new internal function `_rawBalanceAndSlashAmountOf(account)`, which is used
by `balanceOf(account)` to determine the effective balance of an
account.

**Authorization**

In order to slash accounts, the message sender needs to have the newly
introduced `SLASHER_ROLE`.

Closes #212
2025-06-05 14:26:11 +02:00
..