#[ink(message)]
pub fn test_cross_contract_call(
&mut self,
calls_count: u64,
) {
let selector: Selector = Selector::new([0x6b, 0x25, 0xcb, 0x19]);
let response: Result<u64> = build_call::<DefaultEnvironment>()
.call_type(
Call::new()
.callee(self.env().account_id())
.transferred_value(0)
.gas_limit(50000),
)
.call_flags(ink::env::CallFlags::default().set_allow_reentry(true))
.exec_input(
ExecutionInput::new(selector)
.push_arg(calls_count)
)
.returns::<u64>()
.fire();
self.value = response.unwrap();
}
#[ink(message, selector = 0x6b25cb19)]
pub fn dummy_function(
&mut self,
value: u64,
) -> u64 {
return 45 * value;
}
This is my contract code snippet. I am trying to test cross-contract call with simplest computation. But I am getting Contracts.ContractTrapped
error. I also updated the dummy_fuction
selector to "_" to check if i was passing wrong selector. But then also I am getting the same error.
DO we have some examples on how to call cross contract calls to self or other contract?
And Can someone explain what wrong i am doing in my code?
.call()
low level contract execution in solidity.