Module prog

Module prog 

Source
Expand description

Functions and helpers for creating programs from programs.

Any program being an actor, can not only process incoming messages and send outcoming messages to other actors but also create new actors. This feature can be useful when implementing the factory pattern, as a single actor can produce multiple derived actors with different input data.

Firstly you need to upload a Wasm code of the future program(s) by calling gear.uploadCode extrinsic to obtain the corresponding CodeId.

You must also provide a unique byte sequence to create multiple program instances from the same code. This sequence is often referenced as salt. ProgramGenerator allows generating of salt automatically.

The newly created program should be initialized using a corresponding payload; therefore, you must provide it when calling any create_program_* function.

Structs§

ProgramGenerator
Helper to create programs without setting the salt manually.

Functions§

create_program
Same as create_program_bytes, but allows initialize program with the encodable payload.
create_program_bytes
Create a new program from the already existing on-chain code identified by CodeId.
create_program_bytes_delayed
Same as create_program_bytes, but creates a new program after the delay expressed in block count.
create_program_bytes_for_reply
Same as create_program_bytes, but the program will interrupt until the reply is received.
create_program_bytes_for_reply_as
Same as create_program_bytes, but the program will interrupt until the reply is received.
create_program_bytes_with_gas
Same as create_program_bytes, but with an explicit gas limit.
create_program_bytes_with_gas_delayedNon-ethexe
Same as create_program_bytes_with_gas, but creates a new program after the delay expressed in block count.
create_program_bytes_with_gas_for_reply
Same as create_program_bytes_with_gas, but the program will interrupt until the reply is received.
create_program_bytes_with_gas_for_reply_as
Same as create_program_bytes_with_gas, but the program will interrupt until the reply is received.
create_program_delayed
Same as create_program, but creates a new program after the delay expressed in block count.
create_program_for_reply
Same as create_program, but the program will interrupt until the reply is received.
create_program_for_reply_as
Same as create_program, but the program will interrupt until the reply is received.
create_program_with_gas
Same as create_program, but with an explicit gas limit.
create_program_with_gas_delayedNon-ethexe
Same as create_program_with_gas, but creates a new program after the delay expressed in block count.
create_program_with_gas_for_reply
Same as create_program_with_gas, but the program will interrupt until the reply is received.
create_program_with_gas_for_reply_as
Same as create_program_with_gas, but the program will interrupt until the reply is received.