fix warnings in contracts app sol contracts

This commit is contained in:
Jonathan Rainville 2018-09-14 14:35:12 -04:00
parent a3cd053cb1
commit 0bf4e48607
7 changed files with 17 additions and 13 deletions

View File

@ -2,7 +2,7 @@
"default": { "default": {
"versions": { "versions": {
"web3": "1.0.0-beta.27", "web3": "1.0.0-beta.27",
"solc": "0.4.17" "solc": "0.4.24"
}, },
"deployment": { "deployment": {
"host": "localhost", "host": "localhost",

View File

@ -1,9 +1,9 @@
pragma solidity ^0.4.17; pragma solidity ^0.4.24;
contract AnotherStorage { contract AnotherStorage {
address public simpleStorageAddress; address public simpleStorageAddress;
address simpleStorageAddress2; address simpleStorageAddress2;
function AnotherStorage(address addr) public { constructor(address addr) public {
simpleStorageAddress = addr; simpleStorageAddress = addr;
} }

View File

@ -1,3 +1,5 @@
pragma solidity ^0.4.24;
contract ContractArgs { contract ContractArgs {
address public addr_1; address public addr_1;
address public addr_2; address public addr_2;
@ -5,7 +7,7 @@ contract ContractArgs {
function() public payable { } function() public payable { }
function ContractArgs(address[] _addresses, uint initialValue) public { constructor(address[] _addresses, uint initialValue) public {
addr_1 = _addresses[0]; addr_1 = _addresses[0];
addr_2 = _addresses[1]; addr_2 = _addresses[1];
value = initialValue; value = initialValue;

View File

@ -13,7 +13,7 @@ contract Ownable {
* @dev The Ownable constructor sets the original `owner` of the contract to the sender * @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. * account.
*/ */
function Ownable() public { constructor() public {
owner = msg.sender; owner = msg.sender;
} }

View File

@ -6,7 +6,7 @@ library Assert {
event TestEvent(bool passed, string message); event TestEvent(bool passed, string message);
function triggerEvent(bool passed, string message) internal { function triggerEvent(bool passed, string message) internal {
TestEvent(passed, message); emit TestEvent(passed, message);
} }
} }
@ -15,7 +15,7 @@ contract SimpleStorage is Ownable {
function() public payable { } function() public payable { }
function SimpleStorage(uint initialValue) public { constructor(uint initialValue) public {
storedData = initialValue; storedData = initialValue;
} }
@ -27,7 +27,7 @@ contract SimpleStorage is Ownable {
Assert.triggerEvent(true, "hi"); Assert.triggerEvent(true, "hi");
} }
function set2(uint x, uint unusedGiveWarning) public onlyOwner { function set2(uint x) public onlyOwner {
storedData = x; storedData = x;
} }

View File

@ -1,3 +1,5 @@
pragma solidity ^0.4.24;
contract SomeContract { contract SomeContract {
address public addr_1; address public addr_1;
address public addr_2; address public addr_2;
@ -5,7 +7,7 @@ contract SomeContract {
function() public payable { } function() public payable { }
function SomeContract(address[] _addresses, uint initialValue) public { constructor(address[] _addresses, uint initialValue) public {
addr_1 = _addresses[0]; addr_1 = _addresses[0];
addr_2 = _addresses[1]; addr_2 = _addresses[1];
value = initialValue; value = initialValue;

View File

@ -10,7 +10,7 @@ contract Token {
mapping( address => mapping( address => uint ) ) _approvals; mapping( address => mapping( address => uint ) ) _approvals;
uint public _supply; uint public _supply;
//uint public _supply2; //uint public _supply2;
function Token( uint initial_balance ) public { constructor( uint initial_balance ) public {
_balances[msg.sender] = initial_balance; _balances[msg.sender] = initial_balance;
_supply = initial_balance; _supply = initial_balance;
} }
@ -29,7 +29,7 @@ contract Token {
} }
_balances[msg.sender] -= value; _balances[msg.sender] -= value;
_balances[to] += value; _balances[to] += value;
Transfer( msg.sender, to, value ); emit Transfer( msg.sender, to, value );
return true; return true;
} }
function transferFrom( address from, address to, uint value) public returns (bool ok) { function transferFrom( address from, address to, uint value) public returns (bool ok) {
@ -48,13 +48,13 @@ contract Token {
_approvals[from][msg.sender] -= value; _approvals[from][msg.sender] -= value;
_balances[from] -= value; _balances[from] -= value;
_balances[to] += value; _balances[to] += value;
Transfer( from, to, value ); emit Transfer( from, to, value );
return true; return true;
} }
function approve(address spender, uint value) public returns (bool ok) { function approve(address spender, uint value) public returns (bool ok) {
// TODO: should increase instead // TODO: should increase instead
_approvals[msg.sender][spender] = value; _approvals[msg.sender][spender] = value;
Approval( msg.sender, spender, value ); emit Approval( msg.sender, spender, value );
return true; return true;
} }
function allowance(address owner, address spender) public constant returns (uint _allowance) { function allowance(address owner, address spender) public constant returns (uint _allowance) {