mirror of
https://github.com/Instadapp/InstaContract.git
synced 2024-07-29 22:47:45 +00:00
Completed pending stuff in MoatAddress.
This commit is contained in:
parent
f047c6af23
commit
05c69f079a
|
@ -1,6 +1,3 @@
|
||||||
// addresses name - address, asset, resolver, moatkyber, moatmaker, admin
|
|
||||||
// I guess, only keep admin and owner
|
|
||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
||||||
|
@ -8,7 +5,9 @@ import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
||||||
|
|
||||||
contract AddressRegistry {
|
contract AddressRegistry {
|
||||||
|
|
||||||
|
event SetGov(address person, bool assigned);
|
||||||
event AddressChanged(string name, address addr);
|
event AddressChanged(string name, address addr);
|
||||||
|
event PendingAdmin(string name, address addr);
|
||||||
event ResolverApproved(address user, address addr);
|
event ResolverApproved(address user, address addr);
|
||||||
event ResolverDisapproved(address user, address addr);
|
event ResolverDisapproved(address user, address addr);
|
||||||
|
|
||||||
|
@ -27,10 +26,14 @@ contract AddressRegistry {
|
||||||
|
|
||||||
contract ManageGovernors is AddressRegistry {
|
contract ManageGovernors is AddressRegistry {
|
||||||
|
|
||||||
using SafeMath for uint;
|
function setGovernor(address person, bool assigned) public {
|
||||||
using SafeMath for uint256;
|
require(
|
||||||
|
msg.sender == getAddr("admin"),
|
||||||
// set governors function goes here with logics
|
"Permission Denied"
|
||||||
|
);
|
||||||
|
governors[person] = assigned;
|
||||||
|
emit SetGov(person, assigned);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,10 +42,10 @@ contract ManageRegistry is ManageGovernors {
|
||||||
|
|
||||||
address public pendingAdmin;
|
address public pendingAdmin;
|
||||||
uint public pendingTime;
|
uint public pendingTime;
|
||||||
|
|
||||||
function setPendingAdmin() public {
|
function setPendingAdmin() public {
|
||||||
require(block.timestamp > pendingTime, "Pending!");
|
require(block.timestamp > pendingTime, "Pending!");
|
||||||
registry[keccak256("admin")] = pendingAdmin;
|
registry[keccak256("admin")] = pendingAdmin;
|
||||||
|
emit PendingAdmin("admin", pendingAdmin);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAddr(string name, address newAddr) public {
|
function setAddr(string name, address newAddr) public {
|
||||||
|
@ -53,15 +56,14 @@ contract ManageRegistry is ManageGovernors {
|
||||||
);
|
);
|
||||||
pendingAdmin = newAddr;
|
pendingAdmin = newAddr;
|
||||||
pendingTime = block.timestamp.add(24 * 60 * 60); // adding 24 hours
|
pendingTime = block.timestamp.add(24 * 60 * 60); // adding 24 hours
|
||||||
emit AddressChanged(name, newAddr);
|
|
||||||
} else {
|
} else {
|
||||||
require(
|
require(
|
||||||
msg.sender == getAddr("admin"),
|
msg.sender == getAddr("admin"),
|
||||||
"Permission Denied"
|
"Permission Denied"
|
||||||
);
|
);
|
||||||
registry[keccak256(abi.encodePacked(name))] = newAddr;
|
registry[keccak256(abi.encodePacked(name))] = newAddr;
|
||||||
emit AddressChanged(name, newAddr);
|
|
||||||
}
|
}
|
||||||
|
emit AddressChanged(name, newAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAddr(string name) public view returns(address addr) {
|
function getAddr(string name) public view returns(address addr) {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// error with OMG fee collection
|
|
||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user