tornado-core/migrations/2_deploy_hasher.js

22 lines
692 B
JavaScript
Raw Normal View History

2019-07-16 23:49:45 +03:00
/* global artifacts */
2019-07-16 20:27:20 +03:00
const path = require('path')
2019-07-10 19:58:21 +03:00
const genContract = require('circomlib/src/mimcsponge_gencontract.js')
2019-11-08 03:28:29 +03:00
const Artifactor = require('@truffle/artifactor')
2019-07-10 19:58:21 +03:00
module.exports = function(deployer) {
return deployer.then( async () => {
2019-07-16 20:27:20 +03:00
const contractsDir = path.join(__dirname, '..', 'build/contracts')
let artifactor = new Artifactor(contractsDir)
let contractName = 'Hasher'
2019-07-10 19:58:21 +03:00
await artifactor.save({
contractName,
abi: genContract.abi,
2019-10-04 19:27:19 +03:00
unlinked_binary: genContract.createCode('mimcsponge', 220),
2019-07-16 20:27:20 +03:00
}).then(async () => {
const hasherContract = artifacts.require(contractName)
await deployer.deploy(hasherContract)
2019-07-10 19:58:21 +03:00
})
2019-07-16 20:27:20 +03:00
})
}