From b50391862c42857e3ff2388598e52ebab92fc9fa Mon Sep 17 00:00:00 2001 From: Alejandro Santander Date: Thu, 23 Nov 2017 10:41:18 -0300 Subject: [PATCH 1/3] Changes to remove warnings --- contracts/Bounty.sol | 2 +- contracts/DayLimit.sol | 2 +- contracts/LimitBalance.sol | 2 +- contracts/MerkleProof.sol | 2 +- contracts/crowdsale/CappedCrowdsale.sol | 2 +- contracts/crowdsale/Crowdsale.sol | 4 ++-- contracts/crowdsale/RefundVault.sol | 2 +- contracts/crowdsale/RefundableCrowdsale.sol | 2 +- contracts/examples/SampleCrowdsale.sol | 2 +- contracts/examples/SimpleToken.sol | 2 +- contracts/lifecycle/Destructible.sol | 2 +- contracts/lifecycle/TokenDestructible.sol | 2 +- contracts/ownership/HasNoEther.sol | 2 +- contracts/ownership/HasNoTokens.sol | 3 +++ contracts/ownership/Ownable.sol | 2 +- contracts/payment/SplitPayment.sol | 2 +- contracts/token/CappedToken.sol | 2 +- contracts/token/DetailedERC20.sol | 2 +- contracts/token/TokenTimelock.sol | 2 +- contracts/token/TokenVesting.sol | 2 +- 20 files changed, 23 insertions(+), 20 deletions(-) diff --git a/contracts/Bounty.sol b/contracts/Bounty.sol index f3b3cd0b9..a36e61d9c 100644 --- a/contracts/Bounty.sol +++ b/contracts/Bounty.sol @@ -18,7 +18,7 @@ contract Bounty is PullPayment, Destructible { /** * @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed. */ - function() payable { + function() public payable { require(!claimed); } diff --git a/contracts/DayLimit.sol b/contracts/DayLimit.sol index 9964bd536..bf3f3cbf0 100644 --- a/contracts/DayLimit.sol +++ b/contracts/DayLimit.sol @@ -15,7 +15,7 @@ contract DayLimit { * @dev Constructor that sets the passed value as a dailyLimit. * @param _limit uint256 to represent the daily limit. */ - function DayLimit(uint256 _limit) { + function DayLimit(uint256 _limit) public { dailyLimit = _limit; lastDay = today(); } diff --git a/contracts/LimitBalance.sol b/contracts/LimitBalance.sol index a32974184..b7f3d2fee 100644 --- a/contracts/LimitBalance.sol +++ b/contracts/LimitBalance.sol @@ -15,7 +15,7 @@ contract LimitBalance { * @dev Constructor that sets the passed value as a limit. * @param _limit uint256 to represent the limit. */ - function LimitBalance(uint256 _limit) { + function LimitBalance(uint256 _limit) public { limit = _limit; } diff --git a/contracts/MerkleProof.sol b/contracts/MerkleProof.sol index e638c8e9d..d8ab71795 100644 --- a/contracts/MerkleProof.sol +++ b/contracts/MerkleProof.sol @@ -13,7 +13,7 @@ library MerkleProof { * @param _root Merkle root * @param _leaf Leaf of Merkle tree */ - function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) pure returns (bool) { + function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) public pure returns (bool) { // Check if proof length is a multiple of 32 if (_proof.length % 32 != 0) return false; diff --git a/contracts/crowdsale/CappedCrowdsale.sol b/contracts/crowdsale/CappedCrowdsale.sol index 972c1fc1b..c894cdbf5 100644 --- a/contracts/crowdsale/CappedCrowdsale.sol +++ b/contracts/crowdsale/CappedCrowdsale.sol @@ -12,7 +12,7 @@ contract CappedCrowdsale is Crowdsale { uint256 public cap; - function CappedCrowdsale(uint256 _cap) { + function CappedCrowdsale(uint256 _cap) public { require(_cap > 0); cap = _cap; } diff --git a/contracts/crowdsale/Crowdsale.sol b/contracts/crowdsale/Crowdsale.sol index 27ccac3f0..5565a973b 100644 --- a/contracts/crowdsale/Crowdsale.sol +++ b/contracts/crowdsale/Crowdsale.sol @@ -40,7 +40,7 @@ contract Crowdsale { event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); - function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) { + function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) public { require(_startTime >= now); require(_endTime >= _startTime); require(_rate > 0); @@ -61,7 +61,7 @@ contract Crowdsale { // fallback function can be used to buy tokens - function () payable { + function () public payable { buyTokens(msg.sender); } diff --git a/contracts/crowdsale/RefundVault.sol b/contracts/crowdsale/RefundVault.sol index 62d7599dd..a5de66bdb 100644 --- a/contracts/crowdsale/RefundVault.sol +++ b/contracts/crowdsale/RefundVault.sol @@ -22,7 +22,7 @@ contract RefundVault is Ownable { event RefundsEnabled(); event Refunded(address indexed beneficiary, uint256 weiAmount); - function RefundVault(address _wallet) { + function RefundVault(address _wallet) public { require(_wallet != address(0)); wallet = _wallet; state = State.Active; diff --git a/contracts/crowdsale/RefundableCrowdsale.sol b/contracts/crowdsale/RefundableCrowdsale.sol index c468fcf34..9b683b12e 100644 --- a/contracts/crowdsale/RefundableCrowdsale.sol +++ b/contracts/crowdsale/RefundableCrowdsale.sol @@ -21,7 +21,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { // refund vault used to hold funds while crowdsale is running RefundVault public vault; - function RefundableCrowdsale(uint256 _goal) { + function RefundableCrowdsale(uint256 _goal) public { require(_goal > 0); vault = new RefundVault(wallet); goal = _goal; diff --git a/contracts/examples/SampleCrowdsale.sol b/contracts/examples/SampleCrowdsale.sol index a83b8856d..3c7672219 100644 --- a/contracts/examples/SampleCrowdsale.sol +++ b/contracts/examples/SampleCrowdsale.sol @@ -30,7 +30,7 @@ contract SampleCrowdsaleToken is MintableToken { */ contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale { - function SampleCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet) + function SampleCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet) public CappedCrowdsale(_cap) FinalizableCrowdsale() RefundableCrowdsale(_goal) diff --git a/contracts/examples/SimpleToken.sol b/contracts/examples/SimpleToken.sol index 2381a7162..51edf0873 100644 --- a/contracts/examples/SimpleToken.sol +++ b/contracts/examples/SimpleToken.sol @@ -21,7 +21,7 @@ contract SimpleToken is StandardToken { /** * @dev Constructor that gives msg.sender all of existing tokens. */ - function SimpleToken() { + function SimpleToken() public { totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; } diff --git a/contracts/lifecycle/Destructible.sol b/contracts/lifecycle/Destructible.sol index e1b3174bc..6ac2ff827 100644 --- a/contracts/lifecycle/Destructible.sol +++ b/contracts/lifecycle/Destructible.sol @@ -10,7 +10,7 @@ import "../ownership/Ownable.sol"; */ contract Destructible is Ownable { - function Destructible() payable { } + function Destructible() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. diff --git a/contracts/lifecycle/TokenDestructible.sol b/contracts/lifecycle/TokenDestructible.sol index 1c3324fea..8eaad04fd 100644 --- a/contracts/lifecycle/TokenDestructible.sol +++ b/contracts/lifecycle/TokenDestructible.sol @@ -12,7 +12,7 @@ import "../token/ERC20Basic.sol"; */ contract TokenDestructible is Ownable { - function TokenDestructible() payable { } + function TokenDestructible() public payable { } /** * @notice Terminate contract and refund to owner diff --git a/contracts/ownership/HasNoEther.sol b/contracts/ownership/HasNoEther.sol index 3f8309677..238424ad9 100644 --- a/contracts/ownership/HasNoEther.sol +++ b/contracts/ownership/HasNoEther.sol @@ -21,7 +21,7 @@ contract HasNoEther is Ownable { * constructor. By doing it this way we prevent a payable constructor from working. Alternatively * we could use assembly to access msg.value. */ - function HasNoEther() payable { + function HasNoEther() public payable { require(msg.value == 0); } diff --git a/contracts/ownership/HasNoTokens.sol b/contracts/ownership/HasNoTokens.sol index cce530bf6..f7f7e348a 100644 --- a/contracts/ownership/HasNoTokens.sol +++ b/contracts/ownership/HasNoTokens.sol @@ -18,6 +18,9 @@ contract HasNoTokens is CanReclaimToken { * @param data_ Bytes The data passed from the caller. */ function tokenFallback(address from_, uint256 value_, bytes data_) external { + from_; + value_; + data_; revert(); } diff --git a/contracts/ownership/Ownable.sol b/contracts/ownership/Ownable.sol index 67ac79ff1..0e2744914 100644 --- a/contracts/ownership/Ownable.sol +++ b/contracts/ownership/Ownable.sol @@ -17,7 +17,7 @@ contract Ownable { * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ - function Ownable() { + function Ownable() public { owner = msg.sender; } diff --git a/contracts/payment/SplitPayment.sol b/contracts/payment/SplitPayment.sol index 78538e3ec..054d36ab5 100644 --- a/contracts/payment/SplitPayment.sol +++ b/contracts/payment/SplitPayment.sol @@ -20,7 +20,7 @@ contract SplitPayment { /** * @dev Constructor */ - function SplitPayment(address[] _payees, uint256[] _shares) { + function SplitPayment(address[] _payees, uint256[] _shares) public { require(_payees.length == _shares.length); for (uint256 i = 0; i < _payees.length; i++) { diff --git a/contracts/token/CappedToken.sol b/contracts/token/CappedToken.sol index 508669172..c0c2e6fa8 100644 --- a/contracts/token/CappedToken.sol +++ b/contracts/token/CappedToken.sol @@ -11,7 +11,7 @@ contract CappedToken is MintableToken { uint256 public cap; - function CappedToken(uint256 _cap) { + function CappedToken(uint256 _cap) public { require(_cap > 0); cap = _cap; } diff --git a/contracts/token/DetailedERC20.sol b/contracts/token/DetailedERC20.sol index a08236305..28bcbaeef 100644 --- a/contracts/token/DetailedERC20.sol +++ b/contracts/token/DetailedERC20.sol @@ -7,7 +7,7 @@ contract DetailedERC20 is ERC20 { string public symbol; uint8 public decimals; - function DetailedERC20(string _name, string _symbol, uint8 _decimals) { + function DetailedERC20(string _name, string _symbol, uint8 _decimals) public { name = _name; symbol = _symbol; decimals = _decimals; diff --git a/contracts/token/TokenTimelock.sol b/contracts/token/TokenTimelock.sol index 557fc6ed6..fdd9ca495 100644 --- a/contracts/token/TokenTimelock.sol +++ b/contracts/token/TokenTimelock.sol @@ -21,7 +21,7 @@ contract TokenTimelock { // timestamp when token release is enabled uint64 public releaseTime; - function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) { + function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) public { require(_releaseTime > now); token = _token; beneficiary = _beneficiary; diff --git a/contracts/token/TokenVesting.sol b/contracts/token/TokenVesting.sol index 14373d15b..f311dfad5 100644 --- a/contracts/token/TokenVesting.sol +++ b/contracts/token/TokenVesting.sol @@ -39,7 +39,7 @@ contract TokenVesting is Ownable { * @param _duration duration in seconds of the period in which the tokens will vest * @param _revocable whether the vesting is revocable or not */ - function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) { + function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public { require(_beneficiary != address(0)); require(_cliff <= _duration); From c6e0edb26818160219820168f4d2ce5bd19367e1 Mon Sep 17 00:00:00 2001 From: Alejandro Santander Date: Thu, 23 Nov 2017 10:57:36 -0300 Subject: [PATCH 2/3] Remove solidity warnings in tests --- test/helpers/BasicTokenMock.sol | 2 +- test/helpers/BurnableTokenMock.sol | 2 +- test/helpers/CappedCrowdsaleImpl.sol | 2 +- test/helpers/DayLimitMock.sol | 2 +- test/helpers/DetailedERC20Mock.sol | 2 +- test/helpers/ERC23TokenMock.sol | 4 +-- test/helpers/FinalizableCrowdsaleImpl.sol | 2 +- test/helpers/ForceEther.sol | 4 +-- test/helpers/HasNoEtherTest.sol | 2 +- test/helpers/InsecureTargetBounty.sol | 2 +- test/helpers/LimitBalanceMock.sol | 2 +- test/helpers/PausableMock.sol | 2 +- test/helpers/PausableTokenMock.sol | 2 +- test/helpers/PullPaymentMock.sol | 4 +-- test/helpers/ReentrancyAttack.sol | 2 +- test/helpers/ReentrancyMock.sol | 2 +- test/helpers/RefundableCrowdsaleImpl.sol | 2 +- test/helpers/SafeERC20Helper.sol | 34 +++++++++++------------ test/helpers/SafeMathMock.sol | 6 ++-- test/helpers/SecureTargetBounty.sol | 2 +- test/helpers/SplitPaymentMock.sol | 4 +-- test/helpers/StandardTokenMock.sol | 2 +- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/test/helpers/BasicTokenMock.sol b/test/helpers/BasicTokenMock.sol index 6c3f8ef69..46c9eaa90 100644 --- a/test/helpers/BasicTokenMock.sol +++ b/test/helpers/BasicTokenMock.sol @@ -7,7 +7,7 @@ import '../../contracts/token/BasicToken.sol'; // mock class using BasicToken contract BasicTokenMock is BasicToken { - function BasicTokenMock(address initialAccount, uint256 initialBalance) { + function BasicTokenMock(address initialAccount, uint256 initialBalance) public { balances[initialAccount] = initialBalance; totalSupply = initialBalance; } diff --git a/test/helpers/BurnableTokenMock.sol b/test/helpers/BurnableTokenMock.sol index ce6bb4c7c..188084ef5 100644 --- a/test/helpers/BurnableTokenMock.sol +++ b/test/helpers/BurnableTokenMock.sol @@ -4,7 +4,7 @@ import '../../contracts/token/BurnableToken.sol'; contract BurnableTokenMock is BurnableToken { - function BurnableTokenMock(address initialAccount, uint initialBalance) { + function BurnableTokenMock(address initialAccount, uint initialBalance) public { balances[initialAccount] = initialBalance; totalSupply = initialBalance; } diff --git a/test/helpers/CappedCrowdsaleImpl.sol b/test/helpers/CappedCrowdsaleImpl.sol index 3c9692ed8..3177b864a 100644 --- a/test/helpers/CappedCrowdsaleImpl.sol +++ b/test/helpers/CappedCrowdsaleImpl.sol @@ -12,7 +12,7 @@ contract CappedCrowdsaleImpl is CappedCrowdsale { uint256 _rate, address _wallet, uint256 _cap - ) + ) public Crowdsale(_startTime, _endTime, _rate, _wallet) CappedCrowdsale(_cap) { diff --git a/test/helpers/DayLimitMock.sol b/test/helpers/DayLimitMock.sol index 83accc7a5..e40ab1221 100644 --- a/test/helpers/DayLimitMock.sol +++ b/test/helpers/DayLimitMock.sol @@ -4,7 +4,7 @@ import "../../contracts/DayLimit.sol"; contract DayLimitMock is DayLimit { uint256 public totalSpending; - function DayLimitMock(uint256 _value) DayLimit(_value) { + function DayLimitMock(uint256 _value) public DayLimit(_value) { totalSpending = 0; } diff --git a/test/helpers/DetailedERC20Mock.sol b/test/helpers/DetailedERC20Mock.sol index f1f5cbaca..33d42299a 100644 --- a/test/helpers/DetailedERC20Mock.sol +++ b/test/helpers/DetailedERC20Mock.sol @@ -4,5 +4,5 @@ import '../../contracts/token/StandardToken.sol'; import '../../contracts/token/DetailedERC20.sol'; contract DetailedERC20Mock is StandardToken, DetailedERC20 { - function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) {} + function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) public {} } diff --git a/test/helpers/ERC23TokenMock.sol b/test/helpers/ERC23TokenMock.sol index b06adffdc..c234f4c9f 100644 --- a/test/helpers/ERC23TokenMock.sol +++ b/test/helpers/ERC23TokenMock.sol @@ -10,13 +10,13 @@ contract ERC23ContractInterface { contract ERC23TokenMock is BasicToken { - function ERC23TokenMock(address initialAccount, uint256 initialBalance) { + function ERC23TokenMock(address initialAccount, uint256 initialBalance) public { balances[initialAccount] = initialBalance; totalSupply = initialBalance; } // ERC23 compatible transfer function (except the name) - function transferERC23(address _to, uint256 _value, bytes _data) + function transferERC23(address _to, uint256 _value, bytes _data) public returns (bool success) { transfer(_to, _value); diff --git a/test/helpers/FinalizableCrowdsaleImpl.sol b/test/helpers/FinalizableCrowdsaleImpl.sol index c16ab4634..da36a9e7d 100644 --- a/test/helpers/FinalizableCrowdsaleImpl.sol +++ b/test/helpers/FinalizableCrowdsaleImpl.sol @@ -11,7 +11,7 @@ contract FinalizableCrowdsaleImpl is FinalizableCrowdsale { uint256 _endTime, uint256 _rate, address _wallet - ) + ) public Crowdsale(_startTime, _endTime, _rate, _wallet) FinalizableCrowdsale() { diff --git a/test/helpers/ForceEther.sol b/test/helpers/ForceEther.sol index eed268f3c..0206b19da 100644 --- a/test/helpers/ForceEther.sol +++ b/test/helpers/ForceEther.sol @@ -7,9 +7,9 @@ pragma solidity ^0.4.18; // @author Remco Bloemen contract ForceEther { - function ForceEther() payable { } + function ForceEther() public payable { } - function destroyAndSend(address _recipient) { + function destroyAndSend(address _recipient) public { selfdestruct(_recipient); } } diff --git a/test/helpers/HasNoEtherTest.sol b/test/helpers/HasNoEtherTest.sol index 135e07d04..5a51c1855 100644 --- a/test/helpers/HasNoEtherTest.sol +++ b/test/helpers/HasNoEtherTest.sol @@ -5,7 +5,7 @@ import "../../contracts/ownership/HasNoEther.sol"; contract HasNoEtherTest is HasNoEther { // Constructor with explicit payable — should still fail - function HasNoEtherTest() payable { + function HasNoEtherTest() public payable { } } diff --git a/test/helpers/InsecureTargetBounty.sol b/test/helpers/InsecureTargetBounty.sol index e39b90a01..87e3bf8b6 100644 --- a/test/helpers/InsecureTargetBounty.sol +++ b/test/helpers/InsecureTargetBounty.sol @@ -5,7 +5,7 @@ import {Bounty, Target} from "../../contracts/Bounty.sol"; contract InsecureTargetMock is Target { - function checkInvariant() returns(bool){ + function checkInvariant() public returns(bool){ return false; } } diff --git a/test/helpers/LimitBalanceMock.sol b/test/helpers/LimitBalanceMock.sol index 2a1b72375..d14dc6bdb 100644 --- a/test/helpers/LimitBalanceMock.sol +++ b/test/helpers/LimitBalanceMock.sol @@ -7,7 +7,7 @@ import '../../contracts/LimitBalance.sol'; // mock class using LimitBalance contract LimitBalanceMock is LimitBalance(1000) { - function limitedDeposit() payable limitedPayable { + function limitedDeposit() public payable limitedPayable { } } diff --git a/test/helpers/PausableMock.sol b/test/helpers/PausableMock.sol index 59a6b3dd0..e5636a1d0 100644 --- a/test/helpers/PausableMock.sol +++ b/test/helpers/PausableMock.sol @@ -9,7 +9,7 @@ contract PausableMock is Pausable { bool public drasticMeasureTaken; uint256 public count; - function PausableMock() { + function PausableMock() public { drasticMeasureTaken = false; count = 0; } diff --git a/test/helpers/PausableTokenMock.sol b/test/helpers/PausableTokenMock.sol index 54e2cee14..c7e362d6e 100644 --- a/test/helpers/PausableTokenMock.sol +++ b/test/helpers/PausableTokenMock.sol @@ -5,7 +5,7 @@ import '../../contracts/token/PausableToken.sol'; // mock class using PausableToken contract PausableTokenMock is PausableToken { - function PausableTokenMock(address initialAccount, uint initialBalance) { + function PausableTokenMock(address initialAccount, uint initialBalance) public { balances[initialAccount] = initialBalance; } diff --git a/test/helpers/PullPaymentMock.sol b/test/helpers/PullPaymentMock.sol index 93689ed8a..cec38db35 100644 --- a/test/helpers/PullPaymentMock.sol +++ b/test/helpers/PullPaymentMock.sol @@ -7,10 +7,10 @@ import '../../contracts/payment/PullPayment.sol'; // mock class using PullPayment contract PullPaymentMock is PullPayment { - function PullPaymentMock() payable { } + function PullPaymentMock() public payable { } // test helper function to call asyncSend - function callSend(address dest, uint256 amount) { + function callSend(address dest, uint256 amount) public { asyncSend(dest, amount); } diff --git a/test/helpers/ReentrancyAttack.sol b/test/helpers/ReentrancyAttack.sol index 091392b0d..870bcf78e 100644 --- a/test/helpers/ReentrancyAttack.sol +++ b/test/helpers/ReentrancyAttack.sol @@ -2,7 +2,7 @@ pragma solidity ^0.4.18; contract ReentrancyAttack { - function callSender(bytes4 data) { + function callSender(bytes4 data) public { require(msg.sender.call(data)); } diff --git a/test/helpers/ReentrancyMock.sol b/test/helpers/ReentrancyMock.sol index ecf45fef4..b6e5ae782 100644 --- a/test/helpers/ReentrancyMock.sol +++ b/test/helpers/ReentrancyMock.sol @@ -7,7 +7,7 @@ contract ReentrancyMock is ReentrancyGuard { uint256 public counter; - function ReentrancyMock() { + function ReentrancyMock() public { counter = 0; } diff --git a/test/helpers/RefundableCrowdsaleImpl.sol b/test/helpers/RefundableCrowdsaleImpl.sol index f11200ff1..a233d6130 100644 --- a/test/helpers/RefundableCrowdsaleImpl.sol +++ b/test/helpers/RefundableCrowdsaleImpl.sol @@ -12,7 +12,7 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale { uint256 _rate, address _wallet, uint256 _goal - ) + ) public Crowdsale(_startTime, _endTime, _rate, _wallet) RefundableCrowdsale(_goal) { diff --git a/test/helpers/SafeERC20Helper.sol b/test/helpers/SafeERC20Helper.sol index abe73fc68..37bd42b27 100644 --- a/test/helpers/SafeERC20Helper.sol +++ b/test/helpers/SafeERC20Helper.sol @@ -4,45 +4,45 @@ import '../../contracts/token/ERC20.sol'; import '../../contracts/token/SafeERC20.sol'; contract ERC20FailingMock is ERC20 { - function transfer(address, uint256) returns (bool) { + function transfer(address, uint256) public returns (bool) { return false; } - function transferFrom(address, address, uint256) returns (bool) { + function transferFrom(address, address, uint256) public returns (bool) { return false; } - function approve(address, uint256) returns (bool) { + function approve(address, uint256) public returns (bool) { return false; } - function balanceOf(address) constant returns (uint256) { + function balanceOf(address) public constant returns (uint256) { return 0; } - function allowance(address, address) constant returns (uint256) { + function allowance(address, address) public constant returns (uint256) { return 0; } } contract ERC20SucceedingMock is ERC20 { - function transfer(address, uint256) returns (bool) { + function transfer(address, uint256) public returns (bool) { return true; } - function transferFrom(address, address, uint256) returns (bool) { + function transferFrom(address, address, uint256) public returns (bool) { return true; } - function approve(address, uint256) returns (bool) { + function approve(address, uint256) public returns (bool) { return true; } - function balanceOf(address) constant returns (uint256) { + function balanceOf(address) public constant returns (uint256) { return 0; } - function allowance(address, address) constant returns (uint256) { + function allowance(address, address) public constant returns (uint256) { return 0; } } @@ -53,32 +53,32 @@ contract SafeERC20Helper { ERC20 failing; ERC20 succeeding; - function SafeERC20Helper() { + function SafeERC20Helper() public { failing = new ERC20FailingMock(); succeeding = new ERC20SucceedingMock(); } - function doFailingTransfer() { + function doFailingTransfer() public { failing.safeTransfer(0, 0); } - function doFailingTransferFrom() { + function doFailingTransferFrom() public { failing.safeTransferFrom(0, 0, 0); } - function doFailingApprove() { + function doFailingApprove() public { failing.safeApprove(0, 0); } - function doSucceedingTransfer() { + function doSucceedingTransfer() public { succeeding.safeTransfer(0, 0); } - function doSucceedingTransferFrom() { + function doSucceedingTransferFrom() public { succeeding.safeTransferFrom(0, 0, 0); } - function doSucceedingApprove() { + function doSucceedingApprove() public { succeeding.safeApprove(0, 0); } } diff --git a/test/helpers/SafeMathMock.sol b/test/helpers/SafeMathMock.sol index 0b94fb926..6213f5041 100644 --- a/test/helpers/SafeMathMock.sol +++ b/test/helpers/SafeMathMock.sol @@ -7,15 +7,15 @@ import '../../contracts/math/SafeMath.sol'; contract SafeMathMock { uint256 public result; - function multiply(uint256 a, uint256 b) { + function multiply(uint256 a, uint256 b) public { result = SafeMath.mul(a, b); } - function subtract(uint256 a, uint256 b) { + function subtract(uint256 a, uint256 b) public { result = SafeMath.sub(a, b); } - function add(uint256 a, uint256 b) { + function add(uint256 a, uint256 b) public { result = SafeMath.add(a, b); } } diff --git a/test/helpers/SecureTargetBounty.sol b/test/helpers/SecureTargetBounty.sol index 0d80e9c13..aed463949 100644 --- a/test/helpers/SecureTargetBounty.sol +++ b/test/helpers/SecureTargetBounty.sol @@ -5,7 +5,7 @@ import {Bounty, Target} from "../../contracts/Bounty.sol"; contract SecureTargetMock is Target { - function checkInvariant() returns(bool) { + function checkInvariant() public returns(bool) { return true; } } diff --git a/test/helpers/SplitPaymentMock.sol b/test/helpers/SplitPaymentMock.sol index 6df502a4e..f7a487b57 100644 --- a/test/helpers/SplitPaymentMock.sol +++ b/test/helpers/SplitPaymentMock.sol @@ -4,7 +4,7 @@ import '../../contracts/payment/SplitPayment.sol'; // mock class using SplitPayment contract SplitPaymentMock is SplitPayment { - function SplitPaymentMock(address[] _payees, uint256[] _shares) + function SplitPaymentMock(address[] _payees, uint256[] _shares) public SplitPayment(_payees, _shares) payable {} - function () payable {} + function () public payable {} } diff --git a/test/helpers/StandardTokenMock.sol b/test/helpers/StandardTokenMock.sol index 2189edce8..d2fbf84e4 100644 --- a/test/helpers/StandardTokenMock.sol +++ b/test/helpers/StandardTokenMock.sol @@ -7,7 +7,7 @@ import '../../contracts/token/StandardToken.sol'; // mock class using StandardToken contract StandardTokenMock is StandardToken { - function StandardTokenMock(address initialAccount, uint256 initialBalance) { + function StandardTokenMock(address initialAccount, uint256 initialBalance) public { balances[initialAccount] = initialBalance; totalSupply = initialBalance; } From bb1736e376161c0856e2d554626e6fff8680c7c9 Mon Sep 17 00:00:00 2001 From: Alejandro Santander Date: Thu, 23 Nov 2017 12:28:46 -0300 Subject: [PATCH 3/3] Change visibility of fallbacks to external --- contracts/Bounty.sol | 2 +- contracts/crowdsale/Crowdsale.sol | 2 +- test/helpers/SplitPaymentMock.sol | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/Bounty.sol b/contracts/Bounty.sol index a36e61d9c..e1a5acb7c 100644 --- a/contracts/Bounty.sol +++ b/contracts/Bounty.sol @@ -18,7 +18,7 @@ contract Bounty is PullPayment, Destructible { /** * @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed. */ - function() public payable { + function() external payable { require(!claimed); } diff --git a/contracts/crowdsale/Crowdsale.sol b/contracts/crowdsale/Crowdsale.sol index 5565a973b..452bf573a 100644 --- a/contracts/crowdsale/Crowdsale.sol +++ b/contracts/crowdsale/Crowdsale.sol @@ -61,7 +61,7 @@ contract Crowdsale { // fallback function can be used to buy tokens - function () public payable { + function () external payable { buyTokens(msg.sender); } diff --git a/test/helpers/SplitPaymentMock.sol b/test/helpers/SplitPaymentMock.sol index f7a487b57..e884d1af8 100644 --- a/test/helpers/SplitPaymentMock.sol +++ b/test/helpers/SplitPaymentMock.sol @@ -6,5 +6,5 @@ import '../../contracts/payment/SplitPayment.sol'; contract SplitPaymentMock is SplitPayment { function SplitPaymentMock(address[] _payees, uint256[] _shares) public SplitPayment(_payees, _shares) payable {} - function () public payable {} + function () external payable {} }