Skip to content

Comments

feat: enhance reserve lifecycle with reclaim tracking and event emission#34

Merged
phertyameen merged 2 commits intobridgelet-org:mainfrom
Obiajulu-gif:base_reserve
Feb 23, 2026
Merged

feat: enhance reserve lifecycle with reclaim tracking and event emission#34
phertyameen merged 2 commits intobridgelet-org:mainfrom
Obiajulu-gif:base_reserve

Conversation

@Obiajulu-gif
Copy link
Contributor

This pull request introduces a comprehensive reserve lifecycle tracking system for ephemeral accounts, improving how reserve reclamation is handled, tracked, and reported. The changes add new storage fields, event payloads, and contract methods to enable precise tracking of reserve status, reclamation events, and amounts. Tests have been updated to validate the new reserve lifecycle features.

Reserve lifecycle tracking and reclamation:

  • Added new storage fields and methods in storage.rs to track base reserve remaining, available reserve, reserve reclaimed status, last sweep ID, reserve event count, and last reserve event. This enables accurate state management and querying of reserve reclamation. [1] [2]
  • Introduced a new ReserveReclaimed event structure with additional fields (sweep_id, fully_reclaimed, remaining_reserve) and updated event emission logic to include these details, improving transparency and auditability of reserve reclamation. [1] [2]
  • Implemented new contract methods in lib.rs for querying reserve status (get_reserve_remaining, get_reserve_available, is_reserve_reclaimed, get_last_reserve_event, get_reserve_reclaim_event_count) and for safely reclaiming reserve (reclaim_reserve, reclaim_reserve_to). [1] [2]

State transition and event emission improvements:

  • Updated contract logic to ensure reserve is reclaimed only after successful sweep or expiration state transitions, and to emit detailed reserve events. Reserve reclamation is now idempotent and tracked per sweep operation.
  • Added initialization of reserve tracking during account creation to set up all relevant fields and counters.

Test coverage enhancements:

  • Refactored and expanded tests in test.rs to verify reserve lifecycle state, event emission, and correct behavior of new methods, including edge cases for reserve reclamation and querying. [1] [2] [3]

These changes collectively provide robust tracking and control over the account reserve lifecycle, making the contract safer and easier to integrate and audit.

Closes #28

Copy link
Contributor

@phertyameen phertyameen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, your tests are not passing. Is this a work in progress?

@Obiajulu-gif
Copy link
Contributor Author

@phertyameen the test is passing... thank you so much

Copy link
Contributor

@phertyameen phertyameen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awsome

@phertyameen phertyameen merged commit e42c11e into bridgelet-org:main Feb 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reclaim Base Reserve on Successful Sweep

2 participants