@@ -29,6 +29,7 @@ contract EulerSwapProtocolFeeConfig is IEulerSwapProtocolFeeConfig, EVCUtil {
2929 mapping (address pool = > Override) public overrides;
3030
3131 error Unauthorized ();
32+ error InvalidAdminAddress ();
3233 error InvalidProtocolFee ();
3334 error InvalidProtocolFeeRecipient ();
3435
@@ -42,6 +43,8 @@ contract EulerSwapProtocolFeeConfig is IEulerSwapProtocolFeeConfig, EVCUtil {
4243 event OverrideRemoved (address indexed pool );
4344
4445 constructor (address evc , address admin_ ) EVCUtil (evc) {
46+ _validateAdminAddress (admin_);
47+
4548 emit AdminUpdated (address (0 ), admin_);
4649
4750 admin = admin_;
@@ -58,6 +61,8 @@ contract EulerSwapProtocolFeeConfig is IEulerSwapProtocolFeeConfig, EVCUtil {
5861
5962 /// @inheritdoc IEulerSwapProtocolFeeConfig
6063 function setAdmin (address newAdmin ) external onlyAdmin {
64+ _validateAdminAddress (newAdmin);
65+
6166 emit AdminUpdated (admin, newAdmin);
6267
6368 admin = newAdmin;
@@ -104,4 +109,10 @@ contract EulerSwapProtocolFeeConfig is IEulerSwapProtocolFeeConfig, EVCUtil {
104109 fee = defaultFee;
105110 }
106111 }
112+
113+ /// @dev Ensures the admin is not a known sub-account, since they are not allowed
114+ function _validateAdminAddress (address addr ) internal view {
115+ address owner = evc.getAccountOwner (addr);
116+ require (owner == addr || owner == address (0 ), InvalidAdminAddress ());
117+ }
107118}
0 commit comments