-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEndaomentAdminStorage.sol
34 lines (28 loc) · 1.28 KB
/
EndaomentAdminStorage.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
// SPDX-License-Identifier: BSD 3-Clause
pragma solidity ^0.6.10;
import "./Administratable.sol";
// ENDAOMENT ADMIN STORAGE CONTRACT
/**
* @title EndaomentAdminStorage
* @author rheeger
* @notice Stores the contract address of the EndaomentAdmin,
* for use in references by the Org and Fund factories and
* subsequently deployed Org and Fund contracts.
*/
contract EndaomentAdminStorage is Administratable {
address public endaomentAdmin;
event EndaomentAdminChanged(address indexed oldAddress, address indexed newAddress);
/**
* @notice Updates address of the endaomentAdmin contract and emits `EndaomentAdminChanged` event.
* @param newAdmin New address of the endaomentAdmin contract
*/
function updateEndaomentAdmin(address newAdmin) public onlyAdmin(endaomentAdmin) {
// Validate that contract has a valid admin address set
require(newAdmin != address(0), "EndaomentAdminStorage: New admin cannot be the zero address");
EndaomentAdmin endaomentAdminContract = EndaomentAdmin(newAdmin);
address admin = endaomentAdminContract.getRoleAddress(IEndaomentAdmin.Role.ADMIN);
require(admin != address(0), "EndaomentAdminStorage: Admin cannot be the zero address");
emit EndaomentAdminChanged(endaomentAdmin, newAdmin);
endaomentAdmin = newAdmin;
}
}