Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor
  • Loading branch information
azavalla committed Nov 12, 2017
commit 31a62201945c48dfd80a89a7781a384ea564f369
2 changes: 1 addition & 1 deletion contracts/Bounty.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
3 changes: 2 additions & 1 deletion contracts/DayLimit.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma solidity ^0.4.11;


/**
* @title DayLimit
* @dev Base contract that enables methods to be protected by placing a linear limit (specifiable)
Expand All @@ -15,7 +16,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) internal {
dailyLimit = _limit;
lastDay = today();
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/LimitBalance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) internal {
limit = _limit;
}

Expand Down
15 changes: 13 additions & 2 deletions contracts/MerkleProof.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma solidity ^0.4.11;


/*
* @title MerkleProof
* @dev Merkle proof verification
Expand All @@ -13,9 +14,19 @@ library MerkleProof {
* @param _root Merkle root
* @param _leaf Leaf of Merkle tree
*/
function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) constant returns (bool) {

function verifyProof(
bytes _proof,
bytes32 _root,
bytes32 _leaf
)
public
constant
returns (bool)
{
// Check if proof length is a multiple of 32
if (_proof.length % 32 != 0) return false;
if (_proof.length % 32 != 0)
return false;

bytes32 proofElement;
bytes32 computedHash = _leaf;
Expand Down
1 change: 1 addition & 0 deletions contracts/ReentrancyGuard.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma solidity ^0.4.11;


/**
* @title Helps contracts guard agains rentrancy attacks.
* @author Remco Bloemen <remco@2π.com>
Expand Down
3 changes: 2 additions & 1 deletion contracts/crowdsale/CappedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.4.11;
import '../math/SafeMath.sol';
import './Crowdsale.sol';


/**
* @title CappedCrowdsale
* @dev Extension of Crowdsale with a max amount of funds raised
Expand All @@ -12,7 +13,7 @@ contract CappedCrowdsale is Crowdsale {

uint256 public cap;

function CappedCrowdsale(uint256 _cap) {
function CappedCrowdsale(uint256 _cap) internal {
require(_cap > 0);
cap = _cap;
}
Expand Down
23 changes: 17 additions & 6 deletions contracts/crowdsale/Crowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.4.11;
import '../token/MintableToken.sol';
import '../math/SafeMath.sol';


/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
Expand Down Expand Up @@ -37,10 +38,21 @@ contract Crowdsale {
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);


function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) {
event TokenPurchase(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount
);

function Crowdsale(
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet
)
internal
{
require(_startTime >= now);
require(_endTime >= _startTime);
require(_rate > 0);
Expand All @@ -59,9 +71,8 @@ contract Crowdsale {
return new MintableToken();
}


// fallback function can be used to buy tokens
function () payable {
function () public payable {
buyTokens(msg.sender);
}

Expand Down
1 change: 1 addition & 0 deletions contracts/crowdsale/FinalizableCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '../math/SafeMath.sol';
import '../ownership/Ownable.sol';
import './Crowdsale.sol';


/**
* @title FinalizableCrowdsale
* @dev Extension of Crowdsale where an owner can do extra work
Expand Down
3 changes: 2 additions & 1 deletion contracts/crowdsale/RefundVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.4.11;
import '../math/SafeMath.sol';
import '../ownership/Ownable.sol';


/**
* @title RefundVault
* @dev This contract is used for storing funds while a crowdsale
Expand All @@ -22,7 +23,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 != 0x0);
wallet = _wallet;
state = State.Active;
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/RefundableCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 14 additions & 4 deletions contracts/examples/SampleCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import "../crowdsale/CappedCrowdsale.sol";
import "../crowdsale/RefundableCrowdsale.sol";
import "../token/MintableToken.sol";


/**
* @title SampleCrowdsaleToken
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a crowdsale contract.
*/
contract SampleCrowdsaleToken is MintableToken {

string public constant name = "Sample Crowdsale Token";
string public constant symbol = "SCT";
uint8 public constant decimals = 18;
string public constant NAME = "Sample Crowdsale Token";
string public constant SYMBOL = "SCT";
uint8 public constant DECIMALS = 18;

}


/**
* @title SampleCrowdsale
* @dev This is an example of a fully fledged crowdsale.
Expand All @@ -30,7 +32,15 @@ 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)
Expand Down
10 changes: 5 additions & 5 deletions contracts/examples/SimpleToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import "../token/StandardToken.sol";
*/
contract SimpleToken is StandardToken {

string public constant name = "SimpleToken";
string public constant symbol = "SIM";
uint8 public constant decimals = 18;
string public constant NAME = "SimpleToken";
string public constant SYMBOL = "SIM";
uint8 public constant DECIMALS = 18;

uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(DECIMALS));

/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function SimpleToken() {
function SimpleToken() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/lifecycle/Destructible.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "../ownership/Ownable.sol";
*/
contract Destructible is Ownable {

function Destructible() payable { }
function Destructible() internal payable { }

/**
* @dev Transfers the current balance to the owner and terminates the contract.
Expand Down
1 change: 1 addition & 0 deletions contracts/lifecycle/Migrations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.4.11;

import '../ownership/Ownable.sol';


/**
* @title Migrations
* @dev This is a truffle contract, needed for truffle integration, not meant for use by Zeppelin users.
Expand Down
5 changes: 3 additions & 2 deletions contracts/lifecycle/TokenDestructible.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.4.11;
import "../ownership/Ownable.sol";
import "../token/ERC20Basic.sol";


/**
* @title TokenDestructible:
* @author Remco Bloemen <remco@2π.com>
Expand All @@ -12,7 +13,7 @@ import "../token/ERC20Basic.sol";
*/
contract TokenDestructible is Ownable {

function TokenDestructible() payable { }
function TokenDestructible() internal payable { }

/**
* @notice Terminate contract and refund to owner
Expand All @@ -24,7 +25,7 @@ contract TokenDestructible is Ownable {
function destroy(address[] tokens) onlyOwner public {

// Transfer tokens to owner
for(uint256 i = 0; i < tokens.length; i++) {
for (uint256 i = 0; i < tokens.length; i++) {
ERC20Basic token = ERC20Basic(tokens[i]);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
Expand Down
2 changes: 1 addition & 1 deletion contracts/math/Math.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pragma solidity ^0.4.11;


/**
* @title Math
* @dev Assorted math operations
*/

library Math {
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
Expand Down
1 change: 1 addition & 0 deletions contracts/ownership/CanReclaimToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "./Ownable.sol";
import "../token/ERC20Basic.sol";
import "../token/SafeERC20.sol";


/**
* @title Contracts that should be able to recover tokens
* @author SylTi
Expand Down
19 changes: 10 additions & 9 deletions contracts/ownership/Contactable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ pragma solidity ^0.4.11;

import './Ownable.sol';


/**
* @title Contactable token
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their
* contact information.
*/
contract Contactable is Ownable{
contract Contactable is Ownable {

string public contactInformation;
string public contactInformation;

/**
* @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 public {
contactInformation = info;
}
/**
* @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 public {
contactInformation = info;
}
}
1 change: 0 additions & 1 deletion contracts/ownership/DelayedClaimable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ contract DelayedClaimable is Claimable {
start = _start;
}


/**
* @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
* the specified start and end time.
Expand Down
1 change: 1 addition & 0 deletions contracts/ownership/HasNoContracts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pragma solidity ^0.4.11;

import "./Ownable.sol";


/**
* @title Contracts that should not own Contracts
* @author Remco Bloemen <remco@2π.com>
Expand Down
3 changes: 2 additions & 1 deletion contracts/ownership/HasNoEther.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pragma solidity ^0.4.11;

import "./Ownable.sol";


/**
* @title Contracts that should not own Ether
* @author Remco Bloemen <remco@2π.com>
Expand All @@ -21,7 +22,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() internal payable {
require(msg.value == 0);
}

Expand Down
1 change: 1 addition & 0 deletions contracts/ownership/HasNoTokens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pragma solidity ^0.4.11;

import "./CanReclaimToken.sol";


/**
* @title Contracts that should not own Tokens
* @author Remco Bloemen <remco@2π.com>
Expand Down
1 change: 1 addition & 0 deletions contracts/ownership/NoOwner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "./HasNoEther.sol";
import "./HasNoTokens.sol";
import "./HasNoContracts.sol";


/**
* @title Base contract for contracts that should not own things.
* @author Remco Bloemen <remco@2π.com>
Expand Down
Loading