Function concordium_std::prims::invoke

source ·
pub unsafe extern "C" fn invoke(
tag: u32,
start: *const u8,
length: u32
) -> u64
Expand description

Invoke a host instruction. The arguments are

  • tag, which instruction to invoke
    • 0 for transfer to account
    • 1 for call to a contract
    • 2 for query an account balance.
    • 3 for query a contract balance.
    • 4 for query the exchange rates.
  • start, pointer to the start of the invoke payload
  • length, length of the payload
  • if the last 5 bytes are 0 then the call succeeded. In this case the first bit of the response indicates whether our own state has changed (1) or not (0) the remaining 23 bits are the index of the return value that can be used in a call to get_parameter_section and get_parameter_size.
  • otherwise
    • if the fourth byte is 0 the call failed because of a logic error and there is a return value. Bits 1..24 of the response are the index of the return value. Bits 32..64 are to be interpreted in two’s complement and will be a negative number indicating the error code.
    • otherwise only the fourth byte is set.
    • if it is 1 then call failed due to transfer of non-existent amount
    • if it is 2 then the account to transfer to did not exist
    • if it is 3 then the contract to invoke did not exist
    • if it is 4 then the entrypoint did not exist
    • if it is 5 then sending a message to V0 contract failed.
    • if it is 6 then invoking a contract failed with a runtime error
    • no other values are possible