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 ERC721EnumerableComponent extension #983

Merged
merged 83 commits into from
Aug 29, 2024

Conversation

andrew-fleming
Copy link
Collaborator

@andrew-fleming andrew-fleming commented Apr 30, 2024

Fixes #722.

Deps:

PR Checklist

  • Tests
  • Documentation
  • Added entry to CHANGELOG.md
  • Tried the feature on a public network

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.

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);
Copy link
Member

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?

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! Left some comments mostly on the docs.

docs/modules/ROOT/pages/api/erc721.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/erc721.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/erc721.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/erc721.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/erc721.adoc Outdated Show resolved Hide resolved
packages/token/src/tests/erc721.cairo Outdated Show resolved Hide resolved
packages/token/src/tests/erc721.cairo 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.

We are very close @andrew-fleming. I left a suggestion for consistency.

docs/modules/ROOT/pages/api/erc721.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/erc721.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.

Great job! LGTM.

Copy link
Collaborator

@immrsd immrsd left a 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);
Copy link
Collaborator

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?

Copy link
Collaborator Author

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);
            ^***************************************^

@immrsd immrsd self-requested a review August 29, 2024 17:02
Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com>
@andrew-fleming andrew-fleming merged commit b15525e into OpenZeppelin:main Aug 29, 2024
6 checks passed
@andrew-fleming andrew-fleming deleted the erc721-enum branch August 29, 2024 18:38
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.

Migrate ERC721 Enumerate extension
3 participants