tornado-core/migrations/2_deploy_hasher.js

22 lines
673 B
JavaScript

/* global artifacts */
const path = require('path')
const genContract = require('circomlib/src/poseidon_gencontract.js')
const Artifactor = require('truffle-artifactor')
module.exports = function(deployer) {
return deployer.then( async () => {
const contractsDir = path.join(__dirname, '..', 'build/contracts')
let artifactor = new Artifactor(contractsDir)
let contractName = 'Hasher'
await artifactor.save({
contractName,
abi: genContract.abi,
unlinked_binary: genContract.createCode(3),
}).then(async () => {
const hasherContract = artifacts.require(contractName)
await deployer.deploy(hasherContract)
})
})
}