@@ -20,84 +20,91 @@ abstract contract Authorizable is IAuthorizable {
2020 uint256 public immutable REVOKE_AUTHORIZATION_THAWING_PERIOD;
2121
2222 /// @notice Authorization details for authorizer-signer pairs
23- mapping (address signer = > Authorization authorization ) private authorizations ;
23+ mapping (address signer = > Authorization authorization ) private _authorizations ;
2424
2525 /**
26- * @notice Constructs a new instance of the Authorizable contract.
27- * @param _revokeAuthorizationThawingPeriod The duration (in seconds) for which an authorization is thawing before it can be revoked.
26+ * @dev Revert if the caller has not authorized the signer
2827 */
29- constructor (uint256 _revokeAuthorizationThawingPeriod ) {
30- REVOKE_AUTHORIZATION_THAWING_PERIOD = _revokeAuthorizationThawingPeriod;
28+ modifier onlyAuthorized (address signer ) {
29+ _requireAuthorized (msg .sender , signer);
30+ _;
3131 }
3232
3333 /**
34- * @dev Revert if the caller has not authorized the signer
34+ * @notice Constructs a new instance of the Authorizable contract.
35+ * @param revokeAuthorizationThawingPeriod The duration (in seconds) for which an authorization is thawing before it can be revoked.
3536 */
36- modifier onlyAuthorized (address _signer ) {
37- _requireAuthorized (msg .sender , _signer);
38- _;
37+ constructor (uint256 revokeAuthorizationThawingPeriod ) {
38+ REVOKE_AUTHORIZATION_THAWING_PERIOD = revokeAuthorizationThawingPeriod;
3939 }
4040
4141 /**
4242 * See {IAuthorizable.authorizeSigner}.
4343 */
44- function authorizeSigner (address _signer , uint256 _proofDeadline , bytes calldata _proof ) external {
44+ function authorizeSigner (address signer , uint256 proofDeadline , bytes calldata proof ) external {
4545 require (
46- authorizations[_signer ].authorizer == address (0 ),
46+ _authorizations[signer ].authorizer == address (0 ),
4747 AuthorizableSignerAlreadyAuthorized (
48- authorizations[_signer ].authorizer,
49- _signer ,
50- authorizations[_signer ].revoked
48+ _authorizations[signer ].authorizer,
49+ signer ,
50+ _authorizations[signer ].revoked
5151 )
5252 );
53- _verifyAuthorizationProof (_proof, _proofDeadline, _signer );
54- authorizations[_signer ].authorizer = msg .sender ;
55- emit SignerAuthorized (msg .sender , _signer );
53+ _verifyAuthorizationProof (proof, proofDeadline, signer );
54+ _authorizations[signer ].authorizer = msg .sender ;
55+ emit SignerAuthorized (msg .sender , signer );
5656 }
5757
5858 /**
5959 * See {IAuthorizable.thawSigner}.
6060 */
61- function thawSigner (address _signer ) external onlyAuthorized (_signer ) {
62- authorizations[_signer ].thawEndTimestamp = block .timestamp + REVOKE_AUTHORIZATION_THAWING_PERIOD;
63- emit SignerThawing (msg .sender , _signer, authorizations[_signer ].thawEndTimestamp);
61+ function thawSigner (address signer ) external onlyAuthorized (signer ) {
62+ _authorizations[signer ].thawEndTimestamp = block .timestamp + REVOKE_AUTHORIZATION_THAWING_PERIOD;
63+ emit SignerThawing (msg .sender , signer, _authorizations[signer ].thawEndTimestamp);
6464 }
6565
6666 /**
6767 * See {IAuthorizable.cancelThawSigner}.
6868 */
69- function cancelThawSigner (address _signer ) external onlyAuthorized (_signer ) {
70- require (authorizations[_signer ].thawEndTimestamp > 0 , AuthorizableSignerNotThawing (_signer ));
71- uint256 thawEnd = authorizations[_signer ].thawEndTimestamp;
72- authorizations[_signer ].thawEndTimestamp = 0 ;
73- emit SignerThawCanceled (msg .sender , _signer , thawEnd);
69+ function cancelThawSigner (address signer ) external onlyAuthorized (signer ) {
70+ require (_authorizations[signer ].thawEndTimestamp > 0 , AuthorizableSignerNotThawing (signer ));
71+ uint256 thawEnd = _authorizations[signer ].thawEndTimestamp;
72+ _authorizations[signer ].thawEndTimestamp = 0 ;
73+ emit SignerThawCanceled (msg .sender , signer , thawEnd);
7474 }
7575
7676 /**
7777 * See {IAuthorizable.revokeAuthorizedSigner}.
7878 */
79- function revokeAuthorizedSigner (address _signer ) external onlyAuthorized (_signer ) {
80- uint256 thawEndTimestamp = authorizations[_signer ].thawEndTimestamp;
81- require (thawEndTimestamp > 0 , AuthorizableSignerNotThawing (_signer ));
79+ function revokeAuthorizedSigner (address signer ) external onlyAuthorized (signer ) {
80+ uint256 thawEndTimestamp = _authorizations[signer ].thawEndTimestamp;
81+ require (thawEndTimestamp > 0 , AuthorizableSignerNotThawing (signer ));
8282 require (thawEndTimestamp <= block .timestamp , AuthorizableSignerStillThawing (block .timestamp , thawEndTimestamp));
83- authorizations[_signer].revoked = true ;
84- emit SignerRevoked (msg .sender , _signer);
83+ _authorizations[signer].revoked = true ;
84+ emit SignerRevoked (msg .sender , signer);
85+ }
86+
87+ /**
88+ * See {IAuthorizable.getThawEnd}.
89+ */
90+ function getThawEnd (address signer ) external view returns (uint256 ) {
91+ return _authorizations[signer].thawEndTimestamp;
8592 }
8693
8794 /**
8895 * See {IAuthorizable.isAuthorized}.
8996 */
90- function isAuthorized (address _authorizer , address _signer ) external view returns (bool ) {
91- return _isAuthorized (_authorizer, _signer );
97+ function isAuthorized (address authorizer , address signer ) external view returns (bool ) {
98+ return _isAuthorized (authorizer, signer );
9299 }
93100
94101 /**
95102 * See {IAuthorizable.isAuthorized}.
96103 */
97104 function _isAuthorized (address _authorizer , address _signer ) internal view returns (bool ) {
98105 return (_authorizer != address (0 ) &&
99- authorizations [_signer].authorizer == _authorizer &&
100- ! authorizations [_signer].revoked);
106+ _authorizations [_signer].authorizer == _authorizer &&
107+ ! _authorizations [_signer].revoked);
101108 }
102109
103110 /**
@@ -109,13 +116,6 @@ abstract contract Authorizable is IAuthorizable {
109116 require (_isAuthorized (_authorizer, _signer), AuthorizableSignerNotAuthorized (_authorizer, _signer));
110117 }
111118
112- /**
113- * See {IAuthorizable.getThawEnd}.
114- */
115- function getThawEnd (address _signer ) external view returns (uint256 ) {
116- return authorizations[_signer].thawEndTimestamp;
117- }
118-
119119 /**
120120 * @notice Verify the authorization proof provided by the authorizer
121121 * @param _proof The proof provided by the authorizer
0 commit comments