feat(#106): implement real on-chain token.transfer() in sweep() - #198
Merged
phertyameen merged 10 commits intoJun 25, 2026
Conversation
…sweep()
Replace the stub comment with actual token::TokenClient::transfer()
calls. For each recorded payment, calls:
token::TokenClient::new(&env, &payment.asset)
.transfer(&contract_address, &destination, &payment.amount)
Status is set to Swept before transfers to prevent re-entrancy.
Verifies that sweep() calls token::TokenClient::transfer() for each recorded payment, moving the balance from the contract to destination.
|
@Tyler7x 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
|
@Tyler7x resolve conflict please |
Contributor
Author
|
@phertyameen resolved |
… sweep_controller tests
phertyameen
approved these changes
Jun 25, 2026
phertyameen
approved these changes
Jun 25, 2026
5 tasks
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.
Summary
Closes #106
Replaces the stub comment in
sweep()with real on-chain token transfers using the Sorobantoken::TokenClientinterface.Changes
contracts/ephemeral_account/src/lib.rstokento thesoroban_sdkimport.sweep(), after setting status toSwept(re-entrancy guard), iterate over all recorded payments and call:sweep()rustdoc to describe the transfer behaviour.contracts/ephemeral_account/src/test.rstest_sweep_executes_token_transfer: registers a Stellar asset contract, mints 500 tokens to the ephemeral contract, records the payment, callssweep(), then asserts the contract balance is 0 and the destination balance is 500.Notes
Sweptbefore the token calls to prevent re-entrancy — consistent with checks-effects-interactions.mock_all_auths()intercepts the token calls without requiring a real contract.Testing