/// Writes a storage entry from Wasm memory into the VM's storage
Writes a storage entry from Wasm memory into the VM's storage
Writes a storage entry from Wasm memory into the VM ' s storage
pub fn do_write<S: Storage, Q: Querier>(
    ctx: &mut Ctx,
    key_ptr: u32,
    value_ptr: u32,
) -> VmResult<()> {
    if is_storage_readonly::<S, Q>(ctx) {
        return Err(VmError::write_access_denied());
    }
    let key = read_region(ctx, key_ptr, MAX_LENGTH_DB_KEY)?;
    let value = read_region(ctx, value_ptr, MAX_LENGTH_DB_VALUE)?;
    let used_gas =
        with_storage_from_context::<S, Q, _, _>(ctx, |store| Ok(store.set(&key, &value)?))?;
    try_consume_gas::<S, Q>(ctx, used_gas)?;
    Ok(())
}
pub fn do_write < S : Storage , Q : Querier > ( ctx : & mut Ctx , key_ptr : u32 , value_ptr : u32 , ) -> VmResult < ( ) > { if is_storage_readonly :: < S , Q > ( ctx ) { return Err ( VmError :: write_access_denied ( ) ) ; } let key = read_region ( ctx , key_ptr , MAX_LENGTH_DB_KEY ) ? ; let value = read_region ( ctx , value_ptr , MAX_LENGTH_DB_VALUE ) ? ; let used_gas = with_storage_from_context :: < S , Q , _ , _ > ( ctx , | store | Ok ( store . set ( & key , & value ) ? ) ) ? ; try_consume_gas :: < S , Q > ( ctx , used_gas ) ? ; Ok ( ( ) ) }
Writes a storage entry from Wasm memory into the VM's storage
Writes a storage entry from Wasm memory into the VM ' s storage
ctx
&mut Ctx
key_ptr
u32
value_ptr
u32