Add stellar token clawback subcommand - #2717
Open
fnando wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds stellar token clawback as an SAC-admin wrapper over contract invocation.
Changes:
- Implements clawback execution, validation, authorization, and JSON receipts.
- Registers the command and documents its CLI options.
- Adds integration tests for success and error paths.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
FULL_HELP_DOCS.md |
Documents the clawback command. |
cmd/soroban-cli/src/commands/token/mod.rs |
Registers and dispatches clawback. |
cmd/soroban-cli/src/commands/token/clawback.rs |
Implements clawback behavior. |
cmd/soroban-cli/src/cli.rs |
Enables JSON error formatting. |
cmd/crates/soroban-test/tests/it/integration/token/mod.rs |
Registers clawback tests. |
cmd/crates/soroban-test/tests/it/integration/token/clawback.rs |
Tests success, deployment errors, and validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fnando
force-pushed
the
token-clawback
branch
from
September 4, 2026 18:36
7715ec0 to
56f7af1
Compare
fnando
force-pushed
the
token-clawback
branch
from
September 4, 2026 18:49
56f7af1 to
4b3362c
Compare
fnando
force-pushed
the
token-clawback
branch
from
September 4, 2026 19:10
4b3362c to
356c918
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Suppressed comments (2)
cmd/soroban-cli/src/commands/token/clawback.rs:145
--id nativereaches this invocation path, but the native SAC has noAdmincontract-data entry (seecommands/contract/deploy/asset.rs:234-243), soclawbackcannot succeed and surfaces only a downstream invoke failure. Detect a resolved native SAC here and return a typed unsupported/invalid-token error before invoking the contract.
let token = self
.id
.resolve(&config.locator, &network.network_passphrase)?;
cmd/soroban-cli/src/commands/token/clawback.rs:153
- This new muxed-admin rejection has no integration coverage, while the equivalent branches are explicitly tested for
token transferandtoken approve. Add a clawback integration test using anM…admin and assert the clear unsupported error so the known #2645 guard cannot regress into the raw decode failure.
if matches!(source_account, crate::xdr::MuxedAccount::MuxedEd25519(_)) {
return Err(Error::MuxedSourceNotSupported);
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.
What
Adds
stellar token clawback, a SAC-admin write subcommand that claws tokens back from a holder.--adminsigns and authorizes the clawback (the asset issuer for a Stellar Asset Contract),--fromis the holder, and--amountis the quantity in smallest units. Returns a JSON receipt with the tx hash.Why
Part of #2620 (typed SEP-41 + SAC client), a SAC-admin command alongside
mint. A thin wrapper overcontract invokereusingargs::invoke_by_positionandargs::not_deployed_error; likemint, the admin only authorizes and is not aclawbackargument, so only[from, amount]are passed positionally.Known limitations
Muxed (
M…) source accounts are rejected with a clear error (same constraint astransfer, see #2645). Clawback requires the asset's issuer to haveAUTH_CLAWBACK_ENABLED(which also requiresAUTH_REVOCABLE) set before the holder's trustline is created — this is an asset-configuration prerequisite, not enforced by the command.