Integrate iLayer in under an hour
Three steps: find the Hub address, build and sign an OrderRequest, call createOrder(). Everything you need to store, and the two calls you may need later.
callRecipient, callData, callValue. The three optional fields that turn a swap into any DeFi action, and how the Executor keeps them safe.
Most orders end with tokens arriving in a wallet. Some should end with something happening: liquidity supplied, a position opened, an NFT minted, a vault entered. The last three fields of the Order struct exist for that.
bytes32 callRecipient; // destination address
bytes callData; // on EVM: abi-encoded selector + arguments
uint256 callValue; // optional native value to pass alongAfter the Spoke has received the outputs from the solver, it executes the hook: a call to callRecipient with callData and callValue, on the destination chain, in the same transaction as the fill. If the call fails, the fill reverts with ExternalCallFailed(). There is no state where the tokens moved but the action did not.
Not needed? Fill the three fields with null values. The struct does not change shape.
Outputs may be an empty array. Combined with a hook, that gives you an order that pays purely for cross-chain code execution: lock some tokens on chain A, and in exchange a solver runs your calldata on chain B. The inputs are the solver’s payment for gas and service. This is the primitive behind “trigger this contract on Polygon from Ethereum” and it needs no bridge integration on your side.
The Spoke does not call your target directly. On deployment it instantiates an Executor contract, and every hook runs through it. The Executor is isolated: it holds no protocol state, so a malicious or buggy target can only affect its own call. Reentrant calls are blocked for security reasons, so a hook cannot call back into the Spoke or the Hub mid-fill.
On EVM, calldata is the 4-byte function selector followed by the abi-encoded arguments:
bytes4 selector = bytes4(keccak256("setValue(uint256)"));
bytes memory callData = abi.encodePacked(selector, newValue);
Put the target address in callRecipient (as bytes32), the bytes in callData, any native value in callValue. The developer track has a full worked example, Example: a cross-chain contract call, and another that uses outputs and a hook together to LP on Aave from another chain.
Seven chapters in, you can read an Order field by field, follow it through Hub and Spoke, understand how it was priced and why its deadlines are shaped the way they are. The Developer track picks up from here with code: integrate in under an hour, choose a bridge, and the two examples. The Ecosystem track covers solvers, Waku and the industries we build for.
You know the theory. The developer track starts with the three calls you actually need.
Three steps: find the Hub address, build and sign an OrderRequest, call createOrder(). Everything you need to store, and the two calls you may need later.