Skip to content

Consolidated ERC20 Interface and Implementation Files#1125

Merged
frangio merged 9 commits into
OpenZeppelin:masterfrom
dougiebuckets:consolidate-ERC20-interfaces-and-implementation-files-#1098
Aug 3, 2018
Merged

Consolidated ERC20 Interface and Implementation Files#1125
frangio merged 9 commits into
OpenZeppelin:masterfrom
dougiebuckets:consolidate-ERC20-interfaces-and-implementation-files-#1098

Conversation

@dougiebuckets

Copy link
Copy Markdown
Contributor

Fixes #1098

🚀 Description

Went ahead and consolidated ERC20 interfaces and implementation files in an effort to simply OZ's contract offerings for developer/user experience purposes.

  • 📘 I've reviewed the OpenZeppelin Contributor Guidelines
  • ✅ I've successfully run and passed all tests
  • 📖 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).

@nventuro nventuro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work @dougiebuckets, thanks! There's some minor stuff that needs to be addressed before merging, but this is in quite a good place!

Also, looks like some tests (like CanReclaimToken's) use BasicTokenMock: we should migrate them to use StandardTokenMock.

* @dev Adds burnFrom method to ERC20 implementations
*/
contract StandardBurnableToken is BurnableToken, StandardToken {
contract StandardBurnableToken is StandardToken, BurnableToken {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since BurnableToken now inherits from StandardToken (and therefore has the allowed state variable, shouldn't we merge this contract with BurnableToken`?

Comment thread contracts/token/ERC20/TokenTimelock.sol Outdated

// ERC20 basic token contract being held
ERC20Basic public token;
StandardToken public token;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this (and all other references to the type in this contract) be an ERC20?

const { assertRevert } = require('../../helpers/assertRevert');
const BasicToken = artifacts.require('BasicTokenMock');

contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't delete the BasicToken tests, rather, they should be added to the StandardToken test suite.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(don't be confused by the fact that this test was wrongly named StandardToken)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nventuro Thanks for the feedback! Now that BasicToken has been merged w/ StandardToken, I went through BasicToken.test.js and noticed the exact same units tests are already in StandardToken.test.js.

Am I missing something?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you're right, I didn't notice the tests were the same. Thanks for removing that code duplication :)

@nventuro

Copy link
Copy Markdown
Contributor

By the way, please try to address review comments by committing on top of your branch instead of rebasing: that way, it's much easier for us to figure out what changed in each commit. Thanks :)

@nventuro nventuro added kind:improvement contracts Smart contract code. breaking change Changes that break backwards compatibility of the public API. labels Jul 27, 2018
@nventuro nventuro added this to the v2.0 milestone Jul 27, 2018
@nventuro nventuro self-assigned this Jul 28, 2018
Comment thread contracts/token/ERC20/TokenTimelock.sol Outdated

constructor(
ERC20Basic _token,
StandardToken _token,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed this one :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! ty

@nventuro nventuro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo, this looks almost ready to merge!

I think we're not getting a Travis build due to the merge conflict with master, could you address that? Thanks!

@dougiebuckets dougiebuckets force-pushed the consolidate-ERC20-interfaces-and-implementation-files-#1098 branch 5 times, most recently from 34bd333 to 57fb04e Compare July 29, 2018 20:27
@dougiebuckets dougiebuckets force-pushed the consolidate-ERC20-interfaces-and-implementation-files-#1098 branch from 57fb04e to cc0b44e Compare July 29, 2018 20:39
@dougiebuckets

Copy link
Copy Markdown
Contributor Author

@nventuro I'm not sure why I'm still getting this conflict? I've merged my branch w/ master in order to get everything up-to-date (including the updates to HasNoTokens and ReentrancyGuard and I've removed BasicToken.) Any thoughts? Caveat: My git skills could definitely use some work :)

@nventuro

nventuro commented Jul 30, 2018

Copy link
Copy Markdown
Contributor

Looks like you managed to solve it though! Maybe GitHub's UI took a while to update?

There's a small linter error causing the build to fail (you need to add a newline character at the end of BurnableToken.test.js), but other than that this is approved by me. However, since this is a breaking change, I'd like someone else to also review. @frangio care to take a look?

@nventuro nventuro requested a review from frangio July 30, 2018 02:10
frangio
frangio previously approved these changes Aug 1, 2018

@frangio frangio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @dougiebuckets! Thanks!

nventuro
nventuro previously approved these changes Aug 1, 2018
@nventuro

nventuro commented Aug 1, 2018

Copy link
Copy Markdown
Contributor

Awesome! @dougiebuckets let me care of the merge conflicts and we'll merge this, thanks again!

@dougiebuckets

Copy link
Copy Markdown
Contributor Author

Thanks for your help :)

@nventuro nventuro dismissed stale reviews from frangio and themself via ae9ce96 August 2, 2018 21:08

@frangio frangio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@frangio frangio merged commit ef347ff into OpenZeppelin:master Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Changes that break backwards compatibility of the public API. contracts Smart contract code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider removing ERC20Basic and BasicToken

3 participants