Add expirationTimeSeconds to ZeroExTransaction schema throughout codebase
This commit is contained in:
@@ -29,16 +29,18 @@ contract LibZeroExTransaction is
|
||||
// keccak256(abi.encodePacked(
|
||||
// "ZeroExTransaction(",
|
||||
// "uint256 salt,",
|
||||
// "uint256 expirationTimeSeconds,"
|
||||
// "address signerAddress,",
|
||||
// "bytes data",
|
||||
// ")"
|
||||
// ));
|
||||
bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = 0x213c6f636f3ea94e701c0adf9b2624aa45a6c694f9a292c094f9a81c24b5df4c;
|
||||
bytes32 constant public EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = 0x6b4c70d217b44d0ff0d3bf7aeb18eb8604c5cd06f615a4b497aeefa4f01d2775;
|
||||
|
||||
struct ZeroExTransaction {
|
||||
uint256 salt; // Arbitrary number to ensure uniqueness of transaction hash.
|
||||
address signerAddress; // Address of transaction signer.
|
||||
bytes data; // AbiV2 encoded calldata.
|
||||
uint256 salt; // Arbitrary number to ensure uniqueness of transaction hash.
|
||||
uint256 expirationTimeSeconds; // Timestamp in seconds at which transaction expires.
|
||||
address signerAddress; // Address of transaction signer.
|
||||
bytes data; // AbiV2 encoded calldata.
|
||||
}
|
||||
|
||||
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract.
|
||||
@@ -65,12 +67,14 @@ contract LibZeroExTransaction is
|
||||
bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;
|
||||
bytes memory data = transaction.data;
|
||||
uint256 salt = transaction.salt;
|
||||
uint256 expirationTimeSeconds = transaction.expirationTimeSeconds;
|
||||
address signerAddress = transaction.signerAddress;
|
||||
|
||||
// Assembly for more efficiently computing:
|
||||
// keccak256(abi.encodePacked(
|
||||
// EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,
|
||||
// transaction.salt,
|
||||
// transaction.expirationTimeSeconds,
|
||||
// uint256(transaction.signerAddress),
|
||||
// keccak256(transaction.data)
|
||||
// ));
|
||||
@@ -84,11 +88,12 @@ contract LibZeroExTransaction is
|
||||
|
||||
mstore(memPtr, schemaHash) // hash of schema
|
||||
mstore(add(memPtr, 32), salt) // salt
|
||||
mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress
|
||||
mstore(add(memPtr, 96), dataHash) // hash of data
|
||||
mstore(add(memPtr, 64), expirationTimeSeconds) // expirationTimeSeconds
|
||||
mstore(add(memPtr, 96), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress
|
||||
mstore(add(memPtr, 128), dataHash) // hash of data
|
||||
|
||||
// Compute hash
|
||||
result := keccak256(memPtr, 128)
|
||||
result := keccak256(memPtr, 160)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ pragma experimental ABIEncoderV2;
|
||||
import "../src/LibEIP712ExchangeDomain.sol";
|
||||
import "../src/LibMath.sol";
|
||||
import "../src/LibOrder.sol";
|
||||
import "../src/LibZeroExTransaction.sol";
|
||||
import "../src/LibFillResults.sol";
|
||||
|
||||
|
||||
@@ -30,6 +31,7 @@ contract TestLibs is
|
||||
LibEIP712ExchangeDomain,
|
||||
LibMath,
|
||||
LibOrder,
|
||||
LibZeroExTransaction,
|
||||
LibFillResults
|
||||
{
|
||||
constructor (uint256 chainId)
|
||||
|
Reference in New Issue
Block a user