'Rust ink, cross contract call returns ConctractTrapped error
As the title suggests, I'm trying to call a function on already deployed contract with a very simple String return function.
Deployed contract1 function:
#[ink(message)]
#[ink(selector = 0xDEADBEEF)]
pub fn test(&self) -> String {
return "TEST".to_string()
}
The following code snippet is the contract2 function, to return the value from contract1:
#[ink(message)]
pub fn test1(&self,token_contract: AccountId) -> String {
let my_return_value: String = ink_env::call::build_call::<ink_env::DefaultEnvironment>()
.callee(token_contract)
.gas_limit(50000)
.transferred_value(0)
.exec_input(
ink_env::call::ExecutionInput::new(ink_env::call::Selector::new([0xDE, 0xAD, 0xBE, 0xEF]))
)
.returns::<ink_env::call::utils::ReturnType<String>>()
.fire()
.unwrap();
my_return_value
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
