aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-07-07 00:51:23 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-07-07 01:58:28 +0800
commitd2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd (patch)
tree978dd0a5132eee644d2163a33e25a24fdd4a3f14 /packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol
parente796734659ddea76622d81b4416e0b36d5e7c0ed (diff)
downloaddexon-sol-tools-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.tar
dexon-sol-tools-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.tar.gz
dexon-sol-tools-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.tar.bz2
dexon-sol-tools-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.tar.lz
dexon-sol-tools-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.tar.xz
dexon-sol-tools-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.tar.zst
dexon-sol-tools-d2e422cd5eab26108e6c7a9f73c944f4b6fb4fdd.zip
Apply new linter rules
Diffstat (limited to 'packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol')
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol74
1 files changed, 37 insertions, 37 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol
index 3b18ac733..823e14316 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol
@@ -15,7 +15,7 @@
limitations under the License.
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
import "./libs/LibExchangeErrors.sol";
import "./mixins/MSignatureValidator.sol";
@@ -37,7 +37,7 @@ contract MixinTransactions is
address public currentContextAddress;
// Hash for the EIP712 ZeroEx Transaction Schema
- bytes32 constant EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(
+ bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(
"ZeroExTransaction(",
"uint256 salt,",
"address signerAddress,",
@@ -45,41 +45,6 @@ contract MixinTransactions is
")"
));
- /// @dev Calculates EIP712 hash of the Transaction.
- /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
- /// @param signerAddress Address of transaction signer.
- /// @param data AbiV2 encoded calldata.
- /// @return EIP712 hash of the Transaction.
- function hashZeroExTransaction(
- uint256 salt,
- address signerAddress,
- bytes memory data
- )
- internal
- pure
- returns (bytes32 result)
- {
- 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)
- mstore(add(memPtr, 32), salt)
- mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff))
- mstore(add(memPtr, 96), dataHash)
- result := keccak256(memPtr, 128)
- }
-
- return result;
- }
-
/// @dev Executes an exchange method call in the context of signer.
/// @param salt Arbitrary number to ensure uniqueness of transaction hash.
/// @param signerAddress Address of transaction signer.
@@ -139,6 +104,41 @@ contract MixinTransactions is
currentContextAddress = address(0);
}
+ /// @dev Calculates EIP712 hash of the Transaction.
+ /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
+ /// @param signerAddress Address of transaction signer.
+ /// @param data AbiV2 encoded calldata.
+ /// @return EIP712 hash of the Transaction.
+ function hashZeroExTransaction(
+ uint256 salt,
+ address signerAddress,
+ bytes memory data
+ )
+ internal
+ pure
+ returns (bytes32 result)
+ {
+ 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)
+ mstore(add(memPtr, 32), salt)
+ mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff))
+ mstore(add(memPtr, 96), dataHash)
+ result := keccak256(memPtr, 128)
+ }
+
+ return result;
+ }
+
/// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).
/// If calling a fill function, this address will represent the taker.
/// If calling a cancel function, this address will represent the maker.