linting and reorder

This commit is contained in:
Ricardo Guilherme Schmidt 2018-03-03 00:00:11 -03:00
parent 80b1089bd3
commit 612fdb7f43

View File

@ -54,8 +54,6 @@ contract Identity is ERC725, ERC735 {
} }
modifier managerOrActor(bytes32 _key) { modifier managerOrActor(bytes32 _key) {
require( require(
isKeyType(bytes32(msg.sender), MANAGEMENT_KEY) || isKeyType(bytes32(msg.sender), MANAGEMENT_KEY) ||
isKeyType(bytes32(msg.sender), ACTION_KEY) isKeyType(bytes32(msg.sender), ACTION_KEY)
@ -63,6 +61,24 @@ contract Identity is ERC725, ERC735 {
_; _;
} }
modifier validECDSAKey (
bytes32 _key,
bytes32 _signHash,
uint8 _v,
bytes32 _r,
bytes32 _s
)
{
require(address(_key) == ecrecover(
keccak256("\x19Ethereum Signed Message:\n32", _signHash),
_v,
_r,
_s
));
require(keys[_key].purpose != 0);
_;
}
function Identity() public { function Identity() public {
_addKey(bytes32(msg.sender), MANAGEMENT_KEY, 0); _addKey(bytes32(msg.sender), MANAGEMENT_KEY, 0);
@ -70,8 +86,15 @@ contract Identity is ERC725, ERC735 {
minimumApprovalsByKeyPurpose[ACTION_KEY] = 1; minimumApprovalsByKeyPurpose[ACTION_KEY] = 1;
} }
function ()
public
payable
{
}
function managerReset(address _newKey) function managerReset(address _newKey)
external public
recoveryOnly recoveryOnly
{ {
recoveryManager = _newKey; recoveryManager = _newKey;
@ -213,7 +236,10 @@ contract Identity is ERC725, ERC735 {
} }
} }
function removeClaim(bytes32 _claimId) public returns (bool success) { function removeClaim(bytes32 _claimId)
public
returns (bool success)
{
Claim memory c = claims[_claimId]; Claim memory c = claims[_claimId];
require( require(
@ -303,7 +329,14 @@ contract Identity is ERC725, ERC735 {
function getClaim(bytes32 _claimId) function getClaim(bytes32 _claimId)
public public
constant constant
returns(uint256 claimType, uint256 scheme, address issuer, bytes signature, bytes data, string uri) returns(
uint256 claimType,
uint256 scheme,
address issuer,
bytes signature,
bytes data,
string uri
)
{ {
Claim memory _claim = claims[_claimId]; Claim memory _claim = claims[_claimId];
return (_claim.claimType, _claim.scheme, _claim.issuer, _claim.signature, _claim.data, _claim.uri); return (_claim.claimType, _claim.scheme, _claim.issuer, _claim.signature, _claim.data, _claim.uri);
@ -317,19 +350,6 @@ contract Identity is ERC725, ERC735 {
return claimsByType[_claimType]; return claimsByType[_claimType];
} }
modifier validECDSAKey (
bytes32 _key,
bytes32 _signHash,
uint8 _v,
bytes32 _r,
bytes32 _s
)
{
require(address(_key) == ecrecover(keccak256("\x19Ethereum Signed Message:\n32", _signHash), _v, _r, _s));
require(keys[_key].purpose != 0);
_;
}
function approveECDSA( function approveECDSA(
uint256 _id, uint256 _id,
bool _approval, bool _approval,
@ -368,9 +388,21 @@ contract Identity is ERC725, ERC735 {
bytes32 _s bytes32 _s
) )
public public
validECDSAKey(_key, keccak256(address(this), validECDSAKey(
bytes4(keccak256("execute(address,uint256,bytes)")), _key,
_to, _value, _data, _nonce), _v, _r, _s) keccak256(
address(this),
bytes4(
keccak256("execute(address,uint256,bytes)")),
_to,
_value,
_data,
_nonce
),
_v,
_r,
_s
)
managerOrActor(_key) managerOrActor(_key)
returns (uint256 executionId) returns (uint256 executionId)
{ {
@ -386,10 +418,6 @@ contract Identity is ERC725, ERC735 {
recoveryContract = _recoveryContract; recoveryContract = _recoveryContract;
} }
function () public payable {
}
function _execute( function _execute(
address _to, address _to,
uint256 _value, uint256 _value,
@ -445,7 +473,13 @@ contract Identity is ERC725, ERC735 {
} }
} }
function _addKey(bytes32 _key, uint256 _purpose, uint256 _type) private { function _addKey(
bytes32 _key,
uint256 _purpose,
uint256 _type
)
private
{
bytes32 keyHash = keccak256(_key, _purpose); bytes32 keyHash = keccak256(_key, _purpose);
require(keys[keyHash].purpose == 0); require(keys[keyHash].purpose == 0);
@ -460,8 +494,12 @@ contract Identity is ERC725, ERC735 {
indexes[keyHash] = keysByPurpose[_purpose].push(_key) - 1; indexes[keyHash] = keysByPurpose[_purpose].push(_key) - 1;
} }
function _removeKey(bytes32 _key, uint256 _purpose) private { function _removeKey(
bytes32 _key,
uint256 _purpose
)
private
{
bytes32 keyHash = keccak256(_key, _purpose); bytes32 keyHash = keccak256(_key, _purpose);
Key storage myKey = keys[keyHash]; Key storage myKey = keys[keyHash];
KeyRemoved(myKey.key, myKey.purpose, myKey.keyType); KeyRemoved(myKey.key, myKey.purpose, myKey.keyType);