pub fn call_with_function_selector(
    target: ContractId,
    function_selector: Bytes,
    calldata: Bytes,
    single_value_type_arg: bool,
    call_params: CallParams,
) 
Expand description

Call a target contract with a function selector and calldata, provided as Bytes.

Arguments

  • target : [ContractId] - The ContractId of the contract to be called.
  • function_selector : [Bytes] - The function selector of the function to be called, i.e. the first 8 bytes of sha256("my_func(u64)").
  • calldata : [Bytes] - The encoded arguments with which to call the function.
  • single_value_type_arg : [bool] - Whether the function being called takes a single value-type argument.
  • call_params : [CallParams] - The amount and color of coins to forward, and the gas to forward.

Examples

use std::low_level_call::{bytes::Bytes, call_with_function_selector, CallParams};

fn call_contract(target: ContractId, function_selector: Bytes, calldata: Bytes, call_params: CallParams, single_value_type_arg: bool) {
    call_with_function_selector(target, function_selector, calldata, single_value_type_arg, call_params);
}