Skip to content

Add unit tests for optimistic sell update decrementing holdings quantity correctly #621

Description

@Chucks1093

Summary

The sell flow should apply an optimistic update to the holdings cache immediately on submission, decrementing the held quantity. Unit tests should confirm the decrement is applied correctly, that the entry is removed when the result reaches zero, and that the update is rolled back on failure.

Scope

  • Seed the cache with a holding of 3 keys for a creator
  • Submit a sell of 2 keys and assert the cache shows 1 key remaining
  • Submit a sell of 1 key (the last) and assert the holding entry is removed from the cache
  • Simulate a failure on the second sell and assert the cache is restored to 2 keys

Acceptance Criteria

  • Cache decremented by sold quantity on submission
  • Entry removed from cache when quantity reaches zero
  • Cache restored to pre-sell snapshot on failure
  • Rollback uses the snapshot, not a re-fetch

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions