aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-06-30 02:41:23 +0800
committerGitHub <noreply@github.com>2018-06-30 02:41:23 +0800
commit50556e26098a9720f933153697008fb4ea8ececb (patch)
tree3c9ee6887e90b308dfccaa5b9f19a2989c1fcdf4 /packages/contracts
parent7a222985978a8dc2310d7fe0a719ba80ce925df1 (diff)
parent46d79e5115421285faa709e16ba6156f2c672f38 (diff)
downloaddexon-sol-tools-50556e26098a9720f933153697008fb4ea8ececb.tar.gz
dexon-sol-tools-50556e26098a9720f933153697008fb4ea8ececb.tar.zst
dexon-sol-tools-50556e26098a9720f933153697008fb4ea8ececb.zip
Merge pull request #774 from 0xProject/style/contracts/abiEncodeAsmComments
Added some comments for ASM hashing
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol7
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol15
2 files changed, 22 insertions, 0 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol
index e0f450d0a..31f7f2847 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinTransactions.sol
@@ -60,6 +60,13 @@ contract MixinTransactions is
{
bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;
bytes32 dataHash = keccak256(data);
+ // Assembly for more efficiently computing:
+ // keccak256(abi.encode(
+ // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,
+ // salt,
+ // signerAddress,
+ // keccak256(data)
+ // ));
assembly {
let memPtr := mload(64)
mstore(memPtr, schemaHash)
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
index f3f1e9277..954f94f76 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
@@ -98,6 +98,21 @@ contract LibOrder is
bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;
bytes32 makerAssetDataHash = keccak256(order.makerAssetData);
bytes32 takerAssetDataHash = keccak256(order.takerAssetData);
+ // Assembly for more efficiently computing:
+ // keccak256(abi.encode(
+ // order.makerAddress,
+ // order.takerAddress,
+ // order.feeRecipientAddress,
+ // order.senderAddress,
+ // order.makerAssetAmount,
+ // order.takerAssetAmount,
+ // order.makerFee,
+ // order.takerFee,
+ // order.expirationTimeSeconds,
+ // order.salt,
+ // keccak256(order.makerAssetData),
+ // keccak256(order.takerAssetData)
+ // ));
assembly {
// Backup
let temp1 := mload(sub(order, 32))