Compare commits

...

24 Commits

Author SHA1 Message Date
feb665136c 1.10.0 2018-06-05 17:40:24 -03:00
7fb84b42d5 Refactoring Superuser contract to allow Owners to transfer ownership … (#978)
* Refactoring Superuser contract to allow Owners to transfer ownership when they are not superusers #50

* Refactoring tests to create a contract instance for each of them #50
2018-06-05 17:28:42 -03:00
5db0d7d1a0 included command to add upstream (#959) 2018-06-04 18:31:32 -07:00
512e8218ca Add a comment on Detailed ERC20 token #953 (#960)
* add a comment on detailed erc20 token #953
2018-06-04 18:13:09 -07:00
9d6ffae8cb removed mentions of 'development' branch in Contribution Guidelines (#966) 2018-06-04 17:34:04 -07:00
2a997a8e92 Fixed wrong variable name in SampleCrowdsale.test.js. (#916) 2018-06-04 16:49:46 -07:00
5651538045 Clarified the rationaly behind the mul branch test. (#970) 2018-06-04 16:04:08 -07:00
10e84aecaf Fix Node 10 compatibility (#949)
*  update sha3 1.2.0 -> 1.2.2 for node 10 compatibility

* update nan 2.6.2 -> 2.10.0 for node 10 compatibility

* commit new package-lock.json format generated by npm 6
2018-06-04 17:26:23 -03:00
2637bd89be fix: add comment about rbacwithadmin being rather powerful (#936)
* fix: add comment about rbacwithadmin being rather powerful
* fix: move RBACWithAdmin to examples
2018-06-04 12:32:57 -07:00
32ec8b5398 Add Status Embark to README (#956)
* Update README.md

* update embark import to use the v1.9.0 tag instead of master

* Update README.md
2018-06-04 15:21:55 -03:00
a0c03ee61c Adding new Superuser contract with test (#952)
* Adding new Superuser contract + tests
2018-06-03 16:14:30 -07:00
e3f866c982 fix: remove daylimit.sol, closes #925 (#964) 2018-06-01 13:16:47 -07:00
5ab9024b6a update balance syntax for solidity 0.4.23 (#940) 2018-05-30 16:10:08 -07:00
d5f06ab32f addressed TokenVesting contstructor natspec updates in #742 (#935) 2018-05-29 10:45:40 -06:00
746673a94f style: use the max-len solidity rule (#944) 2018-05-14 11:42:32 -06:00
ba4cf03da7 contracts mocks: replace deprecated constant with view (#931) 2018-05-10 10:43:15 -06:00
39370ff690 Adding RBAC Mintable token (#923)
* added the RBACMintableToken
* added MintedCrowdsale with RBACMintableToken test
* added a mintable behaviour for tests
* moved minting tests in behaviour
* created a minted crowdsale behaviour to be tested with both mintable and rbacmintable token
2018-05-09 18:01:25 -07:00
ad12381549 update constructor syntax for solidity 0.4.23 in numerous contracts (#921)
* update solidity-coverage to ^0.5.0

* update truffle dependency to ^4.1.8

* update solium to ^1.1.7

* update all contracts to solidity ^0.4.23
2018-05-08 18:02:00 -07:00
20b85be6aa Ownable behavior (#929)
* added function to renounce ownership

* Provide an Ownable behavior for testing (#905)

* Fix indentation

* Convert to use should assertions
2018-05-08 17:33:37 -07:00
4223c9d50e feat: refactor whitelist.sol to use RBAC (#893)
* feat: refactor whitelist.sol to use RBAC

* fix: remove poor backwards compat attempt
2018-05-08 17:20:28 -07:00
f0eea31bdf Fix ERC721Token.sol code indent (#909) 2018-05-07 11:39:54 -07:00
ce0a928a6c Fix typos in ERC721BasicToken comments (#889) 2018-05-07 11:20:12 -07:00
85f079ee89 Removing more asserts in favor of require (#834)
* Removed asserts and replaced them in favor of require

* Adapted tests to work with requires
2018-05-03 14:04:02 -03:00
7e44204d9b added function to renounce ownership (#907) 2018-05-03 13:25:18 -03:00
126 changed files with 3086 additions and 2878 deletions

View File

@ -5,7 +5,8 @@
"quotes": ["error", "double"],
"no-empty-blocks": "off",
"indentation": ["error", 2],
"arg-overflow": ["warning", 3],
"max-len": ["warning", 79],
"no-constant": ["error"],
"security/enforce-explicit-visibility": ["error"],
"security/no-block-members": ["warning"],
"security/no-inline-assembly": ["warning"]

View File

@ -20,13 +20,13 @@ As a contributor, you are expected to fork this repository, work on your own for
```
cd openzeppelin-solidity
git remote add upstream https://github.com/OpenZeppelin/openzeppelin-solidity.git
git fetch upstream
git checkout development
git pull --rebase upstream development
git pull --rebase upstream master
```
NOTE: The directory `openzeppelin-solidity` represents your fork's local copy.
2) Branch out from `development` into `fix/some-bug-#123`:
2) Branch out from `master` into `fix/some-bug-#123`:
(Postfixing #123 will associate your PR with the issue #123 and make everyone's life easier =D)
```
git checkout -b fix/some-bug-#123

View File

@ -13,7 +13,11 @@ With OpenZeppelin, you can build distributed applications, protocols and organiz
## Getting Started
OpenZeppelin integrates with [Truffle](https://github.com/ConsenSys/truffle), an Ethereum development environment. Please install Truffle and initialize your project with `truffle init`.
OpenZeppelin integrates with [Truffle](https://github.com/ConsenSys/truffle) and [Embark](https://github.com/embark-framework/embark/).
## Truffle
To use with Truffle, first install it and initialize your project with `truffle init`.
```sh
npm install -g truffle
@ -21,7 +25,20 @@ mkdir myproject && cd myproject
truffle init
```
To install the OpenZeppelin library, run the following in your Solidity project root directory:
## Embark
To use with Embark, first install it and initialize your project with `embark new MyApp`.
```sh
npm install -g embark
embark new MyApp
cd MyApp
```
## Installing OpenZeppelin
After installing either Framework, to install the OpenZeppelin library, run the following in your Solidity project root directory:
```sh
npm init -y
npm install -E openzeppelin-solidity
@ -39,6 +56,15 @@ contract MyContract is Ownable {
}
```
If you are using Embark, you can also import directly from github:
```solidity
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol#v1.9.0";
contract MyContract is Ownable {
...
}
```
## Security
OpenZeppelin is meant to provide secure, tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions and any security problem you might experience.

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**
@ -21,7 +21,8 @@ library AddressUtils {
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
assembly { size := extcodesize(addr) } // solium-disable-line security/no-inline-assembly
// solium-disable-next-line security/no-inline-assembly
assembly { size := extcodesize(addr) }
return size > 0;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./payment/PullPayment.sol";

View File

@ -1,75 +0,0 @@
pragma solidity ^0.4.21;
/**
* @title DayLimit
* @dev Base contract that enables methods to be protected by placing a linear limit (specifiable)
* on a particular resource per calendar day. Is multiowned to allow the limit to be altered.
*/
contract DayLimit {
uint256 public dailyLimit;
uint256 public spentToday;
uint256 public lastDay;
/**
* @dev Constructor that sets the passed value as a dailyLimit.
* @param _limit uint256 to represent the daily limit.
*/
function DayLimit(uint256 _limit) public {
dailyLimit = _limit;
lastDay = today();
}
/**
* @dev sets the daily limit. Does not alter the amount already spent today.
* @param _newLimit uint256 to represent the new limit.
*/
function _setDailyLimit(uint256 _newLimit) internal {
dailyLimit = _newLimit;
}
/**
* @dev Resets the amount already spent today.
*/
function _resetSpentToday() internal {
spentToday = 0;
}
/**
* @dev Checks to see if there is enough resource to spend today. If true, the resource may be expended.
* @param _value uint256 representing the amount of resource to spend.
* @return A boolean that is True if the resource was spent and false otherwise.
*/
function underLimit(uint256 _value) internal returns (bool) {
// reset the spend limit if we're on a different day to last time.
if (today() > lastDay) {
spentToday = 0;
lastDay = today();
}
// check to see if there's enough left - if so, subtract and return true.
// overflow protection // dailyLimit check
if (spentToday + _value >= spentToday && spentToday + _value <= dailyLimit) {
spentToday += _value;
return true;
}
return false;
}
/**
* @dev Private function to determine today's index
* @return uint256 of today's index.
*/
function today() private view returns (uint256) {
// solium-disable-next-line security/no-block-members
return block.timestamp / 1 days;
}
/**
* @dev Simple modifier for daily limit.
*/
modifier limitedDaily(uint256 _value) {
require(underLimit(_value));
_;
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**
@ -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) public {
constructor(uint256 _limit) public {
limit = _limit;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/*
@ -14,7 +14,15 @@ library MerkleProof {
* @param _root Merkle root
* @param _leaf Leaf of Merkle tree
*/
function verifyProof(bytes32[] _proof, bytes32 _root, bytes32 _leaf) internal pure returns (bool) {
function verifyProof(
bytes32[] _proof,
bytes32 _root,
bytes32 _leaf
)
internal
pure
returns (bool)
{
bytes32 computedHash = _leaf;
for (uint256 i = 0; i < _proof.length; i++) {

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.23;
import "../ownership/Ownable.sol";
import "../ownership/rbac/RBAC.sol";
import "../ECRecovery.sol";
/**
* @title SignatureBouncer
* @author PhABC and Shrugs

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/ERC20.sol";
import "../math/SafeMath.sol";
@ -25,7 +25,10 @@ contract Crowdsale {
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest and indivisible token unit.
// So, if you are using a rate of 1 with a DetailedERC20 token with 3 decimals called TOK
// 1 wei will give you 1 unit, or 0.001 TOK.
uint256 public rate;
// Amount of wei raised
@ -38,14 +41,19 @@ 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);
event TokenPurchase(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount
);
/**
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
*/
function Crowdsale(uint256 _rate, address _wallet, ERC20 _token) public {
constructor(uint256 _rate, address _wallet, ERC20 _token) public {
require(_rate > 0);
require(_wallet != address(0));
require(_token != address(0));
@ -104,7 +112,12 @@ contract Crowdsale {
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
@ -114,7 +127,12 @@ contract Crowdsale {
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
function _postValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
@ -123,7 +141,12 @@ contract Crowdsale {
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
token.transfer(_beneficiary, _tokenAmount);
}
@ -132,7 +155,12 @@ contract Crowdsale {
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
function _processPurchase(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
_deliverTokens(_beneficiary, _tokenAmount);
}
@ -141,7 +169,12 @@ contract Crowdsale {
* @param _beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
@ -150,7 +183,9 @@ contract Crowdsale {
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
function _getTokenAmount(uint256 _weiAmount)
internal view returns (uint256)
{
return _weiAmount.mul(rate);
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../../math/SafeMath.sol";
import "../../ownership/Ownable.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../validation/TimedCrowdsale.sol";
import "../../token/ERC20/ERC20.sol";
@ -30,7 +30,12 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
function _processPurchase(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../../math/SafeMath.sol";
@ -25,7 +25,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
* @dev Constructor, creates RefundVault.
* @param _goal Funding goal
*/
function RefundableCrowdsale(uint256 _goal) public {
constructor(uint256 _goal) public {
require(_goal > 0);
vault = new RefundVault(wallet);
goal = _goal;

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../../../math/SafeMath.sol";
import "../../../ownership/Ownable.sol";
@ -26,7 +26,7 @@ contract RefundVault is Ownable {
/**
* @param _wallet Vault address
*/
function RefundVault(address _wallet) public {
constructor(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
state = State.Active;

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../Crowdsale.sol";
import "../../token/ERC20/ERC20.sol";
@ -15,10 +15,10 @@ contract AllowanceCrowdsale is Crowdsale {
address public tokenWallet;
/**
* @dev Constructor, takes token wallet address.
* @dev Constructor, takes token wallet address.
* @param _tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
function AllowanceCrowdsale(address _tokenWallet) public {
constructor(address _tokenWallet) public {
require(_tokenWallet != address(0));
tokenWallet = _tokenWallet;
}
@ -36,7 +36,12 @@ contract AllowanceCrowdsale is Crowdsale {
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
token.transferFrom(tokenWallet, _beneficiary, _tokenAmount);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../Crowdsale.sol";
import "../../token/ERC20/MintableToken.sol";
@ -7,7 +7,7 @@ import "../../token/ERC20/MintableToken.sol";
/**
* @title MintedCrowdsale
* @dev Extension of Crowdsale contract whose tokens are minted in each purchase.
* Token ownership should be transferred to MintedCrowdsale for minting.
* Token ownership should be transferred to MintedCrowdsale for minting.
*/
contract MintedCrowdsale is Crowdsale {
@ -16,7 +16,12 @@ contract MintedCrowdsale is Crowdsale {
* @param _beneficiary Token purchaser
* @param _tokenAmount Number of tokens to be minted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
require(MintableToken(token).mint(_beneficiary, _tokenAmount));
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../validation/TimedCrowdsale.sol";
import "../../math/SafeMath.sol";
@ -21,7 +21,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* @param _initialRate Number of tokens a buyer gets per wei at the start of the crowdsale
* @param _finalRate Number of tokens a buyer gets per wei at the end of the crowdsale
*/
function IncreasingPriceCrowdsale(uint256 _initialRate, uint256 _finalRate) public {
constructor(uint256 _initialRate, uint256 _finalRate) public {
require(_initialRate >= _finalRate);
require(_finalRate > 0);
initialRate = _initialRate;
@ -46,7 +46,9 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* @param _weiAmount The value in wei to be converted into tokens
* @return The number of tokens _weiAmount wei will buy at present time
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
function _getTokenAmount(uint256 _weiAmount)
internal view returns (uint256)
{
uint256 currentRate = getCurrentRate();
return currentRate.mul(_weiAmount);
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
@ -17,13 +17,13 @@ contract CappedCrowdsale is Crowdsale {
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
* @param _cap Max amount of wei to be contributed
*/
function CappedCrowdsale(uint256 _cap) public {
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Checks whether the cap has been reached.
* @dev Checks whether the cap has been reached.
* @return Whether the cap was reached
*/
function capReached() public view returns (bool) {
@ -35,7 +35,12 @@ contract CappedCrowdsale is Crowdsale {
* @param _beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
super._preValidatePurchase(_beneficiary, _weiAmount);
require(weiRaised.add(_weiAmount) <= cap);
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
@ -29,7 +29,13 @@ contract IndividuallyCappedCrowdsale is Crowdsale, Ownable {
* @param _beneficiaries List of addresses to be capped
* @param _cap Wei limit for individual contribution
*/
function setGroupCap(address[] _beneficiaries, uint256 _cap) external onlyOwner {
function setGroupCap(
address[] _beneficiaries,
uint256 _cap
)
external
onlyOwner
{
for (uint256 i = 0; i < _beneficiaries.length; i++) {
caps[_beneficiaries[i]] = _cap;
}
@ -49,7 +55,9 @@ contract IndividuallyCappedCrowdsale is Crowdsale, Ownable {
* @param _beneficiary Address of contributor
* @return User contribution so far
*/
function getUserContribution(address _beneficiary) public view returns (uint256) {
function getUserContribution(address _beneficiary)
public view returns (uint256)
{
return contributions[_beneficiary];
}
@ -58,7 +66,12 @@ contract IndividuallyCappedCrowdsale is Crowdsale, Ownable {
* @param _beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
super._preValidatePurchase(_beneficiary, _weiAmount);
require(contributions[_beneficiary].add(_weiAmount) <= caps[_beneficiary]);
}
@ -68,7 +81,12 @@ contract IndividuallyCappedCrowdsale is Crowdsale, Ownable {
* @param _beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed
*/
function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
{
super._updatePurchasingState(_beneficiary, _weiAmount);
contributions[_beneficiary] = contributions[_beneficiary].add(_weiAmount);
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
@ -28,7 +28,7 @@ contract TimedCrowdsale is Crowdsale {
* @param _openingTime Crowdsale opening time
* @param _closingTime Crowdsale closing time
*/
function TimedCrowdsale(uint256 _openingTime, uint256 _closingTime) public {
constructor(uint256 _openingTime, uint256 _closingTime) public {
// solium-disable-next-line security/no-block-members
require(_openingTime >= block.timestamp);
require(_closingTime >= _openingTime);
@ -51,7 +51,13 @@ contract TimedCrowdsale is Crowdsale {
* @param _beneficiary Token purchaser
* @param _weiAmount Amount of wei contributed
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal onlyWhileOpen {
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
onlyWhileOpen
{
super._preValidatePurchase(_beneficiary, _weiAmount);
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../Crowdsale.sol";
import "../../ownership/Ownable.sol";
@ -51,7 +51,13 @@ contract WhitelistedCrowdsale is Crowdsale, Ownable {
* @param _beneficiary Token beneficiary
* @param _weiAmount Amount of wei contributed
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal isWhitelisted(_beneficiary) {
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
isWhitelisted(_beneficiary)
{
super._preValidatePurchase(_beneficiary, _weiAmount);
}

View File

@ -1,6 +1,6 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./RBAC.sol";
import "../ownership/rbac/RBAC.sol";
/**
@ -8,6 +8,13 @@ import "./RBAC.sol";
* @author Matt Condon (@Shrugs)
* @dev It's recommended that you define constants in the contract,
* @dev like ROLE_ADMIN below, to avoid typos.
* @dev
* @dev NOTE: RBACWithAdmin is probably too expansive and powerful for your
* @dev application; an admin is actually able to change any address to any role
* @dev which is a very large API surface. It's recommended that you follow a strategy
* @dev of strictly defining the abilities of your roles
* @dev and the API-surface of your contract.
* @dev This is just an example for example's sake.
*/
contract RBACWithAdmin is RBAC {
/**
@ -28,7 +35,7 @@ contract RBACWithAdmin is RBAC {
/**
* @dev constructor. Sets msg.sender as admin by default
*/
function RBACWithAdmin()
constructor()
public
{
addRole(msg.sender, ROLE_ADMIN);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../crowdsale/validation/CappedCrowdsale.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
@ -13,7 +13,8 @@ import "../token/ERC20/MintableToken.sol";
*/
contract SampleCrowdsaleToken is MintableToken {
string public constant name = "Sample Crowdsale Token"; // solium-disable-line uppercase
// solium-disable-next-line uppercase
string public constant name = "Sample Crowdsale Token";
string public constant symbol = "SCT"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
@ -31,9 +32,14 @@ contract SampleCrowdsaleToken is MintableToken {
* After adding multiple features it's good practice to run integration tests
* to ensure that subcontracts works together as intended.
*/
// XXX There doesn't seem to be a way to split this line that keeps solium
// happy. See:
// https://github.com/duaraghav8/Solium/issues/205
// --elopio - 2018-05-10
// solium-disable-next-line max-len
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
function SampleCrowdsale(
constructor(
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../ownership/Heritable.sol";
@ -19,7 +19,7 @@ contract SimpleSavingsWallet is Heritable {
event Received(address indexed payer, uint256 amount, uint256 balance);
function SimpleSavingsWallet(uint256 _heartbeatTimeout) Heritable(_heartbeatTimeout) public {}
constructor(uint256 _heartbeatTimeout) Heritable(_heartbeatTimeout) public {}
/**
* @dev wallet can receive funds.

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/StandardToken.sol";
@ -21,7 +21,7 @@ contract SimpleToken is StandardToken {
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function SimpleToken() public {
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../ownership/Ownable.sol";
@ -10,7 +10,7 @@ import "../ownership/Ownable.sol";
*/
contract Destructible is Ownable {
function Destructible() public payable { }
constructor() public payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../ownership/Ownable.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../ownership/Ownable.sol";
import "../token/ERC20/ERC20Basic.sol";
@ -12,7 +12,7 @@ import "../token/ERC20/ERC20Basic.sol";
*/
contract TokenDestructible is Ownable {
function TokenDestructible() public payable { }
constructor() public payable { }
/**
* @notice Terminate contract and refund to owner

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**
@ -11,9 +11,13 @@ library SafeMath {
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/emission/AllowanceCrowdsale.sol";
@ -6,12 +6,12 @@ import "../crowdsale/emission/AllowanceCrowdsale.sol";
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
function AllowanceCrowdsaleImpl (
constructor (
uint256 _rate,
address _wallet,
ERC20 _token,
address _tokenWallet
)
)
public
Crowdsale(_rate, _wallet, _token)
AllowanceCrowdsale(_tokenWallet)

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/BasicToken.sol";
@ -7,7 +7,7 @@ import "../token/ERC20/BasicToken.sol";
// mock class using BasicToken
contract BasicTokenMock is BasicToken {
function BasicTokenMock(address initialAccount, uint256 initialBalance) public {
constructor(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.23;
import "../access/SignatureBouncer.sol";

View File

@ -1,11 +1,11 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/BurnableToken.sol";
contract BurnableTokenMock is BurnableToken {
function BurnableTokenMock(address initialAccount, uint initialBalance) public {
constructor(address initialAccount, uint initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/CappedCrowdsale.sol";
@ -6,12 +6,12 @@ import "../crowdsale/validation/CappedCrowdsale.sol";
contract CappedCrowdsaleImpl is CappedCrowdsale {
function CappedCrowdsaleImpl (
constructor (
uint256 _rate,
address _wallet,
ERC20 _token,
uint256 _cap
)
)
public
Crowdsale(_rate, _wallet, _token)
CappedCrowdsale(_cap)

View File

@ -1,25 +0,0 @@
pragma solidity ^0.4.21;
import "../../contracts/DayLimit.sol";
contract DayLimitMock is DayLimit {
uint256 public totalSpending;
function DayLimitMock(uint256 _value) public DayLimit(_value) {
totalSpending = 0;
}
function attemptSpend(uint256 _value) external limitedDaily(_value) {
totalSpending += _value;
}
function setDailyLimit(uint256 _newLimit) external {
_setDailyLimit(_newLimit);
}
function resetSpentToday() external {
_resetSpentToday();
}
}

View File

@ -1,9 +1,16 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/StandardToken.sol";
import "../token/ERC20/DetailedERC20.sol";
contract DetailedERC20Mock is StandardToken, DetailedERC20 {
function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) public {}
constructor(
string _name,
string _symbol,
uint8 _decimals
)
DetailedERC20(_name, _symbol, _decimals)
public
{}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../ECRecovery.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/BasicToken.sol";
@ -10,7 +10,7 @@ contract ERC223ContractInterface {
contract ERC223TokenMock is BasicToken {
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
constructor(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC721/ERC721BasicToken.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC721/ERC721Receiver.sol";
@ -7,9 +7,14 @@ contract ERC721ReceiverMock is ERC721Receiver {
bytes4 retval;
bool reverts;
event Received(address _address, uint256 _tokenId, bytes _data, uint256 _gas);
event Received(
address _address,
uint256 _tokenId,
bytes _data,
uint256 _gas
);
function ERC721ReceiverMock(bytes4 _retval, bool _reverts) public {
constructor(bytes4 _retval, bool _reverts) public {
retval = _retval;
reverts = _reverts;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC721/ERC721Token.sol";
@ -9,7 +9,7 @@ import "../token/ERC721/ERC721Token.sol";
* and a public setter for metadata URI
*/
contract ERC721TokenMock is ERC721Token {
function ERC721TokenMock(string name, string symbol) public
constructor(string name, string symbol) public
ERC721Token(name, symbol)
{ }

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC827/ERC827Token.sol";
@ -7,7 +7,7 @@ import "../token/ERC827/ERC827Token.sol";
// mock class using ERC827 Token
contract ERC827TokenMock is ERC827Token {
function ERC827TokenMock(address initialAccount, uint256 initialBalance) public {
constructor(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/MintableToken.sol";
import "../crowdsale/distribution/FinalizableCrowdsale.sol";
@ -6,13 +6,13 @@ import "../crowdsale/distribution/FinalizableCrowdsale.sol";
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
function FinalizableCrowdsaleImpl (
constructor (
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
address _wallet,
MintableToken _token
)
)
public
Crowdsale(_rate, _wallet, _token)
TimedCrowdsale(_openingTime, _closingTime)

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
// @title Force Ether into a contract.
@ -8,7 +8,7 @@ pragma solidity ^0.4.21;
// @author Remco Bloemen <remco@neufund.org>
contract ForceEther {
function ForceEther() public payable { }
constructor() public payable { }
function destroyAndSend(address _recipient) public {
selfdestruct(_recipient);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../../contracts/ownership/HasNoEther.sol";
@ -6,7 +6,7 @@ import "../../contracts/ownership/HasNoEther.sol";
contract HasNoEtherTest is HasNoEther {
// Constructor with explicit payable — should still fail
function HasNoEtherTest() public payable {
constructor() public payable {
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
import "../math/SafeMath.sol";
@ -6,14 +6,14 @@ import "../math/SafeMath.sol";
contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
function IncreasingPriceCrowdsaleImpl (
constructor (
uint256 _openingTime,
uint256 _closingTime,
address _wallet,
ERC20 _token,
uint256 _initialRate,
uint256 _finalRate
)
)
public
Crowdsale(_initialRate, _wallet, _token)
TimedCrowdsale(_openingTime, _closingTime)

View File

@ -1,16 +1,16 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
contract IndividuallyCappedCrowdsaleImpl is IndividuallyCappedCrowdsale {
function IndividuallyCappedCrowdsaleImpl (
constructor (
uint256 _rate,
address _wallet,
ERC20 _token
)
)
public
Crowdsale(_rate, _wallet, _token)
{

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import {Bounty, Target} from "../../contracts/Bounty.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../LimitBalance.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../../contracts/math/Math.sol";

View File

@ -1,11 +1,19 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import { MerkleProof } from "../MerkleProof.sol";
contract MerkleProofWrapper {
function verifyProof(bytes32[] _proof, bytes32 _root, bytes32 _leaf) public pure returns (bool) {
function verifyProof(
bytes32[] _proof,
bytes32 _root,
bytes32 _leaf
)
public
pure
returns (bool)
{
return MerkleProof.verifyProof(_proof, _root, _leaf);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
contract MessageHelper {
@ -6,12 +6,27 @@ contract MessageHelper {
event Show(bytes32 b32, uint256 number, string text);
event Buy(bytes32 b32, uint256 number, string text, uint256 value);
function showMessage( bytes32 message, uint256 number, string text ) public returns (bool) {
function showMessage(
bytes32 message,
uint256 number,
string text
)
public
returns (bool)
{
emit Show(message, number, text);
return true;
}
function buyMessage( bytes32 message, uint256 number, string text ) public payable returns (bool) {
function buyMessage(
bytes32 message,
uint256 number,
string text
)
public
payable
returns (bool)
{
emit Buy(
message,
number,

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/MintableToken.sol";
import "../crowdsale/emission/MintedCrowdsale.sol";
@ -6,11 +6,11 @@ import "../crowdsale/emission/MintedCrowdsale.sol";
contract MintedCrowdsaleImpl is MintedCrowdsale {
function MintedCrowdsaleImpl (
constructor (
uint256 _rate,
address _wallet,
MintableToken _token
)
)
public
Crowdsale(_rate, _wallet, _token)
{

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../lifecycle/Pausable.sol";
@ -9,7 +9,7 @@ contract PausableMock is Pausable {
bool public drasticMeasureTaken;
uint256 public count;
function PausableMock() public {
constructor() public {
drasticMeasureTaken = false;
count = 0;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/PausableToken.sol";
@ -6,7 +6,7 @@ import "../token/ERC20/PausableToken.sol";
// mock class using PausableToken
contract PausableTokenMock is PausableToken {
function PausableTokenMock(address initialAccount, uint initialBalance) public {
constructor(address initialAccount, uint initialBalance) public {
balances[initialAccount] = initialBalance;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
@ -6,13 +6,13 @@ import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
function PostDeliveryCrowdsaleImpl (
constructor (
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
address _wallet,
ERC20 _token
)
)
public
TimedCrowdsale(_openingTime, _closingTime)
Crowdsale(_rate, _wallet, _token)

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../payment/PullPayment.sol";
@ -7,7 +7,7 @@ import "../payment/PullPayment.sol";
// mock class using PullPayment
contract PullPaymentMock is PullPayment {
function PullPaymentMock() public payable { }
constructor() public payable { }
// test helper function to call asyncSend
function callSend(address dest, uint256 amount) public {

View File

@ -1,6 +1,6 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../ownership/rbac/RBACWithAdmin.sol";
import "../examples/RBACWithAdmin.sol";
contract RBACMock is RBACWithAdmin {
@ -16,7 +16,7 @@ contract RBACMock is RBACWithAdmin {
_;
}
function RBACMock(address[] _advisors)
constructor(address[] _advisors)
public
{
addRole(msg.sender, ROLE_ADVISOR);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
contract ReentrancyAttack {

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../ReentrancyGuard.sol";
import "./ReentrancyAttack.sol";
@ -8,7 +8,7 @@ contract ReentrancyMock is ReentrancyGuard {
uint256 public counter;
function ReentrancyMock() public {
constructor() public {
counter = 0;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/MintableToken.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
@ -6,7 +6,7 @@ import "../crowdsale/distribution/RefundableCrowdsale.sol";
contract RefundableCrowdsaleImpl is RefundableCrowdsale {
function RefundableCrowdsaleImpl (
constructor (
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/SafeERC20.sol";
@ -21,11 +21,11 @@ contract ERC20FailingMock is ERC20 {
return false;
}
function balanceOf(address) public constant returns (uint256) {
function balanceOf(address) public view returns (uint256) {
return 0;
}
function allowance(address, address) public constant returns (uint256) {
function allowance(address, address) public view returns (uint256) {
return 0;
}
}
@ -35,7 +35,7 @@ contract ERC20SucceedingMock is ERC20 {
function totalSupply() public view returns (uint256) {
return 0;
}
function transfer(address, uint256) public returns (bool) {
return true;
}
@ -48,11 +48,11 @@ contract ERC20SucceedingMock is ERC20 {
return true;
}
function balanceOf(address) public constant returns (uint256) {
function balanceOf(address) public view returns (uint256) {
return 0;
}
function allowance(address, address) public constant returns (uint256) {
function allowance(address, address) public view returns (uint256) {
return 0;
}
}
@ -64,7 +64,7 @@ contract SafeERC20Helper {
ERC20 failing;
ERC20 succeeding;
function SafeERC20Helper() public {
constructor() public {
failing = new ERC20FailingMock();
succeeding = new ERC20SucceedingMock();
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../math/SafeMath.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import {Bounty, Target} from "../../contracts/Bounty.sol";

View File

@ -1,11 +1,11 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.23;
import "../token/ERC20/StandardBurnableToken.sol";
contract StandardBurnableTokenMock is StandardBurnableToken {
function StandardBurnableTokenMock(address initialAccount, uint initialBalance) public {
constructor(address initialAccount, uint initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/StandardToken.sol";
@ -6,7 +6,7 @@ import "../token/ERC20/StandardToken.sol";
// mock class using StandardToken
contract StandardTokenMock is StandardToken {
function StandardTokenMock(address initialAccount, uint256 initialBalance) public {
constructor(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/TimedCrowdsale.sol";
@ -6,7 +6,7 @@ import "../crowdsale/validation/TimedCrowdsale.sol";
contract TimedCrowdsaleImpl is TimedCrowdsale {
function TimedCrowdsaleImpl (
constructor (
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../ownership/Whitelist.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/WhitelistedCrowdsale.sol";
@ -6,11 +6,11 @@ import "../crowdsale/validation/WhitelistedCrowdsale.sol";
contract WhitelistedCrowdsaleImpl is WhitelistedCrowdsale {
function WhitelistedCrowdsaleImpl (
constructor (
uint256 _rate,
address _wallet,
ERC20 _token
)
)
public
Crowdsale(_rate, _wallet, _token)
{

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Ownable.sol";
import "../token/ERC20/ERC20Basic.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Ownable.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Ownable.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Claimable.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Ownable.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Ownable.sol";
@ -22,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() public payable {
constructor() public payable {
require(msg.value == 0);
}
@ -36,7 +36,6 @@ contract HasNoEther is Ownable {
* @dev Transfer all Ether held by the contract to the owner.
*/
function reclaimEther() external onlyOwner {
// solium-disable-next-line security/no-send
assert(owner.send(address(this).balance));
owner.transfer(address(this).balance);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./CanReclaimToken.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Ownable.sol";
@ -21,8 +21,15 @@ contract Heritable is Ownable {
event HeirChanged(address indexed owner, address indexed newHeir);
event OwnerHeartbeated(address indexed owner);
event OwnerProclaimedDead(address indexed owner, address indexed heir, uint256 timeOfDeath);
event HeirOwnershipClaimed(address indexed previousOwner, address indexed newOwner);
event OwnerProclaimedDead(
address indexed owner,
address indexed heir,
uint256 timeOfDeath
);
event HeirOwnershipClaimed(
address indexed previousOwner,
address indexed newOwner
);
/**
@ -39,7 +46,7 @@ contract Heritable is Ownable {
* @param _heartbeatTimeout time available for the owner to notify they are alive,
* before the heir can take ownership.
*/
function Heritable(uint256 _heartbeatTimeout) public {
constructor(uint256 _heartbeatTimeout) public {
setHeartbeatTimeout(_heartbeatTimeout);
}
@ -106,7 +113,9 @@ contract Heritable is Ownable {
timeOfDeath_ = 0;
}
function setHeartbeatTimeout(uint256 newHeartbeatTimeout) internal onlyOwner {
function setHeartbeatTimeout(uint256 newHeartbeatTimeout)
internal onlyOwner
{
require(ownerLives());
heartbeatTimeout_ = newHeartbeatTimeout;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./HasNoEther.sol";
import "./HasNoTokens.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**
@ -10,14 +10,18 @@ contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
constructor() public {
owner = msg.sender;
}
@ -30,13 +34,28 @@ contract Ownable {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
* @dev Allows the current owner to relinquish control of the contract.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @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) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}

View File

@ -0,0 +1,62 @@
pragma solidity ^0.4.23;
import "./Ownable.sol";
import "./rbac/RBAC.sol";
/**
* @title Superuser
* @dev The Superuser contract defines a single superuser who can transfer the ownership
* @dev of a contract to a new address, even if he is not the owner.
* @dev A superuser can transfer his role to a new address.
*/
contract Superuser is Ownable, RBAC {
string public constant ROLE_SUPERUSER = "superuser";
constructor () public {
addRole(msg.sender, ROLE_SUPERUSER);
}
/**
* @dev Throws if called by any account that's not a superuser.
*/
modifier onlySuperuser() {
checkRole(msg.sender, ROLE_SUPERUSER);
_;
}
modifier onlyOwnerOrSuperuser() {
require(msg.sender == owner || isSuperuser(msg.sender));
_;
}
/**
* @dev getter to determine if address has superuser role
*/
function isSuperuser(address _addr)
public
view
returns (bool)
{
return hasRole(_addr, ROLE_SUPERUSER);
}
/**
* @dev Allows the current superuser to transfer his role to a newSuperuser.
* @param _newSuperuser The address to transfer ownership to.
*/
function transferSuperuser(address _newSuperuser) public onlySuperuser {
require(_newSuperuser != address(0));
removeRole(msg.sender, ROLE_SUPERUSER);
addRole(_newSuperuser, ROLE_SUPERUSER);
}
/**
* @dev Allows the current superuser or owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwnerOrSuperuser {
_transferOwnership(_newOwner);
}
}

View File

@ -1,7 +1,8 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Ownable.sol";
import "./rbac/RBAC.sol";
/**
@ -9,17 +10,17 @@ import "./Ownable.sol";
* @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
* @dev This simplifies the implementation of "user permissions".
*/
contract Whitelist is Ownable {
mapping(address => bool) public whitelist;
contract Whitelist is Ownable, RBAC {
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
string public constant ROLE_WHITELISTED = "whitelist";
/**
* @dev Throws if called by any account that's not whitelisted.
*/
modifier onlyWhitelisted() {
require(whitelist[msg.sender]);
checkRole(msg.sender, ROLE_WHITELISTED);
_;
}
@ -28,12 +29,23 @@ contract Whitelist is Ownable {
* @param addr address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) {
if (!whitelist[addr]) {
whitelist[addr] = true;
emit WhitelistedAddressAdded(addr);
success = true;
}
function addAddressToWhitelist(address addr)
onlyOwner
public
{
addRole(addr, ROLE_WHITELISTED);
emit WhitelistedAddressAdded(addr);
}
/**
* @dev getter to determine if address is in whitelist
*/
function whitelist(address addr)
public
view
returns (bool)
{
return hasRole(addr, ROLE_WHITELISTED);
}
/**
@ -42,11 +54,12 @@ contract Whitelist is Ownable {
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) {
function addAddressesToWhitelist(address[] addrs)
onlyOwner
public
{
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToWhitelist(addrs[i])) {
success = true;
}
addAddressToWhitelist(addrs[i]);
}
}
@ -56,12 +69,12 @@ contract Whitelist is Ownable {
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
emit WhitelistedAddressRemoved(addr);
success = true;
}
function removeAddressFromWhitelist(address addr)
onlyOwner
public
{
removeRole(addr, ROLE_WHITELISTED);
emit WhitelistedAddressRemoved(addr);
}
/**
@ -70,11 +83,12 @@ contract Whitelist is Ownable {
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {
function removeAddressesFromWhitelist(address[] addrs)
onlyOwner
public
{
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
removeAddressFromWhitelist(addrs[i]);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./Roles.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../math/SafeMath.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "../math/SafeMath.sol";
@ -21,7 +21,7 @@ contract SplitPayment {
/**
* @dev Constructor
*/
function SplitPayment(address[] _payees, uint256[] _shares) public payable {
constructor(address[] _payees, uint256[] _shares) public payable {
require(_payees.length == _shares.length);
for (uint256 i = 0; i < _payees.length; i++) {
@ -43,7 +43,11 @@ contract SplitPayment {
require(shares[payee] > 0);
uint256 totalReceived = address(this).balance.add(totalReleased);
uint256 payment = totalReceived.mul(shares[payee]).div(totalShares).sub(released[payee]);
uint256 payment = totalReceived.mul(
shares[payee]).div(
totalShares).sub(
released[payee]
);
require(payment != 0);
require(address(this).balance >= payment);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./ERC20Basic.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./BasicToken.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./MintableToken.sol";
@ -11,7 +11,7 @@ contract CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
@ -22,7 +22,15 @@ contract CappedToken is MintableToken {
* @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 public returns (bool) {
function mint(
address _to,
uint256 _amount
)
onlyOwner
canMint
public
returns (bool)
{
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);

View File

@ -1,14 +1,20 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./ERC20.sol";
/**
* @title DetailedERC20 token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./ERC20Basic.sol";
@ -8,8 +8,16 @@ import "./ERC20Basic.sol";
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function allowance(address owner, address spender)
public view 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);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
/**

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./StandardToken.sol";
import "../../ownership/Ownable.sol";
@ -22,13 +22,26 @@ contract MintableToken is StandardToken, Ownable {
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @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 public returns (bool) {
function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./StandardToken.sol";
import "../../lifecycle/Pausable.sol";
@ -10,23 +10,59 @@ import "../../lifecycle/Pausable.sol";
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}

View File

@ -0,0 +1,41 @@
pragma solidity ^0.4.23;
import "./MintableToken.sol";
import "../../ownership/rbac/RBAC.sol";
/**
* @title RBACMintableToken
* @author Vittorio Minacori (@vittominacori)
* @dev Mintable Token, with RBAC minter permissions
*/
contract RBACMintableToken is MintableToken, RBAC {
/**
* A constant role name for indicating minters.
*/
string public constant ROLE_MINTER = "minter";
/**
* @dev override the Mintable token modifier to add role based logic
*/
modifier hasMintPermission() {
checkRole(msg.sender, ROLE_MINTER);
_;
}
/**
* @dev add a minter role to an address
* @param minter address
*/
function addMinter(address minter) onlyOwner public {
addRole(minter, ROLE_MINTER);
}
/**
* @dev remove a minter role from an address
* @param minter address
*/
function removeMinter(address minter) onlyOwner public {
removeRole(minter, ROLE_MINTER);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./ERC20Basic.sol";
import "./ERC20.sol";
@ -12,7 +12,7 @@ import "./ERC20.sol";
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
require(token.transfer(to, value));
}
function safeTransferFrom(
@ -23,10 +23,10 @@ library SafeERC20 {
)
internal
{
assert(token.transferFrom(from, to, value));
require(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
require(token.approve(spender, value));
}
}

View File

@ -1,8 +1,9 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.23;
import "./BurnableToken.sol";
import "./StandardToken.sol";
/**
* @title Standard Burnable Token
* @dev Adds burnFrom method to ERC20 implementations

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;
import "./BasicToken.sol";
import "./ERC20.sol";
@ -22,7 +22,14 @@ 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) public returns (bool) {
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
@ -56,7 +63,14 @@ 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) public view returns (uint256) {
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
@ -70,8 +84,15 @@ contract StandardToken is ERC20, BasicToken {
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
@ -86,7 +107,13 @@ contract StandardToken is ERC20, BasicToken {
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;

Some files were not shown because too many files have changed in this diff Show More