Closed skosito closed 2 months ago
The recent changes to the ZetaConnectorNonNative
contract primarily focus on implementing a maximum supply mechanism for token minting. This enhancement includes the introduction of a maxSupply
variable, an event for tracking updates, and error handling for oversupply scenarios. The modifications strengthen the contract's operational integrity, ensuring that any minting attempts exceeding the specified limit are effectively prevented and logged.
Files | Change Summaries |
---|---|
contracts/prototypes/evm/ZetaConnectorNonNative.sol |
Introduced maxSupply variable; added MaxSupplyUpdated event and ExceedsMaxSupply error; implemented setMaxSupply function; modified withdrawal functions to check against maxSupply . |
testFoundry/ZetaConnectorNonNative.t.sol |
Added tests for new maximum supply constraints, including scenarios for withdrawal failures when max supply is reached and asserting expected events/errors during these operations. |
testFoundry/GatewayEVM.t.sol |
Allocated 1 ether to tssAddress in test setup to ensure sufficient balance for operations. |
testFoundry/ZetaConnectorNative.t.sol |
Similar allocation of 1 ether to tssAddress in testMint function to prepare for minting operations. |
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
Objective | Addressed | Explanation |
---|---|---|
Implement safety mechanism for ZetaConnector v2 (#236) | ✅ | |
Minting cap | ✅ |
🐇 In the meadow where bunnies play,
New limits on tokens brighten the day!
With max supply set, we hop with glee,
No more excess, just harmony!
Events will ring, and errors will cheer,
A safer contract, for all to revere! 🌼
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?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 61.40%. Comparing base (
9b5ff23
) to head (9c33fdb
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
closes #236
Summary by CodeRabbit
New Features
Bug Fixes
Tests