Skip to main content
When interacting with assets in a smart contract, the Stellar Asset Contract is not different from any other token that implements the Stellar SEP-41 Token Interface.

Contract Code

The Rust SDK contains a pre-generated client for any contract that implements the token interface:
The asset parameter is not the address of the issuer of an asset, it corresponds to the deployed contract address for this asset.
E.g. for USDC, it would be --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 using register_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: