Summary
The KeyPurchased event emitted on each buy should reflect the supply after the purchase, not before. Unit tests should confirm the new_supply field in the event matches the on-chain supply after the transaction and increments correctly across sequential buys.
Scope
- Test a single buy from supply 0 emits
KeyPurchased with new_supply: 1
- Test buying 5 keys from supply 10 emits
KeyPurchased with new_supply: 15
- Test two sequential buys emit two events with
new_supply incrementing correctly
- Assert
new_supply in the event equals the supply returned by get_total_supply after the call
- Assert no event emitted on a failed buy
Acceptance Criteria
ETA: 12 hours
Coordinate on Telegram
Summary
The
KeyPurchasedevent emitted on each buy should reflect the supply after the purchase, not before. Unit tests should confirm thenew_supplyfield in the event matches the on-chain supply after the transaction and increments correctly across sequential buys.Scope
KeyPurchasedwithnew_supply: 1KeyPurchasedwithnew_supply: 15new_supplyincrementing correctlynew_supplyin the event equals the supply returned byget_total_supplyafter the callAcceptance Criteria
new_supplyin event equals post-buy on-chain supplynew_supplynew_supplymatchesget_total_supplyreturn valueETA: 12 hours
Coordinate on Telegram