Emit a structured event from sweep_terminal_dust recording the swept amount and recipient
Description
sweep_terminal_dust(env, amount) in contracts/escrow/src/lib.rs moves residual funding-token dust to the treasury after a terminal state, enforcing a liability floor — but it emits no contractevent. Every other state-changing entrypoint (funded, sme_wd, inv_claim, refunded, fund_can, etc.) publishes a structured event, so indexers and reconciliation tooling currently cannot observe treasury sweeps on-chain. This is a transparency gap on a privileged, fund-moving admin path.
This issue adds a dedicated dust_swept event carrying the effective swept amount, the treasury recipient, and the invoice id, consistent with the existing event catalog.
Requirements and context
- Repository scope: Liquifact/Liquifact-contracts only.
- Define a new event struct (e.g.
DustSweptEvt) with a unique symbol_short! topic name not already used elsewhere in lib.rs.
- Publish it at the end of
sweep_terminal_dust with the effective amount actually transferred, the treasury address, and invoice_id.
- Ensure the event fires only on a successful sweep, after the balance-checked transfer, never on an error path.
- Keep the existing liability-floor enforcement (
SweepExceedsLiabilityFloor) and all typed error returns unchanged.
- Update the events catalog documentation to include the new event.
Suggested execution
- Fork the repo and create a branch
git checkout -b feature/contracts-dust-swept-event
- Implement changes
- Write code in:
contracts/escrow/src/lib.rs — add the event struct and publish it inside sweep_terminal_dust.
- Write comprehensive tests in:
contracts/escrow/src/tests/external_calls.rs — assert the event topic, amount, and recipient on a successful sweep and assert no event on the floor-exceeded failure.
- Add documentation: add the event to the catalog in
README.md and docs/.
- Include NatSpec-style doc comments (
///) on the new event struct.
- Validate security assumptions: the event payload reflects the real transferred amount, not the requested amount.
- Test and commit
Test and commit
- Run
cargo fmt --all -- --check, cargo build, and cargo test.
- Cover edge cases and failure paths: zero-effective sweep, capped sweep, legal-hold-blocked sweep, and non-terminal status.
- Include the full
cargo test output and a short security notes section in the PR description.
Example commit message
feat: emit dust_swept event from sweep_terminal_dust with amount and recipient
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the Liquifact community on Discord for questions, reviews, and faster merges: https://discord.gg/JrGPH4V3
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Emit a structured event from sweep_terminal_dust recording the swept amount and recipient
Description
sweep_terminal_dust(env, amount)incontracts/escrow/src/lib.rsmoves residual funding-token dust to the treasury after a terminal state, enforcing a liability floor — but it emits nocontractevent. Every other state-changing entrypoint (funded,sme_wd,inv_claim,refunded,fund_can, etc.) publishes a structured event, so indexers and reconciliation tooling currently cannot observe treasury sweeps on-chain. This is a transparency gap on a privileged, fund-moving admin path.This issue adds a dedicated
dust_sweptevent carrying the effective swept amount, the treasury recipient, and the invoice id, consistent with the existing event catalog.Requirements and context
DustSweptEvt) with a uniquesymbol_short!topic name not already used elsewhere inlib.rs.sweep_terminal_dustwith the effective amount actually transferred, the treasury address, andinvoice_id.SweepExceedsLiabilityFloor) and all typed error returns unchanged.Suggested execution
git checkout -b feature/contracts-dust-swept-eventcontracts/escrow/src/lib.rs— add the event struct and publish it insidesweep_terminal_dust.contracts/escrow/src/tests/external_calls.rs— assert the event topic, amount, and recipient on a successful sweep and assert no event on the floor-exceeded failure.README.mdanddocs/.///) on the new event struct.Test and commit
cargo fmt --all -- --check,cargo build, andcargo test.cargo testoutput and a short security notes section in the PR description.Example commit message
feat: emit dust_swept event from sweep_terminal_dust with amount and recipientGuidelines
Community & contribution rewards