tornado-pool-factory/scripts/deployMultipleInstanceFactory.js

29 lines
935 B
JavaScript
Raw Normal View History

2022-02-23 17:27:44 +01:00
const { ethers } = require('hardhat')
const config = require('../config')
const { generate } = require('../src/generateAddresses')
async function deploy({ address, bytecode, singletonFactory }) {
const contractCode = await ethers.provider.getCode(address)
if (contractCode !== '0x') {
console.log(`Contract ${address} already deployed. Skipping...`)
return
}
await singletonFactory.deploy(bytecode, config.salt, { gasLimit: config.deployGasLimit })
}
async function main() {
const singletonFactory = await ethers.getContractAt('SingletonFactory', config.singletonFactory)
const contracts = await generate()
await deploy({ ...contracts.factoryContract, singletonFactory })
2022-03-31 21:40:12 +02:00
console.log(
`MultipleInstanceFactory contract have been deployed on ${contracts.factoryContract.address} address`,
)
2022-02-23 17:27:44 +01:00
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})