Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

LibOrder

Git Source

Constants

ORDER_ROUTE_TYPE

bytes constant ORDER_ROUTE_TYPE =
    abi.encodePacked("OrderRoute(bytes32 orderId,uint256 deadline,Call[] calls)", LibCall.CALL_TYPE)

ORDER_ROUTE_TYPE_HASH

bytes32 constant ORDER_ROUTE_TYPE_HASH = keccak256(ORDER_ROUTE_TYPE)

ORDER_INPUT_TYPE

bytes constant ORDER_INPUT_TYPE = abi.encodePacked("OrderInput(address token,uint256 amount)")

ORDER_INPUT_TYPE_HASH

bytes32 constant ORDER_INPUT_TYPE_HASH = keccak256(ORDER_INPUT_TYPE)

ORDER_OUTPUT_TYPE

bytes constant ORDER_OUTPUT_TYPE =
    abi.encodePacked("OrderOutput(bytes32 orderId,bytes32 recipient,bytes32 token,uint256 amount,bytes callData)")

ORDER_OUTPUT_TYPE_HASH

bytes32 constant ORDER_OUTPUT_TYPE_HASH = keccak256(ORDER_OUTPUT_TYPE)

Functions

orderId

function orderId(Order calldata order) public view returns (bytes32 id);

hash

Raw hash of Order calls — utility, NOT EIP712-compliant

For EIP712-compliant hashing, use hashType() instead

function hash(Order calldata order) public view returns (bytes32 routeHash);

hashType

EIP712 hashStruct for OrderRoute — includes ORDER_ROUTE_TYPE_HASH

Matches: hashStruct(OrderRoute) = keccak256(ORDER_ROUTE_TYPE_HASH ‖ orderId ‖ encodeData(Call[])) where encodeData(Call[]) = keccak256(hashType(calls[0]) ‖ hashType(calls[1]) ‖ …)

function hashType(Order calldata order) public view returns (bytes32 routeHash);

hash

Generates a deterministic hash for an OrderInput WITHOUT type hash signature

function hash(OrderInput calldata input) public pure returns (bytes32 inputHash);

Parameters

NameTypeDescription
inputOrderInputThe OrderInput to hash

Returns

NameTypeDescription
inputHashbytes32The unique hash for this input

hashType

Generates a deterministic hash for an OrderInput

function hashType(OrderInput calldata input) public pure returns (bytes32 inputHash);

Parameters

NameTypeDescription
inputOrderInputThe OrderInput to hash

Returns

NameTypeDescription
inputHashbytes32The unique hash for this input

hash

Generates a deterministic hash for an OrderInput[]

function hash(OrderInput[] calldata inputs) public pure returns (bytes32 inputsHash);

Parameters

NameTypeDescription
inputsOrderInput[]The OrderInput[] to hash

Returns

NameTypeDescription
inputsHashbytes32The unique hash for the inputs

hash

Generates a deterministic hash for an OrderOutput WITHOUT type hash signature

function hash(OrderOutput calldata output) public pure returns (bytes32 outputHash);

Parameters

NameTypeDescription
outputOrderOutputThe OrderOutput to hash

Returns

NameTypeDescription
outputHashbytes32The unique hash for this output

hashType

Generates a deterministic hash for a RelayedOrderOutput

function hashType(RelayedOrderOutput calldata output) public pure returns (bytes32 outputHash);

Parameters

NameTypeDescription
outputRelayedOrderOutputThe RelayedOrderOutput to hash

Returns

NameTypeDescription
outputHashbytes32The unique hash for this output