From a676d6e941c5539e95cf7723a2c0d20b9d4e7846 Mon Sep 17 00:00:00 2001 From: Daniel Okwufulueze Date: Fri, 10 Nov 2017 15:17:44 +0100 Subject: [PATCH 1/4] upgrades -- Upgrade truffle-contract: Upgrade truffle-contract to ^3.0.0 to take advantage of the new artifact format, as stated in the release page for Truffle 4. --- .gitignore | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b5ecb53..5f91a3b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ build_webpack .env npm-debug.log .truffle-solidity-loader +package-lock.json diff --git a/package.json b/package.json index 1e80252..53f33ad 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "recursive-readdir": "2.1.0", "strip-ansi": "3.0.1", "style-loader": "0.13.1", - "truffle-contract": "^1.1.8", + "truffle-contract": "^3.0.0", "url-loader": "0.5.7", "webpack": "1.14.0", "webpack-dev-server": "1.16.2", From 256d772b7793ac57f1bf193d31f5667e5d171ccf Mon Sep 17 00:00:00 2001 From: Daniel Okwufulueze Date: Fri, 10 Nov 2017 15:24:00 +0100 Subject: [PATCH 2/4] upgrades -- Upgrade Smart Contracts: Truffle 4 runs with solc 0.4.18. Since react-auth is Truffle 4-based, its contracts should run on solc v0.4.18 Make solc version on Smart Contracts explicit. --- contracts/Authentication.sol | 2 +- contracts/Migrations.sol | 2 +- contracts/zeppelin/lifecycle/Killable.sol | 2 +- contracts/zeppelin/ownership/Ownable.sol | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/Authentication.sol b/contracts/Authentication.sol index 3001647..8f924fb 100644 --- a/contracts/Authentication.sol +++ b/contracts/Authentication.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.2; +pragma solidity 0.4.18; import './zeppelin/lifecycle/Killable.sol'; diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol index eeed7a4..ad56337 100644 --- a/contracts/Migrations.sol +++ b/contracts/Migrations.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.2; +pragma solidity 0.4.18; contract Migrations { address public owner; diff --git a/contracts/zeppelin/lifecycle/Killable.sol b/contracts/zeppelin/lifecycle/Killable.sol index 8101072..3f20e2c 100644 --- a/contracts/zeppelin/lifecycle/Killable.sol +++ b/contracts/zeppelin/lifecycle/Killable.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.4; +pragma solidity 0.4.18; import "./../ownership/Ownable.sol"; diff --git a/contracts/zeppelin/ownership/Ownable.sol b/contracts/zeppelin/ownership/Ownable.sol index 705f081..6a3e560 100644 --- a/contracts/zeppelin/ownership/Ownable.sol +++ b/contracts/zeppelin/ownership/Ownable.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.4; +pragma solidity 0.4.18; /* From 1aeb6bc68711129be43d22d3ecd9eaa3521fca88 Mon Sep 17 00:00:00 2001 From: Daniel Okwufulueze Date: Fri, 10 Nov 2017 15:25:01 +0100 Subject: [PATCH 3/4] upgrades: Add visibility specification to zeppelin contracts. --- contracts/zeppelin/lifecycle/Killable.sol | 2 +- contracts/zeppelin/ownership/Ownable.sol | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/zeppelin/lifecycle/Killable.sol b/contracts/zeppelin/lifecycle/Killable.sol index 3f20e2c..45d69f4 100644 --- a/contracts/zeppelin/lifecycle/Killable.sol +++ b/contracts/zeppelin/lifecycle/Killable.sol @@ -9,7 +9,7 @@ import "./../ownership/Ownable.sol"; * Base contract that can be killed by owner. All funds in contract will be sent to the owner. */ contract Killable is Ownable { - function kill() onlyOwner { + function kill() public onlyOwner { selfdestruct(owner); } } diff --git a/contracts/zeppelin/ownership/Ownable.sol b/contracts/zeppelin/ownership/Ownable.sol index 6a3e560..84d5350 100644 --- a/contracts/zeppelin/ownership/Ownable.sol +++ b/contracts/zeppelin/ownership/Ownable.sol @@ -10,7 +10,7 @@ pragma solidity 0.4.18; contract Ownable { address public owner; - function Ownable() { + function Ownable() public { owner = msg.sender; } @@ -19,7 +19,7 @@ contract Ownable { _; } - function transferOwnership(address newOwner) onlyOwner { + function transferOwnership(address newOwner) public onlyOwner { if (newOwner != address(0)) owner = newOwner; } From 2b8dd8a6f9a8af4093be54b7c294490b38e9a550 Mon Sep 17 00:00:00 2001 From: Daniel Okwufulueze Date: Fri, 10 Nov 2017 15:26:42 +0100 Subject: [PATCH 4/4] upgrades: Use the 'view' State Mutability instead of 'constant' for login. --- contracts/Authentication.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/Authentication.sol b/contracts/Authentication.sol index 8f924fb..91d7999 100644 --- a/contracts/Authentication.sol +++ b/contracts/Authentication.sol @@ -25,8 +25,9 @@ contract Authentication is Killable { _; } - function login() constant + function login() public + view onlyExistingUser returns (bytes32) { return (users[msg.sender].name);