mirror of
https://github.com/Instadapp/dsa-resolvers-deprecated.git
synced 2024-07-29 22:38:16 +00:00
code refactor
This commit is contained in:
parent
85ebdd1d0f
commit
8a74747dad
|
@ -3,7 +3,7 @@ pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
interface AccountInterface {
|
interface AccountInterface {
|
||||||
function isAuth(address user) external view returns (bool);
|
function isAuth(address user) external view returns (bool);
|
||||||
function sheild(address user) external view returns (bool);
|
function sheild() external view returns (bool);
|
||||||
function version() external view returns (uint);
|
function version() external view returns (uint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ contract Helpers {
|
||||||
ConnectorsInterface connectorsContract;
|
ConnectorsInterface connectorsContract;
|
||||||
}
|
}
|
||||||
|
|
||||||
contract SmartAccountResolver is Helpers {
|
contract AccountResolver is Helpers {
|
||||||
|
|
||||||
function getID(address account) public view returns(uint id){
|
function getID(address account) public view returns(uint id){
|
||||||
return listContract.accountID(account);
|
return listContract.accountID(account);
|
||||||
|
@ -139,6 +139,7 @@ contract SmartAccountResolver is Helpers {
|
||||||
address[] accounts;
|
address[] accounts;
|
||||||
uint[] versions;
|
uint[] versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOwnerDetails(address owner) public view returns(OwnerData memory){
|
function getOwnerDetails(address owner) public view returns(OwnerData memory){
|
||||||
address[] memory accounts = getOwnerAccounts(owner);
|
address[] memory accounts = getOwnerAccounts(owner);
|
||||||
return OwnerData(
|
return OwnerData(
|
||||||
|
@ -147,21 +148,14 @@ contract SmartAccountResolver is Helpers {
|
||||||
getAccountVersions(accounts)
|
getAccountVersions(accounts)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isShield(address account) public view returns(bool shield) {
|
||||||
|
shield = AccountInterface(account).sheild();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
contract ConnectorsResolver is SmartAccountResolver {
|
contract ConnectorsResolver is AccountResolver {
|
||||||
string public constant name = "v1";
|
|
||||||
uint public constant version = 1;
|
|
||||||
|
|
||||||
constructor(address _index) public{
|
|
||||||
index = _index;
|
|
||||||
indexContract = IndexInterface(index);
|
|
||||||
list = indexContract.list();
|
|
||||||
listContract = ListInterface(list);
|
|
||||||
connectorsContract = ConnectorsInterface(indexContract.connectors(version));
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEnabledConnectors() public view returns(address[] memory){
|
function getEnabledConnectors() public view returns(address[] memory){
|
||||||
uint count = connectorsContract.count();
|
uint count = connectorsContract.count();
|
||||||
address enabledAddr = connectorsContract.first();
|
address enabledAddr = connectorsContract.first();
|
||||||
|
@ -183,3 +177,17 @@ contract ConnectorsResolver is SmartAccountResolver {
|
||||||
return addressess;
|
return addressess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
contract Resolver is ConnectorsResolver {
|
||||||
|
string public constant name = "v1";
|
||||||
|
uint public constant version = 1;
|
||||||
|
|
||||||
|
constructor(address _index) public{
|
||||||
|
index = _index;
|
||||||
|
indexContract = IndexInterface(index);
|
||||||
|
list = indexContract.list();
|
||||||
|
listContract = ListInterface(list);
|
||||||
|
connectorsContract = ConnectorsInterface(indexContract.connectors(version));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user