Example: cross-chain contract call

We need to call a dummy contract that exposes the following function

function setValue(uint256 value) external;

We need to craft an order that contains calldata for this specific function, starting from the calldata

bytes4 selector = bytes4(keccak256("setValue(uint256)"));
bytes memory callData = abi.encodePacked(selector, newValue);

then the order itself

{
  sourceChainId: "1", // Ethereum Mainnet
  destinationChainId: "137", // Polygon Pos
  inputs: [
    // WETH
    { tokenType: "FUNGIBLE_TOKEN", tokenAddress: "0x0000000000000000000000004200000000000000000000000000000000000006", tokenId: "0", amount: "10000000" }
  ],
  outputs: [],
  callRecipient: "0x0...", // the contract address
  callData: callData,
  callValue: 0,
}

Last updated