add upgradable instance factory and needed architecture
This commit is contained in:
parent
ebbfbeb1a0
commit
5c9070f7dc
|
@ -134,6 +134,7 @@ contract Identity is ERC725, ERC735 {
|
|||
public
|
||||
selfOnly
|
||||
{
|
||||
require(_minimumApprovals > 0);
|
||||
minimumApprovalsByKeyType[_type] = _minimumApprovals;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
pragma solidity ^0.4.17;
|
||||
|
||||
import "../deploy/Factory.sol";
|
||||
import "../deploy/UpdatableInstance.sol";
|
||||
import "./IdentityKernel.sol";
|
||||
|
||||
contract IdentityFactory is Factory {
|
||||
|
||||
event IdentityCreated(address instance);
|
||||
|
||||
function IdentityFactory(bytes _infohash)
|
||||
Factory(new IdentityKernel(), _infohash)
|
||||
public
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function createIdentity()
|
||||
external
|
||||
{
|
||||
createIdentity(msg.sender);
|
||||
}
|
||||
|
||||
function createIdentity(address _idOwner)
|
||||
public
|
||||
{
|
||||
IdentityKernel instance = IdentityKernel(new UpdatableInstance(address(latestKernel)));
|
||||
instance.initIdentity(_idOwner);
|
||||
IdentityCreated(address(instance));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
pragma solidity ^0.4.17;
|
||||
|
||||
import "../deploy/InstanceStorage.sol";
|
||||
import "./Identity.sol";
|
||||
|
||||
contract IdentityKernel is InstanceStorage, Identity {
|
||||
|
||||
function initIdentity(address _caller) external {
|
||||
require(minimumApprovalsByKeyType[MANAGEMENT_KEY] == 0);
|
||||
_addKey(bytes32(_caller), MANAGEMENT_KEY, 0);
|
||||
minimumApprovalsByKeyType[MANAGEMENT_KEY] = 1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue