tornado-nova/scripts/deploy.js

53 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-06-06 19:31:32 +02:00
const { ethers } = require('hardhat')
2021-09-08 17:57:24 +02:00
const MERKLE_TREE_HEIGHT = 23
2021-06-06 19:31:32 +02:00
async function main() {
2021-09-30 20:32:49 +02:00
require('../scripts/compileHasher')
2021-09-08 17:57:24 +02:00
const govAddress = '0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce'
2021-09-30 20:32:49 +02:00
const omniBridge = '0x59447362798334d3485c64D1e4870Fde2DDC0d75'
const token = '0xCa8d20f3e0144a72C6B5d576e9Bd3Fd8557E2B04' // WBNB
const l1Unwrapper = '0xefc33f8b2c4d51005585962be7ea20518ea9fd0d' // WBNB -> BNB
2021-09-08 17:57:24 +02:00
const Verifier2 = await ethers.getContractFactory('Verifier2')
const verifier2 = await Verifier2.deploy()
await verifier2.deployed()
console.log(`verifier2: ${verifier2.address}`)
const Verifier16 = await ethers.getContractFactory('Verifier16')
const verifier16 = await Verifier16.deploy()
await verifier16.deployed()
console.log(`verifier16: ${verifier16.address}`)
2021-06-06 19:31:32 +02:00
2021-09-30 20:32:49 +02:00
const Hasher = await await ethers.getContractFactory('Hasher')
const hasher = await Hasher.deploy()
2021-06-06 19:31:32 +02:00
const Pool = await ethers.getContractFactory('TornadoPool')
2021-09-30 20:32:49 +02:00
const tornado = await Pool.deploy(
verifier2.address,
verifier16.address,
MERKLE_TREE_HEIGHT,
hasher.address,
token,
omniBridge,
l1Unwrapper,
)
2021-09-08 17:57:24 +02:00
await tornado.deployed()
2021-06-16 02:31:31 +02:00
console.log(`TornadoPool address: ${tornado.address}`)
2021-09-08 17:57:24 +02:00
const CrossChainUpgradeableProxy = await ethers.getContractFactory('CrossChainUpgradeableProxy')
2021-09-30 20:32:49 +02:00
const proxy = await CrossChainUpgradeableProxy.deploy(tornado.address, govAddress, [], omniBridge)
2021-09-08 17:57:24 +02:00
await proxy.deployed()
console.log(`proxy address: ${proxy.address}`)
const tornadoPool = Pool.attach(proxy.address)
2021-09-30 20:32:49 +02:00
await tornadoPool.initialize()
2021-06-06 19:31:32 +02:00
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})