-
Notifications
You must be signed in to change notification settings - Fork 64
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: connector native minting cap #248
Conversation
WalkthroughThe recent changes to the Changes
Sequence Diagram(s)sequenceDiagram
participant TSS as Trusted Service Supplier
participant Contract as ZetaConnectorNonNative
participant User as User
User->>TSS: Request minting
TSS->>Contract: Check maxSupply
alt Sufficient supply available
Contract-->>TSS: Proceed with minting
TSS-->>User: Tokens minted successfully
else Max supply reached
Contract-->>TSS: Revert with ExceedsMaxSupply
TSS-->>User: Minting failed
end
Assessment against linked issues
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 (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #248 +/- ##
==========================================
+ Coverage 60.91% 61.40% +0.48%
==========================================
Files 16 16
Lines 394 399 +5
Branches 103 106 +3
==========================================
+ Hits 240 245 +5
Misses 154 154 ☔ View full report in Codecov by Sentry. |
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.yaml
Review profile: CHILL
Files ignored due to path filters (3)
pkg/contracts/prototypes/evm/zetaconnectornonnative.sol/zetaconnectornonnative.go
is excluded by!pkg/**
typechain-types/contracts/prototypes/evm/ZetaConnectorNonNative.ts
is excluded by!typechain-types/**
typechain-types/factories/contracts/prototypes/evm/ZetaConnectorNonNative__factory.ts
is excluded by!typechain-types/**
Files selected for processing (4)
- contracts/prototypes/evm/ZetaConnectorNonNative.sol (3 hunks)
- testFoundry/GatewayEVM.t.sol (1 hunks)
- testFoundry/ZetaConnectorNative.t.sol (1 hunks)
- testFoundry/ZetaConnectorNonNative.t.sol (6 hunks)
Additional context used
Path-based instructions (1)
contracts/prototypes/evm/ZetaConnectorNonNative.sol (1)
Pattern
contracts/**
: Review the Solidity contracts for security vulnerabilities and best practices.
Additional comments not posted (13)
contracts/prototypes/evm/ZetaConnectorNonNative.sol (7)
10-10
: Addition ofmaxSupply
variable approved.The
maxSupply
variable is appropriately initialized to the maximum value foruint256
, ensuring the cap is effectively unlimited until explicitly set.
14-14
: Addition ofMaxSupplyUpdated
event approved.The
MaxSupplyUpdated
event provides necessary transparency and traceability for changes to the minting limit.
15-15
: Addition ofExceedsMaxSupply
error approved.The
ExceedsMaxSupply
error is crucial for enforcing constraints on the token supply.
24-27
:setMaxSupply
function approved.The function correctly sets the new maximum supply and emits the
MaxSupplyUpdated
event. However, the parameter_maxSupply
should be renamed tomaxSupply
to conform to Solidity naming conventions.- function setMaxSupply(uint256 _maxSupply) external onlyTSS() { - maxSupply = _maxSupply; - emit MaxSupplyUpdated(_maxSupply); + function setMaxSupply(uint256 maxSupply) external onlyTSS() { + maxSupply = maxSupply; + emit MaxSupplyUpdated(maxSupply);
31-31
: Modification towithdraw
function approved.The addition of the check against
maxSupply
ensures that the function adheres to the maximum supply constraint.
39-39
: Modification towithdrawAndCall
function approved.The addition of the check against
maxSupply
ensures that the function adheres to the maximum supply constraint.
52-52
: Modification towithdrawAndRevert
function approved.The addition of the check against
maxSupply
ensures that the function adheres to the maximum supply constraint.testFoundry/ZetaConnectorNative.t.sol (1)
60-60
: Addition ofvm.deal(tssAddress, 1 ether);
approved.This change ensures that the
tssAddress
has a sufficient balance to interact with the contract, enhancing the test setup.testFoundry/ZetaConnectorNonNative.t.sol (4)
35-36
: Addition ofExceedsMaxSupply
error andMaxSupplyUpdated
event approved.These additions are crucial for enforcing supply limits and providing transparency for changes to the minting limit.
84-99
: Addition oftestWithdrawFailsIfMaxSupplyReached
function approved.This test ensures that the
withdraw
function adheres to the maximum supply constraint, enhancing the contract's robustness.
155-169
: Addition oftestWithdrawAndCallReceiveERC20FailsIfMaxSupplyReached
function approved.This test ensures that the
withdrawAndCall
function adheres to the maximum supply constraint, enhancing the contract's robustness.
288-302
: Addition oftestWithdrawAndRevertFailsIfMaxSupplyReached
function approved.This test ensures that the
withdrawAndRevert
function adheres to the maximum supply constraint, enhancing the contract's robustness.testFoundry/GatewayEVM.t.sol (1)
61-62
: LGTM! The change enhances the test setup.The addition of
vm.deal(tssAddress, 1 ether);
ensures that thetssAddress
has sufficient ether for subsequent operations, improving the robustness of the test setup.
closes #236
Summary by CodeRabbit
New Features
Bug Fixes
Tests