-
Notifications
You must be signed in to change notification settings - Fork 61
tests: Add test for erc721 #111
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
Conversation
|
@Otaiki1 Thank you! We recently added tests for ERC20 functionality. Can you please review the tests for the ERC20 functionality and see that your new tests are consistent with them. It looks like you took the same/similar approach which is good. Also please review this new testing documentation for the project: https://github.com/Perfect-Abstractions/Compose/blob/main/test/README.md and make any changes you think are necessary to follow that. |
|
Great work legend! 👏🏼 Can you do following before merging?
|
|
@mudgen , i have made all appropriate changes |
panditdhamdhere
left a comment
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.
Excellent job!
|
Looks good. @adamgall, can you review this pull request? |
Coverage Report
Last updated: Wed, 29 Oct 2025 01:12:46 GMT for commit |
adamgall
left a comment
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 for this PR @Otaiki1! Some feedback:
- We don't need an ERC721-specific README file; you can delete that please.
- this PR is missing harnesses and tests for
LibERC721andLibERC721Enumerable. Please look at the existing test files in this repo for more inspiration and patterns. - ideally could include some tests which include gas benchmarks (confirm some function doesn't use more than
xgas).
|
@adamgall , i have made the specified changes |
|
@Otaiki1 can you please run |
adamgall
left a comment
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.
Just a couple of comments. Also, please run forge fmt. Thank you!
| /// @notice Exposes LibERC721Enumerable.mint as an external function | ||
| /// @dev Note: This fixes the library bug by manually setting ownerOf | ||
| function mint(address _to, uint256 _tokenId) external { | ||
| LibERC721Enumerable.mint(_to, _tokenId); | ||
| // Fix the library bug by manually setting ownerOf | ||
| LibERC721Enumerable.ERC721EnumerableStorage storage s = LibERC721Enumerable.getStorage(); | ||
| s.ownerOf[_tokenId] = _to; | ||
| } |
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.
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.
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.
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.
|
@adamgall , all implemented |
|
@Otaiki1 I think we have some failing tests. I am eager to get this pull request merged. I appreciate your work. |
|
@Otaiki1 bump |
Summary
Added comprehensive Foundry tests for ERC721 implementations covering both basic ERC721Facet and ERC721EnumerableFacet functionality.
Changes Made
test/ERC721/ERC721.t.sol- 34 tests for ERC721Facet covering minting, burning, transfers, approvals, safe transfers, error handling, and eventstest/ERC721/ERC721Enumerable.t.sol- 34 tests for ERC721EnumerableFacet covering enumeration features, token indexing, and complex transfer scenariosownerOfmapping assignment in mint functionChecklist
Before submitting this PR, please ensure:
Code follows the Solidity feature ban - No inheritance, constructors, modifiers, public/private variables, external library functions,
using fordirectives, orselfdestructCode follows Design Principles - Readable, uses diamond storage, favors composition over inheritance
Code matches the codebase style - Consistent formatting, documentation, and patterns (e.g. ERC20Facet.sol)
Code is formatted with
forge fmtTests are included - All new functionality has comprehensive tests
All tests pass - Run
forge testand ensure everything worksDocumentation updated - If applicable, update relevant documentation
Make sure to follow the CONTRIBUTING.md guidelines.
Additional Notes
This PR closes Add foundry tests for the ERC721 implementations #11