Skip to content

feat(invoice): emit EscrowReleasedEvent with minimal payload on release_escrow#183

Open
Markadrian6399 wants to merge 2 commits into
WHEELBACK:mainfrom
Markadrian6399:feature/invoice-escrow-released-event
Open

feat(invoice): emit EscrowReleasedEvent with minimal payload on release_escrow#183
Markadrian6399 wants to merge 2 commits into
WHEELBACK:mainfrom
Markadrian6399:feature/invoice-escrow-released-event

Conversation

@Markadrian6399

@Markadrian6399 Markadrian6399 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Define EscrowReleasedEvent struct with #[contracttype] in contracts/invoice/src/events.rs, carrying only id, merchant, amount_usdc, and released_at
  • Update escrow_released() to publish the new lean struct instead of the full Invoice — reduces Soroban event storage costs and removes the need for indexers/frontend to import full contract types
  • Export EscrowReleasedEvent from the crate root (lib.rs) so consumers can import it directly
  • Add abis/invoice.json to the workspace root (required by the existing test_abi_snapshot_matches_contract test)
  • Repair pre-existing invoice_test.rs corruption: interleaved test function bodies and a duplicated old-API block that prevented the file from compiling

Test plan

  • cargo test -p comebackhere-invoice --test invoice_test — 42 tests pass including new test_escrow_released_event_emits_minimal_payload
  • New test verifies payload has exactly id, merchant, amount_usdc, and released_at — no gross_usdc, payer, metadata, etc.
  • released_at captures env.ledger().timestamp() at the moment of release
  • Existing escrow release state-transition tests (test_release_escrow_transitions_paid_to_released, test_release_escrow_requires_paid_status, test_release_escrow_requires_admin) continue to pass

Closes #3

Markodiba and others added 2 commits June 28, 2026 15:52
…se_escrow

Define a dedicated EscrowReleasedEvent contracttype with only the fields
indexers need (id, merchant, amount_usdc, released_at) and update
escrow_released() to publish it instead of the full Invoice struct.
Leaner payloads reduce Soroban event storage costs and make deserialization
simpler for consumers that should not need to import all contract types.

Also add abis/invoice.json snapshot to the workspace root (required by the
existing ABI snapshot test), and repair pre-existing test file corruption
in invoice_test.rs (interleaved function bodies, duplicate old-API blocks)
that prevented the suite from compiling.

Closes #[issue_id]
@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Markadrian6399 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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(invoice): emit structured event for escrow release

2 participants