Add ability to handle on ZetaChain results from connected chain calls #2736
Labels
feature:idea
An early idea for a feature. Used as reference to follow new feature integrations
feature:smart-contracts
Related to extending smart contracts capability and interactions with ZEVM
Describe the Issue
New smart contract architecture provides ability to perform abritrary smart contract call on connected.
To fully take advantage of this feature, we should add ability to handle the result from the smart contract.
On smart contract
The solution would contains a lot of similarities with the revert management.
We first define a new interface called:
The resultContext can store various data, but in particular, like revertContext, would contains an arbitrary message for the smart contract to be able to understand the origin, what call, the result belongs to
A resultOptions can be provided to instruct how to handle the results:
The interface of
call
andwithdrawAndCall
is extended to allow provided a resultOptions. When provided result is processed.During the calls, the gateway would include the result as part of the emitted event
On protocol
The protocol (ZetaClient included), read the result as part of the event, this data is added in the CCTX object along with the resultOptions
When resultOptions instructs to process result, at the outbound processing stage, the protocol calls the onResult hook.
A new CCTX status should be added: something like OutboundResultProcessingFailed
The text was updated successfully, but these errors were encountered: