From b395b06b65ce35cac155c13d01ab3fc9d42c5cfb Mon Sep 17 00:00:00 2001 From: dmx374 Date: Mon, 18 Sep 2017 13:41:40 +0200 Subject: [PATCH] Explicit public visibility on methods --- contracts/Bounty.sol | 6 +++--- contracts/ECRecovery.sol | 2 +- contracts/crowdsale/Crowdsale.sol | 2 +- contracts/crowdsale/FinalizableCrowdsale.sol | 2 +- contracts/crowdsale/RefundVault.sol | 8 ++++---- contracts/crowdsale/RefundableCrowdsale.sol | 2 +- contracts/lifecycle/Destructible.sol | 4 ++-- contracts/lifecycle/Migrations.sol | 4 ++-- contracts/lifecycle/Pausable.sol | 4 ++-- contracts/lifecycle/TokenDestructible.sol | 2 +- contracts/ownership/Claimable.sol | 4 ++-- contracts/ownership/Contactable.sol | 2 +- contracts/ownership/DelayedClaimable.sol | 4 ++-- contracts/ownership/Ownable.sol | 2 +- contracts/payment/PullPayment.sol | 2 +- contracts/token/BasicToken.sol | 4 ++-- contracts/token/ERC20.sol | 6 +++--- contracts/token/ERC20Basic.sol | 4 ++-- contracts/token/LimitedTransferToken.sol | 6 +++--- contracts/token/MintableToken.sol | 4 ++-- contracts/token/PausableToken.sol | 4 ++-- contracts/token/StandardToken.sol | 6 +++--- contracts/token/TokenTimelock.sol | 10 +++++----- contracts/token/VestedToken.sol | 10 +++++----- 24 files changed, 52 insertions(+), 52 deletions(-) diff --git a/contracts/Bounty.sol b/contracts/Bounty.sol index 7648d729f..367e130f0 100644 --- a/contracts/Bounty.sol +++ b/contracts/Bounty.sol @@ -27,7 +27,7 @@ contract Bounty is PullPayment, Destructible { * msg.sender as a researcher * @return A target contract */ - function createTarget() returns(Target) { + function createTarget() public returns(Target) { Target target = Target(deployContract()); researchers[target] = msg.sender; TargetCreated(target); @@ -44,7 +44,7 @@ contract Bounty is PullPayment, Destructible { * @dev Sends the contract funds to the researcher that proved the contract is broken. * @param target contract */ - function claim(Target target) { + function claim(Target target) public { address researcher = researchers[target]; require(researcher != 0); // Check Target contract invariants @@ -68,5 +68,5 @@ contract Target { * In order to win the bounty, security researchers will try to cause this broken state. * @return True if all invariant values are correct, false otherwise. */ - function checkInvariant() returns(bool); + function checkInvariant() public returns(bool); } diff --git a/contracts/ECRecovery.sol b/contracts/ECRecovery.sol index 17b1b98f7..de32838a1 100644 --- a/contracts/ECRecovery.sol +++ b/contracts/ECRecovery.sol @@ -14,7 +14,7 @@ library ECRecovery { * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address. * @param sig bytes signature, the signature is generated using web3.eth.sign() */ - function recover(bytes32 hash, bytes sig) constant returns (address) { + function recover(bytes32 hash, bytes sig) public constant returns (address) { bytes32 r; bytes32 s; uint8 v; diff --git a/contracts/crowdsale/Crowdsale.sol b/contracts/crowdsale/Crowdsale.sol index 986397b2e..32eb1b4dd 100644 --- a/contracts/crowdsale/Crowdsale.sol +++ b/contracts/crowdsale/Crowdsale.sol @@ -66,7 +66,7 @@ contract Crowdsale { } // low level token purchase function - function buyTokens(address beneficiary) payable { + function buyTokens(address beneficiary) public payable { require(beneficiary != 0x0); require(validPurchase()); diff --git a/contracts/crowdsale/FinalizableCrowdsale.sol b/contracts/crowdsale/FinalizableCrowdsale.sol index 0bae44b47..f07d3a96a 100644 --- a/contracts/crowdsale/FinalizableCrowdsale.sol +++ b/contracts/crowdsale/FinalizableCrowdsale.sol @@ -20,7 +20,7 @@ contract FinalizableCrowdsale is Crowdsale, Ownable { * @dev Must be called after crowdsale ends, to do some extra finalization * work. Calls the contract's finalization function. */ - function finalize() onlyOwner { + function finalize() onlyOwner public { require(!isFinalized); require(hasEnded()); diff --git a/contracts/crowdsale/RefundVault.sol b/contracts/crowdsale/RefundVault.sol index cc92ff9f9..ea74269de 100644 --- a/contracts/crowdsale/RefundVault.sol +++ b/contracts/crowdsale/RefundVault.sol @@ -28,25 +28,25 @@ contract RefundVault is Ownable { state = State.Active; } - function deposit(address investor) onlyOwner payable { + function deposit(address investor) onlyOwner public payable { require(state == State.Active); deposited[investor] = deposited[investor].add(msg.value); } - function close() onlyOwner { + function close() onlyOwner public { require(state == State.Active); state = State.Closed; Closed(); wallet.transfer(this.balance); } - function enableRefunds() onlyOwner { + function enableRefunds() onlyOwner public { require(state == State.Active); state = State.Refunding; RefundsEnabled(); } - function refund(address investor) { + function refund(address investor) public { require(state == State.Refunding); uint256 depositedValue = deposited[investor]; deposited[investor] = 0; diff --git a/contracts/crowdsale/RefundableCrowdsale.sol b/contracts/crowdsale/RefundableCrowdsale.sol index f5b44cda4..f04f643eb 100644 --- a/contracts/crowdsale/RefundableCrowdsale.sol +++ b/contracts/crowdsale/RefundableCrowdsale.sol @@ -35,7 +35,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { } // if crowdsale is unsuccessful, investors can claim refunds here - function claimRefund() { + function claimRefund() public { require(isFinalized); require(!goalReached()); diff --git a/contracts/lifecycle/Destructible.sol b/contracts/lifecycle/Destructible.sol index d0cd9d9a2..9c24474b7 100644 --- a/contracts/lifecycle/Destructible.sol +++ b/contracts/lifecycle/Destructible.sol @@ -15,11 +15,11 @@ contract Destructible is Ownable { /** * @dev Transfers the current balance to the owner and terminates the contract. */ - function destroy() onlyOwner { + function destroy() onlyOwner public { selfdestruct(owner); } - function destroyAndSend(address _recipient) onlyOwner { + function destroyAndSend(address _recipient) onlyOwner public { selfdestruct(_recipient); } } diff --git a/contracts/lifecycle/Migrations.sol b/contracts/lifecycle/Migrations.sol index d5b053087..f389cca99 100644 --- a/contracts/lifecycle/Migrations.sol +++ b/contracts/lifecycle/Migrations.sol @@ -10,11 +10,11 @@ import '../ownership/Ownable.sol'; contract Migrations is Ownable { uint256 public lastCompletedMigration; - function setCompleted(uint256 completed) onlyOwner { + function setCompleted(uint256 completed) onlyOwner public { lastCompletedMigration = completed; } - function upgrade(address newAddress) onlyOwner { + function upgrade(address newAddress) onlyOwner public { Migrations upgraded = Migrations(newAddress); upgraded.setCompleted(lastCompletedMigration); } diff --git a/contracts/lifecycle/Pausable.sol b/contracts/lifecycle/Pausable.sol index ca5f435d6..9c3cc307b 100644 --- a/contracts/lifecycle/Pausable.sol +++ b/contracts/lifecycle/Pausable.sol @@ -34,7 +34,7 @@ contract Pausable is Ownable { /** * @dev called by the owner to pause, triggers stopped state */ - function pause() onlyOwner whenNotPaused { + function pause() onlyOwner whenNotPaused public { paused = true; Pause(); } @@ -42,7 +42,7 @@ contract Pausable is Ownable { /** * @dev called by the owner to unpause, returns to normal state */ - function unpause() onlyOwner whenPaused { + function unpause() onlyOwner whenPaused public { paused = false; Unpause(); } diff --git a/contracts/lifecycle/TokenDestructible.sol b/contracts/lifecycle/TokenDestructible.sol index a6e028c10..e29d69b63 100644 --- a/contracts/lifecycle/TokenDestructible.sol +++ b/contracts/lifecycle/TokenDestructible.sol @@ -21,7 +21,7 @@ contract TokenDestructible is Ownable { * @notice The called token contracts could try to re-enter this contract. Only supply token contracts you trust. */ - function destroy(address[] tokens) onlyOwner { + function destroy(address[] tokens) onlyOwner public { // Transfer tokens to owner for(uint256 i = 0; i < tokens.length; i++) { diff --git a/contracts/ownership/Claimable.sol b/contracts/ownership/Claimable.sol index 4f6ea1a86..321b9aa68 100644 --- a/contracts/ownership/Claimable.sol +++ b/contracts/ownership/Claimable.sol @@ -24,14 +24,14 @@ contract Claimable is Ownable { * @dev Allows the current owner to set the pendingOwner address. * @param newOwner The address to transfer ownership to. */ - function transferOwnership(address newOwner) onlyOwner { + function transferOwnership(address newOwner) onlyOwner public { pendingOwner = newOwner; } /** * @dev Allows the pendingOwner address to finalize the transfer. */ - function claimOwnership() onlyPendingOwner { + function claimOwnership() onlyPendingOwner public { OwnershipTransferred(owner, pendingOwner); owner = pendingOwner; pendingOwner = 0x0; diff --git a/contracts/ownership/Contactable.sol b/contracts/ownership/Contactable.sol index 16b14c1ef..ed0c50dcd 100644 --- a/contracts/ownership/Contactable.sol +++ b/contracts/ownership/Contactable.sol @@ -15,7 +15,7 @@ contract Contactable is Ownable{ * @dev Allows the owner to set a string with their contact information. * @param info The contact information to attach to the contract. */ - function setContactInformation(string info) onlyOwner{ + function setContactInformation(string info) onlyOwner public { contactInformation = info; } } diff --git a/contracts/ownership/DelayedClaimable.sol b/contracts/ownership/DelayedClaimable.sol index b3ef96dbf..329cd5252 100644 --- a/contracts/ownership/DelayedClaimable.sol +++ b/contracts/ownership/DelayedClaimable.sol @@ -20,7 +20,7 @@ contract DelayedClaimable is Claimable { * @param _start The earliest time ownership can be claimed. * @param _end The latest time ownership can be claimed. */ - function setLimits(uint256 _start, uint256 _end) onlyOwner { + function setLimits(uint256 _start, uint256 _end) onlyOwner public { require(_start <= _end); end = _end; start = _start; @@ -31,7 +31,7 @@ contract DelayedClaimable is Claimable { * @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within * the specified start and end time. */ - function claimOwnership() onlyPendingOwner { + function claimOwnership() onlyPendingOwner public { require((block.number <= end) && (block.number >= start)); OwnershipTransferred(owner, pendingOwner); owner = pendingOwner; diff --git a/contracts/ownership/Ownable.sol b/contracts/ownership/Ownable.sol index 1871efe22..307ecee46 100644 --- a/contracts/ownership/Ownable.sol +++ b/contracts/ownership/Ownable.sol @@ -35,7 +35,7 @@ contract Ownable { * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ - function transferOwnership(address newOwner) onlyOwner { + function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; diff --git a/contracts/payment/PullPayment.sol b/contracts/payment/PullPayment.sol index d85f0a576..4a0924fa7 100644 --- a/contracts/payment/PullPayment.sol +++ b/contracts/payment/PullPayment.sol @@ -28,7 +28,7 @@ contract PullPayment { /** * @dev withdraw accumulated balance, called by payee. */ - function withdrawPayments() { + function withdrawPayments() public { address payee = msg.sender; uint256 payment = payments[payee]; diff --git a/contracts/token/BasicToken.sol b/contracts/token/BasicToken.sol index d452c70e6..7df250013 100644 --- a/contracts/token/BasicToken.sol +++ b/contracts/token/BasicToken.sol @@ -19,7 +19,7 @@ contract BasicToken is ERC20Basic { * @param _to The address to transfer to. * @param _value The amount to be transferred. */ - function transfer(address _to, uint256 _value) returns (bool) { + function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); // SafeMath.sub will throw if there is not enough balance. @@ -34,7 +34,7 @@ contract BasicToken is ERC20Basic { * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ - function balanceOf(address _owner) constant returns (uint256 balance) { + function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; } diff --git a/contracts/token/ERC20.sol b/contracts/token/ERC20.sol index 9516ba82d..ca36d737b 100644 --- a/contracts/token/ERC20.sol +++ b/contracts/token/ERC20.sol @@ -9,8 +9,8 @@ import './ERC20Basic.sol'; * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { - function allowance(address owner, address spender) constant returns (uint256); - function transferFrom(address from, address to, uint256 value) returns (bool); - function approve(address spender, uint256 value) returns (bool); + function allowance(address owner, address spender) public constant returns (uint256); + function transferFrom(address from, address to, uint256 value) public returns (bool); + function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } diff --git a/contracts/token/ERC20Basic.sol b/contracts/token/ERC20Basic.sol index 07ab02f0b..76e0704ba 100644 --- a/contracts/token/ERC20Basic.sol +++ b/contracts/token/ERC20Basic.sol @@ -8,7 +8,7 @@ pragma solidity ^0.4.11; */ contract ERC20Basic { uint256 public totalSupply; - function balanceOf(address who) constant returns (uint256); - function transfer(address to, uint256 value) returns (bool); + function balanceOf(address who) public constant returns (uint256); + function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } diff --git a/contracts/token/LimitedTransferToken.sol b/contracts/token/LimitedTransferToken.sol index c08976b80..50e3f1661 100644 --- a/contracts/token/LimitedTransferToken.sol +++ b/contracts/token/LimitedTransferToken.sol @@ -32,7 +32,7 @@ contract LimitedTransferToken is ERC20 { * @param _to The address that will recieve the tokens. * @param _value The amount of tokens to be transferred. */ - function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) returns (bool) { + function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public returns (bool) { return super.transfer(_to, _value); } @@ -42,7 +42,7 @@ contract LimitedTransferToken is ERC20 { * @param _to The address that will recieve the tokens. * @param _value The amount of tokens to be transferred. */ - function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) returns (bool) { + function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) public returns (bool) { return super.transferFrom(_from, _to, _value); } @@ -51,7 +51,7 @@ contract LimitedTransferToken is ERC20 { * @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the * specific logic for limiting token transferability for a holder over time. */ - function transferableTokens(address holder, uint64 time) constant public returns (uint256) { + function transferableTokens(address holder, uint64 time) public constant returns (uint256) { return balanceOf(holder); } } diff --git a/contracts/token/MintableToken.sol b/contracts/token/MintableToken.sol index 697551d3d..234def478 100644 --- a/contracts/token/MintableToken.sol +++ b/contracts/token/MintableToken.sol @@ -31,7 +31,7 @@ contract MintableToken is StandardToken, Ownable { * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ - function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) { + function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); @@ -43,7 +43,7 @@ contract MintableToken is StandardToken, Ownable { * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ - function finishMinting() onlyOwner returns (bool) { + function finishMinting() onlyOwner public returns (bool) { mintingFinished = true; MintFinished(); return true; diff --git a/contracts/token/PausableToken.sol b/contracts/token/PausableToken.sol index 32a4afbf0..bf52e6b9e 100644 --- a/contracts/token/PausableToken.sol +++ b/contracts/token/PausableToken.sol @@ -11,11 +11,11 @@ import '../lifecycle/Pausable.sol'; contract PausableToken is StandardToken, Pausable { - function transfer(address _to, uint256 _value) whenNotPaused returns (bool) { + function transfer(address _to, uint256 _value) whenNotPaused public returns (bool) { return super.transfer(_to, _value); } - function transferFrom(address _from, address _to, uint256 _value) whenNotPaused returns (bool) { + function transferFrom(address _from, address _to, uint256 _value) whenNotPaused public returns (bool) { return super.transferFrom(_from, _to, _value); } } diff --git a/contracts/token/StandardToken.sol b/contracts/token/StandardToken.sol index 9ed357890..6f4537d4e 100644 --- a/contracts/token/StandardToken.sol +++ b/contracts/token/StandardToken.sol @@ -23,7 +23,7 @@ contract StandardToken is ERC20, BasicToken { * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ - function transferFrom(address _from, address _to, uint256 _value) returns (bool) { + function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); var _allowance = allowed[_from][msg.sender]; @@ -43,7 +43,7 @@ contract StandardToken is ERC20, BasicToken { * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ - function approve(address _spender, uint256 _value) returns (bool) { + function approve(address _spender, uint256 _value) public returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not @@ -62,7 +62,7 @@ contract StandardToken is ERC20, BasicToken { * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ - function allowance(address _owner, address _spender) constant returns (uint256 remaining) { + function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; } diff --git a/contracts/token/TokenTimelock.sol b/contracts/token/TokenTimelock.sol index 86dc3b260..1618e3fe7 100644 --- a/contracts/token/TokenTimelock.sol +++ b/contracts/token/TokenTimelock.sol @@ -13,13 +13,13 @@ contract TokenTimelock { using SafeERC20 for ERC20Basic; // ERC20 basic token contract being held - ERC20Basic token; + ERC20Basic public token; // beneficiary of tokens after they are released - address beneficiary; + address public beneficiary; // timestamp when token release is enabled - uint64 releaseTime; + uint64 public releaseTime; function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) { require(_releaseTime > now); @@ -32,7 +32,7 @@ contract TokenTimelock { * @notice Transfers tokens held by timelock to beneficiary. * Deprecated: please use TokenTimelock#release instead. */ - function claim() { + function claim() public { require(msg.sender == beneficiary); release(); } @@ -40,7 +40,7 @@ contract TokenTimelock { /** * @notice Transfers tokens held by timelock to beneficiary. */ - function release() { + function release() public { require(now >= releaseTime); uint256 amount = token.balanceOf(this); diff --git a/contracts/token/VestedToken.sol b/contracts/token/VestedToken.sol index be50de75a..f0f99a23b 100644 --- a/contracts/token/VestedToken.sol +++ b/contracts/token/VestedToken.sol @@ -99,7 +99,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @param time uint64 The specific time. * @return An uint256 representing a holder's total amount of transferable tokens. */ - function transferableTokens(address holder, uint64 time) constant public returns (uint256) { + function transferableTokens(address holder, uint64 time) public constant returns (uint256) { uint256 grantIndex = tokenGrantsCount(holder); if (grantIndex == 0) return super.transferableTokens(holder, time); // shortcut for holder without grants @@ -123,7 +123,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @param _holder The holder of the grants. * @return A uint256 representing the total amount of grants. */ - function tokenGrantsCount(address _holder) constant returns (uint256 index) { + function tokenGrantsCount(address _holder) public constant returns (uint256 index) { return grants[_holder].length; } @@ -156,7 +156,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { uint256 time, uint256 start, uint256 cliff, - uint256 vesting) constant returns (uint256) + uint256 vesting) public constant returns (uint256) { // Shortcuts for before cliff and after vesting cases. if (time < cliff) return 0; @@ -185,7 +185,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @return Returns all the values that represent a TokenGrant(address, value, start, cliff, * revokability, burnsOnRevoke, and vesting) plus the vested value at the current time. */ - function tokenGrant(address _holder, uint256 _grantId) constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) { + function tokenGrant(address _holder, uint256 _grantId) public constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) { TokenGrant storage grant = grants[_holder][_grantId]; granter = grant.granter; @@ -231,7 +231,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @param holder address The address of the holder * @return An uint256 representing the date of the last transferable tokens. */ - function lastTokenIsTransferableDate(address holder) constant public returns (uint64 date) { + function lastTokenIsTransferableDate(address holder) public constant returns (uint64 date) { date = uint64(now); uint256 grantIndex = grants[holder].length; for (uint256 i = 0; i < grantIndex; i++) {