Last active
December 2, 2017 22:33
-
-
Save miguelmota/80124f54afc77f3863918a71b48ca876 to your computer and use it in GitHub Desktop.
0xProject ZRX relayer API generate SH3 (Keccak256) order hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {soliditySHA3} = require('ethereumjs-abi') | |
const BN = require('bn.js') | |
const orderHash = soliditySHA3([ | |
'address', | |
'address', | |
'address', | |
'address', | |
'address', | |
'address', | |
'uint256', | |
'uint256', | |
'uint256', | |
'uint256', | |
'uint256', | |
'uint256' | |
], [ | |
new BN('12459c951127e0c374ff9105dda097662a027093', 16), // exchange contract address | |
new BN('9e56625509c2f60af937f23b7b532600390e8c8b', 16), // maker address | |
new BN('a2b31dacf30a9c50ca473337c01d8a201ae33e32', 16), // taker address | |
new BN('323b5d4c32345ced77393b3530b1eed0f346429d', 16), // maker token address | |
new BN('ef7fff64389b814a946f3e92105513705ca6b990', 16), // taker token address | |
new BN('b046140686d052fff581f63f8136cce132e857da', 16), // fee recipient | |
new BN('10000000000000000', 10), // maker token amount | |
new BN('20000000000000000', 10), // taker token amount | |
new BN('100000000000000', 10), // maker fee | |
new BN('200000000000000', 10), // taker fee | |
new BN('42', 10), // expiration unix timestamp sec | |
new BN('256', 10) // salt | |
]) | |
console.log(orderHash.toString('hex')) // "0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment