mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
Code refactoring.
This commit is contained in:
parent
fd4e3fe9ad
commit
ea51cfdee9
|
@ -11,11 +11,6 @@ contract AddressRegistry {
|
||||||
|
|
||||||
mapping(bytes32 => address) registry;
|
mapping(bytes32 => address) registry;
|
||||||
|
|
||||||
constructor() public {
|
|
||||||
registry[keccak256(abi.encodePacked("admin"))] = msg.sender;
|
|
||||||
registry[keccak256(abi.encodePacked("owner"))] = msg.sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
modifier isAdmin() {
|
modifier isAdmin() {
|
||||||
require(
|
require(
|
||||||
msg.sender == getAddress("admin") ||
|
msg.sender == getAddress("admin") ||
|
||||||
|
@ -106,7 +101,7 @@ contract LogicRegistry is AddressRegistry {
|
||||||
/**
|
/**
|
||||||
* @title User Wallet Registry
|
* @title User Wallet Registry
|
||||||
*/
|
*/
|
||||||
contract ProxyRegistry is LogicRegistry {
|
contract WalletRegistry is LogicRegistry {
|
||||||
|
|
||||||
event Created(address indexed sender, address indexed owner, address proxy);
|
event Created(address indexed sender, address indexed owner, address proxy);
|
||||||
|
|
||||||
|
@ -170,4 +165,14 @@ contract ProxyRegistry is LogicRegistry {
|
||||||
managerEnabled = false;
|
managerEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
contract Registry is WalletRegistry {
|
||||||
|
|
||||||
|
constructor() public {
|
||||||
|
registry[keccak256(abi.encodePacked("admin"))] = msg.sender;
|
||||||
|
registry[keccak256(abi.encodePacked("owner"))] = msg.sender;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -188,7 +188,7 @@ contract UserGuardian is UserAuth {
|
||||||
/**
|
/**
|
||||||
* @dev Throws if the msg.sender is not guardian
|
* @dev Throws if the msg.sender is not guardian
|
||||||
*/
|
*/
|
||||||
function isGuardian() internal returns (bool) {
|
function isGuardian() internal view returns (bool) {
|
||||||
if (msg.sender == guardians[1] || msg.sender == guardians[2] || msg.sender == guardians[3]) {
|
if (msg.sender == guardians[1] || msg.sender == guardians[2] || msg.sender == guardians[3]) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -233,7 +233,7 @@ contract UserManager is UserGuardian {
|
||||||
/**
|
/**
|
||||||
* @dev Throws if the msg.sender is not manager
|
* @dev Throws if the msg.sender is not manager
|
||||||
*/
|
*/
|
||||||
function isManager() internal returns (bool) {
|
function isManager() internal view returns (bool) {
|
||||||
if (msg.sender == managers[1] || msg.sender == managers[2] || msg.sender == managers[3]) {
|
if (msg.sender == managers[1] || msg.sender == managers[2] || msg.sender == managers[3]) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -287,7 +287,6 @@ contract UserWallet is UserManager, UserNote {
|
||||||
/**
|
/**
|
||||||
* @dev sets the "address registry", owner's last activity, owner's active period and initial owner
|
* @dev sets the "address registry", owner's last activity, owner's active period and initial owner
|
||||||
* @param _owner initial owner of the contract
|
* @param _owner initial owner of the contract
|
||||||
* @param _logicRegistryAddr address registry address which have logic proxy registry
|
|
||||||
*/
|
*/
|
||||||
constructor(address _owner) public {
|
constructor(address _owner) public {
|
||||||
registry = msg.sender;
|
registry = msg.sender;
|
||||||
|
@ -344,7 +343,7 @@ contract UserWallet is UserManager, UserNote {
|
||||||
* and if the sender is owner or contract itself or manager
|
* and if the sender is owner or contract itself or manager
|
||||||
* and if manager then Throws if target is default proxy address
|
* and if manager then Throws if target is default proxy address
|
||||||
*/
|
*/
|
||||||
function isExecutable(address proxyTarget) internal returns (bool) {
|
function isExecutable(address proxyTarget) internal view returns (bool) {
|
||||||
(bool isLogic, bool isDefault) = isLogicAuthorised(proxyTarget);
|
(bool isLogic, bool isDefault) = isLogicAuthorised(proxyTarget);
|
||||||
require(isLogic, "logic-proxy-address-not-allowed");
|
require(isLogic, "logic-proxy-address-not-allowed");
|
||||||
if (isAuth(msg.sender)) {
|
if (isAuth(msg.sender)) {
|
Loading…
Reference in New Issue
Block a user