Implement a maximum minting cap or require multi-signature approval for bulk mints.#36
Implement a maximum minting cap or require multi-signature approval for bulk mints.#36aniket866 wants to merge 2 commits intoStabilityNexus:mainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe TNT token contract now enforces a configurable maximum supply cap. An admin-only Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
contracts/src/TNT.sol (1)
63-67: Confirm intended “max supply” semantics (lifetime minted vs. active supply).
The check uses_nextTokenId, so revokes/burns won’t free capacity. If you want a cap on circulating supply, track active supply instead and compare that inissueToken.If active-supply cap is the goal, one approach is:
- Add
uint256 public totalSupply;- Increment in
issueToken, decrement inrevokeTokenandburnToken- Check
if (maxSupply > 0 && totalSupply + 1 > maxSupply) revert MaxSupplyReached();Please confirm which behavior you want.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@contracts/src/TNT.sol` around lines 63 - 67, The current maxSupply check in issueToken uses _nextTokenId, so burned/revoked tokens do not free capacity; if you intend maxSupply to limit circulating (active) tokens instead of lifetime-minted tokens, introduce a uint256 public totalSupply, increment totalSupply in issueToken and decrement it in revokeToken and burnToken, and change the guard in issueToken to check if (maxSupply > 0 && totalSupply + 1 > maxSupply) revert MaxSupplyReached(); otherwise confirm you want lifetime-minted semantics and keep the existing _nextTokenId check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@contracts/src/TNT.sol`:
- Around line 59-61: The setter setMaxSupply currently allows lowering maxSupply
below already minted tokens (tracked by _nextTokenId), which can block minting;
update setMaxSupply to require the new _maxSupply is at least the number of
tokens already minted (use _nextTokenId to compute minted count) and revert
otherwise, and emit a MaxSupplyChanged (or MaxSupplyUpdated) event with old and
new values for auditability; add the event declaration (e.g.,
MaxSupplyChanged(uint256 old, uint256 updated)) and use it in setMaxSupply while
preserving the onlyRole(DEFAULT_ADMIN_ROLE) guard.
---
Nitpick comments:
In `@contracts/src/TNT.sol`:
- Around line 63-67: The current maxSupply check in issueToken uses
_nextTokenId, so burned/revoked tokens do not free capacity; if you intend
maxSupply to limit circulating (active) tokens instead of lifetime-minted
tokens, introduce a uint256 public totalSupply, increment totalSupply in
issueToken and decrement it in revokeToken and burnToken, and change the guard
in issueToken to check if (maxSupply > 0 && totalSupply + 1 > maxSupply) revert
MaxSupplyReached(); otherwise confirm you want lifetime-minted semantics and
keep the existing _nextTokenId check.
Addressed Issues:
Closes #35
See issue #35 for more details
Checklist
AI Usage Disclosure
Check one of the checkboxes below:
I have used the following AI models and tools: TODO
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.
@Zahnentferner
Summary by CodeRabbit