/
Base.sol
31 lines (25 loc) · 933 Bytes
/
Base.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import "../Storage.sol";
import "../../common/ReentrancyGuard.sol";
/// @title Base contract containing functions accessible to the other facets.
/// @author Matter Labs
/// @custom:security-contact security@matterlabs.dev
contract Base is ReentrancyGuard {
AppStorage internal s;
/// @notice Checks that the message sender is an active governor
modifier onlyGovernor() {
require(msg.sender == s.governor, "1g"); // only by governor
_;
}
/// @notice Checks that the message sender is an active governor or admin
modifier onlyGovernorOrAdmin() {
require(msg.sender == s.governor || msg.sender == s.admin, "Only by governor or admin");
_;
}
/// @notice Checks if validator is active
modifier onlyValidator() {
require(s.validators[msg.sender], "1h"); // validator is not active
_;
}
}