Skip to content

Instantly share code, notes, and snippets.

@maheshmurthy
Created April 12, 2018 18:36
Show Gist options
  • Save maheshmurthy/f05f241e293c16ea4f67b6e70ee3dca4 to your computer and use it in GitHub Desktop.
Save maheshmurthy/f05f241e293c16ea4f67b6e70ee3dca4 to your computer and use it in GitHub Desktop.

Revisions

  1. Mahesh Murthy created this gist Apr 12, 2018.
    14 changes: 14 additions & 0 deletions hash_migration.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    var Voting = artifacts.require("./Voting.sol");
    var ECRecovery = artifacts.require("./ECRecovery.sol");

    const sigUtil = require("eth-sig-util")

    var alice_vote_hash = sigUtil.typedSignatureHash([{ type: 'string', name: 'Message', value: "Vote for Alice"}])
    var bob_vote_hash = sigUtil.typedSignatureHash([{ type: 'string', name: 'Message', value: "Vote for Bob"}])
    var carol_vote_hash = sigUtil.typedSignatureHash([{ type: 'string', name: 'Message', value: "Vote for Carol"}])

    module.exports = function(deployer) {
    deployer.deploy(ECRecovery);
    deployer.link(ECRecovery, Voting);
    deployer.deploy(Voting, ['Alice', 'Bob', 'Carol'], [alice_vote_hash, bob_vote_hash, carol_vote_hash]);
    };