From fa7bb9947a222a2e49dad9f018e113f2d1b86f5b Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 6 Oct 2021 20:14:28 +0300 Subject: [PATCH] update deploy script --- package.json | 1 + scripts/deployTornado.js | 38 ++++++++++++++++++++++++++------------ yarn.lock | 27 +++++++++++++++++---------- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 93bc2f1..15fb616 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "hardhat": "^2.3.0", "mocha": "^9.1.0", "omnibridge": "git+https://github.com/peppersec/omnibridge.git#aa3a970c29752a4da5f3fc7ccf0733783c1acf0b", + "prompt-sync": "^4.2.0", "snarkjs": "git+https://github.com/tornadocash/snarkjs.git#616c2d30699f28c8f3ab737b877402ccbb604cfe", "tmp-promise": "^3.0.2", "typechain": "^5.1.2" diff --git a/scripts/deployTornado.js b/scripts/deployTornado.js index df86dc4..962b9c6 100644 --- a/scripts/deployTornado.js +++ b/scripts/deployTornado.js @@ -1,5 +1,6 @@ const { ethers } = require('hardhat') const { utils } = ethers +const prompt = require('prompt-sync')() const MERKLE_TREE_HEIGHT = 23 const { MINIMUM_WITHDRAWAL_AMOUNT, MAXIMUM_DEPOSIT_AMOUNT } = process.env @@ -29,21 +30,34 @@ async function main() { console.log(`hasher: ${hasher.address}`) const Pool = await ethers.getContractFactory('TornadoPool') - const tornadoImpl = await Pool.deploy( - verifier2.address, - verifier16.address, - MERKLE_TREE_HEIGHT, - hasher.address, - token, - omniBridge, - l1Unwrapper, - govAddress, + console.log( + `constructor args:\n${JSON.stringify([ + verifier2.address, + verifier16.address, + MERKLE_TREE_HEIGHT, + hasher.address, + token, + omniBridge, + l1Unwrapper, + govAddress, + ]).slice(1, -1)}\n`, ) - await tornadoImpl.deployed() - console.log(`TornadoPool implementation address: ${tornadoImpl.address}`) + const tornadoImpl = prompt('Deploy tornado pool implementation and provide address here:\n') + // const tornadoImpl = await Pool.deploy( + // verifier2.address, + // verifier16.address, + // MERKLE_TREE_HEIGHT, + // hasher.address, + // token, + // omniBridge, + // l1Unwrapper, + // govAddress, + // ) + // await tornadoImpl.deployed() + // console.log(`TornadoPool implementation address: ${tornadoImpl.address}`) const CrossChainUpgradeableProxy = await ethers.getContractFactory('CrossChainUpgradeableProxy') - const proxy = await CrossChainUpgradeableProxy.deploy(tornadoImpl.address, govAddress, [], amb, l1ChainId) + const proxy = await CrossChainUpgradeableProxy.deploy(tornadoImpl, govAddress, [], amb, l1ChainId) await proxy.deployed() console.log(`proxy address: ${proxy.address}`) diff --git a/yarn.lock b/yarn.lock index 5d547b9..8bfc87c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2001,12 +2001,12 @@ bn.js@4.11.6: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" integrity sha1-UzRK2xRhehP26N0s4okF0cC6MhU= -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.11.9, bn.js@^4.8.0: +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.11.9, bn.js@^4.8.0: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.1.2: +bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.1.2, bn.js@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== @@ -6277,12 +6277,12 @@ merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.3.2: semaphore ">=1.0.1" merkle-patricia-tree@^4.2.0, merkle-patricia-tree@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-4.2.1.tgz#fc43e7b162e597a0720ccdd702bf1d49765691d2" - integrity sha512-25reMgrT8PhJy0Ba0U7fMZD2oobS1FPWB9vQa0uBpJYIQYYuFXEHoqEkTqA/UzX+s9br3pmUVVY/TOsFt/x0oQ== + version "4.2.2" + resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-4.2.2.tgz#6dec17855370172458244c2f42c989dd60b773a3" + integrity sha512-eqZYNTshcYx9aESkSPr71EqwsR/QmpnObDEV4iLxkt/x/IoLYZYjJvKY72voP/27Vy61iMOrfOG6jrn7ttXD+Q== dependencies: "@types/levelup" "^4.3.0" - ethereumjs-util "^7.1.0" + ethereumjs-util "^7.1.2" level-mem "^5.0.1" level-ws "^2.0.0" readable-stream "^3.6.0" @@ -7308,6 +7308,13 @@ promise-to-callback@^1.0.0: is-fn "^1.0.0" set-immediate-shim "^1.0.1" +prompt-sync@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/prompt-sync/-/prompt-sync-4.2.0.tgz#0198f73c5b70e3b03e4b9033a50540a7c9a1d7f4" + integrity sha512-BuEzzc5zptP5LsgV5MZETjDaKSWfchl5U9Luiu8SKp7iZWD5tZalOxvNcZRwv+d2phNFr8xlbxmFNcRKfJOzJw== + dependencies: + strip-ansi "^5.0.0" + proxy-addr@~2.0.5: version "2.0.7" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" @@ -7815,11 +7822,11 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: inherits "^2.0.1" rlp@^2.0.0, rlp@^2.2.1, rlp@^2.2.2, rlp@^2.2.3, rlp@^2.2.4: - version "2.2.6" - resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.6.tgz#c80ba6266ac7a483ef1e69e8e2f056656de2fb2c" - integrity sha512-HAfAmL6SDYNWPUOJNrM500x4Thn4PZsEy5pijPh40U9WfNk0z15hUYzO9xVIMAdIHdFtD8CBDHd75Td1g36Mjg== + version "2.2.7" + resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" + integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== dependencies: - bn.js "^4.11.1" + bn.js "^5.2.0" run-async@^2.2.0: version "2.4.1"