Pauser

Git Source

Inherits: Ownable, IPauser

Title: Pauser

Author: Merge Layers Inc.

Manages pausing operations across deployed markets

State Variables

ROLES

Roles contract reference

IRoles public immutable ROLES

OPERATOR

Operator contract reference

IOperator public immutable OPERATOR

pausableContracts

List of contracts that can be paused

PausableContract[] public pausableContracts

registeredContracts

Tracks whether a contract is registered as pausable

mapping(address _contract => bool _registered) public registeredContracts

contractTypes

Contract type for each registered market

mapping(address _contract => PausableType _type) public contractTypes

Functions

constructor

Sets initial configuration for roles, operator, and owner

constructor(address _roles, address _operator, address owner_) Ownable(owner_);

Parameters

NameTypeDescription
_rolesaddressAddress of the roles contract
_operatoraddressAddress of the operator contract
owner_addressOwner address of the pauser contract

addPausableMarket

Add pausable contract

function addPausableMarket(address _contract, PausableType _contractType) external onlyOwner;

Parameters

NameTypeDescription
_contractaddressthe pausable contract
_contractTypePausableTypethe pausable contract type

removePausableMarket

Removes pausable contract

function removePausableMarket(address _contract) external onlyOwner;

Parameters

NameTypeDescription
_contractaddressthe pausable contract

emergencyPauseMarket

Pauses all operations for a market

function emergencyPauseMarket(address _market) external;

Parameters

NameTypeDescription
_marketaddressthe mToken address

emergencyPauseMarketFor

function emergencyPauseMarketFor(address _market, ImTokenOperationTypes.OperationType _pauseType) external;

emergencyPauseAll

Pauses all operations for all registered markets

function emergencyPauseAll() external;

_pauseAllMarketOperations

Pauses all market operations for a given market

function _pauseAllMarketOperations(address _market) private;

Parameters

NameTypeDescription
_marketaddressThe market to pause

_pauseMarketOperation

Pauses a specific market operation type

function _pauseMarketOperation(address _market, ImTokenOperationTypes.OperationType _pauseType) private;

Parameters

NameTypeDescription
_marketaddressThe market to pause
_pauseTypeImTokenOperationTypes.OperationTypeThe operation type to pause

_pause

Performs pause logic depending on contract type

function _pause(address _market, ImTokenOperationTypes.OperationType _pauseType) private;

Parameters

NameTypeDescription
_marketaddressThe market address to pause
_pauseTypeImTokenOperationTypes.OperationTypeThe operation type to pause

_findIndex

Finds the index of a market within the pausableContracts array

function _findIndex(address _address) private view returns (uint256);

Parameters

NameTypeDescription
_addressaddressThe market address to search for

Returns

NameTypeDescription
<none>uint256index The index of the market