Function casper_contract::ext_ffi::casper_transfer_from_purse_to_purse[][src]

pub unsafe extern "C" fn casper_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,
    id_ptr: *const u8,
    id_size: usize
) -> i32
Expand description

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 URef. The target is also a serialized 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 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 URef to transfer from
  • source_size - size of the source URef (in bytes)
  • target_ptr - pointer in wasm memory to bytes representing the target 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)
  • id_ptr - pointer in wasm memory to bytes representing the user-defined transaction id
  • id_size - size of the id (in bytes)