mirror of
https://github.com/Instadapp/yield-contract.git
synced 2024-07-29 21:47:29 +00:00
moved signers to deployed contracts
This commit is contained in:
parent
52fbd8c0fc
commit
beaa67232e
|
@ -8,10 +8,13 @@ contract Controller {
|
|||
event LogUpdateMaster(address indexed master);
|
||||
event LogEnableConnector(address indexed connector);
|
||||
event LogDisableConnector(address indexed connector);
|
||||
event LogAddSigner(address indexed signer);
|
||||
event LogRemoveSigner(address indexed signer);
|
||||
|
||||
address private newMaster;
|
||||
address public master;
|
||||
mapping (address => bool) public connectors;
|
||||
mapping (address => bool) public signer;
|
||||
|
||||
modifier isMaster() {
|
||||
require(msg.sender == master, "not-master");
|
||||
|
@ -36,21 +39,37 @@ contract Controller {
|
|||
emit LogUpdateMaster(master);
|
||||
}
|
||||
|
||||
// enable flusher connector
|
||||
function enableConnector(address _connector) external isChief {
|
||||
// enable connector
|
||||
function enableConnector(address _connector) external isMaster {
|
||||
require(!connectors[_connector], "already-enabled");
|
||||
require(_connector != address(0), "invalid-connector");
|
||||
connectors[_connector] = true;
|
||||
emit LogEnableConnector(_connector);
|
||||
}
|
||||
|
||||
// disable flusher connector
|
||||
function disableConnector(address _connector) external isChief {
|
||||
// disable connector
|
||||
function disableConnector(address _connector) external isMaster {
|
||||
require(connectors[_connector], "already-disabled");
|
||||
delete connectors[_connector];
|
||||
emit LogDisableConnector(_connector);
|
||||
}
|
||||
|
||||
// enable signer
|
||||
function enableSigner(address _signer) external isMaster {
|
||||
require(_signer != address(0), "invalid-address");
|
||||
require(!signer[_signer], "signer-already-enabled");
|
||||
signer[_signer] = true;
|
||||
emit LogAddSigner(_signer);
|
||||
}
|
||||
|
||||
// disable signer
|
||||
function disableSigner(address _signer) external isMaster {
|
||||
require(_signer != address(0), "invalid-address");
|
||||
require(signer[_signer], "signer-already-disabled");
|
||||
delete signer[_signer];
|
||||
emit LogRemoveSigner(_signer);
|
||||
}
|
||||
|
||||
// check if connectors[] are enabled
|
||||
function isConnector(address[] calldata _connectors) external view returns (bool isOk) {
|
||||
isOk = true;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
pragma solidity ^0.6.8;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
interface RegistryInterface {
|
||||
interface DeployerInterface {
|
||||
function signer(address) external view returns (bool);
|
||||
function isConnector(address[] calldata) external view returns (bool);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ contract Flusher {
|
|||
|
||||
string constant public name = "Flusher-v1";
|
||||
|
||||
RegistryInterface public constant registry = RegistryInterface(address(0)); // TODO - Change while deploying
|
||||
DeployerInterface public constant deployer = DeployerInterface(address(0)); // TODO - Change while deploying
|
||||
|
||||
function spell(address _target, bytes memory _data) internal {
|
||||
require(_target != address(0), "target-invalid");
|
||||
|
@ -29,9 +29,9 @@ contract Flusher {
|
|||
}
|
||||
|
||||
function cast(address[] calldata _targets, bytes[] calldata _datas) external payable {
|
||||
require(registry.signer(msg.sender), "not-signer");
|
||||
require(deployer.signer(msg.sender), "not-signer");
|
||||
require(_targets.length == _datas.length , "invalid-array-length");
|
||||
require(registry.isConnector(_targets), "not-connector");
|
||||
require(deployer.isConnector(_targets), "not-connector");
|
||||
for (uint i = 0; i < _targets.length; i++) {
|
||||
spell(_targets[i], _datas[i]);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@ contract Registry {
|
|||
|
||||
event LogAddChief(address indexed chief);
|
||||
event LogRemoveChief(address indexed chief);
|
||||
event LogAddSigner(address indexed signer);
|
||||
event LogRemoveSigner(address indexed signer);
|
||||
event LogUpdatePoolLogic(address token, address newLogic);
|
||||
event LogUpdateFee(address token, uint newFee);
|
||||
event LogUpdateCap(address token, uint newFee);
|
||||
|
@ -22,7 +20,6 @@ contract Registry {
|
|||
IndexInterface public constant instaIndex = IndexInterface(0x2971AdFa57b20E5a416aE5a708A8655A9c74f723);
|
||||
|
||||
mapping (address => bool) public chief;
|
||||
mapping (address => bool) public signer;
|
||||
mapping (address => address) public poolLogic;
|
||||
mapping (address => uint) public poolCap;
|
||||
mapping (address => uint) public fee;
|
||||
|
@ -60,28 +57,6 @@ contract Registry {
|
|||
emit LogRemoveChief(_chief);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Enable New Signer.
|
||||
* @param _signer Address of the new signer.
|
||||
*/
|
||||
function enableSigner(address _signer) external isChief {
|
||||
require(_signer != address(0), "invalid-address");
|
||||
require(!signer[_signer], "signer-already-enabled");
|
||||
signer[_signer] = true;
|
||||
emit LogAddSigner(_signer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Disable Signer.
|
||||
* @param _signer Address of the existing signer.
|
||||
*/
|
||||
function disableSigner(address _signer) external isChief {
|
||||
require(_signer != address(0), "invalid-address");
|
||||
require(signer[_signer], "signer-already-disabled");
|
||||
delete signer[_signer];
|
||||
emit LogRemoveSigner(_signer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev update pool rate logic
|
||||
* @param _pool pool address
|
||||
|
|
Loading…
Reference in New Issue
Block a user