Skip to content

Commit

Permalink
chore: comments and naming
Browse files Browse the repository at this point in the history
  • Loading branch information
folkyatina committed Jan 7, 2025
1 parent b242670 commit 9822b47
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 43 deletions.
41 changes: 0 additions & 41 deletions contracts/0.8.25/utils/OZPausableUntil.sol

This file was deleted.

52 changes: 52 additions & 0 deletions contracts/0.8.25/utils/PausableUntilWithRoles.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-FileCopyrightText: 2024 Lido <[email protected]>
// SPDX-License-Identifier: GPL-3.0

// See contracts/COMPILERS.md
pragma solidity 0.8.25;

import {PausableUntil} from "contracts/common/utils/PausableUntil.sol";
import {AccessControlEnumerableUpgradeable} from "contracts/openzeppelin/5.0.2/upgradeable/access/extensions/AccessControlEnumerableUpgradeable.sol";

/**
* @title PausableUntilWithRoles
* @author folkyatina
* @notice a `PausableUntil` reference implementation using OpenZeppelin's `AccessControlEnumerableUpgradeable`
* @dev This contract is abstract and should be inherited by the actual contract that is using `whenNotPaused` modifier
* to actually block some functions on pause
*/
abstract contract PausableUntilWithRoles is PausableUntil, AccessControlEnumerableUpgradeable {
/// @notice role that allows to pause the contract
bytes32 public constant PAUSE_ROLE = keccak256("PausableUntilWithRoles.PauseRole");
/// @notice role that allows to resume the contract
bytes32 public constant RESUME_ROLE = keccak256("PausableUntilWithRoles.ResumeRole");

/**
* @notice Resume the contract
* @dev Contract is deployed in paused state and should be resumed explicitly
*/
function resume() external onlyRole(RESUME_ROLE) {
_resume();
}

/**
* @notice Pause the contract
* @param _duration pause duration in seconds (use `PAUSE_INFINITELY` for unlimited)
* @dev Reverts if contract is already paused
* @dev Reverts reason if sender has no `PAUSE_ROLE`
* @dev Reverts if zero duration is passed
*/
function pauseFor(uint256 _duration) external onlyRole(PAUSE_ROLE) {
_pauseFor(_duration);
}

/**
* @notice Pause the contract until a specific timestamp
* @param _pauseUntilInclusive the last second to pause until inclusive
* @dev Reverts if the timestamp is in the past
* @dev Reverts if sender has no `PAUSE_ROLE`
* @dev Reverts if contract is already paused
*/
function pauseUntil(uint256 _pauseUntilInclusive) external onlyRole(PAUSE_ROLE) {
_pauseUntil(_pauseUntilInclusive);
}
}
4 changes: 2 additions & 2 deletions contracts/0.8.25/vaults/VaultHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {IStakingVault} from "./interfaces/IStakingVault.sol";
import {ILido as IStETH} from "../interfaces/ILido.sol";
import {IBeaconProxy} from "./interfaces/IBeaconProxy.sol";

import {OZPausableUntil} from "../utils/OZPausableUntil.sol";
import {PausableUntilWithRoles} from "../utils/PausableUntilWithRoles.sol";

import {Math256} from "contracts/common/lib/Math256.sol";

Expand All @@ -20,7 +20,7 @@ import {Math256} from "contracts/common/lib/Math256.sol";
/// It also allows to force rebalance of the vaults
/// Also, it passes the report from the accounting oracle to the vaults and charges fees
/// @author folkyatina
abstract contract VaultHub is OZPausableUntil {
abstract contract VaultHub is PausableUntilWithRoles {
/// @custom:storage-location erc7201:VaultHub
struct VaultHubStorage {
/// @notice vault sockets with vaults connected to the hub
Expand Down

0 comments on commit 9822b47

Please sign in to comment.