-
Notifications
You must be signed in to change notification settings - Fork 568
[BLD-71] SDK, Dashboard: Fix Supplies shown in ERC721 contract #7803
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
[BLD-71] SDK, Dashboard: Fix Supplies shown in ERC721 contract #7803
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: fd4414b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThe changes update the logic for calculating claimed and unclaimed NFT supply in ERC721 extensions and the dashboard UI. The new approach incorporates the Changes
Sequence Diagram(s)sequenceDiagram
participant DashboardUI
participant ERC721Extension
participant Contract
DashboardUI->>ERC721Extension: getTotalSupply()
ERC721Extension->>Contract: read getTotalSupply
Contract-->>ERC721Extension: totalSupply
DashboardUI->>ERC721Extension: getTotalClaimedSupply()
ERC721Extension->>Contract: read startTokenId
ERC721Extension->>Contract: read nextTokenIdToClaim
Contract-->>ERC721Extension: startTokenId, nextTokenIdToClaim
ERC721Extension-->>DashboardUI: nextTokenIdToClaim - startTokenId
DashboardUI->>ERC721Extension: getTotalUnclaimedSupply()
ERC721Extension->>Contract: read startTokenId
ERC721Extension->>Contract: read nextTokenIdToMint
ERC721Extension->>ERC721Extension: getTotalClaimedSupply()
Contract-->>ERC721Extension: startTokenId, nextTokenIdToMint
ERC721Extension-->>DashboardUI: nextTokenIdToMint - startTokenId - totalClaimedSupply
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
size-limit report 📦
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7803 +/- ##
=======================================
Coverage 56.34% 56.34%
=======================================
Files 905 905
Lines 58788 58796 +8
Branches 4141 4142 +1
=======================================
+ Hits 33122 33130 +8
Misses 25561 25561
Partials 105 105
🚀 New features to boost your workflow:
|
Merge activity
|
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR updates the `getTotalClaimedSupply` and `getTotalUnclaimedSupply` functions in the ERC721 extensions to account for `startTokenId`, improving the accuracy of token supply calculations. ### Detailed summary - Modified `getTotalClaimedSupply` to subtract `startTokenId` from `nextTokenIdToClaim`. - Updated `getTotalUnclaimedSupply` to subtract `startTokenId` and `totalClaimedSupply` from `nextTokenIdToMint`. - Changed imports in `supply-cards.tsx` to use the new supply functions. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved supply calculations in NFT dashboards by directly using contract data instead of manual computations. * Adjusted logic to accurately account for token ID offsets when displaying claimed and unclaimed NFT supply. * **Bug Fixes** * Resolved inconsistencies in claimed and unclaimed NFT supply values when contracts use a custom starting token ID. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
0b1793b
to
fd4414b
Compare
PR-Codex overview
This PR updates the
getTotalClaimedSupply
andgetTotalUnclaimedSupply
functions in the ERC721 extensions to account for thestartTokenId
if it is set in the contract, enhancing the accuracy of token supply calculations.Detailed summary
getTotalClaimedSupply
to subtractstartTokenId
fromnextTokenIdToClaim
.getTotalUnclaimedSupply
to subtract bothstartTokenId
andtotalClaimedSupply
fromnextTokenIdToMint
.SupplyCards
component to use the new supply calculation methods.Summary by CodeRabbit
Refactor
Bug Fixes