Skip to main content

Hooks

Description

Symbiotic contracts are very flexible in the sense of Vault curation methodology. Its core contracts have such advantages in that direction as:

  • There are several different delegation mechanics, and there will be more in the future (you can read more about it here)
  • It is possible to set up a highly granular separation of roles across different entities directly through the core contracts
  • The delegation model allows the processing of slashing events in any custom way through hooks

hooks

Technical overview

Symbiotic core contracts don’t force the use of some specific hooks (and don’t force even the use of hooks overall). Therefore, anyone can create their own implementation of it.

note

The hooks can be created by anyone. However, only the Vault curators are able to set or update the hooks for their Vaults.

Let’s consider only a couple of possible use designs for hooks:

  • Adjustment of delegations depending on each slashing event hooks-adjustment
  • Being a part of some external system of contracts built on top of Symbiotic core contracts (e.g., reputation system) hooks-external
info

The overall number of possible use cases for hooks is limited only by the onSlash() call gas limit set in the core contracts, which is equal to 250,000.

Example hooks

Repository with examples

Symbiotic Delegator modules don’t update allocations during slashing events in any way. Therefore, we’ve implemented several example hooks for adjustment of delegations in case of slashings for each existing delegation module.

NetworkRestakeDelegator Hooks

  1. NetworkRestakeDecreaseHook - decreases the network’s limit by the slashed amount and decreases the slashed operator’s shares in such a way as to reduce its stake (which depends on the network’s limit) by the slashed amount (it doesn’t change stake amounts for other operators)

  2. NetworkRestakeRedistributeHook - decreases the slashed operator’s shares by slashed percent from the given stake, redistributing the decreased stake to other operators

  3. NetworkRestakeResetHook - resets the slashed operator’s shares to zero in case it was slashed a configured number of times during a configured period

FullRestakeDelegator Hooks

  1. FullRestakeDecreaseHook - decreases the network’s limit by the slashed amount and reduces the operator’s limit by the slashed amount (it doesn’t change stake amounts for other operators)

  2. FullRestakeResetHook - resets the slashed operator’s limit to zero in case it was slashed a configured number of times during a configured period

OperatorSpecificDelegator Hooks

  1. OperatorSpecificDecreaseHook - decreases the network’s limit by the slashed amount

  2. OperatorSpecificResetHook - resets the slashing network’s limit to zero in case it was slashed a configured number of times during a configured period