compileHasher.js 596 B

12345678910111213141516171819202122
  1. // Generates Hasher artifact at compile-time using Truffle's external compiler
  2. // mechanism
  3. const path = require('path')
  4. const fs = require('fs')
  5. const genContract = require('circomlib/src/mimcsponge_gencontract.js')
  6. // where Truffle will expect to find the results of the external compiler
  7. // command
  8. const outputPath = path.join(__dirname, '..', 'build', 'Hasher.json')
  9. function main() {
  10. const contract = {
  11. contractName: 'Hasher',
  12. abi: genContract.abi,
  13. bytecode: genContract.createCode('mimcsponge', 220),
  14. }
  15. fs.writeFileSync(outputPath, JSON.stringify(contract))
  16. }
  17. main()