Changed name to function, and added view to Factory

This commit is contained in:
Richard Ramos 2018-03-13 13:52:44 -04:00
parent daf69e5c91
commit 05376565a7
2 changed files with 25 additions and 13 deletions

View File

@ -31,6 +31,18 @@ contract Factory is Controlled {
_setKernel(_kernel, _infohash);
}
function getVersion(uint256 index) public view
returns(uint256 blockNumber,
uint256 timestamp,
address kernel,
bytes infohash)
{
return (versionLog[index].blockNumber,
versionLog[index].timestamp,
versionLog[index].kernel,
versionLog[index].infohash);
}
function _setKernel(address _kernel, bytes _infohash)
internal
{

View File

@ -29,7 +29,7 @@ contract Identity is ERC725, ERC735 {
modifier managerOnly {
require(
isKeyType(bytes32(msg.sender), MANAGEMENT_KEY)
isKeyPurpose(bytes32(msg.sender), MANAGEMENT_KEY)
);
_;
}
@ -49,14 +49,14 @@ contract Identity is ERC725, ERC735 {
}
modifier actorOnly(bytes32 _key) {
require(isKeyType(_key, ACTION_KEY));
require(isKeyPurpose(_key, ACTION_KEY));
_;
}
modifier managerOrActor(bytes32 _key) {
require(
isKeyType(bytes32(msg.sender), MANAGEMENT_KEY) ||
isKeyType(bytes32(msg.sender), ACTION_KEY)
isKeyPurpose(bytes32(msg.sender), MANAGEMENT_KEY) ||
isKeyPurpose(bytes32(msg.sender), ACTION_KEY)
);
_;
}
@ -219,7 +219,7 @@ contract Identity is ERC725, ERC735 {
}
} else {
require(_issuer == msg.sender);
require(isKeyType(bytes32(msg.sender), CLAIM_SIGNER_KEY));
require(isKeyPurpose(bytes32(msg.sender), CLAIM_SIGNER_KEY));
_execute(address(this), 0, msg.data);
ClaimRequested(
claimHash,
@ -270,12 +270,12 @@ contract Identity is ERC725, ERC735 {
return (myKey.purpose, myKey.keyType, myKey.key);
}
function isKeyType(bytes32 _key, uint256 _type)
function isKeyPurpose(bytes32 _key, uint256 _purpose)
public
constant
returns (bool)
{
return keys[keccak256(_key, _type)].purpose == _type;
return keys[keccak256(_key, _purpose)].purpose == _purpose;
}
function getKeyPurpose(bytes32 _key)
@ -287,22 +287,22 @@ contract Identity is ERC725, ERC735 {
uint256[] memory purposeHolder = new uint256[](4);
uint8 counter = 0;
if (isKeyType(_key, MANAGEMENT_KEY)) {
if (isKeyPurpose(_key, MANAGEMENT_KEY)) {
purposeHolder[counter] = MANAGEMENT_KEY;
counter++;
}
if (isKeyType(_key, ACTION_KEY)) {
if (isKeyPurpose(_key, ACTION_KEY)) {
purposeHolder[counter] = ACTION_KEY;
counter++;
}
if (isKeyType(_key, CLAIM_SIGNER_KEY)) {
if (isKeyPurpose(_key, CLAIM_SIGNER_KEY)) {
purposeHolder[counter] = CLAIM_SIGNER_KEY;
counter++;
}
if (isKeyType(_key, ENCRYPTION_KEY)) {
if (isKeyPurpose(_key, ENCRYPTION_KEY)) {
purposeHolder[counter] = ENCRYPTION_KEY;
counter++;
}
@ -463,12 +463,12 @@ contract Identity is ERC725, ERC735 {
Approved(_id, _approval);
if (trx.to == address(this)) {
require(isKeyType(_key, MANAGEMENT_KEY));
require(isKeyPurpose(_key, MANAGEMENT_KEY));
bytes32 managerKeyHash = keccak256(_key, MANAGEMENT_KEY);
requiredKeyPurpose = MANAGEMENT_KEY;
approvalCount = _calculateApprovals(managerKeyHash, _approval, trx);
} else {
require(isKeyType(_key, ACTION_KEY));
require(isKeyPurpose(_key, ACTION_KEY));
bytes32 actorKeyHash = keccak256(_key, ACTION_KEY);
requiredKeyPurpose = ACTION_KEY;
approvalCount = _calculateApprovals(actorKeyHash, _approval, trx);