-
Notifications
You must be signed in to change notification settings - Fork 138
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
ERC2981 (Royalty Info) for Cairo #413
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look great @immrsd. We should think of a way to group imports together, but that's out of the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @immrsd! Overall, the PR looks good to me. I left a few questions and comments
<RoyaltyInfoSection bind:opts={opts.royaltyInfo} errors={errors} /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The window is getting pretty crowded with all the features. Maybe we should consider doing something like having a dropdown menu that opens when the box is checked for votes and royalty? Outside of this PR's scope though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, we should consider that
On the other hand, the Cairo control panels are still more concise that the Solidity ones and if we decide to go with that approach it may make sense to also apply it to the Solidity version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @immrsd, this looks great! Just a few comments.
export const enabledDefaults: RoyaltyInfoOptions = { | ||
enabled: true, | ||
defaultRoyaltyFraction: '10', | ||
feeDenominator: DEFAULT_FEE_DENOMINATOR.toString() | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is only used in generate/erc{1155,721}.ts
, which has generator functions for testing different possible combinations. In this case:
- rename or add a comment to make it more clear that these values are just for testing
generate/erc{1155,721}.ts
should use an array of the different combinations to test with
For example, define something like the following:
export const enabledDefaults: RoyaltyInfoOptions = { | |
enabled: true, | |
defaultRoyaltyFraction: '10', | |
feeDenominator: DEFAULT_FEE_DENOMINATOR.toString() | |
}; | |
export const testRoyaltyInfoOptions = [ | |
{ | |
enabled: false, | |
defaultRoyaltyFraction: '10', // these should be ignored since enabled is false | |
feeDenominator: DEFAULT_FEE_DENOMINATOR.toString(), | |
}, | |
{ | |
enabled: true, | |
defaultRoyaltyFraction: '100', | |
feeDenominator: DEFAULT_FEE_DENOMINATOR.toString(), | |
}, | |
{ | |
enabled: true, | |
defaultRoyaltyFraction: '10000', | |
feeDenominator: '100000', | |
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this is the desired approach, so I've added 3 different options. The only problem is that now instead of 800 generated contracts we have 2000. That shouldn't be a problem, but as a result Scarb compiler required more than 100 GB of RAM at some point during compilation. I've barely managed to compile all the contracts and it took more than 30 minutes
Scarb compiler is not yet well-optimized and this behaviour shouldn't be normal. We should look into it, it seems that some compilation steps that should be O(1) are in fact O(n). Although, I reckon it shouldn't be in the scope of this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add some tests in packages/core-cairo/src/erc721.test.ts
and packages/core-cairo/src/erc1155.test.ts
so that their snapshots are included.
Can you also bump the version in packages/core-cairo/package.json
?
The rest LGTM, thanks!
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring: Next stepsTake a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with |
Updated the test project
Addressed and added tests for royalty info feature for ERC721 and ERC1155 |
This reverts commit 044c2c7.
@SocketSecurity ignore npm/[email protected] Unrelated to this PR. |
ERC2981
(RoyaltyInfo) toERC721
andERC1155
uint
Cairo types in input fields