Problem
ticket/src/lib.rs exposes mint_ticket and a tickets_sold counter, but there is no maximum supply: mint_ticket can be called indefinitely and tickets_sold only counts upward. For an event-ticketing contract, an uncapped supply means an organizer (or a bug) can mint beyond the intended allocation, and downstream consumers have no on-chain guarantee of scarcity.
What needs to be done
- Add a maximum-supply parameter set at
initialize (stored in instance storage).
- Enforce it in
mint_ticket: reject minting once tickets_sold reaches the maximum, returning a typed Error (add a "sold out"/"supply exceeded" variant).
- Add a read-only getter for the configured maximum and the remaining supply.
- Extend the instance TTL on the mint write and keep the existing event emissions.
Files
Acceptance deliverables
- Minting beyond the configured maximum is rejected with a typed error.
- The maximum and remaining supply are queryable on-chain.
- All CI checks pass; the change cannot be merged until CI is green.
Tests to pass
- Test: minting up to the maximum succeeds and the next mint returns the typed error.
- Test: the remaining-supply getter decreases correctly as tickets are minted.
Problem
ticket/src/lib.rsexposesmint_ticketand atickets_soldcounter, but there is no maximum supply:mint_ticketcan be called indefinitely andtickets_soldonly counts upward. For an event-ticketing contract, an uncapped supply means an organizer (or a bug) can mint beyond the intended allocation, and downstream consumers have no on-chain guarantee of scarcity.What needs to be done
initialize(stored in instance storage).mint_ticket: reject minting oncetickets_soldreaches the maximum, returning a typedError(add a "sold out"/"supply exceeded" variant).Files
ticket/src/lib.rsAcceptance deliverables
Tests to pass