Bouncer contract implementation (#883)

* feat: implement bouncer contracts

* fix: rename Bouncer to SignatureBouncer
This commit is contained in:
Matt Condon
2018-04-17 11:36:24 -03:00
committed by GitHub
parent 0926729c8f
commit 6a7114fdb4
8 changed files with 322 additions and 29 deletions

View File

@ -1,8 +0,0 @@
import utils from 'ethereumjs-util';
// Hash and add same prefix to the hash that ganache use.
module.exports = function (message) {
const messageHex = Buffer.from(utils.sha3(message).toString('hex'), 'hex');
const prefix = utils.toBuffer('\u0019Ethereum Signed Message:\n' + messageHex.length.toString());
return utils.bufferToHex(utils.sha3(Buffer.concat([prefix, messageHex])));
};