feat: connect invoice-token transfer lock to escrow settlement/refund#52
Merged
Jayrodri088 merged 6 commits intoMar 25, 2026
Conversation
|
@KevinMB0220 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! 🚀 |
Contributor
|
@KevinMB0220 Please merge conflicts |
set_transfer_locked now accepts an explicit `caller: Address` param. Both admin and minter (escrow contract) are authorised to change the lock state; any other caller returns Error::Unauthorized. This is the token-side prerequisite that lets the escrow contract unlock transfers at the end of an invoice lifecycle. Closes StellarState#27 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
record_payment and refund now call set_transfer_locked(false) on the invoice-token contract (using the escrow's minter authority) after updating the escrow status. Token transfers are blocked while the invoice is active (Created/Funded) and unlocked once the lifecycle ends (Settled/Refunded). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Pass explicit admin/minter caller in all existing set_transfer_locked calls - Add test_set_transfer_locked_by_minter: minter can lock/unlock - Add test_set_transfer_locked_unauthorized_fails: stranger gets Unauthorized Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fund - MockInvoiceToken: add set_transfer_locked no-op so unit tests compile - integration happy path: assert token is locked while active, unlocked after settlement, and buyer can transfer tokens freely post-settlement - integration refund: assert token is unlocked after refund - New test_integration_token_locked_during_active_escrow: full Created → Funded (locked) → Settled (unlocked) flow with transfer assertion before and after unlock Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update Settlement and Refund sections to reflect that the escrow contract now unlocks invoice token transfers as part of those operations. Add a Transfer Lock Policy table showing transfer_locked state per escrow status and the access-control rules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
be89a46 to
047315a
Compare
Contributor
Author
Done can you review please |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #27
Summary
invoice-token:set_transfer_lockednow accepts an explicitcaller: Addressparameter. Bothadminandminter(the escrow contract) are authorised to change the lock state; any other caller returnsError::Unauthorized.invoice-escrow:record_paymentandrefundcallset_transfer_locked(false)on the invoice token (via the escrow's minter authority) after the status transition. Tokens are locked duringCreated/Fundedand unlocked onSettled/Refunded.test_set_transfer_locked_by_minter,test_set_transfer_locked_unauthorized_fails); escrow integration tests assert lock state before and after each lifecycle transition; new dedicated testtest_integration_token_locked_during_active_escrow.docs/lifecycle.mdupdated with unlock behaviour and a Transfer Lock Policy table.Transfer Lock Policy
transfer_lockedCreatedtrueFundedtrueSettledfalseRefundedfalseTest plan
cargo fmt --checkpasses (no formatting issues)cargo clippy -- -D warningspasses (no lints)cargo test— all tests pass (18 token unit tests, 11 escrow unit tests, 3 escrow integration tests)trueimmediately afterfund_escrowfalseafterrecord_payment(settlement)falseafterrefundset_transfer_lockedgetsError::Unauthorizedset_transfer_lockeddirectly🤖 Generated with Claude Code