CreateContractFromExternalRefWithConstructorHostFunction
extends HostFunction
in package
Represents a Soroban host function for creating contracts from a CAP-85 external executable reference, passing constructor arguments
Combines CreateContractFromExternalRefHostFunction with constructor initialization: the executable names an owner contract and a tag whose persistent entry holds the wasm hash, and the constructor arguments are passed to the created instance during deployment.
The executable owner must be a contract address — only a contract can hold the executable tag entry. The constructor, setExecutableOwner(), and toXdr() reject any other address type.
Usage:
$args = [XdrSCVal::forSymbol("admin"), XdrSCVal::forAddress($adminAddress)];
$hostFunction = new CreateContractFromExternalRefWithConstructorHostFunction( Address::fromAccountId("GABC..."), // Deployer address Address::fromContractId($ownerId), // Contract holding the executable tag entry "token-v1", // Tag of the entry on the owner $args, // Constructor arguments $salt // Optional salt );
Tags
Table of Contents
Properties
- $address : Address
- $constructorArgs : array<string|int, XdrSCVal>
- $executableOwner : Address
- $salt : string
- $tag : string
Methods
- __construct() : mixed
- Constructs a new CreateContractFromExternalRefWithConstructorHostFunction
- fromXdr() : HostFunction
- Creates a HostFunction from XDR format
- getAddress() : Address
- getConstructorArgs() : array<string|int, XdrSCVal>
- getExecutableOwner() : Address
- getSalt() : string
- getTag() : string
- setAddress() : void
- setConstructorArgs() : void
- setExecutableOwner() : void
- setSalt() : void
- setTag() : void
- toXdr() : XdrHostFunction
- Converts the host function to XDR format
Properties
$address
public
Address
$address
The deployer address
$constructorArgs
public
array<string|int, XdrSCVal>
$constructorArgs
The constructor arguments
$executableOwner
public
Address
$executableOwner
The contract holding the executable tag entry the instance runs
$salt
public
string
$salt
The salt value for contract address generation
$tag
public
string
$tag
The tag the owner holds the executable entry under
Methods
__construct()
Constructs a new CreateContractFromExternalRefWithConstructorHostFunction
public
__construct(Address $address, Address $executableOwner, string $tag, array<string|int, XdrSCVal> $constructorArgs[, string|null $salt = null ]) : mixed
Parameters
- $address : Address
-
The deployer address
- $executableOwner : Address
-
The contract holding the executable tag entry
- $tag : string
-
The tag of the executable entry on the owner; matched byte for byte
- $constructorArgs : array<string|int, XdrSCVal>
-
The constructor arguments
- $salt : string|null = null
-
Optional salt (32 random bytes generated if not provided)
Tags
fromXdr()
Creates a HostFunction from XDR format
public
static fromXdr(XdrHostFunction $xdr) : HostFunction
Parameters
- $xdr : XdrHostFunction
-
The XDR host function
Tags
Return values
HostFunction —The decoded host function instance
getAddress()
public
getAddress() : Address
Return values
AddressgetConstructorArgs()
public
getConstructorArgs() : array<string|int, XdrSCVal>
Return values
array<string|int, XdrSCVal>getExecutableOwner()
public
getExecutableOwner() : Address
Return values
AddressgetSalt()
public
getSalt() : string
Return values
stringgetTag()
public
getTag() : string
Return values
stringsetAddress()
public
setAddress(Address $address) : void
Parameters
- $address : Address
setConstructorArgs()
public
setConstructorArgs(array<string|int, XdrSCVal> $constructorArgs) : void
Parameters
- $constructorArgs : array<string|int, XdrSCVal>
setExecutableOwner()
public
setExecutableOwner(Address $executableOwner) : void
Parameters
- $executableOwner : Address
Tags
setSalt()
public
setSalt(string $salt) : void
Parameters
- $salt : string
setTag()
public
setTag(string $tag) : void
Parameters
- $tag : string
toXdr()
Converts the host function to XDR format
public
toXdr() : XdrHostFunction
Tags
Return values
XdrHostFunction —The XDR representation