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 (result, gas_info) =
        with_storage_from_context::<S, Q, _, _>(ctx, |store| Ok(store.set(&key, &value)))?;
    process_gas_info::<S, Q>(ctx, gas_info)?;
    result?;

    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
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 (result, gas_info) =
        with_storage_from_context::<S, Q, _, _>(ctx, |store| Ok(store.set(&key, &value)))?;
    process_gas_info::<S, Q>(ctx, gas_info)?;
    result?;
    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 ( result , gas_info ) = with_storage_from_context :: < S , Q , _ , _ > ( ctx , | store | Ok ( store . set ( & key , & value ) ) ) ? ; process_gas_info :: < S , Q > ( ctx , gas_info ) ? ; result ? ; 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
ctx
&mut Ctx
key_ptr
u32
value_ptr
u32