From d0bd1ee78bbcc0f209a88009b8ed524240237214 Mon Sep 17 00:00:00 2001 From: Samyak Jain <34437877+KaymasJain@users.noreply.github.com> Date: Tue, 15 Jun 2021 19:43:35 +0530 Subject: [PATCH] auth connector update --- contracts/mainnet/connectors/authority/main.sol | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/contracts/mainnet/connectors/authority/main.sol b/contracts/mainnet/connectors/authority/main.sol index 395ac77e..c6da4204 100644 --- a/contracts/mainnet/connectors/authority/main.sol +++ b/contracts/mainnet/connectors/authority/main.sol @@ -18,7 +18,13 @@ abstract contract AuthorityResolver is Events, Helpers { function add( address authority ) external payable returns (string memory _eventName, bytes memory _eventParam) { - AccountInterface(address(this)).enable(authority); + + AccountInterface _dsa = AccountInterface(address(this)); + if (_dsa.isAuth(authority)) { + authority = address(0); + } else { + _dsa.enable(authority); + } _eventName = "LogAddAuth(address,address)"; _eventParam = abi.encode(msg.sender, authority); @@ -33,7 +39,12 @@ abstract contract AuthorityResolver is Events, Helpers { address authority ) external payable returns (string memory _eventName, bytes memory _eventParam) { require(checkAuthCount() > 1, "Removing-all-authorities"); - AccountInterface(address(this)).disable(authority); + AccountInterface _dsa = AccountInterface(address(this)); + if (_dsa.isAuth(authority)) { + _dsa.disable(authority); + } else { + authority = address(0); + } _eventName = "LogRemoveAuth(address,address)"; _eventParam = abi.encode(msg.sender, authority);