Last active
April 6, 2018 20:04
-
-
Save kyriediculous/987ad238f0d13a9392350c9acd36ddfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.19; | |
import './ContractProvider.sol'; | |
/** | |
* Base class for every contract (DB, Controller, ALC,) | |
* Once the CMC address being used by our newly added contract is set it can not be set again except by our CMC contract | |
**/ | |
contract CMCEnabled { | |
address public CMC; | |
modifier isCMCEnabled(bytes32 _name) { | |
require(msg.sender == ContractProvider(CMC).contracts(_name)); | |
_; | |
} | |
function() external { | |
revert(); | |
} | |
function setCMCAddress(address _CMC) external { | |
if (CMC != 0x0 && msg.sender != CMC) { | |
revert(); | |
} else { | |
CMC = _CMC; | |
} | |
} | |
function changeCMCAddress(address _newCMC) external { | |
require(CMC == msg.sender); | |
CMC = _newCMC; | |
} | |
function kill() external { | |
assert(msg.sender == CMC); | |
selfdestruct(CMC); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment