db_init

Function db_init 

Source
pub(crate) fn db_init(
    ctx: FunctionEnvMut<'_, Env>,
    ptr: WasmPtr<u8>,
    ptr_len: u32,
) -> i64
Expand description

Create a new on-chain database instance for the calling contract. When created, push it to the list of db_handles.

This function expects to receive a pointer from which a ContractId and the db_name will be read.

This function should only be allowed in ContractSection::Deploy, as that is called when a contract is being (re)deployed and databases have to be created.

ยงPermissions

  • ContractSection::Deploy