-
Notifications
You must be signed in to change notification settings - Fork 342
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 ERC721EnumerableComponent extension #983
Add ERC721EnumerableComponent extension #983
Conversation
…eat/add-hooks-#965
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.
Sorry for the delay @andrew-fleming. I reviewed the component and it looks great. I think we can go ahead with this version (we may use Vec in the future if we find it worth it). I didn't review the documentation and tests yet, but that's on my priorities.
let zero_address = Zero::zero(); | ||
|
||
if previous_owner == zero_address { | ||
PrivateImpl::_add_token_to_all_tokens_enumeration(ref self, token_id); |
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.
Can't we use self instead of PrivateImpl here?
packages/token/src/erc721/extensions/erc721_enumerable/erc721_enumerable.cairo
Outdated
Show resolved
Hide resolved
packages/token/src/erc721/extensions/erc721_enumerable/erc721_enumerable.cairo
Show resolved
Hide resolved
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.
Looking great Andrew! Left some comments mostly on the docs.
packages/token/src/erc721/extensions/erc721_enumerable/erc721_enumerable.cairo
Show resolved
Hide resolved
Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com>
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.
We are very close @andrew-fleming. I left a suggestion for consistency.
packages/token/src/erc721/extensions/erc721_enumerable/erc721_enumerable.cairo
Show resolved
Hide resolved
Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com>
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.
Great job! LGTM.
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.
Looks good
auth: ContractAddress | ||
) { | ||
let mut contract_state = ERC721Component::HasComponent::get_contract_mut(ref self); | ||
contract_state.erc721_enumerable.before_update(to, token_id); |
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.
Could you check if self.get_contract_mut().erc721_enumerable.before_update(to, token_id);
will do the job?
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 compiler yells that the ref arg must be a variable. Keeping it in one line would be much better though
error: ref argument must be a variable.
self.get_contract_mut().erc721_enumerable.before_update(to, token_id);
^***************************************^
Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>
Fixes #722.
Deps:
PR Checklist