2017-07-05 10:28:15 +00:00
|
|
|
contract Factory {
|
|
|
|
|
|
|
|
event ContractInstantiation(address sender, address instantiation);
|
|
|
|
|
|
|
|
mapping(address => bool) public isInstantiation;
|
|
|
|
mapping(address => address[]) public instantiations;
|
|
|
|
|
|
|
|
/// @dev Returns number of instantiations by creator.
|
|
|
|
/// @param creator Contract creator.
|
|
|
|
/// @return Returns number of instantiations by creator.
|
|
|
|
function getInstantiationCount(address creator)
|
|
|
|
public
|
2018-07-02 09:14:28 +00:00
|
|
|
view
|
2017-07-05 10:28:15 +00:00
|
|
|
returns (uint)
|
|
|
|
{
|
|
|
|
return instantiations[creator].length;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @dev Registers contract in factory registry.
|
|
|
|
/// @param instantiation Address of contract instantiation.
|
|
|
|
function register(address instantiation)
|
|
|
|
internal
|
|
|
|
{
|
|
|
|
isInstantiation[instantiation] = true;
|
|
|
|
instantiations[msg.sender].push(instantiation);
|
2018-06-27 08:35:38 +00:00
|
|
|
emit ContractInstantiation(msg.sender, instantiation);
|
2017-07-05 10:28:15 +00:00
|
|
|
}
|
|
|
|
}
|