Skip to content

Instantly share code, notes, and snippets.

@andreafspeziale
Last active July 3, 2019 17:20
Show Gist options
  • Save andreafspeziale/303017c65a14529aa68ddaa02fe11a46 to your computer and use it in GitHub Desktop.
Save andreafspeziale/303017c65a14529aa68ddaa02fe11a46 to your computer and use it in GitHub Desktop.
const userProxyContractNonce = new BigNumber(await ProxyInstance.nonce.call(user))
const messageToBeHashed = [
ProxyInstance.address,
user,
TargetContractInstance.address,
web3.utils.toTwosComplement(userValueTransactionField),
userDataTransactionField,
AssetInstance.address,
web3.utils.toTwosComplement(REWARD_AMOUNT),
web3.utils.toTwosComplement(userProxyContractNonce),
]
const messageHashed = web3.utils.soliditySha3(...messageToBeHashed)
const messageSigned = await web3.eth.sign(messageHashed, user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment