Merge pull request #450 from dmx374/master

Explicit public visibility on methods
pull/456/merge
Francisco Giordano 7 years ago
commit 74e416f04f
  1. 6
      contracts/Bounty.sol
  2. 2
      contracts/ECRecovery.sol
  3. 2
      contracts/crowdsale/Crowdsale.sol
  4. 2
      contracts/crowdsale/FinalizableCrowdsale.sol
  5. 8
      contracts/crowdsale/RefundVault.sol
  6. 2
      contracts/crowdsale/RefundableCrowdsale.sol
  7. 4
      contracts/lifecycle/Destructible.sol
  8. 4
      contracts/lifecycle/Migrations.sol
  9. 4
      contracts/lifecycle/Pausable.sol
  10. 2
      contracts/lifecycle/TokenDestructible.sol
  11. 4
      contracts/ownership/Claimable.sol
  12. 2
      contracts/ownership/Contactable.sol
  13. 4
      contracts/ownership/DelayedClaimable.sol
  14. 2
      contracts/ownership/Ownable.sol
  15. 2
      contracts/payment/PullPayment.sol
  16. 4
      contracts/token/BasicToken.sol
  17. 6
      contracts/token/ERC20.sol
  18. 4
      contracts/token/ERC20Basic.sol
  19. 6
      contracts/token/LimitedTransferToken.sol
  20. 4
      contracts/token/MintableToken.sol
  21. 4
      contracts/token/PausableToken.sol
  22. 6
      contracts/token/StandardToken.sol
  23. 10
      contracts/token/TokenTimelock.sol
  24. 10
      contracts/token/VestedToken.sol

@ -27,7 +27,7 @@ contract Bounty is PullPayment, Destructible {
* msg.sender as a researcher * msg.sender as a researcher
* @return A target contract * @return A target contract
*/ */
function createTarget() returns(Target) { function createTarget() public returns(Target) {
Target target = Target(deployContract()); Target target = Target(deployContract());
researchers[target] = msg.sender; researchers[target] = msg.sender;
TargetCreated(target); 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. * @dev Sends the contract funds to the researcher that proved the contract is broken.
* @param target contract * @param target contract
*/ */
function claim(Target target) { function claim(Target target) public {
address researcher = researchers[target]; address researcher = researchers[target];
require(researcher != 0); require(researcher != 0);
// Check Target contract invariants // 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. * 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. * @return True if all invariant values are correct, false otherwise.
*/ */
function checkInvariant() returns(bool); function checkInvariant() public returns(bool);
} }

@ -14,7 +14,7 @@ library ECRecovery {
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address. * @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() * @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 r;
bytes32 s; bytes32 s;
uint8 v; uint8 v;

@ -66,7 +66,7 @@ contract Crowdsale {
} }
// low level token purchase function // low level token purchase function
function buyTokens(address beneficiary) payable { function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0); require(beneficiary != 0x0);
require(validPurchase()); require(validPurchase());

@ -20,7 +20,7 @@ contract FinalizableCrowdsale is Crowdsale, Ownable {
* @dev Must be called after crowdsale ends, to do some extra finalization * @dev Must be called after crowdsale ends, to do some extra finalization
* work. Calls the contract's finalization function. * work. Calls the contract's finalization function.
*/ */
function finalize() onlyOwner { function finalize() onlyOwner public {
require(!isFinalized); require(!isFinalized);
require(hasEnded()); require(hasEnded());

@ -28,25 +28,25 @@ contract RefundVault is Ownable {
state = State.Active; state = State.Active;
} }
function deposit(address investor) onlyOwner payable { function deposit(address investor) onlyOwner public payable {
require(state == State.Active); require(state == State.Active);
deposited[investor] = deposited[investor].add(msg.value); deposited[investor] = deposited[investor].add(msg.value);
} }
function close() onlyOwner { function close() onlyOwner public {
require(state == State.Active); require(state == State.Active);
state = State.Closed; state = State.Closed;
Closed(); Closed();
wallet.transfer(this.balance); wallet.transfer(this.balance);
} }
function enableRefunds() onlyOwner { function enableRefunds() onlyOwner public {
require(state == State.Active); require(state == State.Active);
state = State.Refunding; state = State.Refunding;
RefundsEnabled(); RefundsEnabled();
} }
function refund(address investor) { function refund(address investor) public {
require(state == State.Refunding); require(state == State.Refunding);
uint256 depositedValue = deposited[investor]; uint256 depositedValue = deposited[investor];
deposited[investor] = 0; deposited[investor] = 0;

@ -35,7 +35,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
} }
// if crowdsale is unsuccessful, investors can claim refunds here // if crowdsale is unsuccessful, investors can claim refunds here
function claimRefund() { function claimRefund() public {
require(isFinalized); require(isFinalized);
require(!goalReached()); require(!goalReached());

@ -15,11 +15,11 @@ contract Destructible is Ownable {
/** /**
* @dev Transfers the current balance to the owner and terminates the contract. * @dev Transfers the current balance to the owner and terminates the contract.
*/ */
function destroy() onlyOwner { function destroy() onlyOwner public {
selfdestruct(owner); selfdestruct(owner);
} }
function destroyAndSend(address _recipient) onlyOwner { function destroyAndSend(address _recipient) onlyOwner public {
selfdestruct(_recipient); selfdestruct(_recipient);
} }
} }

@ -10,11 +10,11 @@ import '../ownership/Ownable.sol';
contract Migrations is Ownable { contract Migrations is Ownable {
uint256 public lastCompletedMigration; uint256 public lastCompletedMigration;
function setCompleted(uint256 completed) onlyOwner { function setCompleted(uint256 completed) onlyOwner public {
lastCompletedMigration = completed; lastCompletedMigration = completed;
} }
function upgrade(address newAddress) onlyOwner { function upgrade(address newAddress) onlyOwner public {
Migrations upgraded = Migrations(newAddress); Migrations upgraded = Migrations(newAddress);
upgraded.setCompleted(lastCompletedMigration); upgraded.setCompleted(lastCompletedMigration);
} }

@ -34,7 +34,7 @@ contract Pausable is Ownable {
/** /**
* @dev called by the owner to pause, triggers stopped state * @dev called by the owner to pause, triggers stopped state
*/ */
function pause() onlyOwner whenNotPaused { function pause() onlyOwner whenNotPaused public {
paused = true; paused = true;
Pause(); Pause();
} }
@ -42,7 +42,7 @@ contract Pausable is Ownable {
/** /**
* @dev called by the owner to unpause, returns to normal state * @dev called by the owner to unpause, returns to normal state
*/ */
function unpause() onlyOwner whenPaused { function unpause() onlyOwner whenPaused public {
paused = false; paused = false;
Unpause(); Unpause();
} }

@ -21,7 +21,7 @@ contract TokenDestructible is Ownable {
* @notice The called token contracts could try to re-enter this contract. Only * @notice The called token contracts could try to re-enter this contract. Only
supply token contracts you trust. supply token contracts you trust.
*/ */
function destroy(address[] tokens) onlyOwner { function destroy(address[] tokens) onlyOwner public {
// Transfer tokens to owner // Transfer tokens to owner
for(uint256 i = 0; i < tokens.length; i++) { for(uint256 i = 0; i < tokens.length; i++) {

@ -24,14 +24,14 @@ contract Claimable is Ownable {
* @dev Allows the current owner to set the pendingOwner address. * @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to. * @param newOwner The address to transfer ownership to.
*/ */
function transferOwnership(address newOwner) onlyOwner { function transferOwnership(address newOwner) onlyOwner public {
pendingOwner = newOwner; pendingOwner = newOwner;
} }
/** /**
* @dev Allows the pendingOwner address to finalize the transfer. * @dev Allows the pendingOwner address to finalize the transfer.
*/ */
function claimOwnership() onlyPendingOwner { function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner); OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner; owner = pendingOwner;
pendingOwner = 0x0; pendingOwner = 0x0;

@ -15,7 +15,7 @@ contract Contactable is Ownable{
* @dev Allows the owner to set a string with their contact information. * @dev Allows the owner to set a string with their contact information.
* @param info The contact information to attach to the contract. * @param info The contact information to attach to the contract.
*/ */
function setContactInformation(string info) onlyOwner{ function setContactInformation(string info) onlyOwner public {
contactInformation = info; contactInformation = info;
} }
} }

@ -20,7 +20,7 @@ contract DelayedClaimable is Claimable {
* @param _start The earliest time ownership can be claimed. * @param _start The earliest time ownership can be claimed.
* @param _end The latest 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); require(_start <= _end);
end = _end; end = _end;
start = _start; 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 * @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
* the specified start and end time. * the specified start and end time.
*/ */
function claimOwnership() onlyPendingOwner { function claimOwnership() onlyPendingOwner public {
require((block.number <= end) && (block.number >= start)); require((block.number <= end) && (block.number >= start));
OwnershipTransferred(owner, pendingOwner); OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner; owner = pendingOwner;

@ -35,7 +35,7 @@ contract Ownable {
* @dev Allows the current owner to transfer control of the contract to a newOwner. * @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. * @param newOwner The address to transfer ownership to.
*/ */
function transferOwnership(address newOwner) onlyOwner { function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0)); require(newOwner != address(0));
OwnershipTransferred(owner, newOwner); OwnershipTransferred(owner, newOwner);
owner = newOwner; owner = newOwner;

@ -28,7 +28,7 @@ contract PullPayment {
/** /**
* @dev withdraw accumulated balance, called by payee. * @dev withdraw accumulated balance, called by payee.
*/ */
function withdrawPayments() { function withdrawPayments() public {
address payee = msg.sender; address payee = msg.sender;
uint256 payment = payments[payee]; uint256 payment = payments[payee];

@ -19,7 +19,7 @@ contract BasicToken is ERC20Basic {
* @param _to The address to transfer to. * @param _to The address to transfer to.
* @param _value The amount to be transferred. * @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)); require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance. // 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. * @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address. * @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]; return balances[_owner];
} }

@ -9,8 +9,8 @@ import './ERC20Basic.sol';
* @dev see https://github.com/ethereum/EIPs/issues/20 * @dev see https://github.com/ethereum/EIPs/issues/20
*/ */
contract ERC20 is ERC20Basic { contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256); function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) returns (bool); function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value);
} }

@ -8,7 +8,7 @@ pragma solidity ^0.4.11;
*/ */
contract ERC20Basic { contract ERC20Basic {
uint256 public totalSupply; uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256); function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) returns (bool); function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value);
} }

@ -32,7 +32,7 @@ contract LimitedTransferToken is ERC20 {
* @param _to The address that will recieve the tokens. * @param _to The address that will recieve the tokens.
* @param _value The amount of tokens to be transferred. * @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); return super.transfer(_to, _value);
} }
@ -42,7 +42,7 @@ contract LimitedTransferToken is ERC20 {
* @param _to The address that will recieve the tokens. * @param _to The address that will recieve the tokens.
* @param _value The amount of tokens to be transferred. * @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); 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 * @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the
* specific logic for limiting token transferability for a holder over time. * 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); return balanceOf(holder);
} }
} }

@ -31,7 +31,7 @@ contract MintableToken is StandardToken, Ownable {
* @param _amount The amount of tokens to mint. * @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. * @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); totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount); balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount); Mint(_to, _amount);
@ -43,7 +43,7 @@ contract MintableToken is StandardToken, Ownable {
* @dev Function to stop minting new tokens. * @dev Function to stop minting new tokens.
* @return True if the operation was successful. * @return True if the operation was successful.
*/ */
function finishMinting() onlyOwner returns (bool) { function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true; mintingFinished = true;
MintFinished(); MintFinished();
return true; return true;

@ -11,11 +11,11 @@ import '../lifecycle/Pausable.sol';
contract PausableToken is StandardToken, Pausable { 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); 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); return super.transferFrom(_from, _to, _value);
} }
} }

@ -23,7 +23,7 @@ contract StandardToken is ERC20, BasicToken {
* @param _to address The address which you want to transfer to * @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred * @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)); require(_to != address(0));
var _allowance = allowed[_from][msg.sender]; 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 _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent. * @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` // To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not // 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. * @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. * @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]; return allowed[_owner][_spender];
} }

@ -13,13 +13,13 @@ contract TokenTimelock {
using SafeERC20 for ERC20Basic; using SafeERC20 for ERC20Basic;
// ERC20 basic token contract being held // ERC20 basic token contract being held
ERC20Basic token; ERC20Basic public token;
// beneficiary of tokens after they are released // beneficiary of tokens after they are released
address beneficiary; address public beneficiary;
// timestamp when token release is enabled // timestamp when token release is enabled
uint64 releaseTime; uint64 public releaseTime;
function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) { function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) {
require(_releaseTime > now); require(_releaseTime > now);
@ -32,7 +32,7 @@ contract TokenTimelock {
* @notice Transfers tokens held by timelock to beneficiary. * @notice Transfers tokens held by timelock to beneficiary.
* Deprecated: please use TokenTimelock#release instead. * Deprecated: please use TokenTimelock#release instead.
*/ */
function claim() { function claim() public {
require(msg.sender == beneficiary); require(msg.sender == beneficiary);
release(); release();
} }
@ -40,7 +40,7 @@ contract TokenTimelock {
/** /**
* @notice Transfers tokens held by timelock to beneficiary. * @notice Transfers tokens held by timelock to beneficiary.
*/ */
function release() { function release() public {
require(now >= releaseTime); require(now >= releaseTime);
uint256 amount = token.balanceOf(this); uint256 amount = token.balanceOf(this);

@ -99,7 +99,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @param time uint64 The specific time. * @param time uint64 The specific time.
* @return An uint256 representing a holder's total amount of transferable tokens. * @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); uint256 grantIndex = tokenGrantsCount(holder);
if (grantIndex == 0) return super.transferableTokens(holder, time); // shortcut for holder without grants 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. * @param _holder The holder of the grants.
* @return A uint256 representing the total amount of 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; return grants[_holder].length;
} }
@ -156,7 +156,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
uint256 time, uint256 time,
uint256 start, uint256 start,
uint256 cliff, uint256 cliff,
uint256 vesting) constant returns (uint256) uint256 vesting) public constant returns (uint256)
{ {
// Shortcuts for before cliff and after vesting cases. // Shortcuts for before cliff and after vesting cases.
if (time < cliff) return 0; 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, * @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. * 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]; TokenGrant storage grant = grants[_holder][_grantId];
granter = grant.granter; granter = grant.granter;
@ -231,7 +231,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @param holder address The address of the holder * @param holder address The address of the holder
* @return An uint256 representing the date of the last transferable tokens. * @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); date = uint64(now);
uint256 grantIndex = grants[holder].length; uint256 grantIndex = grants[holder].length;
for (uint256 i = 0; i < grantIndex; i++) { for (uint256 i = 0; i < grantIndex; i++) {

Loading…
Cancel
Save