@@ -17,6 +17,9 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
17
17
mapping (address => bool ) _authorized_readers;
18
18
mapping (bytes32 attId = > bytes collateral ) _db;
19
19
20
+ event SetAuthorizedWriter (address caller , bool authorized );
21
+ event SetAuthorizedReader (address caller , bool authorized );
22
+
20
23
modifier onlyDao (address dao ) {
21
24
require (_authorized_writers[dao], "FORBIDDEN " );
22
25
_;
@@ -26,15 +29,15 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
26
29
_initializeOwner (msg .sender );
27
30
28
31
// adding address(0) as an authorized_reader to allow eth_call
29
- _authorized_readers[ address (0 )] = true ;
32
+ _setAuthorizedReader ( address (0 ), true ) ;
30
33
}
31
34
32
35
function isAuthorizedCaller (address caller ) external view returns (bool ) {
33
36
return _authorized_readers[caller];
34
37
}
35
38
36
39
function setCallerAuthorization (address caller , bool authorized ) external onlyOwner {
37
- _authorized_readers[ caller] = authorized;
40
+ _setAuthorizedReader ( caller, authorized) ;
38
41
}
39
42
40
43
function pauseCallerRestriction () external onlyOwner whenNotPaused {
@@ -46,11 +49,11 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
46
49
}
47
50
48
51
function grantDao (address granted ) external onlyOwner {
49
- _authorized_writers[ granted] = true ;
52
+ _setAuthorizedWriter ( granted, true ) ;
50
53
}
51
54
52
55
function revokeDao (address revoked ) external onlyOwner {
53
- _authorized_writers[ revoked] = false ;
56
+ _setAuthorizedWriter ( revoked, false ) ;
54
57
}
55
58
56
59
function collateralPointer (bytes32 key ) external pure override returns (bytes32 collateralAttId ) {
@@ -99,6 +102,16 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
99
102
attestationId = keccak256 (abi.encodePacked (magic, key));
100
103
}
101
104
105
+ function _setAuthorizedWriter (address caller , bool authorized ) private {
106
+ _authorized_writers[caller] = authorized;
107
+ emit SetAuthorizedWriter (caller, authorized);
108
+ }
109
+
110
+ function _setAuthorizedReader (address caller , bool authorized ) private {
111
+ _authorized_readers[caller] = authorized;
112
+ emit SetAuthorizedReader (caller, authorized);
113
+ }
114
+
102
115
/// TCB Management
103
116
using EnumerableSet for EnumerableSet.Bytes32Set;
104
117
0 commit comments