Skip to content

Instantly share code, notes, and snippets.

@feuGeneA
Created November 7, 2019 22:00
Show Gist options
  • Save feuGeneA/31166d0898f27baf8b10670b796fa99d to your computer and use it in GitHub Desktop.
Save feuGeneA/31166d0898f27baf8b10670b796fa99d to your computer and use it in GitHub Desktop.
diff --git a/contracts/dev-utils/contracts/src/DevUtils.sol b/contracts/dev-utils/contracts/src/DevUtils.sol
index 44166d22b..46107efdf 100644
--- a/contracts/dev-utils/contracts/src/DevUtils.sol
+++ b/contracts/dev-utils/contracts/src/DevUtils.sol
@@ -19,6 +19,9 @@
pragma solidity ^0.5.5;
pragma experimental ABIEncoderV2;
+import "@0x/contracts-exchange-libs/contracts/src/LibEIP712ExchangeDomain.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-utils/contracts/src/LibEIP712.sol";
import "./OrderValidationUtils.sol";
import "./OrderTransferSimulationUtils.sol";
import "./LibTransactionDecoder.sol";
@@ -29,6 +32,7 @@ import "./EthBalanceChecker.sol";
contract DevUtils is
OrderValidationUtils,
LibTransactionDecoder,
+ LibEIP712ExchangeDomain,
EthBalanceChecker,
OrderTransferSimulationUtils
{
@@ -37,4 +41,17 @@ contract DevUtils is
OrderValidationUtils(_exchange)
OrderTransferSimulationUtils(_exchange)
{}
+
+ function getOrderHash(LibOrder.Order calldata order, uint256 chainId)
+ external
+ pure
+ returns (bytes32 orderHash)
+ {
+ return LibOrder.getTypedDataHash(order, LibEIP712.hashEIP712Domain(
+ _EIP712_EXCHANGE_DOMAIN_NAME,
+ _EIP712_EXCHANGE_DOMAIN_VERSION,
+ chainId,
+ address(0)
+ ));
+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment