Contract Code
The Rust SDK contains a pre-generated client for any contract that implements the token interface:asset parameter is not the address of the issuer of an asset, it corresponds to the deployed contract address for this asset.
--asset USDC:G... For the native asset, XLM, --asset native. See the deploy SAC guide for more details.
ClientsA client created by
token::TokenClient implements the functions defined by any contract that implements the SEP-41 Token Interface. But with CAP-46-6 smart contract standardized asset, the Stellar Asset Contract exposes additional functions such as mint. To access the additional functions, another client needs to be used: token::StellarAssetClient. This client only implements the functions from CAP-46-6, which are not part of the SEP-41 interface.Testing
Soroban Rust SDK provides an easy way to instantiate a Stellar Asset Contract tokens usingregister_stellar_asset_contract_v2. This function can be seen as the deployment of a generic token. It also allows you to manipulate flags on the issuer account like AUTH_REVOCABLE and AUTH_REQUIRED. In the following example, we are following the best practices outlined in the Issuing and Distribution Accounts section:
Examples
See the full examples that utilize the token contract in various ways for more details:- Timelock and single offer move token via
transferto and from the contract - Atomic swap uses
transferto transfer token on behalf of the user