DeploySACWithAssetHostFunction
extends HostFunction
in package
Represents a Soroban host function for deploying a Stellar Asset Contract (SAC)
This host function deploys a Stellar Asset Contract for a given asset. SACs are standardized smart contracts that provide token functionality for Stellar assets on the Soroban smart contract platform.
Stellar Asset Contracts enable:
- Interoperability between Stellar assets and Soroban contracts
- Standard token interface (similar to ERC-20)
- Native asset support in smart contract environments
Each Stellar asset can have one canonical SAC, deployed using this host function. The contract address is deterministically generated from the asset.
Usage:
// Deploy SAC for a custom asset
$asset = Asset::createNonNativeAsset("USD", "GBBB...");
$hostFunction = new DeploySACWithAssetHostFunction($asset);
// Deploy SAC for native XLM $xlmAsset = new AssetTypeNative(); $hostFunction = new DeploySACWithAssetHostFunction($xlmAsset);
// Use in an InvokeHostFunctionOperation $operation = (new InvokeHostFunctionOperationBuilder($hostFunction))->build();
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructs a new DeploySACWithAssetHostFunction
- fromXdr() : DeploySACWithAssetHostFunction
- Creates a DeploySACWithAssetHostFunction from XDR format
- getAsset() : Asset
- Gets the asset
- setAsset() : void
- Sets the asset
- toXdr() : XdrHostFunction
- Converts the deploy SAC host function to XDR format
Properties
$asset
public
Asset
$asset
The Stellar asset to deploy as a SAC
Methods
__construct()
Constructs a new DeploySACWithAssetHostFunction
public
__construct(Asset $asset) : mixed
Parameters
- $asset : Asset
-
The Stellar asset to deploy
fromXdr()
Creates a DeploySACWithAssetHostFunction from XDR format
public
static fromXdr(XdrHostFunction $xdr) : DeploySACWithAssetHostFunction
Parameters
- $xdr : XdrHostFunction
-
The XDR host function
Tags
Return values
DeploySACWithAssetHostFunction —The decoded host function
getAsset()
Gets the asset
public
getAsset() : Asset
Return values
Asset —The Stellar asset to deploy
setAsset()
Sets the asset
public
setAsset(Asset $asset) : void
Parameters
- $asset : Asset
-
The Stellar asset to deploy
toXdr()
Converts the deploy SAC host function to XDR format
public
toXdr() : XdrHostFunction
Return values
XdrHostFunction —The XDR host function