updated to new solidity keywords and linting

This commit is contained in:
Ricardo Guilherme Schmidt 2018-03-30 02:31:08 -03:00
parent 33bb06bd76
commit e76dfe33ab
4 changed files with 52 additions and 38 deletions

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.17; pragma solidity ^0.4.21;
import "./DelayedUpdatableInstanceStorage.sol"; import "./DelayedUpdatableInstanceStorage.sol";
import "./DelegatedCall.sol"; import "./DelegatedCall.sol";
@ -22,42 +22,56 @@ contract DelayedUpdatableInstance is DelayedUpdatableInstanceStorage, DelegatedC
* @dev delegatecall everything (but declared functions) to `_target()` * @dev delegatecall everything (but declared functions) to `_target()`
* @notice Verify `kernel()` code to predict behavior * @notice Verify `kernel()` code to predict behavior
*/ */
function () external delegated { function ()
external
delegated
{
//all goes to kernel //all goes to kernel
} }
function updateRequestUpdatableInstance(
address _kernel
)
external
{
require(msg.sender == address(this));
uint activation = block.timestamp + 30 days;
update = Update(_kernel, activation);
emit UpdateRequested(_kernel, activation);
}
function updateConfirmUpdatableInstance(
address _kernel
)
external
{
require(msg.sender == address(this));
Update memory pending = update;
require(pending.kernel == _kernel);
require(pending.activation < block.timestamp);
kernel = pending.kernel;
delete update;
emit UpdateConfirmed(kernel, pending.kernel);
}
function updateCancelUpdatableInstance()
external
{
require(msg.sender == address(this));
delete update;
}
/** /**
* @dev returns configured kernel * @dev returns configured kernel
* @return kernel address * @return kernel address
*/ */
function targetDelegatedCall() function targetDelegatedCall()
internal internal
constant view
returns(address) returns(address)
{ {
return kernel; return kernel;
} }
function updateRequestUpdatableInstance(address _kernel) external {
require(msg.sender == address(this));
uint activation = block.timestamp + 30 days;
update = Update(_kernel, activation);
UpdateRequested(_kernel, activation);
}
function updateConfirmUpdatableInstance(address _kernel) external {
require(msg.sender == address(this));
Update memory pending = update;
require(pending.kernel == _kernel);
require(pending.activation < block.timestamp);
kernel = pending.kernel;
delete update;
UpdateConfirmed(kernel, pending.kernel);
}
function updateCancelUpdatableInstance() external {
require(msg.sender == address(this));
delete update;
}
} }

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.21;
contract ERC725 { contract ERC725 {
@ -19,9 +19,9 @@ contract ERC725 {
bytes32 key; bytes32 key;
} }
function getKey(bytes32 _key, uint256 _purpose) public constant returns(uint256 purpose, uint256 keyType, bytes32 key); function getKey(bytes32 _key, uint256 _purpose) public view returns(uint256 purpose, uint256 keyType, bytes32 key);
function getKeyPurpose(bytes32 _key) public constant returns(uint256[] purpose); function getKeyPurpose(bytes32 _key) public view returns(uint256[] purpose);
function getKeysByPurpose(uint256 _purpose) public constant returns(bytes32[] keys); function getKeysByPurpose(uint256 _purpose) public view returns(bytes32[] keys);
function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) public returns (bool success); function addKey(bytes32 _key, uint256 _purpose, uint256 _keyType) public returns (bool success);
function removeKey(bytes32 _key, uint256 _purpose) public returns (bool success); function removeKey(bytes32 _key, uint256 _purpose) public returns (bool success);
function execute(address _to, uint256 _value, bytes _data) public returns (uint256 executionId); function execute(address _to, uint256 _value, bytes _data) public returns (uint256 executionId);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.21;
contract ERC735 { contract ERC735 {
@ -16,8 +16,8 @@ contract ERC735 {
string uri; string uri;
} }
function getClaim(bytes32 _claimId) public constant returns(uint256 claimType, uint256 scheme, address issuer, bytes signature, bytes data, string uri); function getClaim(bytes32 _claimId) public view returns(uint256 claimType, uint256 scheme, address issuer, bytes signature, bytes data, string uri);
function getClaimIdsByType(uint256 _claimType) public constant returns(bytes32[] claimIds); function getClaimIdsByType(uint256 _claimType) public view returns(bytes32[] claimIds);
function addClaim(uint256 _claimType, uint256 _scheme, address _issuer, bytes _signature, bytes _data, string _uri) public returns (bytes32 claimRequestId); function addClaim(uint256 _claimType, uint256 _scheme, address _issuer, bytes _signature, bytes _data, string _uri) public returns (bytes32 claimRequestId);
function removeClaim(bytes32 _claimId) public returns (bool success); function removeClaim(bytes32 _claimId) public returns (bool success);
} }

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.17; pragma solidity ^0.4.21;
import "./ERC725.sol"; import "./ERC725.sol";
import "./ERC735.sol"; import "./ERC735.sol";
@ -283,7 +283,7 @@ contract Identity is ERC725, ERC735 {
uint256 _purpose uint256 _purpose
) )
public public
constant view
returns(uint256 purpose, uint256 keyType, bytes32 key) returns(uint256 purpose, uint256 keyType, bytes32 key)
{ {
Key storage myKey = keys[keccak256(_key, _purpose)]; Key storage myKey = keys[keccak256(_key, _purpose)];
@ -292,7 +292,7 @@ contract Identity is ERC725, ERC735 {
function isKeyPurpose(bytes32 _key, uint256 _purpose) function isKeyPurpose(bytes32 _key, uint256 _purpose)
public public
constant view
returns (bool) returns (bool)
{ {
return keys[keccak256(_key, _purpose)].purpose == _purpose; return keys[keccak256(_key, _purpose)].purpose == _purpose;
@ -300,7 +300,7 @@ contract Identity is ERC725, ERC735 {
function getKeyPurpose(bytes32 _key) function getKeyPurpose(bytes32 _key)
public public
constant view
returns(uint256[] purpose) returns(uint256[] purpose)
{ {
@ -337,7 +337,7 @@ contract Identity is ERC725, ERC735 {
function getKeysByPurpose(uint256 _purpose) function getKeysByPurpose(uint256 _purpose)
public public
constant view
returns(bytes32[]) returns(bytes32[])
{ {
return keysByPurpose[_purpose]; return keysByPurpose[_purpose];
@ -345,7 +345,7 @@ contract Identity is ERC725, ERC735 {
function getClaim(bytes32 _claimId) function getClaim(bytes32 _claimId)
public public
constant view
returns( returns(
uint256 claimType, uint256 claimType,
uint256 scheme, uint256 scheme,
@ -361,7 +361,7 @@ contract Identity is ERC725, ERC735 {
function getClaimIdsByType(uint256 _claimType) function getClaimIdsByType(uint256 _claimType)
public public
constant view
returns(bytes32[] claimIds) returns(bytes32[] claimIds)
{ {
return claimsByType[_claimType]; return claimsByType[_claimType];