all files / contracts/ ConceptRegistry.sol

100% Statements 14/14
75% Branches 3/4
100% Functions 2/2
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                                                                          28× 26×   16× 16× 16×      
pragma solidity ^0.4.23;
 
import "./Concept.sol";
import "./ProxyFactory.sol";
 
 
//@purpose: To create and store the concept ontology
contract ConceptRegistry {
    mapping (address => bool) public conceptExists;
    address public fathomToken;
    bool public initialized = false;
    address public mewAddress; //a manually created contract with no parents
    address public distributorAddress; //a manually created contract with no parents
    ProxyFactory public proxyFactory;
 
    event ConceptCreation (address _concept, address indexed cloneOf);
 
    //@purpose: give this contract the address of a UserRegistry and mew Concept
    function init(address _token, address _distributor, address _proxyFactory) public {
        Eif (initialized == false) {
            fathomToken = _token;
            distributorAddress = _distributor;
            proxyFactory = ProxyFactory(_proxyFactory);
            Concept mew = proxyFactory.createConcept(new address[](0), new uint[](0), uint(2**255), "", address(0x0), address(0x0));
            emit ConceptCreation(address(mew), address(0x0));
            mewAddress = address(mew);
            conceptExists[mewAddress] = true;
            initialized = true;
        }
    }
 
    /*
      @purpose: To make a concept
      @param: address[] parentList = an array of addresses containing the addresses of the concepts parents
    */
    function makeConcept (
        address[] parentList,
        uint[] _propagationRates,
        uint _lifetime,
        bytes _data,
        address _owner,
        address cloneOf
    )
        public
        returns (address)
    {
        require(parentList.length > 0, 'Must specify at least one parent concept');
        Concept newConcept = proxyFactory.createConcept(parentList, _propagationRates, _lifetime, _data, _owner, cloneOf);
 
        conceptExists[address(newConcept)] = true;
        emit ConceptCreation(address(newConcept), cloneOf);
        return address(newConcept);
    }
}