From c6e0edb26818160219820168f4d2ce5bd19367e1 Mon Sep 17 00:00:00 2001 From: Alejandro Santander Date: Thu, 23 Nov 2017 10:57:36 -0300 Subject: [PATCH] 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; }