Skip to content

Instantly share code, notes, and snippets.

@kyriediculous
Last active April 6, 2018 18:18
Show Gist options
  • Save kyriediculous/590eff0b3e138f36ae435be3f7ec476c to your computer and use it in GitHub Desktop.
Save kyriediculous/590eff0b3e138f36ae435be3f7ec476c to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.19;
import './CMCEnabled.sol';
import './Ownable.sol';
contract CMC is Ownable {
mapping (bytes32 => address) public contracts;
function addContract(bytes32 _name, address _address) external onlyOwner {
CMCEnabled _CMCEnabled = CMCEnabled(_address);
_CMCEnabled.setCMCAddress(address(this));
contracts[_name] = _address;
}
function getContract(bytes32 _name) external view returns (address) {
return contracts[_name];
}
function removeContract(bytes32 _name) external onlyOwner returns (bool) {
require(contracts[_name] != 0x0);
CMCEnabled _CMCEnabled = CMCEnabled(contracts[_name]);
_CMCEnabled.kill();
contracts[_name] = 0x0;
}
function changeContractCMC(bytes32 _name, address _newCMC) external onlyOwner {
CMCEnabled _CMCEnabled = CMCEnabled(contracts[_name]);
_CMCEnabled.changeCMCAddress(_newCMC);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment