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 preset #810

Merged
merged 17 commits into from
Nov 21, 2023
Merged

Conversation

andrew-fleming
Copy link
Collaborator

@andrew-fleming andrew-fleming commented Nov 3, 2023

Fixes (partial) #804.

PR Checklist

  • Tests
  • Tried the feature on a public network (deploy tx)
  • Documentation

Copy link
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

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

Looking great Andrew! After settling on how to approach documenting these presets, I think is good to go.

docs/modules/ROOT/pages/erc20.adoc Outdated Show resolved Hide resolved
Copy link
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

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

Looking good! We still need to add the class_hash table somehow in the docs, but I think we can merge this PR and tackle that in another one, because that one is going to take some time no design and back and forth, and having these PRs staled is not necessary imo.

@andrew-fleming
Copy link
Collaborator Author

Looking good! We still need to add the class_hash table somehow in the docs, but I think we can merge this PR and tackle that in another one, because that one is going to take some time no design and back and forth, and having these PRs staled is not necessary imo.

That we do. Yeah, agreed on not stalling all the PRs

docs/modules/ROOT/pages/api/erc20.adoc Outdated Show resolved Hide resolved
src/tests/token/test_erc20.cairo Outdated Show resolved Hide resolved
@@ -147,7 +147,7 @@ fn test__approve_from_zero() {
fn test__approve_to_zero() {
let mut state = setup();
testing::set_caller_address(OWNER());
state.erc20._approve(OWNER(), Zeroable::zero(), VALUE);
state.erc20._approve(OWNER(), ZERO(), VALUE);
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we have ZERO() instead of using Zeroable::zero()?

Copy link
Member

Choose a reason for hiding this comment

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

IMO shorter and easier to read and follow (is not the same to ctrl+f Zeroable::zero that is used for everything zeroable, than to look for the ZERO() constant)

Copy link
Contributor

@martriay martriay Nov 10, 2023

Choose a reason for hiding this comment

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

we could simply use zero() from Zeroable if it's a matter of length. I don't see much value in it and the fact that it's used for everything zero (address, uint, etc) is not a problem to me. Otoh I don't think it's that important, even though I prefer minimalism and only adding something if it's really needed, there's no problem with ZERO() either.

@martriay martriay linked an issue Nov 10, 2023 that may be closed by this pull request
@andrew-fleming andrew-fleming merged commit 7a7be63 into OpenZeppelin:main Nov 21, 2023
4 checks passed
@andrew-fleming andrew-fleming deleted the add-erc20-preset branch November 21, 2023 21:27
martriay added a commit that referenced this pull request Nov 24, 2023
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.

Add vanilla presets
3 participants