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 ERC1155 #896

Merged
merged 33 commits into from
Feb 29, 2024
Merged

Add ERC1155 #896

merged 33 commits into from
Feb 29, 2024

Conversation

ericnordelo
Copy link
Member

@ericnordelo ericnordelo commented Feb 5, 2024

Fixes #572

PR Checklist

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

@cloudvenger
Copy link
Contributor

hey @ericnordelo do not hesitate to ask me for the review if needed. Let me know when I can start it 👍

Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

Good job @cloudvenger and @ericnordelo! I think it's ok to leave the docs for a different PR to avoid a gigantic one, but do need to add more tests, especially for the new ERC1155 preset.

src/tests/mocks.cairo Show resolved Hide resolved
src/tests/mocks/account_mocks.cairo Outdated Show resolved Hide resolved
src/tests/utils.cairo Outdated Show resolved Hide resolved
src/presets/erc1155.cairo Show resolved Hide resolved
src/presets/erc1155.cairo Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/tests/token/test_dual1155_receiver.cairo Outdated Show resolved Hide resolved
src/tests/token/test_dual1155_receiver.cairo Outdated Show resolved Hide resolved
@ericnordelo
Copy link
Member Author

I did finish testing the ERC1155 component. Tomorrow I will check the dual case and the preset test modules.

Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

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

Great work, @cloudvenger @ericnordelo! I left some feedback :)

src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/tests/token/test_erc1155.cairo Outdated Show resolved Hide resolved
src/tests/token/test_erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/dual1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/dual1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/interface.cairo Outdated Show resolved Hide resolved
@andrew-fleming
Copy link
Collaborator

Tomorrow I will check the dual case and the preset test modules.

@ericnordelo whoops, just saw this^. Don't mind my dual case comments 😅

src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Show resolved Hide resolved
Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

we're almost there! not sure if we should be adding a mixin now or in another PR

src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
}

#[test]
fn test_update_wac_from_zero_to_non_zero_camel_receiver() {
Copy link
Contributor

Choose a reason for hiding this comment

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

wac sounds like guac to me
image

Copy link
Member Author

Choose a reason for hiding this comment

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

:)

Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

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

Improvements look great, Eric! I left a few minor suggestions and comments, but this looks just about ready to me

src/tests/mocks/erc1155_receiver_mocks.cairo Outdated Show resolved Hide resolved
src/tests/token/test_dual1155_receiver.cairo Outdated Show resolved Hide resolved
src/tests/utils.cairo Outdated Show resolved Hide resolved
src/tests/token/test_dual1155.cairo Outdated Show resolved Hide resolved
src/token/erc1155/erc1155.cairo Outdated Show resolved Hide resolved
src/tests/token/test_erc1155.cairo Outdated Show resolved Hide resolved
src/tests/token/test_erc1155.cairo Outdated Show resolved Hide resolved
Comment on lines +3 to +9
use openzeppelin::tests::token::test_erc1155::{
assert_only_event_transfer_single, assert_only_event_transfer_batch,
assert_only_event_approval_for_all
};
use openzeppelin::tests::token::test_erc1155::{
setup_account, setup_receiver, setup_camel_receiver, setup_account_with_salt, setup_src5
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if it'd make sense to create more granular utils for tests. setup_account, for example, can be useful in a a few test modules. Just a thought for the future

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that's probably worth it, yes

src/tests/presets/test_erc1155.cairo Outdated Show resolved Hide resolved
Copy link
Contributor

@martriay martriay 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 to me!

src/account/interface.cairo Outdated Show resolved Hide resolved
Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

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

LGTM!

@ericnordelo ericnordelo merged commit ca11b87 into OpenZeppelin:main Feb 29, 2024
5 checks passed
@ericnordelo ericnordelo deleted the feat/erc1155-#572 branch February 29, 2024 13:58
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 erc1155 contracts
5 participants