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