mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 20:27:58 -05:00
* changes to pausemanager * add space * working pausemanager tests * npx hardhat test working for existing suite * more pausemanager tests * more tests and comments * minor typo fix * revert pauseTypes.ts changes * fix PauseManager test cases * small reverts * more test adjustments * Update contracts/src/security/pausing/PauseManager.sol Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * Update contracts/src/security/pausing/interfaces/IPauseManager.sol Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * Update contracts/src/security/pausing/PauseManager.sol Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * Update contracts/src/security/pausing/PauseManager.sol Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * fix unchecked * Update contracts/src/security/pausing/PauseManager.sol Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * Update contracts/src/security/pausing/PauseManager.sol Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * Update contracts/src/security/pausing/PauseManager.sol Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * more comment fixes * match interface and contract natspec comments * add *.mdx changes * change pauseExpiry to pauseExpiryTimestamp * doc change * tests passing with new pause expiry value after security council pause * add new overflow test to pausemanager * expand unchecked block * indent unchecked block * unPauseDueToExpiry -> unPauseByExpiredType * Update contracts/src/security/pausing/PauseManager.sol Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * added unpausebytype comment --------- Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com>
259 lines
6.9 KiB
Plaintext
259 lines
6.9 KiB
Plaintext
# `PauseManager`
|
|
|
|
### PAUSE_ALL_ROLE
|
|
|
|
```solidity
|
|
bytes32 PAUSE_ALL_ROLE
|
|
```
|
|
|
|
This is used to pause all pausable functions.
|
|
|
|
### UNPAUSE_ALL_ROLE
|
|
|
|
```solidity
|
|
bytes32 UNPAUSE_ALL_ROLE
|
|
```
|
|
|
|
This is used to unpause all unpausable functions.
|
|
|
|
### SECURITY_COUNCIL_ROLE
|
|
|
|
```solidity
|
|
bytes32 SECURITY_COUNCIL_ROLE
|
|
```
|
|
|
|
Role assigned to the security council that enables indefinite pausing and bypassing the cooldown period.
|
|
|
|
_Is not a pause or unpause role; a specific pause/unpause role is still required for specific pause/unpause types._
|
|
|
|
### PAUSE_DURATION
|
|
|
|
```solidity
|
|
uint256 PAUSE_DURATION
|
|
```
|
|
|
|
Duration of pauses, after which pauses will expire (except by the SECURITY_COUNCIL_ROLE).
|
|
|
|
### COOLDOWN_DURATION
|
|
|
|
```solidity
|
|
uint256 COOLDOWN_DURATION
|
|
```
|
|
|
|
Duration of cooldown after a pause expires, during which no pauses (except by the SECURITY_COUNCIL_ROLE) can be enacted.
|
|
|
|
_This prevents indefinite pause chaining by a non-SECURITY_COUNCIL_ROLE._
|
|
|
|
### pauseExpiryTimestamp
|
|
|
|
```solidity
|
|
uint256 pauseExpiryTimestamp
|
|
```
|
|
|
|
Unix timestamp of pause expiry.
|
|
|
|
_pauseExpiryTimestamp applies to all pause types. Pausing with one pause type blocks other pause types from being enacted (unless the SECURITY_COUNCIL_ROLE is used).
|
|
This prevents indefinite pause chaining by a non-SECURITY_COUNCIL_ROLE._
|
|
|
|
### onlyUsedPausedTypes
|
|
|
|
```solidity
|
|
modifier onlyUsedPausedTypes(enum IPauseManager.PauseType _pauseType)
|
|
```
|
|
|
|
_Modifier to prevent usage of unused PauseType._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The PauseType value being checked. Requirements: - The type must not be UNUSED. |
|
|
|
|
### whenTypeAndGeneralNotPaused
|
|
|
|
```solidity
|
|
modifier whenTypeAndGeneralNotPaused(enum IPauseManager.PauseType _pauseType)
|
|
```
|
|
|
|
_Modifier to make a function callable only when the specific and general types are not paused._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value being checked. Requirements: - The type must not be paused. |
|
|
|
|
### whenTypeNotPaused
|
|
|
|
```solidity
|
|
modifier whenTypeNotPaused(enum IPauseManager.PauseType _pauseType)
|
|
```
|
|
|
|
_Modifier to make a function callable only when the type is not paused._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value being checked. Requirements: - The type must not be paused. |
|
|
|
|
### __PauseManager_init
|
|
|
|
```solidity
|
|
function __PauseManager_init(struct IPauseManager.PauseTypeRole[] _pauseTypeRoleAssignments, struct IPauseManager.PauseTypeRole[] _unpauseTypeRoleAssignments) internal
|
|
```
|
|
|
|
Initializes the pause manager with the given pause and unpause roles.
|
|
|
|
_This function is called during contract initialization to set up the pause and unpause roles._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseTypeRoleAssignments | struct IPauseManager.PauseTypeRole[] | An array of PauseTypeRole structs defining the pause types and their associated roles. |
|
|
| _unpauseTypeRoleAssignments | struct IPauseManager.PauseTypeRole[] | An array of PauseTypeRole structs defining the unpause types and their associated roles. |
|
|
|
|
### _requireTypeAndGeneralNotPaused
|
|
|
|
```solidity
|
|
function _requireTypeAndGeneralNotPaused(enum IPauseManager.PauseType _pauseType) internal view virtual
|
|
```
|
|
|
|
_Throws if the specific or general types are paused.
|
|
Checks the specific and general pause types._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value being checked. |
|
|
|
|
### _requireTypeNotPaused
|
|
|
|
```solidity
|
|
function _requireTypeNotPaused(enum IPauseManager.PauseType _pauseType) internal view virtual
|
|
```
|
|
|
|
_Throws if the type is paused.
|
|
Checks the specific pause type._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value being checked. |
|
|
|
|
### pauseByType
|
|
|
|
```solidity
|
|
function pauseByType(enum IPauseManager.PauseType _pauseType) external
|
|
```
|
|
|
|
Pauses functionality by specific type.
|
|
|
|
_Throws if UNUSED pause type is used.
|
|
Requires the role mapped in `_pauseTypeRoles` for the pauseType.
|
|
Non-SECURITY_COUNCIL_ROLE can only pause after cooldown has passed.
|
|
SECURITY_COUNCIL_ROLE can pause without cooldown or expiry restrictions._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value. |
|
|
|
|
### unPauseByType
|
|
|
|
```solidity
|
|
function unPauseByType(enum IPauseManager.PauseType _pauseType) external
|
|
```
|
|
|
|
Unpauses functionality by specific type.
|
|
|
|
_Throws if UNUSED pause type is used.
|
|
Requires the role mapped in `_unPauseTypeRoles` for the pauseType.
|
|
SECURITY_COUNCIL_ROLE unpause will reset the cooldown, enabling non-SECURITY_COUNCIL_ROLE pausing._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value. |
|
|
|
|
### unPauseByExpiredType
|
|
|
|
```solidity
|
|
function unPauseByExpiredType(enum IPauseManager.PauseType _pauseType) external
|
|
```
|
|
|
|
Unpauses a specific pause type when the pause has expired.
|
|
|
|
_Can be called by anyone.
|
|
Throws if UNUSED pause type is used, or the pause expiry period has not passed._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value. |
|
|
|
|
### isPaused
|
|
|
|
```solidity
|
|
function isPaused(enum IPauseManager.PauseType _pauseType) public view returns (bool pauseTypeIsPaused)
|
|
```
|
|
|
|
Check if a pause type is enabled.
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value. |
|
|
|
|
#### Return Values
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| pauseTypeIsPaused | bool | Returns true if the pause type if paused, false otherwise. |
|
|
|
|
### updatePauseTypeRole
|
|
|
|
```solidity
|
|
function updatePauseTypeRole(enum IPauseManager.PauseType _pauseType, bytes32 _newRole) external
|
|
```
|
|
|
|
Update the pause type role mapping.
|
|
|
|
_Throws if UNUSED pause type is used.
|
|
Throws if role not different.
|
|
SECURITY_COUNCIL_ROLE role is required to execute this function._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value to update. |
|
|
| _newRole | bytes32 | The role to update to. |
|
|
|
|
### updateUnpauseTypeRole
|
|
|
|
```solidity
|
|
function updateUnpauseTypeRole(enum IPauseManager.PauseType _pauseType, bytes32 _newRole) external
|
|
```
|
|
|
|
Update the unpause type role mapping.
|
|
|
|
_Throws if UNUSED pause type is used.
|
|
Throws if role not different.
|
|
SECURITY_COUNCIL_ROLE role is required to execute this function._
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| _pauseType | enum IPauseManager.PauseType | The pause type value to update. |
|
|
| _newRole | bytes32 | The role to update to. |
|
|
|