Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| feb665136c | |||
| 7fb84b42d5 | |||
| 5db0d7d1a0 | |||
| 512e8218ca | |||
| 9d6ffae8cb | |||
| 2a997a8e92 | |||
| 5651538045 | |||
| 10e84aecaf | |||
| 2637bd89be | |||
| 32ec8b5398 | |||
| a0c03ee61c | |||
| e3f866c982 | |||
| 5ab9024b6a | |||
| d5f06ab32f | |||
| 746673a94f | |||
| ba4cf03da7 | |||
| 39370ff690 | |||
| ad12381549 | |||
| 20b85be6aa | |||
| 4223c9d50e | |||
| f0eea31bdf | |||
| ce0a928a6c | |||
| 85f079ee89 | |||
| 7e44204d9b |
@ -5,7 +5,8 @@
|
|||||||
"quotes": ["error", "double"],
|
"quotes": ["error", "double"],
|
||||||
"no-empty-blocks": "off",
|
"no-empty-blocks": "off",
|
||||||
"indentation": ["error", 2],
|
"indentation": ["error", 2],
|
||||||
"arg-overflow": ["warning", 3],
|
"max-len": ["warning", 79],
|
||||||
|
"no-constant": ["error"],
|
||||||
"security/enforce-explicit-visibility": ["error"],
|
"security/enforce-explicit-visibility": ["error"],
|
||||||
"security/no-block-members": ["warning"],
|
"security/no-block-members": ["warning"],
|
||||||
"security/no-inline-assembly": ["warning"]
|
"security/no-inline-assembly": ["warning"]
|
||||||
|
|||||||
@ -20,13 +20,13 @@ As a contributor, you are expected to fork this repository, work on your own for
|
|||||||
|
|
||||||
```
|
```
|
||||||
cd openzeppelin-solidity
|
cd openzeppelin-solidity
|
||||||
|
git remote add upstream https://github.com/OpenZeppelin/openzeppelin-solidity.git
|
||||||
git fetch upstream
|
git fetch upstream
|
||||||
git checkout development
|
git pull --rebase upstream master
|
||||||
git pull --rebase upstream development
|
|
||||||
```
|
```
|
||||||
NOTE: The directory `openzeppelin-solidity` represents your fork's local copy.
|
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)
|
(Postfixing #123 will associate your PR with the issue #123 and make everyone's life easier =D)
|
||||||
```
|
```
|
||||||
git checkout -b fix/some-bug-#123
|
git checkout -b fix/some-bug-#123
|
||||||
|
|||||||
30
README.md
30
README.md
@ -13,7 +13,11 @@ With OpenZeppelin, you can build distributed applications, protocols and organiz
|
|||||||
|
|
||||||
## Getting Started
|
## 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
|
```sh
|
||||||
npm install -g truffle
|
npm install -g truffle
|
||||||
@ -21,7 +25,20 @@ mkdir myproject && cd myproject
|
|||||||
truffle init
|
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
|
```sh
|
||||||
npm init -y
|
npm init -y
|
||||||
npm install -E openzeppelin-solidity
|
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
|
## 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.
|
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.
|
||||||
|
|||||||
@ -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.
|
// for more details about how this works.
|
||||||
// TODO Check this again before the Serenity release, because all addresses will be
|
// TODO Check this again before the Serenity release, because all addresses will be
|
||||||
// contracts then.
|
// 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;
|
return size > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "./payment/PullPayment.sol";
|
import "./payment/PullPayment.sol";
|
||||||
|
|||||||
@ -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));
|
|
||||||
_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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.
|
* @dev Constructor that sets the passed value as a limit.
|
||||||
* @param _limit uint256 to represent the limit.
|
* @param _limit uint256 to represent the limit.
|
||||||
*/
|
*/
|
||||||
function LimitBalance(uint256 _limit) public {
|
constructor(uint256 _limit) public {
|
||||||
limit = _limit;
|
limit = _limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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 _root Merkle root
|
||||||
* @param _leaf Leaf of Merkle tree
|
* @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;
|
bytes32 computedHash = _leaf;
|
||||||
|
|
||||||
for (uint256 i = 0; i < _proof.length; i++) {
|
for (uint256 i = 0; i < _proof.length; i++) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
pragma solidity ^0.4.18;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../ownership/Ownable.sol";
|
import "../ownership/Ownable.sol";
|
||||||
import "../ownership/rbac/RBAC.sol";
|
import "../ownership/rbac/RBAC.sol";
|
||||||
import "../ECRecovery.sol";
|
import "../ECRecovery.sol";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title SignatureBouncer
|
* @title SignatureBouncer
|
||||||
* @author PhABC and Shrugs
|
* @author PhABC and Shrugs
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/ERC20.sol";
|
import "../token/ERC20/ERC20.sol";
|
||||||
import "../math/SafeMath.sol";
|
import "../math/SafeMath.sol";
|
||||||
@ -25,7 +25,10 @@ contract Crowdsale {
|
|||||||
// Address where funds are collected
|
// Address where funds are collected
|
||||||
address public wallet;
|
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;
|
uint256 public rate;
|
||||||
|
|
||||||
// Amount of wei raised
|
// Amount of wei raised
|
||||||
@ -38,14 +41,19 @@ contract Crowdsale {
|
|||||||
* @param value weis paid for purchase
|
* @param value weis paid for purchase
|
||||||
* @param amount amount of tokens purchased
|
* @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 _rate Number of token units a buyer gets per wei
|
||||||
* @param _wallet Address where collected funds will be forwarded to
|
* @param _wallet Address where collected funds will be forwarded to
|
||||||
* @param _token Address of the token being sold
|
* @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(_rate > 0);
|
||||||
require(_wallet != address(0));
|
require(_wallet != address(0));
|
||||||
require(_token != address(0));
|
require(_token != address(0));
|
||||||
@ -104,7 +112,12 @@ contract Crowdsale {
|
|||||||
* @param _beneficiary Address performing the token purchase
|
* @param _beneficiary Address performing the token purchase
|
||||||
* @param _weiAmount Value in wei involved in the 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(_beneficiary != address(0));
|
||||||
require(_weiAmount != 0);
|
require(_weiAmount != 0);
|
||||||
}
|
}
|
||||||
@ -114,7 +127,12 @@ contract Crowdsale {
|
|||||||
* @param _beneficiary Address performing the token purchase
|
* @param _beneficiary Address performing the token purchase
|
||||||
* @param _weiAmount Value in wei involved in the 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
|
// optional override
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +141,12 @@ contract Crowdsale {
|
|||||||
* @param _beneficiary Address performing the token purchase
|
* @param _beneficiary Address performing the token purchase
|
||||||
* @param _tokenAmount Number of tokens to be emitted
|
* @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);
|
token.transfer(_beneficiary, _tokenAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +155,12 @@ contract Crowdsale {
|
|||||||
* @param _beneficiary Address receiving the tokens
|
* @param _beneficiary Address receiving the tokens
|
||||||
* @param _tokenAmount Number of tokens to be purchased
|
* @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);
|
_deliverTokens(_beneficiary, _tokenAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +169,12 @@ contract Crowdsale {
|
|||||||
* @param _beneficiary Address receiving the tokens
|
* @param _beneficiary Address receiving the tokens
|
||||||
* @param _weiAmount Value in wei involved in the purchase
|
* @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
|
// optional override
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +183,9 @@ contract Crowdsale {
|
|||||||
* @param _weiAmount Value in wei to be converted into tokens
|
* @param _weiAmount Value in wei to be converted into tokens
|
||||||
* @return Number of tokens that can be purchased with the specified _weiAmount
|
* @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);
|
return _weiAmount.mul(rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../../math/SafeMath.sol";
|
import "../../math/SafeMath.sol";
|
||||||
import "../../ownership/Ownable.sol";
|
import "../../ownership/Ownable.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../validation/TimedCrowdsale.sol";
|
import "../validation/TimedCrowdsale.sol";
|
||||||
import "../../token/ERC20/ERC20.sol";
|
import "../../token/ERC20/ERC20.sol";
|
||||||
@ -30,7 +30,12 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
|
|||||||
* @param _beneficiary Token purchaser
|
* @param _beneficiary Token purchaser
|
||||||
* @param _tokenAmount Amount of tokens purchased
|
* @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);
|
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../../math/SafeMath.sol";
|
import "../../math/SafeMath.sol";
|
||||||
@ -25,7 +25,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
|
|||||||
* @dev Constructor, creates RefundVault.
|
* @dev Constructor, creates RefundVault.
|
||||||
* @param _goal Funding goal
|
* @param _goal Funding goal
|
||||||
*/
|
*/
|
||||||
function RefundableCrowdsale(uint256 _goal) public {
|
constructor(uint256 _goal) public {
|
||||||
require(_goal > 0);
|
require(_goal > 0);
|
||||||
vault = new RefundVault(wallet);
|
vault = new RefundVault(wallet);
|
||||||
goal = _goal;
|
goal = _goal;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../../../math/SafeMath.sol";
|
import "../../../math/SafeMath.sol";
|
||||||
import "../../../ownership/Ownable.sol";
|
import "../../../ownership/Ownable.sol";
|
||||||
@ -26,7 +26,7 @@ contract RefundVault is Ownable {
|
|||||||
/**
|
/**
|
||||||
* @param _wallet Vault address
|
* @param _wallet Vault address
|
||||||
*/
|
*/
|
||||||
function RefundVault(address _wallet) public {
|
constructor(address _wallet) public {
|
||||||
require(_wallet != address(0));
|
require(_wallet != address(0));
|
||||||
wallet = _wallet;
|
wallet = _wallet;
|
||||||
state = State.Active;
|
state = State.Active;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../Crowdsale.sol";
|
import "../Crowdsale.sol";
|
||||||
import "../../token/ERC20/ERC20.sol";
|
import "../../token/ERC20/ERC20.sol";
|
||||||
@ -18,7 +18,7 @@ contract AllowanceCrowdsale is Crowdsale {
|
|||||||
* @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
|
* @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));
|
require(_tokenWallet != address(0));
|
||||||
tokenWallet = _tokenWallet;
|
tokenWallet = _tokenWallet;
|
||||||
}
|
}
|
||||||
@ -36,7 +36,12 @@ contract AllowanceCrowdsale is Crowdsale {
|
|||||||
* @param _beneficiary Token purchaser
|
* @param _beneficiary Token purchaser
|
||||||
* @param _tokenAmount Amount of tokens purchased
|
* @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);
|
token.transferFrom(tokenWallet, _beneficiary, _tokenAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../Crowdsale.sol";
|
import "../Crowdsale.sol";
|
||||||
import "../../token/ERC20/MintableToken.sol";
|
import "../../token/ERC20/MintableToken.sol";
|
||||||
@ -16,7 +16,12 @@ contract MintedCrowdsale is Crowdsale {
|
|||||||
* @param _beneficiary Token purchaser
|
* @param _beneficiary Token purchaser
|
||||||
* @param _tokenAmount Number of tokens to be minted
|
* @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));
|
require(MintableToken(token).mint(_beneficiary, _tokenAmount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../validation/TimedCrowdsale.sol";
|
import "../validation/TimedCrowdsale.sol";
|
||||||
import "../../math/SafeMath.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 _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
|
* @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(_initialRate >= _finalRate);
|
||||||
require(_finalRate > 0);
|
require(_finalRate > 0);
|
||||||
initialRate = _initialRate;
|
initialRate = _initialRate;
|
||||||
@ -46,7 +46,9 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
|
|||||||
* @param _weiAmount The value in wei to be converted into tokens
|
* @param _weiAmount The value in wei to be converted into tokens
|
||||||
* @return The number of tokens _weiAmount wei will buy at present time
|
* @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();
|
uint256 currentRate = getCurrentRate();
|
||||||
return currentRate.mul(_weiAmount);
|
return currentRate.mul(_weiAmount);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../../math/SafeMath.sol";
|
import "../../math/SafeMath.sol";
|
||||||
import "../Crowdsale.sol";
|
import "../Crowdsale.sol";
|
||||||
@ -17,7 +17,7 @@ contract CappedCrowdsale is Crowdsale {
|
|||||||
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
|
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
|
||||||
* @param _cap Max amount of wei to be contributed
|
* @param _cap Max amount of wei to be contributed
|
||||||
*/
|
*/
|
||||||
function CappedCrowdsale(uint256 _cap) public {
|
constructor(uint256 _cap) public {
|
||||||
require(_cap > 0);
|
require(_cap > 0);
|
||||||
cap = _cap;
|
cap = _cap;
|
||||||
}
|
}
|
||||||
@ -35,7 +35,12 @@ contract CappedCrowdsale is Crowdsale {
|
|||||||
* @param _beneficiary Token purchaser
|
* @param _beneficiary Token purchaser
|
||||||
* @param _weiAmount Amount of wei contributed
|
* @param _weiAmount Amount of wei contributed
|
||||||
*/
|
*/
|
||||||
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
|
function _preValidatePurchase(
|
||||||
|
address _beneficiary,
|
||||||
|
uint256 _weiAmount
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
{
|
||||||
super._preValidatePurchase(_beneficiary, _weiAmount);
|
super._preValidatePurchase(_beneficiary, _weiAmount);
|
||||||
require(weiRaised.add(_weiAmount) <= cap);
|
require(weiRaised.add(_weiAmount) <= cap);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../../math/SafeMath.sol";
|
import "../../math/SafeMath.sol";
|
||||||
import "../Crowdsale.sol";
|
import "../Crowdsale.sol";
|
||||||
@ -29,7 +29,13 @@ contract IndividuallyCappedCrowdsale is Crowdsale, Ownable {
|
|||||||
* @param _beneficiaries List of addresses to be capped
|
* @param _beneficiaries List of addresses to be capped
|
||||||
* @param _cap Wei limit for individual contribution
|
* @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++) {
|
for (uint256 i = 0; i < _beneficiaries.length; i++) {
|
||||||
caps[_beneficiaries[i]] = _cap;
|
caps[_beneficiaries[i]] = _cap;
|
||||||
}
|
}
|
||||||
@ -49,7 +55,9 @@ contract IndividuallyCappedCrowdsale is Crowdsale, Ownable {
|
|||||||
* @param _beneficiary Address of contributor
|
* @param _beneficiary Address of contributor
|
||||||
* @return User contribution so far
|
* @return User contribution so far
|
||||||
*/
|
*/
|
||||||
function getUserContribution(address _beneficiary) public view returns (uint256) {
|
function getUserContribution(address _beneficiary)
|
||||||
|
public view returns (uint256)
|
||||||
|
{
|
||||||
return contributions[_beneficiary];
|
return contributions[_beneficiary];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +66,12 @@ contract IndividuallyCappedCrowdsale is Crowdsale, Ownable {
|
|||||||
* @param _beneficiary Token purchaser
|
* @param _beneficiary Token purchaser
|
||||||
* @param _weiAmount Amount of wei contributed
|
* @param _weiAmount Amount of wei contributed
|
||||||
*/
|
*/
|
||||||
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
|
function _preValidatePurchase(
|
||||||
|
address _beneficiary,
|
||||||
|
uint256 _weiAmount
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
{
|
||||||
super._preValidatePurchase(_beneficiary, _weiAmount);
|
super._preValidatePurchase(_beneficiary, _weiAmount);
|
||||||
require(contributions[_beneficiary].add(_weiAmount) <= caps[_beneficiary]);
|
require(contributions[_beneficiary].add(_weiAmount) <= caps[_beneficiary]);
|
||||||
}
|
}
|
||||||
@ -68,7 +81,12 @@ contract IndividuallyCappedCrowdsale is Crowdsale, Ownable {
|
|||||||
* @param _beneficiary Token purchaser
|
* @param _beneficiary Token purchaser
|
||||||
* @param _weiAmount Amount of wei contributed
|
* @param _weiAmount Amount of wei contributed
|
||||||
*/
|
*/
|
||||||
function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
|
function _updatePurchasingState(
|
||||||
|
address _beneficiary,
|
||||||
|
uint256 _weiAmount
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
{
|
||||||
super._updatePurchasingState(_beneficiary, _weiAmount);
|
super._updatePurchasingState(_beneficiary, _weiAmount);
|
||||||
contributions[_beneficiary] = contributions[_beneficiary].add(_weiAmount);
|
contributions[_beneficiary] = contributions[_beneficiary].add(_weiAmount);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../../math/SafeMath.sol";
|
import "../../math/SafeMath.sol";
|
||||||
import "../Crowdsale.sol";
|
import "../Crowdsale.sol";
|
||||||
@ -28,7 +28,7 @@ contract TimedCrowdsale is Crowdsale {
|
|||||||
* @param _openingTime Crowdsale opening time
|
* @param _openingTime Crowdsale opening time
|
||||||
* @param _closingTime Crowdsale closing 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
|
// solium-disable-next-line security/no-block-members
|
||||||
require(_openingTime >= block.timestamp);
|
require(_openingTime >= block.timestamp);
|
||||||
require(_closingTime >= _openingTime);
|
require(_closingTime >= _openingTime);
|
||||||
@ -51,7 +51,13 @@ contract TimedCrowdsale is Crowdsale {
|
|||||||
* @param _beneficiary Token purchaser
|
* @param _beneficiary Token purchaser
|
||||||
* @param _weiAmount Amount of wei contributed
|
* @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);
|
super._preValidatePurchase(_beneficiary, _weiAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../Crowdsale.sol";
|
import "../Crowdsale.sol";
|
||||||
import "../../ownership/Ownable.sol";
|
import "../../ownership/Ownable.sol";
|
||||||
@ -51,7 +51,13 @@ contract WhitelistedCrowdsale is Crowdsale, Ownable {
|
|||||||
* @param _beneficiary Token beneficiary
|
* @param _beneficiary Token beneficiary
|
||||||
* @param _weiAmount Amount of wei contributed
|
* @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);
|
super._preValidatePurchase(_beneficiary, _weiAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
* @author Matt Condon (@Shrugs)
|
||||||
* @dev It's recommended that you define constants in the contract,
|
* @dev It's recommended that you define constants in the contract,
|
||||||
* @dev like ROLE_ADMIN below, to avoid typos.
|
* @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 {
|
contract RBACWithAdmin is RBAC {
|
||||||
/**
|
/**
|
||||||
@ -28,7 +35,7 @@ contract RBACWithAdmin is RBAC {
|
|||||||
/**
|
/**
|
||||||
* @dev constructor. Sets msg.sender as admin by default
|
* @dev constructor. Sets msg.sender as admin by default
|
||||||
*/
|
*/
|
||||||
function RBACWithAdmin()
|
constructor()
|
||||||
public
|
public
|
||||||
{
|
{
|
||||||
addRole(msg.sender, ROLE_ADMIN);
|
addRole(msg.sender, ROLE_ADMIN);
|
||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../crowdsale/validation/CappedCrowdsale.sol";
|
import "../crowdsale/validation/CappedCrowdsale.sol";
|
||||||
import "../crowdsale/distribution/RefundableCrowdsale.sol";
|
import "../crowdsale/distribution/RefundableCrowdsale.sol";
|
||||||
@ -13,7 +13,8 @@ import "../token/ERC20/MintableToken.sol";
|
|||||||
*/
|
*/
|
||||||
contract SampleCrowdsaleToken is MintableToken {
|
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
|
string public constant symbol = "SCT"; // solium-disable-line uppercase
|
||||||
uint8 public constant decimals = 18; // 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
|
* After adding multiple features it's good practice to run integration tests
|
||||||
* to ensure that subcontracts works together as intended.
|
* 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 {
|
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
|
||||||
|
|
||||||
function SampleCrowdsale(
|
constructor(
|
||||||
uint256 _openingTime,
|
uint256 _openingTime,
|
||||||
uint256 _closingTime,
|
uint256 _closingTime,
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../ownership/Heritable.sol";
|
import "../ownership/Heritable.sol";
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ contract SimpleSavingsWallet is Heritable {
|
|||||||
event Received(address indexed payer, uint256 amount, uint256 balance);
|
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.
|
* @dev wallet can receive funds.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../token/ERC20/StandardToken.sol";
|
import "../token/ERC20/StandardToken.sol";
|
||||||
@ -21,7 +21,7 @@ contract SimpleToken is StandardToken {
|
|||||||
/**
|
/**
|
||||||
* @dev Constructor that gives msg.sender all of existing tokens.
|
* @dev Constructor that gives msg.sender all of existing tokens.
|
||||||
*/
|
*/
|
||||||
function SimpleToken() public {
|
constructor() public {
|
||||||
totalSupply_ = INITIAL_SUPPLY;
|
totalSupply_ = INITIAL_SUPPLY;
|
||||||
balances[msg.sender] = INITIAL_SUPPLY;
|
balances[msg.sender] = INITIAL_SUPPLY;
|
||||||
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
|
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../ownership/Ownable.sol";
|
import "../ownership/Ownable.sol";
|
||||||
@ -10,7 +10,7 @@ import "../ownership/Ownable.sol";
|
|||||||
*/
|
*/
|
||||||
contract Destructible is Ownable {
|
contract Destructible is Ownable {
|
||||||
|
|
||||||
function Destructible() public payable { }
|
constructor() public payable { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Transfers the current balance to the owner and terminates the contract.
|
* @dev Transfers the current balance to the owner and terminates the contract.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../ownership/Ownable.sol";
|
import "../ownership/Ownable.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../ownership/Ownable.sol";
|
import "../ownership/Ownable.sol";
|
||||||
import "../token/ERC20/ERC20Basic.sol";
|
import "../token/ERC20/ERC20Basic.sol";
|
||||||
@ -12,7 +12,7 @@ import "../token/ERC20/ERC20Basic.sol";
|
|||||||
*/
|
*/
|
||||||
contract TokenDestructible is Ownable {
|
contract TokenDestructible is Ownable {
|
||||||
|
|
||||||
function TokenDestructible() public payable { }
|
constructor() public payable { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Terminate contract and refund to owner
|
* @notice Terminate contract and refund to owner
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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.
|
* @dev Multiplies two numbers, throws on overflow.
|
||||||
*/
|
*/
|
||||||
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
|
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) {
|
if (a == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = a * b;
|
c = a * b;
|
||||||
assert(c / a == b);
|
assert(c / a == b);
|
||||||
return c;
|
return c;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/ERC20.sol";
|
import "../token/ERC20/ERC20.sol";
|
||||||
import "../crowdsale/emission/AllowanceCrowdsale.sol";
|
import "../crowdsale/emission/AllowanceCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/emission/AllowanceCrowdsale.sol";
|
|||||||
|
|
||||||
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
|
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
|
||||||
|
|
||||||
function AllowanceCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
address _wallet,
|
address _wallet,
|
||||||
ERC20 _token,
|
ERC20 _token,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../token/ERC20/BasicToken.sol";
|
import "../token/ERC20/BasicToken.sol";
|
||||||
@ -7,7 +7,7 @@ import "../token/ERC20/BasicToken.sol";
|
|||||||
// mock class using BasicToken
|
// mock class using BasicToken
|
||||||
contract BasicTokenMock is BasicToken {
|
contract BasicTokenMock is BasicToken {
|
||||||
|
|
||||||
function BasicTokenMock(address initialAccount, uint256 initialBalance) public {
|
constructor(address initialAccount, uint256 initialBalance) public {
|
||||||
balances[initialAccount] = initialBalance;
|
balances[initialAccount] = initialBalance;
|
||||||
totalSupply_ = initialBalance;
|
totalSupply_ = initialBalance;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.18;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../access/SignatureBouncer.sol";
|
import "../access/SignatureBouncer.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/BurnableToken.sol";
|
import "../token/ERC20/BurnableToken.sol";
|
||||||
|
|
||||||
|
|
||||||
contract BurnableTokenMock is BurnableToken {
|
contract BurnableTokenMock is BurnableToken {
|
||||||
|
|
||||||
function BurnableTokenMock(address initialAccount, uint initialBalance) public {
|
constructor(address initialAccount, uint initialBalance) public {
|
||||||
balances[initialAccount] = initialBalance;
|
balances[initialAccount] = initialBalance;
|
||||||
totalSupply_ = initialBalance;
|
totalSupply_ = initialBalance;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/ERC20.sol";
|
import "../token/ERC20/ERC20.sol";
|
||||||
import "../crowdsale/validation/CappedCrowdsale.sol";
|
import "../crowdsale/validation/CappedCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/validation/CappedCrowdsale.sol";
|
|||||||
|
|
||||||
contract CappedCrowdsaleImpl is CappedCrowdsale {
|
contract CappedCrowdsaleImpl is CappedCrowdsale {
|
||||||
|
|
||||||
function CappedCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
address _wallet,
|
address _wallet,
|
||||||
ERC20 _token,
|
ERC20 _token,
|
||||||
|
|||||||
@ -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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,9 +1,16 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/StandardToken.sol";
|
import "../token/ERC20/StandardToken.sol";
|
||||||
import "../token/ERC20/DetailedERC20.sol";
|
import "../token/ERC20/DetailedERC20.sol";
|
||||||
|
|
||||||
|
|
||||||
contract DetailedERC20Mock is StandardToken, DetailedERC20 {
|
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
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../ECRecovery.sol";
|
import "../ECRecovery.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/BasicToken.sol";
|
import "../token/ERC20/BasicToken.sol";
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ contract ERC223ContractInterface {
|
|||||||
|
|
||||||
contract ERC223TokenMock is BasicToken {
|
contract ERC223TokenMock is BasicToken {
|
||||||
|
|
||||||
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
|
constructor(address initialAccount, uint256 initialBalance) public {
|
||||||
balances[initialAccount] = initialBalance;
|
balances[initialAccount] = initialBalance;
|
||||||
totalSupply_ = initialBalance;
|
totalSupply_ = initialBalance;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC721/ERC721BasicToken.sol";
|
import "../token/ERC721/ERC721BasicToken.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC721/ERC721Receiver.sol";
|
import "../token/ERC721/ERC721Receiver.sol";
|
||||||
|
|
||||||
@ -7,9 +7,14 @@ contract ERC721ReceiverMock is ERC721Receiver {
|
|||||||
bytes4 retval;
|
bytes4 retval;
|
||||||
bool reverts;
|
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;
|
retval = _retval;
|
||||||
reverts = _reverts;
|
reverts = _reverts;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC721/ERC721Token.sol";
|
import "../token/ERC721/ERC721Token.sol";
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ import "../token/ERC721/ERC721Token.sol";
|
|||||||
* and a public setter for metadata URI
|
* and a public setter for metadata URI
|
||||||
*/
|
*/
|
||||||
contract ERC721TokenMock is ERC721Token {
|
contract ERC721TokenMock is ERC721Token {
|
||||||
function ERC721TokenMock(string name, string symbol) public
|
constructor(string name, string symbol) public
|
||||||
ERC721Token(name, symbol)
|
ERC721Token(name, symbol)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../token/ERC827/ERC827Token.sol";
|
import "../token/ERC827/ERC827Token.sol";
|
||||||
@ -7,7 +7,7 @@ import "../token/ERC827/ERC827Token.sol";
|
|||||||
// mock class using ERC827 Token
|
// mock class using ERC827 Token
|
||||||
contract ERC827TokenMock is ERC827Token {
|
contract ERC827TokenMock is ERC827Token {
|
||||||
|
|
||||||
function ERC827TokenMock(address initialAccount, uint256 initialBalance) public {
|
constructor(address initialAccount, uint256 initialBalance) public {
|
||||||
balances[initialAccount] = initialBalance;
|
balances[initialAccount] = initialBalance;
|
||||||
totalSupply_ = initialBalance;
|
totalSupply_ = initialBalance;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/MintableToken.sol";
|
import "../token/ERC20/MintableToken.sol";
|
||||||
import "../crowdsale/distribution/FinalizableCrowdsale.sol";
|
import "../crowdsale/distribution/FinalizableCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/distribution/FinalizableCrowdsale.sol";
|
|||||||
|
|
||||||
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
|
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
|
||||||
|
|
||||||
function FinalizableCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _openingTime,
|
uint256 _openingTime,
|
||||||
uint256 _closingTime,
|
uint256 _closingTime,
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
// @title Force Ether into a contract.
|
// @title Force Ether into a contract.
|
||||||
@ -8,7 +8,7 @@ pragma solidity ^0.4.21;
|
|||||||
// @author Remco Bloemen <remco@neufund.org>
|
// @author Remco Bloemen <remco@neufund.org>
|
||||||
contract ForceEther {
|
contract ForceEther {
|
||||||
|
|
||||||
function ForceEther() public payable { }
|
constructor() public payable { }
|
||||||
|
|
||||||
function destroyAndSend(address _recipient) public {
|
function destroyAndSend(address _recipient) public {
|
||||||
selfdestruct(_recipient);
|
selfdestruct(_recipient);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../../contracts/ownership/HasNoEther.sol";
|
import "../../contracts/ownership/HasNoEther.sol";
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ import "../../contracts/ownership/HasNoEther.sol";
|
|||||||
contract HasNoEtherTest is HasNoEther {
|
contract HasNoEtherTest is HasNoEther {
|
||||||
|
|
||||||
// Constructor with explicit payable — should still fail
|
// Constructor with explicit payable — should still fail
|
||||||
function HasNoEtherTest() public payable {
|
constructor() public payable {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
|
import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
|
||||||
import "../math/SafeMath.sol";
|
import "../math/SafeMath.sol";
|
||||||
@ -6,7 +6,7 @@ import "../math/SafeMath.sol";
|
|||||||
|
|
||||||
contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
|
contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
|
||||||
|
|
||||||
function IncreasingPriceCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _openingTime,
|
uint256 _openingTime,
|
||||||
uint256 _closingTime,
|
uint256 _closingTime,
|
||||||
address _wallet,
|
address _wallet,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/ERC20.sol";
|
import "../token/ERC20/ERC20.sol";
|
||||||
import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
|
import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
|
|||||||
|
|
||||||
contract IndividuallyCappedCrowdsaleImpl is IndividuallyCappedCrowdsale {
|
contract IndividuallyCappedCrowdsaleImpl is IndividuallyCappedCrowdsale {
|
||||||
|
|
||||||
function IndividuallyCappedCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
address _wallet,
|
address _wallet,
|
||||||
ERC20 _token
|
ERC20 _token
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import {Bounty, Target} from "../../contracts/Bounty.sol";
|
import {Bounty, Target} from "../../contracts/Bounty.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../LimitBalance.sol";
|
import "../LimitBalance.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../../contracts/math/Math.sol";
|
import "../../contracts/math/Math.sol";
|
||||||
|
|||||||
@ -1,11 +1,19 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import { MerkleProof } from "../MerkleProof.sol";
|
import { MerkleProof } from "../MerkleProof.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MerkleProofWrapper {
|
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);
|
return MerkleProof.verifyProof(_proof, _root, _leaf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
contract MessageHelper {
|
contract MessageHelper {
|
||||||
@ -6,12 +6,27 @@ contract MessageHelper {
|
|||||||
event Show(bytes32 b32, uint256 number, string text);
|
event Show(bytes32 b32, uint256 number, string text);
|
||||||
event Buy(bytes32 b32, uint256 number, string text, uint256 value);
|
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);
|
emit Show(message, number, text);
|
||||||
return true;
|
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(
|
emit Buy(
|
||||||
message,
|
message,
|
||||||
number,
|
number,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/MintableToken.sol";
|
import "../token/ERC20/MintableToken.sol";
|
||||||
import "../crowdsale/emission/MintedCrowdsale.sol";
|
import "../crowdsale/emission/MintedCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/emission/MintedCrowdsale.sol";
|
|||||||
|
|
||||||
contract MintedCrowdsaleImpl is MintedCrowdsale {
|
contract MintedCrowdsaleImpl is MintedCrowdsale {
|
||||||
|
|
||||||
function MintedCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
address _wallet,
|
address _wallet,
|
||||||
MintableToken _token
|
MintableToken _token
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../lifecycle/Pausable.sol";
|
import "../lifecycle/Pausable.sol";
|
||||||
@ -9,7 +9,7 @@ contract PausableMock is Pausable {
|
|||||||
bool public drasticMeasureTaken;
|
bool public drasticMeasureTaken;
|
||||||
uint256 public count;
|
uint256 public count;
|
||||||
|
|
||||||
function PausableMock() public {
|
constructor() public {
|
||||||
drasticMeasureTaken = false;
|
drasticMeasureTaken = false;
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/PausableToken.sol";
|
import "../token/ERC20/PausableToken.sol";
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ import "../token/ERC20/PausableToken.sol";
|
|||||||
// mock class using PausableToken
|
// mock class using PausableToken
|
||||||
contract PausableTokenMock is PausableToken {
|
contract PausableTokenMock is PausableToken {
|
||||||
|
|
||||||
function PausableTokenMock(address initialAccount, uint initialBalance) public {
|
constructor(address initialAccount, uint initialBalance) public {
|
||||||
balances[initialAccount] = initialBalance;
|
balances[initialAccount] = initialBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/ERC20.sol";
|
import "../token/ERC20/ERC20.sol";
|
||||||
import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
|
import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
|
|||||||
|
|
||||||
contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
|
contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
|
||||||
|
|
||||||
function PostDeliveryCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _openingTime,
|
uint256 _openingTime,
|
||||||
uint256 _closingTime,
|
uint256 _closingTime,
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../payment/PullPayment.sol";
|
import "../payment/PullPayment.sol";
|
||||||
@ -7,7 +7,7 @@ import "../payment/PullPayment.sol";
|
|||||||
// mock class using PullPayment
|
// mock class using PullPayment
|
||||||
contract PullPaymentMock is PullPayment {
|
contract PullPaymentMock is PullPayment {
|
||||||
|
|
||||||
function PullPaymentMock() public payable { }
|
constructor() public payable { }
|
||||||
|
|
||||||
// test helper function to call asyncSend
|
// test helper function to call asyncSend
|
||||||
function callSend(address dest, uint256 amount) public {
|
function callSend(address dest, uint256 amount) public {
|
||||||
|
|||||||
@ -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 {
|
contract RBACMock is RBACWithAdmin {
|
||||||
@ -16,7 +16,7 @@ contract RBACMock is RBACWithAdmin {
|
|||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
function RBACMock(address[] _advisors)
|
constructor(address[] _advisors)
|
||||||
public
|
public
|
||||||
{
|
{
|
||||||
addRole(msg.sender, ROLE_ADVISOR);
|
addRole(msg.sender, ROLE_ADVISOR);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
contract ReentrancyAttack {
|
contract ReentrancyAttack {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../ReentrancyGuard.sol";
|
import "../ReentrancyGuard.sol";
|
||||||
import "./ReentrancyAttack.sol";
|
import "./ReentrancyAttack.sol";
|
||||||
@ -8,7 +8,7 @@ contract ReentrancyMock is ReentrancyGuard {
|
|||||||
|
|
||||||
uint256 public counter;
|
uint256 public counter;
|
||||||
|
|
||||||
function ReentrancyMock() public {
|
constructor() public {
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/MintableToken.sol";
|
import "../token/ERC20/MintableToken.sol";
|
||||||
import "../crowdsale/distribution/RefundableCrowdsale.sol";
|
import "../crowdsale/distribution/RefundableCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/distribution/RefundableCrowdsale.sol";
|
|||||||
|
|
||||||
contract RefundableCrowdsaleImpl is RefundableCrowdsale {
|
contract RefundableCrowdsaleImpl is RefundableCrowdsale {
|
||||||
|
|
||||||
function RefundableCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _openingTime,
|
uint256 _openingTime,
|
||||||
uint256 _closingTime,
|
uint256 _closingTime,
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/ERC20.sol";
|
import "../token/ERC20/ERC20.sol";
|
||||||
import "../token/ERC20/SafeERC20.sol";
|
import "../token/ERC20/SafeERC20.sol";
|
||||||
@ -21,11 +21,11 @@ contract ERC20FailingMock is ERC20 {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function balanceOf(address) public constant returns (uint256) {
|
function balanceOf(address) public view returns (uint256) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowance(address, address) public constant returns (uint256) {
|
function allowance(address, address) public view returns (uint256) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,11 +48,11 @@ contract ERC20SucceedingMock is ERC20 {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function balanceOf(address) public constant returns (uint256) {
|
function balanceOf(address) public view returns (uint256) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowance(address, address) public constant returns (uint256) {
|
function allowance(address, address) public view returns (uint256) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ contract SafeERC20Helper {
|
|||||||
ERC20 failing;
|
ERC20 failing;
|
||||||
ERC20 succeeding;
|
ERC20 succeeding;
|
||||||
|
|
||||||
function SafeERC20Helper() public {
|
constructor() public {
|
||||||
failing = new ERC20FailingMock();
|
failing = new ERC20FailingMock();
|
||||||
succeeding = new ERC20SucceedingMock();
|
succeeding = new ERC20SucceedingMock();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../math/SafeMath.sol";
|
import "../math/SafeMath.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import {Bounty, Target} from "../../contracts/Bounty.sol";
|
import {Bounty, Target} from "../../contracts/Bounty.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
pragma solidity ^0.4.18;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/StandardBurnableToken.sol";
|
import "../token/ERC20/StandardBurnableToken.sol";
|
||||||
|
|
||||||
|
|
||||||
contract StandardBurnableTokenMock is StandardBurnableToken {
|
contract StandardBurnableTokenMock is StandardBurnableToken {
|
||||||
|
|
||||||
function StandardBurnableTokenMock(address initialAccount, uint initialBalance) public {
|
constructor(address initialAccount, uint initialBalance) public {
|
||||||
balances[initialAccount] = initialBalance;
|
balances[initialAccount] = initialBalance;
|
||||||
totalSupply_ = initialBalance;
|
totalSupply_ = initialBalance;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/StandardToken.sol";
|
import "../token/ERC20/StandardToken.sol";
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ import "../token/ERC20/StandardToken.sol";
|
|||||||
// mock class using StandardToken
|
// mock class using StandardToken
|
||||||
contract StandardTokenMock is StandardToken {
|
contract StandardTokenMock is StandardToken {
|
||||||
|
|
||||||
function StandardTokenMock(address initialAccount, uint256 initialBalance) public {
|
constructor(address initialAccount, uint256 initialBalance) public {
|
||||||
balances[initialAccount] = initialBalance;
|
balances[initialAccount] = initialBalance;
|
||||||
totalSupply_ = initialBalance;
|
totalSupply_ = initialBalance;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/ERC20.sol";
|
import "../token/ERC20/ERC20.sol";
|
||||||
import "../crowdsale/validation/TimedCrowdsale.sol";
|
import "../crowdsale/validation/TimedCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/validation/TimedCrowdsale.sol";
|
|||||||
|
|
||||||
contract TimedCrowdsaleImpl is TimedCrowdsale {
|
contract TimedCrowdsaleImpl is TimedCrowdsale {
|
||||||
|
|
||||||
function TimedCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _openingTime,
|
uint256 _openingTime,
|
||||||
uint256 _closingTime,
|
uint256 _closingTime,
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../ownership/Whitelist.sol";
|
import "../ownership/Whitelist.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../token/ERC20/ERC20.sol";
|
import "../token/ERC20/ERC20.sol";
|
||||||
import "../crowdsale/validation/WhitelistedCrowdsale.sol";
|
import "../crowdsale/validation/WhitelistedCrowdsale.sol";
|
||||||
@ -6,7 +6,7 @@ import "../crowdsale/validation/WhitelistedCrowdsale.sol";
|
|||||||
|
|
||||||
contract WhitelistedCrowdsaleImpl is WhitelistedCrowdsale {
|
contract WhitelistedCrowdsaleImpl is WhitelistedCrowdsale {
|
||||||
|
|
||||||
function WhitelistedCrowdsaleImpl (
|
constructor (
|
||||||
uint256 _rate,
|
uint256 _rate,
|
||||||
address _wallet,
|
address _wallet,
|
||||||
ERC20 _token
|
ERC20 _token
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./Ownable.sol";
|
import "./Ownable.sol";
|
||||||
import "../token/ERC20/ERC20Basic.sol";
|
import "../token/ERC20/ERC20Basic.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "./Ownable.sol";
|
import "./Ownable.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./Ownable.sol";
|
import "./Ownable.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./Claimable.sol";
|
import "./Claimable.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./Ownable.sol";
|
import "./Ownable.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./Ownable.sol";
|
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
|
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
|
||||||
* we could use assembly to access msg.value.
|
* we could use assembly to access msg.value.
|
||||||
*/
|
*/
|
||||||
function HasNoEther() public payable {
|
constructor() public payable {
|
||||||
require(msg.value == 0);
|
require(msg.value == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,6 @@ contract HasNoEther is Ownable {
|
|||||||
* @dev Transfer all Ether held by the contract to the owner.
|
* @dev Transfer all Ether held by the contract to the owner.
|
||||||
*/
|
*/
|
||||||
function reclaimEther() external onlyOwner {
|
function reclaimEther() external onlyOwner {
|
||||||
// solium-disable-next-line security/no-send
|
owner.transfer(address(this).balance);
|
||||||
assert(owner.send(address(this).balance));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./CanReclaimToken.sol";
|
import "./CanReclaimToken.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "./Ownable.sol";
|
import "./Ownable.sol";
|
||||||
@ -21,8 +21,15 @@ contract Heritable is Ownable {
|
|||||||
|
|
||||||
event HeirChanged(address indexed owner, address indexed newHeir);
|
event HeirChanged(address indexed owner, address indexed newHeir);
|
||||||
event OwnerHeartbeated(address indexed owner);
|
event OwnerHeartbeated(address indexed owner);
|
||||||
event OwnerProclaimedDead(address indexed owner, address indexed heir, uint256 timeOfDeath);
|
event OwnerProclaimedDead(
|
||||||
event HeirOwnershipClaimed(address indexed previousOwner, address indexed newOwner);
|
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,
|
* @param _heartbeatTimeout time available for the owner to notify they are alive,
|
||||||
* before the heir can take ownership.
|
* before the heir can take ownership.
|
||||||
*/
|
*/
|
||||||
function Heritable(uint256 _heartbeatTimeout) public {
|
constructor(uint256 _heartbeatTimeout) public {
|
||||||
setHeartbeatTimeout(_heartbeatTimeout);
|
setHeartbeatTimeout(_heartbeatTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +113,9 @@ contract Heritable is Ownable {
|
|||||||
timeOfDeath_ = 0;
|
timeOfDeath_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setHeartbeatTimeout(uint256 newHeartbeatTimeout) internal onlyOwner {
|
function setHeartbeatTimeout(uint256 newHeartbeatTimeout)
|
||||||
|
internal onlyOwner
|
||||||
|
{
|
||||||
require(ownerLives());
|
require(ownerLives());
|
||||||
heartbeatTimeout_ = newHeartbeatTimeout;
|
heartbeatTimeout_ = newHeartbeatTimeout;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./HasNoEther.sol";
|
import "./HasNoEther.sol";
|
||||||
import "./HasNoTokens.sol";
|
import "./HasNoTokens.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,14 +10,18 @@ contract Ownable {
|
|||||||
address public owner;
|
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
|
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
|
||||||
* account.
|
* account.
|
||||||
*/
|
*/
|
||||||
function Ownable() public {
|
constructor() public {
|
||||||
owner = msg.sender;
|
owner = msg.sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,13 +34,28 @@ contract Ownable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Allows the current owner to transfer control of the contract to a newOwner.
|
* @dev Allows the current owner to relinquish control of the contract.
|
||||||
* @param newOwner The address to transfer ownership to.
|
|
||||||
*/
|
*/
|
||||||
function transferOwnership(address newOwner) public onlyOwner {
|
function renounceOwnership() public onlyOwner {
|
||||||
require(newOwner != address(0));
|
emit OwnershipRenounced(owner);
|
||||||
emit OwnershipTransferred(owner, newOwner);
|
owner = address(0);
|
||||||
owner = newOwner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
62
contracts/ownership/Superuser.sol
Normal file
62
contracts/ownership/Superuser.sol
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,8 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "./Ownable.sol";
|
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 The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
|
||||||
* @dev This simplifies the implementation of "user permissions".
|
* @dev This simplifies the implementation of "user permissions".
|
||||||
*/
|
*/
|
||||||
contract Whitelist is Ownable {
|
contract Whitelist is Ownable, RBAC {
|
||||||
mapping(address => bool) public whitelist;
|
|
||||||
|
|
||||||
event WhitelistedAddressAdded(address addr);
|
event WhitelistedAddressAdded(address addr);
|
||||||
event WhitelistedAddressRemoved(address addr);
|
event WhitelistedAddressRemoved(address addr);
|
||||||
|
|
||||||
|
string public constant ROLE_WHITELISTED = "whitelist";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Throws if called by any account that's not whitelisted.
|
* @dev Throws if called by any account that's not whitelisted.
|
||||||
*/
|
*/
|
||||||
modifier onlyWhitelisted() {
|
modifier onlyWhitelisted() {
|
||||||
require(whitelist[msg.sender]);
|
checkRole(msg.sender, ROLE_WHITELISTED);
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,12 +29,23 @@ contract Whitelist is Ownable {
|
|||||||
* @param addr address
|
* @param addr address
|
||||||
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
|
* @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) {
|
function addAddressToWhitelist(address addr)
|
||||||
if (!whitelist[addr]) {
|
onlyOwner
|
||||||
whitelist[addr] = true;
|
public
|
||||||
|
{
|
||||||
|
addRole(addr, ROLE_WHITELISTED);
|
||||||
emit WhitelistedAddressAdded(addr);
|
emit WhitelistedAddressAdded(addr);
|
||||||
success = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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,
|
* @return true if at least one address was added to the whitelist,
|
||||||
* false if all addresses were already in 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++) {
|
for (uint256 i = 0; i < addrs.length; i++) {
|
||||||
if (addAddressToWhitelist(addrs[i])) {
|
addAddressToWhitelist(addrs[i]);
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,12 +69,12 @@ contract Whitelist is Ownable {
|
|||||||
* @return true if the address was removed from the whitelist,
|
* @return true if the address was removed from the whitelist,
|
||||||
* false if the address wasn't in the whitelist in the first place
|
* false if the address wasn't in the whitelist in the first place
|
||||||
*/
|
*/
|
||||||
function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
|
function removeAddressFromWhitelist(address addr)
|
||||||
if (whitelist[addr]) {
|
onlyOwner
|
||||||
whitelist[addr] = false;
|
public
|
||||||
|
{
|
||||||
|
removeRole(addr, ROLE_WHITELISTED);
|
||||||
emit WhitelistedAddressRemoved(addr);
|
emit WhitelistedAddressRemoved(addr);
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,11 +83,12 @@ contract Whitelist is Ownable {
|
|||||||
* @return true if at least one address was removed from the whitelist,
|
* @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
|
* 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++) {
|
for (uint256 i = 0; i < addrs.length; i++) {
|
||||||
if (removeAddressFromWhitelist(addrs[i])) {
|
removeAddressFromWhitelist(addrs[i]);
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./Roles.sol";
|
import "./Roles.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "../math/SafeMath.sol";
|
import "../math/SafeMath.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "../math/SafeMath.sol";
|
import "../math/SafeMath.sol";
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ contract SplitPayment {
|
|||||||
/**
|
/**
|
||||||
* @dev Constructor
|
* @dev Constructor
|
||||||
*/
|
*/
|
||||||
function SplitPayment(address[] _payees, uint256[] _shares) public payable {
|
constructor(address[] _payees, uint256[] _shares) public payable {
|
||||||
require(_payees.length == _shares.length);
|
require(_payees.length == _shares.length);
|
||||||
|
|
||||||
for (uint256 i = 0; i < _payees.length; i++) {
|
for (uint256 i = 0; i < _payees.length; i++) {
|
||||||
@ -43,7 +43,11 @@ contract SplitPayment {
|
|||||||
require(shares[payee] > 0);
|
require(shares[payee] > 0);
|
||||||
|
|
||||||
uint256 totalReceived = address(this).balance.add(totalReleased);
|
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(payment != 0);
|
||||||
require(address(this).balance >= payment);
|
require(address(this).balance >= payment);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
import "./ERC20Basic.sol";
|
import "./ERC20Basic.sol";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./BasicToken.sol";
|
import "./BasicToken.sol";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./MintableToken.sol";
|
import "./MintableToken.sol";
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ contract CappedToken is MintableToken {
|
|||||||
|
|
||||||
uint256 public cap;
|
uint256 public cap;
|
||||||
|
|
||||||
function CappedToken(uint256 _cap) public {
|
constructor(uint256 _cap) public {
|
||||||
require(_cap > 0);
|
require(_cap > 0);
|
||||||
cap = _cap;
|
cap = _cap;
|
||||||
}
|
}
|
||||||
@ -22,7 +22,15 @@ contract CappedToken is MintableToken {
|
|||||||
* @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 public returns (bool) {
|
function mint(
|
||||||
|
address _to,
|
||||||
|
uint256 _amount
|
||||||
|
)
|
||||||
|
onlyOwner
|
||||||
|
canMint
|
||||||
|
public
|
||||||
|
returns (bool)
|
||||||
|
{
|
||||||
require(totalSupply_.add(_amount) <= cap);
|
require(totalSupply_.add(_amount) <= cap);
|
||||||
|
|
||||||
return super.mint(_to, _amount);
|
return super.mint(_to, _amount);
|
||||||
|
|||||||
@ -1,14 +1,20 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./ERC20.sol";
|
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 {
|
contract DetailedERC20 is ERC20 {
|
||||||
string public name;
|
string public name;
|
||||||
string public symbol;
|
string public symbol;
|
||||||
uint8 public decimals;
|
uint8 public decimals;
|
||||||
|
|
||||||
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
|
constructor(string _name, string _symbol, uint8 _decimals) public {
|
||||||
name = _name;
|
name = _name;
|
||||||
symbol = _symbol;
|
symbol = _symbol;
|
||||||
decimals = _decimals;
|
decimals = _decimals;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./ERC20Basic.sol";
|
import "./ERC20Basic.sol";
|
||||||
|
|
||||||
@ -8,8 +8,16 @@ 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) public view returns (uint256);
|
function allowance(address owner, address spender)
|
||||||
function transferFrom(address from, address to, uint256 value) public returns (bool);
|
public view returns (uint256);
|
||||||
|
|
||||||
|
function transferFrom(address from, address to, uint256 value)
|
||||||
|
public returns (bool);
|
||||||
|
|
||||||
function approve(address spender, 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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./StandardToken.sol";
|
import "./StandardToken.sol";
|
||||||
import "../../ownership/Ownable.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
|
* @dev Function to mint tokens
|
||||||
* @param _to The address that will receive the minted tokens.
|
* @param _to The address that will receive the minted tokens.
|
||||||
* @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 public returns (bool) {
|
function mint(
|
||||||
|
address _to,
|
||||||
|
uint256 _amount
|
||||||
|
)
|
||||||
|
hasMintPermission
|
||||||
|
canMint
|
||||||
|
public
|
||||||
|
returns (bool)
|
||||||
|
{
|
||||||
totalSupply_ = totalSupply_.add(_amount);
|
totalSupply_ = totalSupply_.add(_amount);
|
||||||
balances[_to] = balances[_to].add(_amount);
|
balances[_to] = balances[_to].add(_amount);
|
||||||
emit Mint(_to, _amount);
|
emit Mint(_to, _amount);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./StandardToken.sol";
|
import "./StandardToken.sol";
|
||||||
import "../../lifecycle/Pausable.sol";
|
import "../../lifecycle/Pausable.sol";
|
||||||
@ -10,23 +10,59 @@ import "../../lifecycle/Pausable.sol";
|
|||||||
**/
|
**/
|
||||||
contract PausableToken is StandardToken, Pausable {
|
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);
|
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);
|
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);
|
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);
|
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);
|
return super.decreaseApproval(_spender, _subtractedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
41
contracts/token/ERC20/RBACMintableToken.sol
Normal file
41
contracts/token/ERC20/RBACMintableToken.sol
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./ERC20Basic.sol";
|
import "./ERC20Basic.sol";
|
||||||
import "./ERC20.sol";
|
import "./ERC20.sol";
|
||||||
@ -12,7 +12,7 @@ import "./ERC20.sol";
|
|||||||
*/
|
*/
|
||||||
library SafeERC20 {
|
library SafeERC20 {
|
||||||
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
|
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
|
||||||
assert(token.transfer(to, value));
|
require(token.transfer(to, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
function safeTransferFrom(
|
function safeTransferFrom(
|
||||||
@ -23,10 +23,10 @@ library SafeERC20 {
|
|||||||
)
|
)
|
||||||
internal
|
internal
|
||||||
{
|
{
|
||||||
assert(token.transferFrom(from, to, value));
|
require(token.transferFrom(from, to, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
function safeApprove(ERC20 token, address spender, uint256 value) internal {
|
function safeApprove(ERC20 token, address spender, uint256 value) internal {
|
||||||
assert(token.approve(spender, value));
|
require(token.approve(spender, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
pragma solidity ^0.4.18;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./BurnableToken.sol";
|
import "./BurnableToken.sol";
|
||||||
import "./StandardToken.sol";
|
import "./StandardToken.sol";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Standard Burnable Token
|
* @title Standard Burnable Token
|
||||||
* @dev Adds burnFrom method to ERC20 implementations
|
* @dev Adds burnFrom method to ERC20 implementations
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
pragma solidity ^0.4.21;
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
import "./BasicToken.sol";
|
import "./BasicToken.sol";
|
||||||
import "./ERC20.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 _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) public returns (bool) {
|
function transferFrom(
|
||||||
|
address _from,
|
||||||
|
address _to,
|
||||||
|
uint256 _value
|
||||||
|
)
|
||||||
|
public
|
||||||
|
returns (bool)
|
||||||
|
{
|
||||||
require(_to != address(0));
|
require(_to != address(0));
|
||||||
require(_value <= balances[_from]);
|
require(_value <= balances[_from]);
|
||||||
require(_value <= allowed[_from][msg.sender]);
|
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.
|
* @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) public view returns (uint256) {
|
function allowance(
|
||||||
|
address _owner,
|
||||||
|
address _spender
|
||||||
|
)
|
||||||
|
public
|
||||||
|
view
|
||||||
|
returns (uint256)
|
||||||
|
{
|
||||||
return allowed[_owner][_spender];
|
return allowed[_owner][_spender];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +84,15 @@ contract StandardToken is ERC20, BasicToken {
|
|||||||
* @param _spender The address which will spend the funds.
|
* @param _spender The address which will spend the funds.
|
||||||
* @param _addedValue The amount of tokens to increase the allowance by.
|
* @param _addedValue The amount of tokens to increase the allowance by.
|
||||||
*/
|
*/
|
||||||
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
|
function increaseApproval(
|
||||||
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
|
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]);
|
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -86,7 +107,13 @@ contract StandardToken is ERC20, BasicToken {
|
|||||||
* @param _spender The address which will spend the funds.
|
* @param _spender The address which will spend the funds.
|
||||||
* @param _subtractedValue The amount of tokens to decrease the allowance by.
|
* @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];
|
uint oldValue = allowed[msg.sender][_spender];
|
||||||
if (_subtractedValue > oldValue) {
|
if (_subtractedValue > oldValue) {
|
||||||
allowed[msg.sender][_spender] = 0;
|
allowed[msg.sender][_spender] = 0;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user