diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-07-30 12:47:21 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-08-08 05:34:28 +0800 |
commit | 3d6cf503645386734bb552e09df2c6709e2ed45c (patch) | |
tree | 8172873cac06bcc7e47204aad70c3d8f83a1a215 /packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol | |
parent | 8199e8794331f555679496d32cb87ad8513c31d1 (diff) | |
download | dexon-sol-tools-3d6cf503645386734bb552e09df2c6709e2ed45c.tar dexon-sol-tools-3d6cf503645386734bb552e09df2c6709e2ed45c.tar.gz dexon-sol-tools-3d6cf503645386734bb552e09df2c6709e2ed45c.tar.bz2 dexon-sol-tools-3d6cf503645386734bb552e09df2c6709e2ed45c.tar.lz dexon-sol-tools-3d6cf503645386734bb552e09df2c6709e2ed45c.tar.xz dexon-sol-tools-3d6cf503645386734bb552e09df2c6709e2ed45c.tar.zst dexon-sol-tools-3d6cf503645386734bb552e09df2c6709e2ed45c.zip |
Fix comments, styling, and optimize hashOrder
Diffstat (limited to 'packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol')
-rw-r--r-- | packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol index 1fc41dafd..c9e45189d 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol @@ -30,7 +30,7 @@ contract LibEIP712 { string constant internal EIP712_DOMAIN_VERSION = "2"; // Hash of the EIP712 Domain Separator Schema - bytes32 public constant EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked( + bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked( "EIP712Domain(", "string name,", "string version,", @@ -45,11 +45,11 @@ contract LibEIP712 { constructor () public { - EIP712_DOMAIN_HASH = keccak256(abi.encode( + EIP712_DOMAIN_HASH = keccak256(abi.encodePacked( EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH, keccak256(bytes(EIP712_DOMAIN_NAME)), keccak256(bytes(EIP712_DOMAIN_VERSION)), - address(this) + bytes32(address(this)) )); } @@ -59,8 +59,13 @@ contract LibEIP712 { function hashEIP712Message(bytes32 hashStruct) internal view - returns (bytes32) + returns (bytes32 result) { - return keccak256(abi.encodePacked(EIP191_HEADER, EIP712_DOMAIN_HASH, hashStruct)); + result = keccak256(abi.encodePacked( + EIP191_HEADER, + EIP712_DOMAIN_HASH, + hashStruct + )); + return result; } } |