mirror of
https://github.com/tornadocash/tornado-nova
synced 2024-02-02 14:53:56 +01:00
Merge pull request #15 from tornadocash/fixDeploy
This commit is contained in:
commit
3cae4c9817
@ -1,6 +1,6 @@
|
|||||||
const { ethers } = require('hardhat')
|
const { ethers } = require('hardhat')
|
||||||
|
|
||||||
const MERKLE_TREE_HEIGHT = 32
|
const MERKLE_TREE_HEIGHT = 23
|
||||||
const MerkleTree = require('fixed-merkle-tree')
|
const MerkleTree = require('fixed-merkle-tree')
|
||||||
const { poseidon } = require('circomlib')
|
const { poseidon } = require('circomlib')
|
||||||
const poseidonHash = (items) => ethers.BigNumber.from(poseidon(items).toString())
|
const poseidonHash = (items) => ethers.BigNumber.from(poseidon(items).toString())
|
||||||
@ -14,6 +14,9 @@ const toFixedHex = (number, length = 32) =>
|
|||||||
).padStart(length * 2, '0')
|
).padStart(length * 2, '0')
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
const govAddress = '0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce'
|
||||||
|
const crossDomainMessenger = '0x4200000000000000000000000000000000000007'
|
||||||
|
|
||||||
const Verifier2 = await ethers.getContractFactory('Verifier2')
|
const Verifier2 = await ethers.getContractFactory('Verifier2')
|
||||||
const verifier2 = await Verifier2.deploy()
|
const verifier2 = await Verifier2.deploy()
|
||||||
await verifier2.deployed()
|
await verifier2.deployed()
|
||||||
@ -26,10 +29,21 @@ async function main() {
|
|||||||
|
|
||||||
const tree = new MerkleTree(MERKLE_TREE_HEIGHT, [], { hashFunction: poseidonHash2 })
|
const tree = new MerkleTree(MERKLE_TREE_HEIGHT, [], { hashFunction: poseidonHash2 })
|
||||||
const root = await tree.root()
|
const root = await tree.root()
|
||||||
|
console.log('root', toFixedHex(root))
|
||||||
|
|
||||||
const Pool = await ethers.getContractFactory('TornadoPool')
|
const Pool = await ethers.getContractFactory('TornadoPool')
|
||||||
const tornado = await Pool.deploy(verifier2.address, verifier16.address, toFixedHex(root))
|
const tornado = await Pool.deploy(verifier2.address, verifier16.address)
|
||||||
|
await tornado.deployed()
|
||||||
console.log(`TornadoPool address: ${tornado.address}`)
|
console.log(`TornadoPool address: ${tornado.address}`)
|
||||||
|
|
||||||
|
const CrossChainUpgradeableProxy = await ethers.getContractFactory('CrossChainUpgradeableProxy')
|
||||||
|
const proxy = await CrossChainUpgradeableProxy.deploy(tornado.address, govAddress, [], crossDomainMessenger)
|
||||||
|
await proxy.deployed()
|
||||||
|
console.log(`proxy address: ${proxy.address}`)
|
||||||
|
|
||||||
|
const tornadoPool = Pool.attach(proxy.address)
|
||||||
|
|
||||||
|
await tornadoPool.initialize(toFixedHex(root))
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user