Cairo: Use Contracts for Cairo v0.12.0, add ERC20Votes#355
Cairo: Use Contracts for Cairo v0.12.0, add ERC20Votes#355ericglau merged 26 commits intoOpenZeppelin:masterfrom
Conversation
ericnordelo
left a comment
There was a problem hiding this comment.
Looking good! I Left a couple of comments.
packages/core-cairo/src/erc20.ts
Outdated
| args: [], | ||
| returns: 'felt252', | ||
| code: [ | ||
| "'DAPP_NAME'" |
There was a problem hiding this comment.
Users should be able to set this and DAPP_VERSION as inputs.
There was a problem hiding this comment.
Changed it to use the contract name as the name, and added a separate version input.
Let me know if you think there is a need to allow a different name (i.e. a separate name input specifically for SNIP12) than the contract name.
packages/core-cairo/src/erc20.ts
Outdated
| requireAccessControl(c, externalTrait, functions.mint, access, 'MINTER', 'minter'); | ||
| } | ||
|
|
||
| function addVotes(c: ContractBuilder) { |
There was a problem hiding this comment.
The order of the embedded implementations changes when the Mintable option is toggled. Not a big deal, but it would be nice to maintain the consistency when using the same components.
There was a problem hiding this comment.
Can you share an example of which embedded impls you are referring to?
There was a problem hiding this comment.
Added sorting of implemented traits, first by number of tags, then by name.
There was a problem hiding this comment.
Looking good, Eric! I have a suggestion 😅
Now that we have hooks, I'm thinking that we can embed ERC20MixinImpl with pausable enabled and add assert_not_paused in the before_update hook.
This will change the behavior from past Cairo wizard iterations because approvals will be able to go through when paused. Do note that the extension in Solidity also allows approvals when paused. As an added bonus if we agree on the change, the code will be much cleaner. What do you guys think? @ericglau @ericnordelo
|
@andrew-fleming That sounds good to me! However, I would prefer for that to be in a separate PR, and perhaps (depending on timing) it may make sense to do this when hooks are available for the other contract kinds. I think the current PR is an improvement over the current state (and enables 0.12.0) and therefore makes sense on its own. |
Sounds good on all accounts! |
|
@ericnordelo @andrew-fleming I've added SNIP12-specific options as "Application Name" and "Application Version", and added checks to ensure these are not empty string. This PR is ready for re-review. |
ericnordelo
left a comment
There was a problem hiding this comment.
Looking good Eric! One small detail, I think we could move SNIP12MetadataImpl above the ERC20HooksTraitImpl just for visibility.
Uh oh!
There was an error while loading. Please reload this page.