11---
22title : Result callback guide
33description :
4- Use the iExec result callback feature to have the protocol invoke a function on your
5- smart contract at the end of a task execution.
4+ Use the iExec result callback feature to have the protocol invoke a function
5+ on your smart contract at the end of a task execution.
66---
77
88# Result Callback
@@ -20,23 +20,25 @@ Use a callback when your smart contract should:
2020
2121## 🧩 High-level flow
2222
23- 1 . A requester executes an iApp.
24- 2 . The iApp writes ` ${IEXEC_OUT}/computed.json ` with a ` callback-data ` field
23+ 1 . A requester deploys the smart contract that should receive the callback data.
24+ 2 . The requester executes an iApp and specifies the callback address.
25+ 3 . The iApp writes ` ${IEXEC_OUT}/computed.json ` with a ` callback-data ` field
2526 (ABI‑encoded bytes you crafted).
26- 3 . After the task completes and is validated, the iExec protocol invokes your
27+ 4 . After the task completes and is validated, the iExec protocol invokes your
2728 contract’s ` receiveResult(bytes32,bytes) ` .
28- 4 . Your contract decodes and processes those bytes if callback data have been
29+ 5 . Your contract decodes and processes those bytes if callback data have been
2930 provided.
3031
3132## Step-by-Step Implementation
3233
3334### Step 1: Implement the Callback Contract
3435
35- Your contract must expose ` receiveResult(bytes32,bytes) `
36+ Your contract must expose the function ` receiveResult(bytes32,bytes) `
3637[ ERC1154] ( https://github.com/iExecBlockchainComputing/iexec-solidity/blob/master/contracts/ERC1154/IERC1154.sol ) .
3738The protocol calls it with:
3839
39- - ` _callID ` : the first arg the taskId
40+ - ` _callID ` : This parameter represents the ` taskId ` , passed as the first
41+ argument
4042- ` callback ` : exactly the bytes you encoded as ` callback-data `
4143
4244Decode using the same tuple. (Optional) Add protections: authorized caller check
0 commit comments