use MessageSigned.sol abstract contract

This commit is contained in:
Ricardo Guilherme Schmidt 2018-05-08 20:48:18 -03:00
parent 2d8bc3a8fb
commit 8938d03911
1 changed files with 13 additions and 27 deletions

View File

@ -2,9 +2,9 @@ pragma solidity ^0.4.21;
import "./ERC725.sol"; import "./ERC725.sol";
import "./ERC735.sol"; import "./ERC735.sol";
import "../common/MessageSigned.sol";
contract Identity is ERC725, ERC735, MessageSigned {
contract Identity is ERC725, ERC735 {
mapping (bytes32 => Key) keys; mapping (bytes32 => Key) keys;
mapping (uint256 => bytes32[]) keysByPurpose; mapping (uint256 => bytes32[]) keysByPurpose;
@ -60,19 +60,14 @@ contract Identity is ERC725, ERC735 {
modifier validECDSAKey ( modifier validECDSAKey (
bytes32 _key, bytes32 _key,
bytes32 _signHash, bytes32 _messageHash,
uint8 _v, bytes _signature
bytes32 _r, ) {
bytes32 _s
)
{
require( require(
_key == keccak256( _key == keccak256(
ecrecover( recoverAddress(
keccak256("\x19Ethereum Signed Message:\n32", _signHash), getSignHash(_messageHash),
_v, _signature
_r,
_s
) )
) )
); );
@ -361,9 +356,7 @@ contract Identity is ERC725, ERC735 {
uint256 _id, uint256 _id,
bool _approval, bool _approval,
bytes32 _key, bytes32 _key,
uint8 _v, bytes _signature
bytes32 _r,
bytes32 _s
) )
public public
validECDSAKey( validECDSAKey(
@ -374,11 +367,8 @@ contract Identity is ERC725, ERC735 {
_id, _id,
_approval _approval
), ),
_v, _signature
_r,
_s
) )
managerOrActor(_key)
returns (bool success) returns (bool success)
{ {
return _approve(_key, _id, _approval); return _approve(_key, _id, _approval);
@ -390,9 +380,7 @@ contract Identity is ERC725, ERC735 {
bytes _data, bytes _data,
uint256 _nonce, uint256 _nonce,
bytes32 _key, bytes32 _key,
uint8 _v, bytes _signature
bytes32 _r,
bytes32 _s
) )
public public
validECDSAKey( validECDSAKey(
@ -405,11 +393,9 @@ contract Identity is ERC725, ERC735 {
_data, _data,
_nonce _nonce
), ),
_v, _signature
_r,
_s
) )
managerOrActor(_key) requiredKey(_to == address(this) ? MANAGEMENT_KEY : ACTION_KEY)
returns (uint256 executionId) returns (uint256 executionId)
{ {
executionId = _execute(_to, _value, _data); executionId = _execute(_to, _value, _data);