Manage a Safety Module

As the owner of a Safety Module, it is possible to update the configuration in order to:

  • Add new reserve pools

  • Update the max slash percentages of reserve pools

  • Add/remove triggers that are allowed to be used to trigger the Safety Module

  • Update delays

Configuration updates follows a two-step process:

  1. Configuration updates are queued with SafetyModule.updateConfigs:

    /// @notice Parameters for configuration updates.
    struct UpdateConfigsCalldataParams {
      // The new reserve pool configs.
      ReservePoolConfig[] reservePoolConfigs;
      // The new trigger configs.
      TriggerConfig[] triggerConfigUpdates;
      // The new delays config.
      Delays delaysConfig;
    }
    
    /// @notice Signal an update to the safety module configs. Existing queued updates are overwritten.
    /// @param configUpdates_ The new configs. Includes:
    /// - reservePoolConfigs: The array of new reserve pool configs, sorted by associated ID. The array may also
    /// include config for new reserve pools.
    /// - triggerConfigUpdates: The array of trigger config updates. It only needs to include config for updates to
    /// existing triggers or new triggers.
    /// - delaysConfig: The new delays config.
    function updateConfigs(UpdateConfigsCalldataParams calldata configUpdates_) external;
  2. Configuration updates can be applied after the config update delay has elapsed and within the config update grace period with SafetyModule.finalizeUpdateConfigs:

    /// @notice Parameters for configuration updates.
    struct UpdateConfigsCalldataParams {
      // The new reserve pool configs.
      ReservePoolConfig[] reservePoolConfigs;
      // The new trigger configs.
      TriggerConfig[] triggerConfigUpdates;
      // The new delays config.
      Delays delaysConfig;
    }
    
    /// @notice Execute queued updates to the safety module configs.
    /// @param configUpdates_ The new configs. Includes:
    /// - reservePoolConfigs: The array of new reserve pool configs, sorted by associated ID. The array may also
    /// include config for new reserve pools.
    /// - triggerConfigUpdates: The array of trigger config updates. It only needs to include config for updates to
    /// existing triggers or new triggers.
    /// - delaysConfig: The new delays config.
    function finalizeUpdateConfigs(UpdateConfigsCalldataParams calldata configUpdates_) external;

The reserve pool configs for the update must obey the general requirements for creating a Safety Module (see Define Safety Module Configuration) with a few caveats:

  • It is not possible to remove reserve pools, so existing reserve pools must be included at the start of the ReservePoolConfig[] sorted by the associated reserve pool IDs. Any new reserve pools come after the existing reserve pools and the reserve pool IDs assigned to them respect the order of the array.

  • It is not possible to remove reserve pools, so the existing reserve pools must be included at the start of the ReservePoolConfig[] sorted by the associated reserve pool IDs.

Note: If a configuration update is queued but not finalized before a Safety Module enters the TRIGGERED state, the queued update is cleared and may be requeued when the Safety Module returns to either the ACTIVE or PAUSED states.

Last updated