diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol b/packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol index 7f01fc1b7..b548479cd 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/LibOrder.sol @@ -17,11 +17,12 @@ */ pragma solidity ^0.4.19; +pragma experimental ABIEncoderV2; contract LibOrder { bytes32 constant orderSchemaHash = keccak256( - "address exchangeContractAddress", + "address exchange", "address makerAddress", "address takerAddress", "address makerTokenAddress", @@ -36,6 +37,7 @@ contract LibOrder { ); struct Order { + address exchange; address maker; address taker; address makerToken; @@ -46,30 +48,20 @@ contract LibOrder { uint256 makerFee; uint256 takerFee; uint256 expirationTimestampInSec; - bytes32 orderHash; + uint256 salt; } - - /// @dev Calculates Keccak-256 hash of order with specified parameters. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @return Keccak-256 hash of order. - function getOrderHash(address[5] orderAddresses, uint256[6] orderValues) + + /// @dev Calculates Keccak-256 hash of the order. + /// @param order The order structure. + /// @return Keccak-256 EIP712 hash of the order. + function getOrderHash(Order memory order) public view returns (bytes32 orderHash) { + // TODO: EIP712 is not finalized yet orderHash = keccak256( - address(this), - orderAddresses[0], // maker - orderAddresses[1], // taker - orderAddresses[2], // makerToken - orderAddresses[3], // takerToken - orderAddresses[4], // feeRecipient - orderValues[0], // makerTokenAmount - orderValues[1], // takerTokenAmount - orderValues[2], // makerFee - orderValues[3], // takerFee - orderValues[4], // expirationTimestampInSec - orderValues[5] // salt + orderSchemaHash, + keccak256(order) ); return orderHash; } |