Shared Safety Module Functionality
A Shared Safety Module is an external module that allows many individual Safety Modules to coordinate, so they can share risk by pooling reserve assets.
When a Safety Module is part of a Shared Safety Module, its ISharedSafetyModule sharedSafetyModule storage variable will be a non-zero address that is the associated SharedSafetyModule contract. If sharedSafetyModule == address(0), the Safety Module is not part of Shared Safety Module.
Specifying A Shared Safety Module
Setting a Shared Safety Module follows a three-step process, where the last two steps are similar to configuration changes (see Manage a Safety Module):
The Safety Module
ownerfirst sets aproposedSharedSafetyModuleby calling:
/// @notice Used to set the proposed SharedSafetyModule.
/// @param proposedSharedSafetyModule_ The new proposed SharedSafetyModule.
/// @dev Only the owner can call this function.
function setProposedSharedSafetyModule(ISharedSafetyModule proposedSharedSafetyModule_) external onlyOwner {The
proposedSharedSafetyModuleis allowed to queue itself by calling:
/// @notice Used to queue an update to this SafetyModule's SharedSafetyModule.
/// @dev Only the proposed SharedSafetyModule can call this function.
function queueSharedSafetyModule() external onlyProposedSharedSafetyModule;The queued
sharedSafetyModulecan get applied by theproposedSharedSafetyModuleafter the config update delay has elapsed and within the config update grace period withSafetyModule.finalizeSharedSafetyModule:
/// @notice Finalizes an update SharedSafetyModule for the SafetyModule.
/// @dev Only the proposed SharedSafetyModule can call this function.
function finalizeSharedSafetyModule() external onlyProposedSharedSafetyModule;The delay period allows Safety Module depositors to withdraw in case they do not wish to be part of the specified Shared Safety Module.
Shared Safety Module Privileges
A Shared Safety Module is given certain privileges with respect to the Safety Module, explained below.
Triggering the Safety Module
A Shared Safety Module is triggered indirectly via one of its child SafetyModule contracts. When a child SafetyModule’s trigger() function is called, it forwards the trigger to its parent SharedSafetyModule if one is configured. This is done by invoking SharedSafetyModule.propagateTrigger().
Note: The snippet below only shows the relevant portion of the child module’s
trigger()function. It is not the complete implementation of the trigger flow.
PropagateTrigger will then call sharedSafetyModuleTrigger on all of the sibling Safety Modules
Updating Safety Module Configurations
The Shared Safety Module assumes the traditional role of the owner in Safety Module update configurations. Specifically, it is authorized to call SafetyModule.updateConfigs:
Configuration updates that occur while a Safety Module is part of a Shared Safety Module have two unique features:
The Shared Safety Module's config update delay and config update grace period are used
Only the
sharedSafetyModuleis authorized to callSafetyModule.finalizeUpdateConfigsinstead of anyone
Resetting The Shared Safety Module
The Shared Safety Module is the only address authorized to reset the sharedSafetyModule to address(0):
This is intended to be used when the Safety Module leaves the Shared Safety Module.
Last updated