mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
auth connector update
This commit is contained in:
parent
dc43a3f3b3
commit
d0bd1ee78b
|
@ -18,7 +18,13 @@ abstract contract AuthorityResolver is Events, Helpers {
|
||||||
function add(
|
function add(
|
||||||
address authority
|
address authority
|
||||||
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
) 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)";
|
_eventName = "LogAddAuth(address,address)";
|
||||||
_eventParam = abi.encode(msg.sender, authority);
|
_eventParam = abi.encode(msg.sender, authority);
|
||||||
|
@ -33,7 +39,12 @@ abstract contract AuthorityResolver is Events, Helpers {
|
||||||
address authority
|
address authority
|
||||||
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
||||||
require(checkAuthCount() > 1, "Removing-all-authorities");
|
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)";
|
_eventName = "LogRemoveAuth(address,address)";
|
||||||
_eventParam = abi.encode(msg.sender, authority);
|
_eventParam = abi.encode(msg.sender, authority);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user