File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ pragma solidity ^0.7.3;
4
4
pragma experimental ABIEncoderV2;
5
5
6
6
import "@openzeppelin/contracts/cryptography/ECDSA.sol " ;
7
+ import "@openzeppelin/contracts/utils/Address.sol " ;
7
8
8
9
import "../governance/Governed.sol " ;
9
10
import "../staking/IStaking.sol " ;
@@ -54,6 +55,7 @@ contract AllocationExchange is Governed {
54
55
address _governor ,
55
56
address _authority
56
57
) {
58
+ require (_governor != address (0 ), "Exchange: governor must be set " );
57
59
Governed._initialize (_governor);
58
60
59
61
graphToken = _graphToken;
@@ -97,6 +99,12 @@ contract AllocationExchange is Governed {
97
99
*/
98
100
function _setAuthority (address _authority ) private {
99
101
require (_authority != address (0 ), "Exchange: empty authority " );
102
+ // This will help catch some operational errors but not all.
103
+ // The validation will fail under the following conditions:
104
+ // - a contract in construction
105
+ // - an address where a contract will be created
106
+ // - an address where a contract lived, but was destroyed
107
+ require (! Address.isContract (_authority), "Exchange: authority must be EOA " );
100
108
authority = _authority;
101
109
emit AuthoritySet (authority);
102
110
}
You can’t perform that action at this time.
0 commit comments