LibOrder
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
| Name | Type | Description |
|---|---|---|
input | OrderInput | The OrderInput to hash |
Returns
| Name | Type | Description |
|---|---|---|
inputHash | bytes32 | The unique hash for this input |
hashType
Generates a deterministic hash for an OrderInput
function hashType(OrderInput calldata input) public pure returns (bytes32 inputHash);
Parameters
| Name | Type | Description |
|---|---|---|
input | OrderInput | The OrderInput to hash |
Returns
| Name | Type | Description |
|---|---|---|
inputHash | bytes32 | The unique hash for this input |
hash
Generates a deterministic hash for an OrderInput[]
function hash(OrderInput[] calldata inputs) public pure returns (bytes32 inputsHash);
Parameters
| Name | Type | Description |
|---|---|---|
inputs | OrderInput[] | The OrderInput[] to hash |
Returns
| Name | Type | Description |
|---|---|---|
inputsHash | bytes32 | The 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
| Name | Type | Description |
|---|---|---|
output | OrderOutput | The OrderOutput to hash |
Returns
| Name | Type | Description |
|---|---|---|
outputHash | bytes32 | The unique hash for this output |
hashType
Generates a deterministic hash for a RelayedOrderOutput
function hashType(RelayedOrderOutput calldata output) public pure returns (bytes32 outputHash);
Parameters
| Name | Type | Description |
|---|---|---|
output | RelayedOrderOutput | The RelayedOrderOutput to hash |
Returns
| Name | Type | Description |
|---|---|---|
outputHash | bytes32 | The unique hash for this output |