-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathSablierV2Adminable.sol
44 lines (35 loc) · 1.68 KB
/
SablierV2Adminable.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
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.18;
import { ISablierV2Adminable } from "../interfaces/ISablierV2Adminable.sol";
import { Errors } from "../libraries/Errors.sol";
/// @title SablierV2Adminable
/// @dev Abstract contract that implements the {ISablierV2Adminable} interface.
abstract contract SablierV2Adminable is ISablierV2Adminable {
/*//////////////////////////////////////////////////////////////////////////
STORAGE
//////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ISablierV2Adminable
address public override admin;
/*//////////////////////////////////////////////////////////////////////////
MODIFIERS
//////////////////////////////////////////////////////////////////////////*/
/// @notice Reverts if called by any account other than the admin.
modifier onlyAdmin() {
if (admin != msg.sender) {
revert Errors.SablierV2Adminable_CallerNotAdmin({ admin: admin, caller: msg.sender });
}
_;
}
/*//////////////////////////////////////////////////////////////////////////
PUBLIC NON-CONSTANT FUNCTIONS
//////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ISablierV2Adminable
function transferAdmin(address newAdmin) public virtual override onlyAdmin {
// Load the current admin in memory.
address oldAdmin = admin;
// Effects: update the admin.
admin = newAdmin;
// Log the transfer of the admin.
emit ISablierV2Adminable.TransferAdmin(oldAdmin, newAdmin);
}
}