Stellar PHP SDK API Documentation

CreateContractFromExternalRefHostFunction extends HostFunction
in package

Represents a Soroban host function for creating contracts from a CAP-85 external executable reference

From Protocol 28 on, a contract can be created without naming a wasm hash directly. The executable instead names an owner contract and a tag; the owner holds a persistent contract data entry under that tag whose value is the 32-byte hash of an already uploaded wasm, and the created instance runs that code.

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: $hostFunction = new CreateContractFromExternalRefHostFunction( Address::fromAccountId("GABC..."), // Deployer address Address::fromContractId($ownerId), // Contract holding the executable tag entry "token-v1", // Tag of the entry on the owner $salt // Optional salt );

Tags
see
HostFunction

Base class for all host functions

CreateContractFromExternalRefWithConstructorHostFunction

For contracts with constructor arguments

CreateContractHostFunction

For creating contracts from a wasm hash

https://developers.stellar.org

Stellar developer docs

since
1.13.0

Table of Contents

Properties

$address  : Address
$executableOwner  : Address
$salt  : string
$tag  : string

Methods

__construct()  : mixed
Constructs a new CreateContractFromExternalRefHostFunction
fromXdr()  : HostFunction
Creates a HostFunction from XDR format
getAddress()  : Address
getExecutableOwner()  : Address
getSalt()  : string
getTag()  : string
setAddress()  : void
setExecutableOwner()  : void
setSalt()  : void
setTag()  : void
toXdr()  : XdrHostFunction
Converts the host function to XDR format

Properties

Methods

__construct()

Constructs a new CreateContractFromExternalRefHostFunction

public __construct(Address $address, Address $executableOwner, string $tag[, 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

$salt : string|null = null

Optional salt (32 random bytes generated if not provided)

Tags
throws
InvalidArgumentException

If the executable owner is not a contract address

Exception

If random bytes generation fails

On this page

Search results