Skip to main content

DeployContract

Function DeployContract 

Source
pub fn DeployContract(
    nonce: &SHA256Hash,
    contract_hash: &SHA256Hash,
) -> Result<ContractAddress, SysErr>
Expand description

Deploys a contract with the specified nonce and contract hash to a computed address. The contract must be provided in the transaction’s contracts_to_deploy field.

§Arguments

  • nonce
  • contract_hash

§Outputs

  • deployed_address

This is a convenience wrapper around uninit_DeployContract that returns the result as SyscallResult<T>.

§Errors

  • kSyscallErrorCodeInvalidSyscallInput: The requested contract was not available for deployment, or the contract is a special precompiled (native) contract that cannot be deployed (i.e. the native token contract). To deploy a contract, that contract must either already exist on chain or must be provided in the transaction’s contracts_to_deploy field.

  • kSyscallErrorCodeContractAlreadyDeployed: A contract with the same nonce and contract hash has already been deployed at the computed address, either in a previous block or earlier in this transaction. A contract can be deployed multiple times concurrently in the same block. If a contract must be initialized only once, then that contract should run some initialization process and that initialization should acquire a semaphore.