fn write_to_contract<S: Storage, Q: Querier>(ctx: &mut Ctx, input: &[u8]) -> VmResult<u32> {
    let target_ptr = with_func_from_context::<S, Q, u32, u32, _, _>(ctx, "allocate", |allocate| {
        let out_size = to_u32(input.len())?;
        let ptr = allocate.call(out_size)?;
        if ptr == 0 {
            return Err(CommunicationError::zero_address().into());
        }
        Ok(ptr)
    })?;
    write_region(ctx, target_ptr, input)?;
    Ok(target_ptr)
}
/// Creates a Region in the contract, writes the given data to it and returns the memory location
Creates a Region in the contract, writes the given data to it and returns the memory location
Creates a Region in the contract writes the given data to it and returns the memory location
fn write_to_contract<S: Storage, Q: Querier>(ctx: &mut Ctx, input: &[u8]) -> VmResult<u32> {
    let target_ptr = with_func_from_context::<S, Q, u32, u32, _, _>(ctx, "allocate", |allocate| {
        let out_size = to_u32(input.len())?;
        let ptr = allocate.call(out_size)?;
        if ptr == 0 {
            return Err(CommunicationError::zero_address().into());
        }
        Ok(ptr)
    })?;
    write_region(ctx, target_ptr, input)?;
    Ok(target_ptr)
}
fn write_to_contract < S : Storage , Q : Querier > ( ctx : & mut Ctx , input : & [ u8 ] ) -> VmResult < u32 > { let target_ptr = with_func_from_context :: < S , Q , u32 , u32 , _ , _ > ( ctx , " " , | allocate | { let out_size = to_u32 ( input . len ( ) ) ? ; let ptr = allocate . call ( out_size ) ? ; if ptr == 0 { return Err ( CommunicationError :: zero_address ( ) . into ( ) ) ; } Ok ( ptr ) } ) ? ; write_region ( ctx , target_ptr , input ) ? ; Ok ( target_ptr ) }
Creates a Region in the contract, writes the given data to it and returns the memory location
Creates a Region in the contract writes the given data to it and returns the memory location
ctx
&mut Ctx
input
&[u8]
ctx
&mut Ctx
input
&[u8]