Skip to content

Commit ecce311

Browse files
committed
Merge branch 'master' into gsn-beta
2 parents 9928686 + be4b80a commit ecce311

File tree

168 files changed

+16769
-15446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+16769
-15446
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
name: Bug report
3-
about: Report a bug in OpenZeppelin
3+
about: Report a bug in OpenZeppelin Contracts
44

55
---
66

77
<!-- Briefly describe the issue you're experiencing. Tell us what you were trying to do and what happened instead. -->
88

9-
<!-- Remember, this is not a place to ask for help debugging code. For that, we welcome you in the Zeppelin Forum: https://forum.zeppelin.solutions/. -->
9+
<!-- Remember, this is not a place to ask for help debugging code. For that, we welcome you in the OpenZeppelin Community Forum: https://forum.openzeppelin.com/. -->
1010

1111
**💻 Environment**
1212

13-
<!-- Tell us what version of OpenZeppelin you're using, and how you're using it: Truffle, Remix, etc. -->
13+
<!-- Tell us what version of OpenZeppelin Contracts you're using, and how you're using it: Truffle, Remix, etc. -->
1414

1515
**📝 Details**
1616

.github/ISSUE_TEMPLATE/feature_request.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Feature request
3-
about: Suggest an idea for OpenZeppelin
3+
about: Suggest an idea for OpenZeppelin Contracts
44

55
---
66

@@ -11,4 +11,4 @@ about: Suggest an idea for OpenZeppelin
1111
<!-- Please describe your feature request in detail. -->
1212

1313
<!-- Make sure that you have reviewed the OpenZeppelin Contributor Guidelines. -->
14-
<!-- https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/CONTRIBUTING.md -->
14+
<!-- https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md -->

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Fixes #
1313

1414
<!-- 3. Before submitting, please make sure that you have:
1515
- reviewed the OpenZeppelin Contributor Guidelines
16-
(https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/CONTRIBUTING.md),
16+
(https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md),
1717
- added tests where applicable to test new functionality,
1818
- made sure that your contracts are well-documented,
1919
- run the Solidity linter (`npm run lint:sol`) and fixed any issues,

.gitignore

+7-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ build/
4141
# IntelliJ IDE
4242
.idea
4343

44-
# docsite artifacts
45-
docsite-build
46-
docs/api
44+
# docs artifacts
45+
docs/modules/api
46+
openzeppelin-docs
47+
48+
# only used to package @openzeppelin/contracts
49+
contracts/build/
50+
contracts/README.md

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
### New features:
66
* `Address.toPayable`: added a helper to convert between address types without having to resort to low-level casting. ([#1773](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1773))
77

8+
### Improvements:
9+
* `Address.isContract`: switched from `extcodesize` to `extcodehash` for less gas usage. ([#1802](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1802))
10+
* `SafeMath`: added custom error messages support for `sub`, `div` and `mod` functions. `ERC20` and `ERC777` updated to throw custom errors on subtraction overflows. ([#1828](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1828))
11+
12+
### Bugfixes
13+
814
## 2.3.0 (2019-05-27)
915

1016
### New features:

CODE_STYLE.md

+6
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ Any exception or additions specific to our project are documented below.
6161
6262
Some standards (e.g. ERC20) use present tense, and in those cases the
6363
standard specification prevails.
64+
65+
* Interface names should have a capital I prefix.
66+
67+
```
68+
interface IERC777 {
69+
```

CONTRIBUTING.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Contributing to OpenZeppelin
1+
Contributing to OpenZeppelin Contracts
22
=======
33

4-
We really appreciate and value contributions to OpenZeppelin. Please take 5' to review the items listed below to make sure that your contributions are merged as soon as possible.
4+
We really appreciate and value contributions to OpenZeppelin Contracts. Please take 5' to review the items listed below to make sure that your contributions are merged as soon as possible.
55

66
## Contribution guidelines
77

@@ -16,12 +16,12 @@ As a contributor, you are expected to fork this repository, work on your own for
1616
1) Make sure your fork is up to date with the main repository:
1717

1818
```
19-
cd openzeppelin-solidity
20-
git remote add upstream https://github.com/OpenZeppelin/openzeppelin-solidity.git
19+
cd openzeppelin-contracts
20+
git remote add upstream https://github.com/OpenZeppelin/openzeppelin-contracts.git
2121
git fetch upstream
2222
git pull --rebase upstream master
2323
```
24-
NOTE: The directory `openzeppelin-solidity` represents your fork's local copy.
24+
NOTE: The directory `openzeppelin-contracts` represents your fork's local copy.
2525

2626
2) Branch out from `master` into `fix/some-bug-#123`:
2727
(Postfixing #123 will associate your PR with the issue #123 and make everyone's life easier =D)
@@ -37,7 +37,7 @@ git commit "Fix some bug #123"
3737
git push origin fix/some-bug-#123
3838
```
3939

40-
4) Go to [github.com/OpenZeppelin/openzeppelin-solidity](https://github.com/OpenZeppelin/openzeppelin-solidity) in your web browser and issue a new pull request.
40+
4) Go to [github.com/OpenZeppelin/openzeppelin-contracts](https://github.com/OpenZeppelin/openzeppelin-contracts) in your web browser and issue a new pull request.
4141

4242
*IMPORTANT* Read the PR template very carefully and make sure to follow all the instructions. These instructions
4343
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.
@@ -48,9 +48,9 @@ refer to some very important conditions that your PR must meet in order to be ac
4848

4949
## All set!
5050

51-
If you have any questions feel free to post them to github.com/OpenZeppelin/openzeppelin-solidity/issues.
51+
If you have any questions feel free to post them to github.com/OpenZeppelin/openzeppelin-contracts/issues.
5252

53-
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).
53+
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-contracts/labels/good%20first%20issue).
5454

5555
Thanks for your time and code!
5656

README.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# <img src="logo.png" alt="OpenZeppelin" width="400px">
1+
# <img src="logo.png" alt="OpenZeppelin" height="40px">
22

3-
[![NPM Package](https://img.shields.io/npm/v/openzeppelin-solidity.svg?style=flat-square)](https://www.npmjs.org/package/openzeppelin-solidity)
4-
[![Build Status](https://travis-ci.com/OpenZeppelin/openzeppelin-solidity.svg?branch=master)](https://travis-ci.com/OpenZeppelin/openzeppelin-solidity)
5-
[![Coverage Status](https://coveralls.io/repos/github/OpenZeppelin/openzeppelin-solidity/badge.svg?branch=master)](https://coveralls.io/github/OpenZeppelin/openzeppelin-solidity?branch=master)
3+
[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/contracts.svg)](https://www.npmjs.org/package/@openzeppelin/contracts)
4+
[![Build Status](https://travis-ci.com/OpenZeppelin/openzeppelin-contracts.svg?branch=master)](https://travis-ci.com/OpenZeppelin/openzeppelin-contracts)
5+
[![Coverage Status](https://coveralls.io/repos/github/OpenZeppelin/openzeppelin-contracts/badge.svg?branch=master)](https://coveralls.io/github/OpenZeppelin/openzeppelin-contracts?branch=master)
66

7-
**OpenZeppelin is a library for secure smart contract development.** It provides implementations of standards like ERC20 and ERC721 which you can deploy as-is or extend to suit your needs, as well as Solidity components to build custom contracts and more complex decentralized systems.
7+
**OpenZeppelin Contracts is a library for secure smart contract development.** It provides implementations of standards like ERC20 and ERC721 which you can deploy as-is or extend to suit your needs, as well as Solidity components to build custom contracts and more complex decentralized systems.
88

99
## Install
1010

1111
```
12-
npm install openzeppelin-solidity
12+
npm install @openzeppelin/contracts
1313
```
1414

15-
OpenZeppelin features a stable API, which means your contracts won't break unexpectedly when upgrading to a newer minor version. You can read ṫhe details in our [API Stability](https://forum.zeppelin.solutions/t/api-stability/138) document.
15+
OpenZeppelin Contracts features a stable API, which means your contracts won't break unexpectedly when upgrading to a newer minor version. You can read ṫhe details in our [API Stability] document.
1616

1717
## Usage
1818

@@ -21,8 +21,8 @@ To write your custom contracts, import ours and extend them through inheritance.
2121
```solidity
2222
pragma solidity ^0.5.0;
2323
24-
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol';
25-
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol';
24+
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
25+
import "@openzeppelin/contracts/token/ERC721/ERC721Mintable.sol";
2626
2727
contract MyNFT is ERC721Full, ERC721Mintable {
2828
constructor() ERC721Full("MyNFT", "MNFT") public {
@@ -36,7 +36,7 @@ On our site you will find a few [guides] to learn about the different parts of O
3636

3737
## Security
3838

39-
OpenZeppelin the project is maintained by [Zeppelin] the company, and developed following our high standards for code quality and security. OpenZeppelin is meant to provide 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 problems you might experience.
39+
This project is maintained by [OpenZeppelin], and developed following our high standards for code quality and security. OpenZeppelin is meant to provide 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 problems you might experience.
4040

4141
The core development principles and strategies that OpenZeppelin is based on include: security in depth, simple and modular code, clarity-driven naming conventions, comprehensive unit testing, pre-and-post-condition sanity checks, code consistency, and regular audits.
4242

@@ -53,10 +53,11 @@ OpenZeppelin exists thanks to its contributors. There are many ways you can part
5353
OpenZeppelin is released under the [MIT License](LICENSE).
5454

5555

56-
[API docs]: https://docs.openzeppelin.org/v2.3.0/api/token/erc721
57-
[guides]: https://docs.openzeppelin.org/v2.3.0/get-started
58-
[forum]: https://forum.zeppelin.solutions
59-
[Zeppelin]: https://zeppelin.solutions
56+
[API docs]: https://docs.openzeppelin.com/contracts/api/token/erc20
57+
[guides]: https://docs.openzeppelin.com/contracts
58+
[API Stability]: https://docs.openzeppelin.com/contracts/api-stability
59+
[forum]: https://forum.openzeppelin.com
60+
[OpenZeppelin]: https://openzeppelin.com
6061
[contribution guide]: CONTRIBUTING.md
6162
[Truffle]: https://truffleframework.com/docs/truffle/quickstart
6263
[Embark]: https://embark.status.im/docs/quick_start.html

RELEASING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This document describes our release process, and contains the steps to be followed by an OpenZeppelin maintainer at the several stages of a release.
44

5-
We release a new version of OpenZeppelin monthly. Release cycles are tracked in the [issue milestones](https://github.com/OpenZeppelin/openzeppelin-solidity/milestones).
5+
We release a new version of OpenZeppelin monthly. Release cycles are tracked in the [issue milestones](https://github.com/OpenZeppelin/openzeppelin-contracts/milestones).
66

77
Each release has at least one release candidate published first, intended for community review and any critical fixes that may come out of it. At the moment we leave 1 week between the first release candidate and the final release.
88

@@ -32,7 +32,7 @@ git push upstream release-vX.Y.Z
3232
git push upstream vX.Y.Z-rc.R
3333
```
3434

35-
Draft the release notes in our [GitHub releases](https://github.com/OpenZeppelin/openzeppelin-solidity/releases). Make sure to mark it as a pre-release! Try to be consistent with our previous release notes in the title and format of the text. Release candidates don't need a detailed changelog, but make sure to include a link to GitHub's compare page.
35+
Draft the release notes in our [GitHub releases](https://github.com/OpenZeppelin/openzeppelin-contracts/releases). Make sure to mark it as a pre-release! Try to be consistent with our previous release notes in the title and format of the text. Release candidates don't need a detailed changelog, but make sure to include a link to GitHub's compare page.
3636

3737
Once the CI run for the new tag is green, publish on npm under the `next` tag. You should see the contracts compile automatically.
3838

@@ -76,7 +76,7 @@ Publish the release notes on GitHub and ask our community manager to announce th
7676
Delete the `next` tag in the npm package as there is no longer a release candidate.
7777

7878
```
79-
npm dist-tag rm --otp $2FA_CODE openzeppelin-solidity next
79+
npm dist-tag rm --otp $2FA_CODE @openzeppelin/contracts next
8080
```
8181

8282
## Merging the release branch

contracts/access/README.adoc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
= Access
2+
3+
NOTE: This page is incomplete. We're working to improve it for the next release. Stay tuned!
4+
5+
== Library
6+
7+
{{Roles}}
8+
9+
== Roles
10+
11+
{{CapperRole}}
12+
13+
{{MinterRole}}
14+
15+
{{PauserRole}}
16+
17+
{{SignerRole}}
18+
19+
{{WhitelistAdminRole}}
20+
21+
{{WhitelistedRole}}

contracts/access/README.md

-9
This file was deleted.

contracts/crowdsale/README.adoc

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
= Crowdsales
2+
3+
NOTE: This page is incomplete. We're working to improve it for the next release. Stay tuned!
4+
5+
== Core
6+
7+
{{Crowdsale}}
8+
9+
== Emission
10+
11+
{{AllowanceCrowdsale}}
12+
13+
{{MintedCrowdsale}}
14+
15+
== Validation
16+
17+
{{CappedCrowdsale}}
18+
19+
{{IndividuallyCappedCrowdsale}}
20+
21+
{{PausableCrowdsale}}
22+
23+
{{TimedCrowdsale}}
24+
25+
{{WhitelistCrowdsale}}
26+
27+
== Distribution
28+
29+
{{FinalizableCrowdsale}}
30+
31+
{{PostDeliveryCrowdsale}}
32+
33+
{{RefundableCrowdsale}}
34+
35+
{{RefundablePostDeliveryCrowdsale}}

contracts/crowdsale/README.md

-13
This file was deleted.

contracts/cryptography/ECDSA.sol

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ library ECDSA {
1515
* this function rejects them by requiring the `s` value to be in the lower
1616
* half order, and the `v` value to be either 27 or 28.
1717
*
18-
* (.note) This call _does not revert_ if the signature is invalid, or
18+
* NOTE: This call _does not revert_ if the signature is invalid, or
1919
* if the signer is otherwise unable to be retrieved. In those scenarios,
2020
* the zero address is returned.
2121
*
22-
* (.warning) `hash` _must_ be the result of a hash operation for the
22+
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
2323
* verification to be secure: it is possible to craft signatures that
2424
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
2525
* this is by receiving a hash of the original message (which may otherwise)
26-
* be too long), and then calling `toEthSignedMessageHash` on it.
26+
* be too long), and then calling {toEthSignedMessageHash} on it.
2727
*/
2828
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
2929
// Check the signature length
@@ -69,10 +69,10 @@ library ECDSA {
6969
/**
7070
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
7171
* replicates the behavior of the
72-
* [`eth_sign`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign)
72+
* https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`]
7373
* JSON-RPC method.
7474
*
75-
* See `recover`.
75+
* See {recover}.
7676
*/
7777
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
7878
// 32 is the length in bytes of hash,
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
---
2-
sections:
3-
- title: Libraries
4-
contracts:
5-
- ECDSA
6-
- MerkleProof
7-
---
1+
= Cryptography
82

93
This collection of libraries provides simple and safe ways to use different cryptographic primitives.
4+
5+
== Libraries
6+
7+
{{ECDSA}}
8+
9+
{{MerkleProof}}

contracts/drafts/Counters.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import "../math/SafeMath.sol";
99
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
1010
*
1111
* Include with `using Counters for Counters.Counter;`
12-
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the SafeMath
12+
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
1313
* overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
1414
* directly accessed.
1515
*/

contracts/drafts/ERC1046/ERC20Metadata.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "../../token/ERC20/IERC20.sol";
55
/**
66
* @title ERC-1047 Token Metadata
77
* @dev See https://eips.ethereum.org/EIPS/eip-1046
8-
* @dev tokenURI must respond with a URI that implements https://eips.ethereum.org/EIPS/eip-1047
8+
* @dev {tokenURI} must respond with a URI that implements https://eips.ethereum.org/EIPS/eip-1047
99
*/
1010
contract ERC20Metadata {
1111
string private _tokenURI;

contracts/drafts/ERC20Migrator.sol

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import "../math/Math.sol";
1414
* migration to the new token contract. In this way, token holders "turn in"
1515
* their old balance and will be minted an equal amount in the new token.
1616
* The new token contract must be mintable. For the precise interface refer to
17-
* OpenZeppelin's ERC20Mintable, but the only functions that are needed are
18-
* `isMinter(address)` and `mint(address, amount)`. The migrator will check
17+
* OpenZeppelin's {ERC20Mintable}, but the only functions that are needed are
18+
* {MinterRole-isMinter} and {ERC20Mintable-mint}. The migrator will check
1919
* that it is a minter for the token.
2020
* The balance from the legacy token will be transferred to the migrator, as it
2121
* is migrated, and remain there forever.
@@ -24,6 +24,7 @@ import "../math/Math.sol";
2424
* version of it using ZeppelinOS. To read more about how this can be done
2525
* using this implementation, please follow the official documentation site of
2626
* ZeppelinOS: https://docs.zeppelinos.org/docs/erc20_onboarding.html
27+
*
2728
* Example of usage:
2829
* ```
2930
* const migrator = await ERC20Migrator.new(legacyToken.address);

0 commit comments

Comments
 (0)