pub fn instantiate_with_code<T: Config>(
    value: <<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance,
    gas_limit: Weight,
    storage_deposit_limit: Option<<<<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance as HasCompact>::Type>,
    code: Vec<u8>,
    data: Vec<u8>,
    salt: Vec<u8>
)
Expand description

Instantiates a new contract from the supplied code optionally transferring some balance.

This dispatchable has the same effect as calling [Self::upload_code] + [Self::instantiate]. Bundling them together provides efficiency gains. Please also check the documentation of [Self::upload_code].

Parameters

  • value: The balance to transfer from the origin to the newly created contract.
  • gas_limit: The gas limit enforced when executing the constructor.
  • storage_deposit_limit: The maximum amount of balance that can be charged/reserved from the caller to pay for the storage consumed.
  • code: The contract code to deploy in raw bytes.
  • data: The input data to pass to the contract constructor.
  • salt: Used for the address derivation. See Pallet::contract_address.

Instantiation is executed as follows:

  • The supplied code is deployed, and a code_hash is created for that code.
  • If the code_hash already exists on the chain the underlying code will be shared.
  • The destination address is computed based on the sender, code_hash and the salt.
  • The smart-contract account is created at the computed address.
  • The value is transferred to the new account.
  • The deploy function is executed in the context of the newly-created account.

Warning: Doc-Only

This function is an automatically generated, and is doc-only, uncallable stub. See the real version in Pallet::instantiate_with_code.