Skip to content

feat(refund): emit low refund-reserve alerts on threshold crossing - #861

Merged
fati-Onchain merged 1 commit into
Facil-Pay:mainfrom
Osaodion:feat/issue-814-feat-refund-low-refund-reserve-alerts
Oct 23, 2026
Merged

fati-Onchain merged 1 commit into
Facil-Pay:mainfrom
Osaodion:feat/issue-814-feat-refund-low-refund-reserve-alerts

Conversation

@Osaodion

Copy link
Copy Markdown
Contributor

Overview

This PR adds a low refund-reserve alert to the refund contract so merchants are warned before their reserve is exhausted. A RefundReserveLow event is emitted when a withdrawal or refund causes the reserve to cross below a merchant-set warning level, firing once on the crossing rather than on every subsequent operation while the reserve stays low.

Related Issue

Changes

🔔 Low Reserve Alerts

  • [MODIFY] contracts/refund/src/lib.rs

    • Emits RefundReserveLow when a withdrawal or refund leaves the reserve below the merchant-set warning level.
    • Tracks the crossing so the event fires only when the reserve transitions below the level, not on every refund while it remains low.
  • [ADD] contracts/refund/src/test_refund_reserve.rs

    • Tests covering the event firing on the crossing and staying silent on subsequent operations while the reserve remains low.
  • [MODIFY] contracts/refund/README.md

    • Documents the new function(s), parameters, errors and the RefundReserveLow event.

Verification Results

cargo fmt --all -- --check
cargo clippy -- -D warnings
cargo test --workspace
Acceptance Criteria Status
The event fires when the reserve crosses below the level, not on every refund while it stays low ✅ Crossing-only emission covered by test_refund_reserve.rs
cargo fmt --all -- --check, cargo clippy -- -D warnings and cargo test --workspace pass ✅ All checks pass
The contract's README documents the new function(s), parameters, errors and events ✅ README updated with RefundReserveLow

Closes #814

@fati-Onchain
fati-Onchain merged commit 26d1d58 into Facil-Pay:main Oct 23, 2026
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.

feat(refund): Low refund-reserve alerts

2 participants