2_deploy_hasher.js 691 B

12345678910111213141516171819202122
  1. /* global artifacts */
  2. const path = require('path')
  3. const genContract = require('circomlib/src/mimcsponge_gencontract.js')
  4. const Artifactor = require('truffle-artifactor')
  5. module.exports = function(deployer) {
  6. return deployer.then( async () => {
  7. const contractsDir = path.join(__dirname, '..', 'build/contracts')
  8. let artifactor = new Artifactor(contractsDir)
  9. let contractName = 'Hasher'
  10. await artifactor.save({
  11. contractName,
  12. abi: genContract.abi,
  13. unlinked_binary: genContract.createCode('mimcsponge', 220),
  14. }).then(async () => {
  15. const hasherContract = artifacts.require(contractName)
  16. await deployer.deploy(hasherContract)
  17. })
  18. })
  19. }