Compare commits

...

32 Commits

Author SHA1 Message Date
4a10f727c4 1.9.0 2018-04-26 16:36:06 -03:00
e79dc645e4 Merge branch 'rename-openzeppelin-solidity' 2018-04-26 16:35:19 -03:00
0e5799c93b Clean up npm package (#904)
* ignore everything but official contracts for npm

* add tests to npm package

* remove truffle migrations stuff

* remove seemingly unused npm dependency

* clean up dependencies
2018-04-26 12:36:41 -03:00
90413e75f1 add version script to update ethpm.json (#906) 2018-04-25 20:32:09 -03:00
9c262571ae rename to openzeppelin-solidity 2018-04-25 19:19:15 -03:00
76fe1548ae Fix ERC721 test is not checking name and symbol properly #910 (#911) 2018-04-23 20:36:47 -03:00
8f2a4785cb Make ERC827 methods payable (#838)
* Make ERC827 methods payable

* Suppress linter errors

* Add some ERC827 payable tests

* Remove failOnBuy method from MessageHelper

* Fix linter warning

* Fix tests
2018-04-23 15:16:55 +02:00
16535fbb87 Update ERC827.sol to not use function overloading (#871)
* Update ERC827.sol to not use function overloading

* updated tests for erc827 function name changes

* fixed broken test

* removed findMethod from erc827 tests that is no longer necessary
2018-04-23 13:39:34 +02:00
77cc33fc5c cleaned up unsued variable definition (#753) 2018-04-20 16:01:05 -03:00
0b33d29e41 Add travis job to run test suite with solc nightly (#902)
Job is allowed to fail, and is run just for information purposes
2018-04-19 12:12:36 -03:00
61dfdde6c4 Updated send to sent. Matching indentation of closing comment. (#897) 2018-04-18 14:48:16 -03:00
e8be9a7bd0 Remove suggestion to rebase (#899) 2018-04-18 14:47:22 -03:00
dd8758fedf move misplaced MathMock (#900) 2018-04-18 14:47:00 -03:00
c63b203c1d Small SafeMath.sol gas improvements (add & mul). (#894) 2018-04-17 19:16:30 -03:00
c191757c6e rename truffle.js to truffle-config.js (#886) 2018-04-17 17:14:38 -03:00
f4bdaf49a1 Increase test coverage to 93% #549 (#768)
* Increase test coverage to 93% #549

* cover missing AllowanceCrowdsale branch

* improve Heritable coverage

* fix lint errors

* proper equal assert

* address review comments

* remove unneeded const definitions and imports

* use assertRevert

* reword scenario description

* Increase test coverage to 93% #549

* cover missing AllowanceCrowdsale branch

* improve Heritable coverage

* fix lint errors

* proper equal assert

* address review comments

* remove unneeded const definitions and imports

* use assertRevert

* reword scenario description

* move HIGH_GOAL constant to the scope where it's used

* remove const at top level

* address review comments
2018-04-17 15:05:34 -03:00
6a7114fdb4 Bouncer contract implementation (#883)
* feat: implement bouncer contracts

* fix: rename Bouncer to SignatureBouncer
2018-04-17 11:36:24 -03:00
0926729c8f Add StandardBurnableToken implementation (#870)
* Add StandardBurnableToken implementation

BurnableToken that extends from StandardToken and adds a
burnFrom method that decrements allowance. Equivalent to
a transferFrom plus burn in a single operation.

* Return event object from expectEvent helper

* Add comment on Approval event in burnFrom function

* Improvements on burnable token tests

- Inject initial balance as a parameter to the behaviour
- Use expectEvent helper for assertions on events
- Use chai bignumber for numbers
- Change to bdd-style assertions
2018-04-11 16:15:33 -03:00
9e1c934ffd Various fixes and formatting chores (#885)
* fix: clean up solium linting errors

* fix: make various contracts natspec compliant

* fix: this.balance deprecated; convert to address(this).balance

* fix: contract.call deprecated and switch to gasleft()

* fix: ignore empty block rule project-wide

* fix: add ignore cases for the rest of the linting warnings
2018-04-10 20:31:29 -03:00
a7e91856f3 Update to Truffle 4.1.5 and Ganache 6.1.0 (#876)
* Update to ganache-cli v6.1.0 and truffle v4.1.0

* Update to stable version of ganache-cli

* fix: update event emission warning

- Fix event emission warnings for solidity 4.21 after truffle has been
updated to use this version

* fix pr review comments

* update to truffle v4.1.5

* update package-lock

* add additional emit keywords

* update solidity-coverage to 0.4.15

* update to solium 1.1.6

* fix MerkleProof coverage analysis by testing through wrapper

* change version pragma to ^0.4.21

* fix solium linting errors
2018-04-09 20:48:32 -03:00
06666be93a change MerkleProof interface to take array of bytes32 (#879) 2018-04-08 12:36:16 -03:00
915f74c5f6 remove collaborators and audits from README (#866) 2018-04-04 21:17:27 -03:00
3d3f20f7e3 Removing obsolete comment - explicit check in place (#851) 2018-04-04 09:53:55 -03:00
03a3302abd add missing await in IndividuallyCappedCrowdsale (#867) 2018-04-03 18:50:24 -03:00
bd5f7f5774 Fix SafeMath test file (#865) 2018-04-03 17:54:48 -03:00
a6bef44790 fix: remove admin functionality from RBAC.sol fixes #802 (#836)
- splits the admin part of RBAC.sol into RBACWithAdmin.sol
2018-04-03 16:56:31 -03:00
a9c777faa6 docs: fix contributing link (#848)
* docs: fix contributing link
2018-04-03 15:56:01 -03:00
44a404aae5 Remove unnecessary import from ERC721Token.sol (#855)
The DeprecatedERC721.sol isn't implemented or necessary.
2018-04-03 11:32:52 -03:00
1d2d18f9da Small gas improvement in SafeMath.sol (#811) 2018-03-28 15:00:10 -03:00
82ce197e44 tests: fix most of the static warnings (#844) 2018-03-28 13:33:58 -03:00
42787e2a75 added awaits (#845) 2018-03-26 21:55:52 -03:00
9bc43c8d0f make ethjs-abi a devDependency (#843) 2018-03-26 16:24:12 -03:00
149 changed files with 3732 additions and 1618 deletions

View File

@ -12,7 +12,7 @@
Next, we need to know what your environment looks like.
- Which version of OpenZeppelin are you using?
- What network are you deploying to? testrpc? Ganache? Ropsten?
- What network are you deploying to? Ganache? Ropsten?
- How are you deploying your OpenZeppelin-backed contracts? truffle? Remix? Let us know!
## 📝 Details

View File

@ -11,7 +11,7 @@ Fixes #
<!-- 3. Before submitting, please review the following checklist: -->
- [ ] 📘 I've reviewed the [OpenZeppelin Contributor Guidelines](/docs/CONTRIBUTING.md)
- [ ] 📘 I've reviewed the [OpenZeppelin Contributor Guidelines](../blob/master/CONTRIBUTING.md)
- [ ] ✅ I've added tests where applicable to test my new functionality.
- [ ] 📖 I've made sure that my contracts are well-documented.
- [ ] 🎨 I've run the JS/Solidity linters and fixed any issues (`npm run lint:all:fix`).
- [ ] 🎨 I've run the JS/Solidity linters and fixed any issues (`npm run lint:all:fix`).

View File

@ -3,6 +3,7 @@
"plugins": ["security"],
"rules": {
"quotes": ["error", "double"],
"no-empty-blocks": "off",
"indentation": ["error", 2],
"arg-overflow": ["warning", 3],
"security/enforce-explicit-visibility": ["error"],

View File

@ -10,10 +10,12 @@ cache:
env:
-
- SOLIDITY_COVERAGE=true
- SOLC_NIGHTLY=true
matrix:
fast_finish: true
allow_failures:
- env: SOLIDITY_COVERAGE=true
- env: SOLC_NIGHTLY=true
before_script:
- truffle version
script:

View File

@ -5,27 +5,26 @@ We really appreciate and value contributions to OpenZeppelin. Please take 5' to
## Contribution guidelines
Smart contracts manage value and are highly vulnerable to errors and attacks. We have very strict guidelines, please make sure to review them: ["Contribution guidelines wiki entry"](https://github.com/OpenZeppelin/zeppelin-solidity/wiki/Contribution-guidelines).
Smart contracts manage value and are highly vulnerable to errors and attacks. We have very strict guidelines, please make sure to review them: ["Contribution guidelines wiki entry"](https://github.com/OpenZeppelin/openzeppelin-solidity/wiki/Contribution-guidelines).
## Creating Pull Requests (PRs)
As a contributor, you are expected to fork this repository, work on your own fork and then submit pull requests. The pull requests will be reviewed and eventually merged into the main repo. See ["Fork-a-Repo"](https://help.github.com/articles/fork-a-repo/) for how this works.
*IMPORTANT*
* Please use `rebase` instead of `merge` when updating your fork.
* Please see ["Git flow wiki entry"](https://github.com/OpenZeppelin/zeppelin-solidity/wiki/Git-flow) for understanding how to use branches in this repository.
* Please see ["Git flow wiki entry"](https://github.com/OpenZeppelin/openzeppelin-solidity/wiki/Git-flow) for understanding how to use branches in this repository.
## A typical workflow
1) Make sure your fork is up to date with the main repository:
```
cd zeppelin-solidity
cd openzeppelin-solidity
git fetch upstream
git checkout development
git pull --rebase upstream development
```
NOTE: The directory `zeppelin-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`:
(Postfixing #123 will associate your PR with the issue #123 and make everyone's life easier =D)
@ -41,7 +40,7 @@ git commit "Fix some bug #123"
git push origin fix/some-bug-#123
```
4) Go to [github.com/OpenZeppelin/zeppelin-solidity](https://github.com/OpenZeppelin/zeppelin-solidity) in your web browser and issue a new pull request.
4) Go to [github.com/OpenZeppelin/openzeppelin-solidity](https://github.com/OpenZeppelin/zeppelin-solidity) in your web browser and issue a new pull request.
*IMPORTANT* Read the PR template very carefully and make sure to follow all the instructions. These instructions
refer to some very important conditions that your PR must meet in order to be accepted, such as making sure that all tests pass, JS linting tests pass, solidity linting tests pass, etc.
@ -52,8 +51,8 @@ refer to some very important conditions that your PR must meet in order to be ac
## All set!
If you have any questions feel free to post them to github.com/OpenZeppelin/zeppelin-solidity/issues.
If you have any questions feel free to post them to github.com/OpenZeppelin/openzeppelin-solidity/issues.
Finally, if you're looking to collaborate and want to find easy tasks to start, look at the issues we marked as ["Good first issue"](https://github.com/OpenZeppelin/zeppelin-solidity/labels/good%20first%20issue).
Finally, if you're looking to collaborate and want to find easy tasks to start, look at the issues we marked as ["Good first issue"](https://github.com/OpenZeppelin/openzeppelin-solidity/labels/good%20first%20issue).
Thanks for your time and code!

View File

@ -1,7 +1,7 @@
# Zeppelin Solidity
[![NPM Package](https://img.shields.io/npm/v/zeppelin-solidity.svg?style=flat-square)](https://www.npmjs.org/package/zeppelin-solidity)
[![Build Status](https://img.shields.io/travis/OpenZeppelin/zeppelin-solidity.svg?branch=master&style=flat-square)](https://travis-ci.org/OpenZeppelin/zeppelin-solidity)
[![Coverage Status](https://img.shields.io/coveralls/github/OpenZeppelin/zeppelin-solidity/master.svg?style=flat-square)](https://coveralls.io/github/OpenZeppelin/zeppelin-solidity?branch=master)
# OpenZeppelin Solidity
[![NPM Package](https://img.shields.io/npm/v/openzeppelin-solidity.svg?style=flat-square)](https://www.npmjs.org/package/openzeppelin-solidity)
[![Build Status](https://img.shields.io/travis/OpenZeppelin/openzeppelin-solidity.svg?branch=master&style=flat-square)](https://travis-ci.org/OpenZeppelin/openzeppelin-solidity)
[![Coverage Status](https://img.shields.io/coveralls/github/OpenZeppelin/openzeppelin-solidity/master.svg?style=flat-square)](https://coveralls.io/github/OpenZeppelin/openzeppelin-solidity?branch=master)
OpenZeppelin is a library for writing secure [Smart Contracts](https://en.wikipedia.org/wiki/Smart_contract) on Ethereum.
@ -24,15 +24,15 @@ truffle init
To install the OpenZeppelin library, run the following in your Solidity project root directory:
```sh
npm init -y
npm install -E zeppelin-solidity
npm install -E openzeppelin-solidity
```
**Note that OpenZeppelin does not currently follow semantic versioning.** You may encounter breaking changes upon a minor version bump. We recommend pinning the version of OpenZeppelin you use, as done by the `-E` (`--save-exact`) option.
After that, you'll get all the library's contracts in the `node_modules/zeppelin-solidity/contracts` folder. You can use the contracts in the library like so:
After that, you'll get all the library's contracts in the `node_modules/openzeppelin-solidity/contracts` folder. You can use the contracts in the library like so:
```js
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
```solidity
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
contract MyContract is Ownable {
...
@ -56,27 +56,9 @@ Building a distributed application, protocol or organization with OpenZeppelin?
Interested in contributing to OpenZeppelin?
- Framework proposal and roadmap: https://medium.com/zeppelin-blog/zeppelin-framework-proposal-and-development-roadmap-fdfa9a3a32ab#.iain47pak
- Issue tracker: https://github.com/OpenZeppelin/zeppelin-solidity/issues
- Contribution guidelines: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/CONTRIBUTING.md
- Wiki: https://github.com/OpenZeppelin/zeppelin-solidity/wiki
## Collaborating organizations and audits by OpenZeppelin
- [Golem](https://golem.network/)
- [Mediachain](http://www.mediachain.io/)
- [Truffle](http://truffleframework.com/)
- [Firstblood](https://firstblood.io/)
- [Rootstock](https://www.rsk.co/)
- [Consensys](https://consensys.net/)
- [DigixGlobal](https://www.dgx.io/)
- [Coinfund](https://coinfund.io/)
- [DemocracyEarth](https://democracy.earth/)
- [Signatura](https://signatura.co/)
- [Ether.camp](http://www.ether.camp/)
- [Aragon](https://aragon.one/)
- [Wings](https://wings.ai/)
among others...
- Issue tracker: https://github.com/OpenZeppelin/openzeppelin-solidity/issues
- Contribution guidelines: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/CONTRIBUTING.md
- Wiki: https://github.com/OpenZeppelin/openzeppelin-solidity/wiki
## License
Code released under the [MIT License](https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/LICENSE).
Code released under the [MIT License](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/LICENSE).

2
contracts/.npmignore Normal file
View File

@ -0,0 +1,2 @@
mocks
examples

View File

@ -1,4 +1,5 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
/**
* Utility library of inline functions on addresses
@ -6,15 +7,21 @@ pragma solidity ^0.4.18;
library AddressUtils {
/**
* Returns whether there is code in the target address
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param addr address address to check
* @return whether there is code in the target address
* @param addr address to check
* @return whether the target address is a contract
*/
function isContract(address addr) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(addr) }
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
assembly { size := extcodesize(addr) } // solium-disable-line security/no-inline-assembly
return size > 0;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./payment/PullPayment.sol";
@ -30,7 +30,7 @@ contract Bounty is PullPayment, Destructible {
function createTarget() public returns(Target) {
Target target = Target(deployContract());
researchers[target] = msg.sender;
TargetCreated(target);
emit TargetCreated(target);
return target;
}
@ -43,7 +43,7 @@ contract Bounty is PullPayment, Destructible {
require(researcher != 0);
// Check Target contract invariants
require(!target.checkInvariant());
asyncSend(researcher, this.balance);
asyncSend(researcher, address(this).balance);
claimed = true;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
/**
@ -61,7 +61,8 @@ contract DayLimit {
* @return uint256 of today's index.
*/
function today() private view returns (uint256) {
return now / 1 days;
// solium-disable-next-line security/no-block-members
return block.timestamp / 1 days;
}
/**

View File

@ -1,10 +1,14 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
/**
* @title Eliptic curve signature operations
*
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*
* TODO Remove this library once solidity supports passing a signature to ecrecover.
* See https://github.com/ethereum/solidity/issues/864
*
*/
library ECRecovery {
@ -14,17 +18,24 @@ library ECRecovery {
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param sig bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes sig) internal pure returns (address) {
function recover(bytes32 hash, bytes sig)
internal
pure
returns (address)
{
bytes32 r;
bytes32 s;
uint8 v;
//Check the signature length
// Check the signature length
if (sig.length != 65) {
return (address(0));
}
// Divide the signature in r, s and v variables
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solium-disable-next-line security/no-inline-assembly
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
@ -40,8 +51,26 @@ library ECRecovery {
if (v != 27 && v != 28) {
return (address(0));
} else {
// solium-disable-next-line arg-overflow
return ecrecover(hash, v, r, s);
}
}
/**
* toEthSignedMessageHash
* @dev prefix a bytes32 value with "\x19Ethereum Signed Message:"
* @dev and hash the result
*/
function toEthSignedMessageHash(bytes32 hash)
internal
pure
returns (bytes32)
{
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(
"\x19Ethereum Signed Message:\n32",
hash
);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
/**
@ -23,7 +23,7 @@ contract LimitBalance {
* @dev Checks if limit was reached. Case true, it throws.
*/
modifier limitedPayable() {
require(this.balance <= limit);
require(address(this).balance <= limit);
_;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
/*
@ -14,20 +14,11 @@ library MerkleProof {
* @param _root Merkle root
* @param _leaf Leaf of Merkle tree
*/
function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) public pure returns (bool) {
// Check if proof length is a multiple of 32
if (_proof.length % 32 != 0) {
return false;
}
bytes32 proofElement;
function verifyProof(bytes32[] _proof, bytes32 _root, bytes32 _leaf) internal pure returns (bool) {
bytes32 computedHash = _leaf;
for (uint256 i = 32; i <= _proof.length; i += 32) {
assembly {
// Load the current element of the proof
proofElement := mload(add(_proof, i))
}
for (uint256 i = 0; i < _proof.length; i++) {
bytes32 proofElement = _proof[i];
if (computedHash < proofElement) {
// Hash(current computed hash + current element of the proof)

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
/**
@ -12,7 +12,7 @@ contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancy_lock = false;
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
@ -23,10 +23,10 @@ contract ReentrancyGuard {
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!reentrancy_lock);
reentrancy_lock = true;
require(!reentrancyLock);
reentrancyLock = true;
_;
reentrancy_lock = false;
reentrancyLock = false;
}
}

View File

@ -0,0 +1,90 @@
pragma solidity ^0.4.18;
import "../ownership/Ownable.sol";
import "../ownership/rbac/RBAC.sol";
import "../ECRecovery.sol";
/**
* @title SignatureBouncer
* @author PhABC and Shrugs
* @dev Bouncer allows users to submit a signature as a permission to do an action.
* @dev If the signature is from one of the authorized bouncer addresses, the signature
* @dev is valid. The owner of the contract adds/removes bouncers.
* @dev Bouncer addresses can be individual servers signing grants or different
* @dev users within a decentralized club that have permission to invite other members.
* @dev
* @dev This technique is useful for whitelists and airdrops; instead of putting all
* @dev valid addresses on-chain, simply sign a grant of the form
* @dev keccak256(`:contractAddress` + `:granteeAddress`) using a valid bouncer address.
* @dev Then restrict access to your crowdsale/whitelist/airdrop using the
* @dev `onlyValidSignature` modifier (or implement your own using isValidSignature).
* @dev
* @dev See the tests Bouncer.test.js for specific usage examples.
*/
contract SignatureBouncer is Ownable, RBAC {
using ECRecovery for bytes32;
string public constant ROLE_BOUNCER = "bouncer";
/**
* @dev requires that a valid signature of a bouncer was provided
*/
modifier onlyValidSignature(bytes _sig)
{
require(isValidSignature(msg.sender, _sig));
_;
}
/**
* @dev allows the owner to add additional bouncer addresses
*/
function addBouncer(address _bouncer)
onlyOwner
public
{
require(_bouncer != address(0));
addRole(_bouncer, ROLE_BOUNCER);
}
/**
* @dev allows the owner to remove bouncer addresses
*/
function removeBouncer(address _bouncer)
onlyOwner
public
{
require(_bouncer != address(0));
removeRole(_bouncer, ROLE_BOUNCER);
}
/**
* @dev is the signature of `this + sender` from a bouncer?
* @return bool
*/
function isValidSignature(address _address, bytes _sig)
internal
view
returns (bool)
{
return isValidDataHash(
keccak256(address(this), _address),
_sig
);
}
/**
* @dev internal function to convert a hash to an eth signed message
* @dev and then recover the signature and check it against the bouncer role
* @return bool
*/
function isValidDataHash(bytes32 hash, bytes _sig)
internal
view
returns (bool)
{
address signer = hash
.toEthSignedMessageHash()
.recover(_sig);
return hasRole(signer, ROLE_BOUNCER);
}
}

View File

@ -1,8 +1,9 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/ERC20.sol";
import "../math/SafeMath.sol";
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale,
@ -11,11 +12,10 @@ import "../math/SafeMath.sol";
* functionality and/or custom behavior.
* The external interface represents the basic interface for purchasing tokens, and conform
* the base architecture for crowdsales. They are *not* intended to be modified / overriden.
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
* the methods to add functionality. Consider using 'super' where appropiate to concatenate
* behavior.
*/
contract Crowdsale {
using SafeMath for uint256;
@ -82,7 +82,12 @@ contract Crowdsale {
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, weiAmount);

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../../math/SafeMath.sol";
import "../../ownership/Ownable.sol";
import "../validation/TimedCrowdsale.sol";
/**
* @title FinalizableCrowdsale
* @dev Extension of Crowdsale where an owner can do extra work
@ -25,7 +26,7 @@ contract FinalizableCrowdsale is TimedCrowdsale, Ownable {
require(hasClosed());
finalization();
Finalized();
emit Finalized();
isFinalized = true;
}
@ -37,4 +38,5 @@ contract FinalizableCrowdsale is TimedCrowdsale, Ownable {
*/
function finalization() internal {
}
}

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../validation/TimedCrowdsale.sol";
import "../../token/ERC20/ERC20.sol";
import "../../math/SafeMath.sol";
/**
* @title PostDeliveryCrowdsale
* @dev Crowdsale that locks tokens from withdrawal until it ends.
@ -13,15 +14,6 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
mapping(address => uint256) public balances;
/**
* @dev Overrides parent by storing balances instead of issuing tokens right away.
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
}
/**
* @dev Withdraw tokens only after crowdsale ends.
*/
@ -32,4 +24,14 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
balances[msg.sender] = 0;
_deliverTokens(msg.sender, amount);
}
/**
* @dev Overrides parent by storing balances instead of issuing tokens right away.
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../../math/SafeMath.sol";
@ -22,7 +22,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
RefundVault public vault;
/**
* @dev Constructor, creates RefundVault.
* @dev Constructor, creates RefundVault.
* @param _goal Funding goal
*/
function RefundableCrowdsale(uint256 _goal) public {
@ -42,7 +42,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
}
/**
* @dev Checks whether funding goal was reached.
* @dev Checks whether funding goal was reached.
* @return Whether funding goal was reached
*/
function goalReached() public view returns (bool) {

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../../../math/SafeMath.sol";
import "../../../ownership/Ownable.sol";
@ -43,14 +43,14 @@ contract RefundVault is Ownable {
function close() onlyOwner public {
require(state == State.Active);
state = State.Closed;
Closed();
wallet.transfer(this.balance);
emit Closed();
wallet.transfer(address(this).balance);
}
function enableRefunds() onlyOwner public {
require(state == State.Active);
state = State.Refunding;
RefundsEnabled();
emit RefundsEnabled();
}
/**
@ -61,6 +61,6 @@ contract RefundVault is Ownable {
uint256 depositedValue = deposited[investor];
deposited[investor] = 0;
investor.transfer(depositedValue);
Refunded(investor, depositedValue);
emit Refunded(investor, depositedValue);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../Crowdsale.sol";
import "../../token/ERC20/ERC20.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../Crowdsale.sol";
import "../../token/ERC20/MintableToken.sol";

View File

@ -1,11 +1,12 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../validation/TimedCrowdsale.sol";
import "../../math/SafeMath.sol";
/**
* @title IncreasingPriceCrowdsale
* @dev Extension of Crowdsale contract that increases the price of tokens linearly in time.
* @dev Extension of Crowdsale contract that increases the price of tokens linearly in time.
* Note that what should be provided to the constructor is the initial and final _rates_, that is,
* the amount of tokens per wei contributed. Thus, the initial rate must be greater than the final rate.
*/
@ -28,12 +29,13 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
}
/**
* @dev Returns the rate of tokens per wei at the present time.
* Note that, as price _increases_ with time, the rate _decreases_.
* @dev Returns the rate of tokens per wei at the present time.
* Note that, as price _increases_ with time, the rate _decreases_.
* @return The number of tokens a buyer gets per wei at a given time
*/
function getCurrentRate() public view returns (uint256) {
uint256 elapsedTime = now.sub(openingTime);
// solium-disable-next-line security/no-block-members
uint256 elapsedTime = block.timestamp.sub(openingTime);
uint256 timeRange = closingTime.sub(openingTime);
uint256 rateRange = initialRate.sub(finalRate);
return initialRate.sub(elapsedTime.mul(rateRange).div(timeRange));

View File

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

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
@ -15,10 +15,11 @@ contract TimedCrowdsale is Crowdsale {
uint256 public closingTime;
/**
* @dev Reverts if not in crowdsale time range.
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(now >= openingTime && now <= closingTime);
// solium-disable-next-line security/no-block-members
require(block.timestamp >= openingTime && block.timestamp <= closingTime);
_;
}
@ -28,7 +29,8 @@ contract TimedCrowdsale is Crowdsale {
* @param _closingTime Crowdsale closing time
*/
function TimedCrowdsale(uint256 _openingTime, uint256 _closingTime) public {
require(_openingTime >= now);
// solium-disable-next-line security/no-block-members
require(_openingTime >= block.timestamp);
require(_closingTime >= _openingTime);
openingTime = _openingTime;
@ -40,9 +42,10 @@ contract TimedCrowdsale is Crowdsale {
* @return Whether crowdsale period has elapsed
*/
function hasClosed() public view returns (bool) {
return now > closingTime;
// solium-disable-next-line security/no-block-members
return block.timestamp > closingTime;
}
/**
* @dev Extend parent behavior requiring to be within contributing period
* @param _beneficiary Token purchaser

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../crowdsale/validation/CappedCrowdsale.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
@ -33,7 +33,16 @@ contract SampleCrowdsaleToken is MintableToken {
*/
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
function SampleCrowdsale(uint256 _openingTime, uint256 _closingTime, uint256 _rate, address _wallet, uint256 _cap, MintableToken _token, uint256 _goal) public
function SampleCrowdsale(
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
address _wallet,
uint256 _cap,
MintableToken _token,
uint256 _goal
)
public
Crowdsale(_rate, _wallet, _token)
CappedCrowdsale(_cap)
TimedCrowdsale(_openingTime, _closingTime)

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.21;
import "../ownership/Heritable.sol";
@ -20,12 +20,12 @@ contract SimpleSavingsWallet is Heritable {
function SimpleSavingsWallet(uint256 _heartbeatTimeout) Heritable(_heartbeatTimeout) public {}
/**
* @dev wallet can receive funds.
*/
function () public payable {
Received(msg.sender, msg.value, this.balance);
emit Received(msg.sender, msg.value, address(this).balance);
}
/**
@ -35,6 +35,6 @@ contract SimpleSavingsWallet is Heritable {
require(payee != 0 && payee != address(this));
require(amount > 0);
payee.transfer(amount);
Sent(payee, amount, this.balance);
emit Sent(payee, amount, address(this).balance);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/StandardToken.sol";
@ -24,7 +24,7 @@ contract SimpleToken is StandardToken {
function SimpleToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}

View File

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

View File

@ -1,21 +0,0 @@
pragma solidity ^0.4.18;
import "../ownership/Ownable.sol";
/**
* @title Migrations
* @dev This is a truffle contract, needed for truffle integration, not meant for use by Zeppelin users.
*/
contract Migrations is Ownable {
uint256 public lastCompletedMigration;
function setCompleted(uint256 completed) onlyOwner public {
lastCompletedMigration = completed;
}
function upgrade(address newAddress) onlyOwner public {
Migrations upgraded = Migrations(newAddress);
upgraded.setCompleted(lastCompletedMigration);
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../ownership/Ownable.sol";
@ -36,7 +36,7 @@ contract Pausable is Ownable {
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
emit Pause();
}
/**
@ -44,6 +44,6 @@ contract Pausable is Ownable {
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
emit Unpause();
}
}

View File

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

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
/**
@ -10,11 +10,11 @@ library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
c = a * b;
assert(c / a == b);
return c;
}
@ -24,9 +24,9 @@ library SafeMath {
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
return a / b;
}
/**
@ -40,8 +40,8 @@ library SafeMath {
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/emission/AllowanceCrowdsale.sol";

View File

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

View File

@ -0,0 +1,22 @@
pragma solidity ^0.4.18;
import "../access/SignatureBouncer.sol";
contract SignatureBouncerMock is SignatureBouncer {
function checkValidSignature(address _address, bytes _sig)
public
view
returns (bool)
{
return isValidSignature(_address, _sig);
}
function onlyWithValidSignature(bytes _sig)
onlyValidSignature(_sig)
public
view
{
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/BurnableToken.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/CappedCrowdsale.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../../contracts/DayLimit.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/StandardToken.sol";
import "../token/ERC20/DetailedERC20.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../ECRecovery.sol";
@ -7,10 +7,19 @@ import "../ECRecovery.sol";
contract ECRecoveryMock {
using ECRecovery for bytes32;
address public addrRecovered;
function recover(bytes32 hash, bytes sig) public returns (address) {
addrRecovered = hash.recover(sig);
function recover(bytes32 hash, bytes sig)
public
pure
returns (address)
{
return hash.recover(sig);
}
function toEthSignedMessageHash(bytes32 hash)
public
pure
returns (bytes32)
{
return hash.toEthSignedMessageHash();
}
}

View File

@ -1,11 +1,13 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/BasicToken.sol";
contract ERC223ContractInterface {
function tokenFallback(address _from, uint256 _value, bytes _data) external;
}
contract ERC223TokenMock is BasicToken {
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
@ -18,11 +20,12 @@ contract ERC223TokenMock is BasicToken {
returns (bool success)
{
transfer(_to, _value);
bool is_contract = false;
bool isContract = false;
// solium-disable-next-line security/no-inline-assembly
assembly {
is_contract := not(iszero(extcodesize(_to)))
isContract := not(iszero(extcodesize(_to)))
}
if (is_contract) {
if (isContract) {
ERC223ContractInterface receiver = ERC223ContractInterface(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}

View File

@ -1,7 +1,8 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC721/ERC721BasicToken.sol";
/**
* @title ERC721BasicTokenMock
* This mock just provides a public mint and burn functions for testing purposes

View File

@ -1,11 +1,12 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC721/ERC721Receiver.sol";
contract ERC721ReceiverMock is ERC721Receiver {
bytes4 retval;
bool reverts;
event Received(address _address, uint256 _tokenId, bytes _data, uint256 _gas);
function ERC721ReceiverMock(bytes4 _retval, bool _reverts) public {
@ -13,9 +14,21 @@ contract ERC721ReceiverMock is ERC721Receiver {
reverts = _reverts;
}
function onERC721Received(address _address, uint256 _tokenId, bytes _data) public returns(bytes4) {
function onERC721Received(
address _address,
uint256 _tokenId,
bytes _data
)
public
returns(bytes4)
{
require(!reverts);
Received(_address, _tokenId, _data, msg.gas);
emit Received(
_address,
_tokenId,
_data,
gasleft() // msg.gas was deprecated in solidityv0.4.21
);
return retval;
}
}

View File

@ -1,7 +1,8 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC721/ERC721Token.sol";
/**
* @title ERC721TokenMock
* This mock just provides a public mint and burn functions for testing purposes,
@ -23,4 +24,4 @@ contract ERC721TokenMock is ERC721Token {
function setTokenURI(uint256 _tokenId, string _uri) public {
super._setTokenURI(_tokenId, _uri);
}
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.13;
pragma solidity ^0.4.21;
import "../token/ERC827/ERC827Token.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/MintableToken.sol";
import "../crowdsale/distribution/FinalizableCrowdsale.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
// @title Force Ether into a contract.

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../../contracts/ownership/HasNoEther.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
import "../math/SafeMath.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";

View File

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

View File

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

View File

@ -0,0 +1,26 @@
pragma solidity ^0.4.21;
import "../../contracts/math/Math.sol";
contract MathMock {
uint64 public result64;
uint256 public result256;
function max64(uint64 a, uint64 b) public {
result64 = Math.max64(a, b);
}
function min64(uint64 a, uint64 b) public {
result64 = Math.min64(a, b);
}
function max256(uint256 a, uint256 b) public {
result256 = Math.max256(a, b);
}
function min256(uint256 a, uint256 b) public {
result256 = Math.min256(a, b);
}
}

View File

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

View File

@ -1,11 +1,22 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.21;
contract MessageHelper {
event Show(bytes32 b32, uint256 number, string text);
event Buy(bytes32 b32, uint256 number, string text, uint256 value);
function showMessage( bytes32 message, uint256 number, string text ) public returns (bool) {
Show(message, number, text);
emit Show(message, number, text);
return true;
}
function buyMessage( bytes32 message, uint256 number, string text ) public payable returns (bool) {
emit Buy(
message,
number,
text,
msg.value);
return true;
}
@ -14,6 +25,7 @@ contract MessageHelper {
}
function call(address to, bytes data) public returns (bool) {
// solium-disable-next-line security/no-low-level-calls
if (to.call(data))
return true;
else

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/MintableToken.sol";
import "../crowdsale/emission/MintedCrowdsale.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../lifecycle/Pausable.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/PausableToken.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";

View File

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

View File

@ -1,9 +1,9 @@
pragma solidity ^0.4.8;
pragma solidity ^0.4.21;
import "../ownership/rbac/RBAC.sol";
import "../ownership/rbac/RBACWithAdmin.sol";
contract RBACMock is RBAC {
contract RBACMock is RBACWithAdmin {
string constant ROLE_ADVISOR = "advisor";

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
contract ReentrancyAttack {
function callSender(bytes4 data) public {
// solium-disable-next-line security/no-low-level-calls
require(msg.sender.call(data));
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../ReentrancyGuard.sol";
import "./ReentrancyAttack.sol";
@ -27,7 +27,8 @@ contract ReentrancyMock is ReentrancyGuard {
bytes4 func = bytes4(keccak256("countThisRecursive(uint256)"));
if (n > 0) {
count();
bool result = this.call(func, n - 1);
// solium-disable-next-line security/no-low-level-calls
bool result = address(this).call(func, n - 1);
require(result == true);
}
}

View File

@ -1,8 +1,9 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/MintableToken.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
contract RefundableCrowdsaleImpl is RefundableCrowdsale {
function RefundableCrowdsaleImpl (
@ -12,7 +13,7 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale {
address _wallet,
MintableToken _token,
uint256 _goal
)
)
public
Crowdsale(_rate, _wallet, _token)
TimedCrowdsale(_openingTime, _closingTime)

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/SafeERC20.sol";

View File

@ -1,21 +1,24 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../math/SafeMath.sol";
contract SafeMathMock {
uint256 public result;
function multiply(uint256 a, uint256 b) public {
result = SafeMath.mul(a, b);
function mul(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.mul(a, b);
}
function subtract(uint256 a, uint256 b) public {
result = SafeMath.sub(a, b);
function div(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.div(a, b);
}
function add(uint256 a, uint256 b) public {
result = SafeMath.add(a, b);
function sub(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.sub(a, b);
}
function add(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.add(a, b);
}
}

View File

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

View File

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

View File

@ -1,7 +1,8 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/StandardToken.sol";
// mock class using StandardToken
contract StandardTokenMock is StandardToken {

View File

@ -1,8 +1,9 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/TimedCrowdsale.sol";
contract TimedCrowdsaleImpl is TimedCrowdsale {
function TimedCrowdsaleImpl (
@ -11,7 +12,7 @@ contract TimedCrowdsaleImpl is TimedCrowdsale {
uint256 _rate,
address _wallet,
ERC20 _token
)
)
public
Crowdsale(_rate, _wallet, _token)
TimedCrowdsale(_openingTime, _closingTime)

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/WhitelistedCrowdsale.sol";

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./Ownable.sol";
@ -32,7 +32,7 @@ contract Claimable is Ownable {
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner);
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./Claimable.sol";
@ -31,7 +31,7 @@ contract DelayedClaimable is Claimable {
*/
function claimOwnership() onlyPendingOwner public {
require((block.number <= end) && (block.number >= start));
OwnershipTransferred(owner, pendingOwner);
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
end = 0;

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./Ownable.sol";
@ -8,11 +8,11 @@ import "./Ownable.sol";
* @author Remco Bloemen <remco@2π.com>
* @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
* in the contract, it will allow the owner to reclaim this ether.
* @notice Ether can still be send to this contract by:
* @notice Ether can still be sent to this contract by:
* calling functions labeled `payable`
* `selfdestruct(contract_address)`
* mining directly to the contract address
*/
*/
contract HasNoEther is Ownable {
/**
@ -36,6 +36,7 @@ contract HasNoEther is Ownable {
* @dev Transfer all Ether held by the contract to the owner.
*/
function reclaimEther() external onlyOwner {
assert(owner.send(this.balance));
// solium-disable-next-line security/no-send
assert(owner.send(address(this).balance));
}
}

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.21;
import "./Ownable.sol";
@ -46,7 +46,7 @@ contract Heritable is Ownable {
function setHeir(address newHeir) public onlyOwner {
require(newHeir != owner);
heartbeat();
HeirChanged(owner, newHeir);
emit HeirChanged(owner, newHeir);
heir_ = newHeir;
}
@ -61,7 +61,7 @@ contract Heritable is Ownable {
function heartbeatTimeout() public view returns(uint256) {
return heartbeatTimeout_;
}
function timeOfDeath() public view returns(uint256) {
return timeOfDeath_;
}
@ -80,7 +80,8 @@ contract Heritable is Ownable {
*/
function proclaimDeath() public onlyHeir {
require(ownerLives());
OwnerProclaimedDead(owner, heir_, timeOfDeath_);
emit OwnerProclaimedDead(owner, heir_, timeOfDeath_);
// solium-disable-next-line security/no-block-members
timeOfDeath_ = block.timestamp;
}
@ -88,7 +89,7 @@ contract Heritable is Ownable {
* @dev Owner can send a heartbeat if they were mistakenly pronounced dead.
*/
function heartbeat() public onlyOwner {
OwnerHeartbeated(owner);
emit OwnerHeartbeated(owner);
timeOfDeath_ = 0;
}
@ -97,9 +98,10 @@ contract Heritable is Ownable {
*/
function claimHeirOwnership() public onlyHeir {
require(!ownerLives());
// solium-disable-next-line security/no-block-members
require(block.timestamp >= timeOfDeath_ + heartbeatTimeout_);
OwnershipTransferred(owner, heir_);
HeirOwnershipClaimed(owner, heir_);
emit OwnershipTransferred(owner, heir_);
emit HeirOwnershipClaimed(owner, heir_);
owner = heir_;
timeOfDeath_ = 0;
}

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
/**
@ -35,7 +35,7 @@ contract Ownable {
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./Ownable.sol";
@ -11,7 +11,7 @@ import "./Ownable.sol";
*/
contract Whitelist is Ownable {
mapping(address => bool) public whitelist;
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
@ -26,21 +26,21 @@ contract Whitelist is Ownable {
/**
* @dev add an address to the whitelist
* @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) {
if (!whitelist[addr]) {
whitelist[addr] = true;
WhitelistedAddressAdded(addr);
success = true;
emit WhitelistedAddressAdded(addr);
success = true;
}
}
/**
* @dev add addresses to the whitelist
* @param addrs addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
@ -53,13 +53,13 @@ contract Whitelist is Ownable {
/**
* @dev remove an address from the whitelist
* @param addr address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
WhitelistedAddressRemoved(addr);
emit WhitelistedAddressRemoved(addr);
success = true;
}
}
@ -67,7 +67,7 @@ contract Whitelist is Ownable {
/**
* @dev remove addresses from the whitelist
* @param addrs addresses
* @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
*/
function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./Roles.sol";
@ -7,8 +7,8 @@ import "./Roles.sol";
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* Supports unlimited numbers of roles and addresses.
* See //contracts/mocks/RBACMock.sol for an example of usage.
* @dev Supports unlimited numbers of roles and addresses.
* @dev See //contracts/mocks/RBACMock.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
* It's also recommended that you define constants in the contract, like ROLE_ADMIN below,
@ -22,20 +22,6 @@ contract RBAC {
event RoleAdded(address addr, string roleName);
event RoleRemoved(address addr, string roleName);
/**
* A constant role name for indicating admins.
*/
string public constant ROLE_ADMIN = "admin";
/**
* @dev constructor. Sets msg.sender as admin by default
*/
function RBAC()
public
{
addRole(msg.sender, ROLE_ADMIN);
}
/**
* @dev reverts if addr does not have role
* @param addr address
@ -63,30 +49,6 @@ contract RBAC {
return roles[roleName].has(addr);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function adminAddRole(address addr, string roleName)
onlyAdmin
public
{
addRole(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function adminRemoveRole(address addr, string roleName)
onlyAdmin
public
{
removeRole(addr, roleName);
}
/**
* @dev add a role to an address
* @param addr address
@ -96,7 +58,7 @@ contract RBAC {
internal
{
roles[roleName].add(addr);
RoleAdded(addr, roleName);
emit RoleAdded(addr, roleName);
}
/**
@ -108,7 +70,7 @@ contract RBAC {
internal
{
roles[roleName].remove(addr);
RoleRemoved(addr, roleName);
emit RoleRemoved(addr, roleName);
}
/**
@ -122,16 +84,6 @@ contract RBAC {
_;
}
/**
* @dev modifier to scope access to admins
* // reverts
*/
modifier onlyAdmin()
{
checkRole(msg.sender, ROLE_ADMIN);
_;
}
/**
* @dev modifier to scope access to a set of roles (uses msg.sender as addr)
* @param roleNames the names of the roles to scope access to

View File

@ -0,0 +1,60 @@
pragma solidity ^0.4.21;
import "./RBAC.sol";
/**
* @title RBACWithAdmin
* @author Matt Condon (@Shrugs)
* @dev It's recommended that you define constants in the contract,
* @dev like ROLE_ADMIN below, to avoid typos.
*/
contract RBACWithAdmin is RBAC {
/**
* A constant role name for indicating admins.
*/
string public constant ROLE_ADMIN = "admin";
/**
* @dev modifier to scope access to admins
* // reverts
*/
modifier onlyAdmin()
{
checkRole(msg.sender, ROLE_ADMIN);
_;
}
/**
* @dev constructor. Sets msg.sender as admin by default
*/
function RBACWithAdmin()
public
{
addRole(msg.sender, ROLE_ADMIN);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function adminAddRole(address addr, string roleName)
onlyAdmin
public
{
addRole(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function adminRemoveRole(address addr, string roleName)
onlyAdmin
public
{
removeRole(addr, roleName);
}
}

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../math/SafeMath.sol";
@ -23,7 +23,7 @@ contract PullPayment {
uint256 payment = payments[payee];
require(payment != 0);
require(this.balance >= payment);
require(address(this).balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "../math/SafeMath.sol";
@ -42,11 +42,11 @@ contract SplitPayment {
require(shares[payee] > 0);
uint256 totalReceived = this.balance.add(totalReleased);
uint256 totalReceived = address(this).balance.add(totalReleased);
uint256 payment = totalReceived.mul(shares[payee]).div(totalShares).sub(released[payee]);
require(payment != 0);
require(this.balance >= payment);
require(address(this).balance >= payment);
released[payee] = released[payee].add(payment);
totalReleased = totalReleased.add(payment);

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./ERC20Basic.sol";
@ -32,10 +32,9 @@ contract BasicToken is ERC20Basic {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
@ -44,7 +43,7 @@ contract BasicToken is ERC20Basic {
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./BasicToken.sol";
@ -16,14 +16,17 @@ contract BurnableToken is BasicToken {
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./StandardToken.sol";
import "../../ownership/Ownable.sol";
@ -7,7 +7,7 @@ import "../../ownership/Ownable.sol";
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
@ -31,8 +31,8 @@ contract MintableToken is StandardToken, Ownable {
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
@ -42,7 +42,7 @@ contract MintableToken is StandardToken, Ownable {
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
emit MintFinished();
return true;
}
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity ^0.4.21;
import "./StandardToken.sol";
import "../../lifecycle/Pausable.sol";

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