-
Notifications
You must be signed in to change notification settings - Fork 230
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
feat: add tag logic #168
feat: add tag logic #168
Conversation
WalkthroughWalkthroughThe recent updates to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ZetaXPContract as Contract
User->>Contract: Mint NFT with tag
alt Tag already held
Contract-->>User: Revert with TagAlreadyHoldByUser error
else Tag not held
Contract-->>User: Mint successful
end
User->>Contract: Update NFT with tag
alt Tag already held
Contract-->>User: Revert with TagAlreadyHoldByUser error
else Tag not held
Contract-->>User: Update successful
end
User->>Contract: Query NFTs by tag
Contract-->>User: Return NFTs associated with tag
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/zevm-app-contracts/contracts/xp-nft/xpNFT.sol (4 hunks)
- packages/zevm-app-contracts/test/xp-nft/xp-nft.ts (2 hunks)
Additional comments not posted (6)
packages/zevm-app-contracts/contracts/xp-nft/xpNFT.sol (4)
26-26
: MappingtokenByUserTag
is well-implemented.The addition of
tokenByUserTag
efficiently tracks tokens associated with specific tags for each user, aligning with the PR objectives.
44-44
: ErrorTagAlreadyHoldByUser
is appropriately introduced.The error ensures that users cannot mint or update NFTs with tags they already hold, maintaining data integrity.
136-136
:mintNFT
function correctly enforces unique tags.The check for existing tags before minting ensures that users cannot hold multiple tokens with the same tag.
148-148
:updateNFT
function correctly validates tag ownership.The function ensures that only tokens with the correct tag can be updated, preventing unauthorized changes.
packages/zevm-app-contracts/test/xp-nft/xp-nft.ts (2)
258-293
: Test case for tag uniqueness is well-implemented.The test ensures that the contract correctly reverts when a user tries to mint an NFT with a tag they already hold.
295-316
: Test case for querying by tag and user is well-implemented.The test confirms that NFTs are correctly associated with their tags and users, validating the
tokenByUserTag
mapping.
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.
utACK
Summary
Summary by CodeRabbit
New Features
Bug Fixes
Tests