move events and nonce increment
This commit is contained in:
parent
7b179ec04c
commit
334f6754af
|
@ -452,7 +452,7 @@ contract Identity is ERC725, ERC735 {
|
||||||
returns (uint256 executionId)
|
returns (uint256 executionId)
|
||||||
{
|
{
|
||||||
executionId = nonce;
|
executionId = nonce;
|
||||||
emit ExecutionRequested(executionId, _to, _value, _data);
|
nonce++;
|
||||||
txx[executionId] = Transaction({
|
txx[executionId] = Transaction({
|
||||||
to: _to,
|
to: _to,
|
||||||
value: _value,
|
value: _value,
|
||||||
|
@ -460,7 +460,7 @@ contract Identity is ERC725, ERC735 {
|
||||||
nonce: nonce,
|
nonce: nonce,
|
||||||
approverCount: 0
|
approverCount: 0
|
||||||
});
|
});
|
||||||
nonce++;
|
emit ExecutionRequested(executionId, _to, _value, _data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _approve(
|
function _approve(
|
||||||
|
@ -476,8 +476,6 @@ contract Identity is ERC725, ERC735 {
|
||||||
|
|
||||||
uint256 approvalCount;
|
uint256 approvalCount;
|
||||||
uint256 requiredKeyPurpose;
|
uint256 requiredKeyPurpose;
|
||||||
|
|
||||||
emit Approved(_id, _approval);
|
|
||||||
|
|
||||||
if (trx.to == address(this)) {
|
if (trx.to == address(this)) {
|
||||||
require(isKeyPurpose(_key, MANAGEMENT_KEY));
|
require(isKeyPurpose(_key, MANAGEMENT_KEY));
|
||||||
|
@ -490,7 +488,9 @@ contract Identity is ERC725, ERC735 {
|
||||||
requiredKeyPurpose = ACTION_KEY;
|
requiredKeyPurpose = ACTION_KEY;
|
||||||
approvalCount = _calculateApprovals(actorKeyHash, _approval, trx);
|
approvalCount = _calculateApprovals(actorKeyHash, _approval, trx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit Approved(_id, _approval);
|
||||||
|
|
||||||
if (approvalCount >= minimumApprovalsByKeyPurpose[requiredKeyPurpose]) {
|
if (approvalCount >= minimumApprovalsByKeyPurpose[requiredKeyPurpose]) {
|
||||||
//(?) success should be included in event?
|
//(?) success should be included in event?
|
||||||
success = trx.to.call.value(trx.value)(trx.data);
|
success = trx.to.call.value(trx.value)(trx.data);
|
||||||
|
@ -513,10 +513,10 @@ contract Identity is ERC725, ERC735 {
|
||||||
_purpose == ACTION_KEY ||
|
_purpose == ACTION_KEY ||
|
||||||
_purpose == CLAIM_SIGNER_KEY ||
|
_purpose == CLAIM_SIGNER_KEY ||
|
||||||
_purpose == ENCRYPTION_KEY
|
_purpose == ENCRYPTION_KEY
|
||||||
);
|
);
|
||||||
emit KeyAdded(_key, _purpose, _type);
|
|
||||||
keys[keyHash] = Key(_purpose, _type, _key);
|
keys[keyHash] = Key(_purpose, _type, _key);
|
||||||
indexes[keyHash] = keysByPurpose[_purpose].push(_key) - 1;
|
indexes[keyHash] = keysByPurpose[_purpose].push(_key) - 1;
|
||||||
|
emit KeyAdded(_key, _purpose, _type);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _removeKey(
|
function _removeKey(
|
||||||
|
@ -526,9 +526,8 @@ contract Identity is ERC725, ERC735 {
|
||||||
private
|
private
|
||||||
{
|
{
|
||||||
bytes32 keyHash = keccak256(_key, _purpose);
|
bytes32 keyHash = keccak256(_key, _purpose);
|
||||||
Key storage myKey = keys[keyHash];
|
Key memory myKey = keys[keyHash];
|
||||||
emit KeyRemoved(myKey.key, myKey.purpose, myKey.keyType);
|
|
||||||
|
|
||||||
uint index = indexes[keyHash];
|
uint index = indexes[keyHash];
|
||||||
delete indexes[keyHash];
|
delete indexes[keyHash];
|
||||||
bytes32 replacer = keysByPurpose[_purpose][keysByPurpose[_purpose].length - 1];
|
bytes32 replacer = keysByPurpose[_purpose][keysByPurpose[_purpose].length - 1];
|
||||||
|
@ -545,6 +544,7 @@ contract Identity is ERC725, ERC735 {
|
||||||
}
|
}
|
||||||
|
|
||||||
delete keys[keyHash];
|
delete keys[keyHash];
|
||||||
|
emit KeyRemoved(myKey.key, myKey.purpose, myKey.keyType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _calculateApprovals(
|
function _calculateApprovals(
|
||||||
|
@ -615,15 +615,6 @@ contract Identity is ERC725, ERC735 {
|
||||||
private
|
private
|
||||||
{
|
{
|
||||||
require(msg.sender == _issuer);
|
require(msg.sender == _issuer);
|
||||||
emit ClaimChanged(
|
|
||||||
_claimHash,
|
|
||||||
_claimType,
|
|
||||||
_scheme,
|
|
||||||
_issuer,
|
|
||||||
_signature,
|
|
||||||
_data,
|
|
||||||
_uri
|
|
||||||
);
|
|
||||||
claims[_claimHash] = Claim({
|
claims[_claimHash] = Claim({
|
||||||
claimType: _claimType,
|
claimType: _claimType,
|
||||||
scheme: _scheme,
|
scheme: _scheme,
|
||||||
|
@ -632,6 +623,15 @@ contract Identity is ERC725, ERC735 {
|
||||||
data: _data,
|
data: _data,
|
||||||
uri: _uri
|
uri: _uri
|
||||||
});
|
});
|
||||||
|
emit ClaimChanged(
|
||||||
|
_claimHash,
|
||||||
|
_claimType,
|
||||||
|
_scheme,
|
||||||
|
_issuer,
|
||||||
|
_signature,
|
||||||
|
_data,
|
||||||
|
_uri
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue