[][src]Function casperlabs_contract::ext_ffi::transfer_from_purse_to_purse

pub unsafe extern "C" fn transfer_from_purse_to_purse(
    source_ptr: *const u8,
    source_size: usize,
    target_ptr: *const u8,
    target_size: usize,
    amount_ptr: *const u8,
    amount_size: usize
) -> i32

This function uses the mint contract’s transfer function to transfer tokens from the specified source purse to the specified target purse. If the target account does not exist then it is automatically created, and the tokens are transferred to the main purse of the new account. The source is a serialized casperlabs_types::uref::URef. The target is also a serialized casperlabs_types::uref::URef. The amount must be a serialized 512-bit unsigned integer. This function causes a Trap if the source or target cannot be de-serialized as a casperlabs_types::uref::URef or the amount cannot be de-serialized into a U512. The return value indicated what occurred, where 0 means a successful transfer, 1 means the transfer failed (this could be because the source purse had insufficient tokens or because there was not valid access to the source purse or target purse).

Arguments

  • source_ptr - pointer in wasm memory to bytes representing the source casperlabs_types::uref::URef to transfer from
  • source_size - size of the source casperlabs_types::uref::URef (in bytes)
  • target_ptr - pointer in wasm memory to bytes representing the target casperlabs_types::uref::URef to transfer to
  • target_size - size of the target (in bytes)
  • amount_ptr - pointer in wasm memory to bytes representing the amount to transfer to the target account
  • amount_size - size of the amount (in bytes)