Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ERC20 and ERC777 fixed supply presets #2377 #2399

Merged

Conversation

ashwinYardi
Copy link
Contributor

Open issue: #2377

Additions #

  1. Added ERC20 preset contract with with fixed initial supply.
  2. Added ERC777 preset contract with fixed initial supply.
  3. Added tests for both the presets.

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

Thanks @ashwinYardi!

contracts/presets/ERC20PresetFixedSupply.sol Outdated Show resolved Hide resolved
test/presets/ERC777PresetFixedSupply.js Outdated Show resolved Hide resolved
contracts/presets/ERC20PresetFixedSupply.sol Outdated Show resolved Hide resolved
test/presets/ERC777PresetFixedSupply.js Outdated Show resolved Hide resolved
@ashwinYardi ashwinYardi force-pushed the feature/presets-erc20-erc777-#2377 branch from c76503e to 8e40673 Compare November 12, 2020 07:19
@stale
Copy link

stale bot commented Nov 28, 2020

Hi all!
This Pull Request has not had any recent activity, is it still relevant? If so, what is blocking it? Is there anything we can do to help move it forward?
Thanks!

@stale stale bot added the stale label Nov 28, 2020
@ashwinYardi
Copy link
Contributor Author

@frangio @Skyge Some info about the testcases included:

Since the base contracts used in above presets, already have a full fledged test cases to cover the entire behavior, Only bare minimum test cases which help in establishing the high level behavior of preset contracts have been added. Again, I referred to test cases written for already added presets and it made sense to proceed this way.

Thanks and please let me know if there is anything missing or needs to be corrected, would be happy to do it immediately so that we can get this meged! ( PS. Sorry for not mentioning this info about testcases on PR's description ).

@stale stale bot removed the stale label Nov 29, 2020
@frangio frangio changed the title add erc20 and erc777 presets #2377 Add ERC20 and ERC777 fixed supply presets #2377 Dec 1, 2020
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

@ashwinYardi Sorry for taking so long to come back to this!

Thank you for explaining the rationale for what to test. I didn't remember the other presets followed the same approach to testing.

I'd like to see a few more changes in the tests before we merge this:

  • Remove the context and describe "wrappers", since they don't serve any purpose here.
  • Remove tests that we can assume correct from the base ERC777 contract:
    • returns a granularity of 1
    • returns 18 when decimals is called
  • ERC20: add a test for the total supply

I also think the documentation needs a little bit of work. But this is something we can do if you prefer. If you'd like to take a stab at it you can take a look at the docs comments for the existing presets and follow a similar format. The docs for the constructor are missing too.

In order for the presets to show in the site, you need to add their names in contracts/presets/README.adoc.

@ashwinYardi
Copy link
Contributor Author

Hi @frangio ! Thanks a lot for the feedback.

  • Removed the unused context and describe "wrappers"
  • Removed the suggested tests that can be assumed correct from base implementation
  • Added a test for total supply in ERC20 preset
  • Added a test for decrementing the total supply when tokens are burnt in ERC20 preset
  • Gave a shot at improving documentation
  • Added required entries in contracts/presets/README.adoc

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

Great work @ashwinYardi! I made a few small changes to the docs, added a changelog entry, and I realized I prefer to keep the defaultOperators argument in the same place as the ERC777 constructor so I changed that as well.

@frangio frangio merged commit 883116e into OpenZeppelin:master Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants