WIP
This commit is contained in:
parent
2689dbd414
commit
568995e19a
15
.env.example
15
.env.example
|
@ -1,15 +1,8 @@
|
|||
# Mainnet
|
||||
DEPLOYER=0xCEe71753C9820f063b38FDbE4cFDAf1d3D928A80
|
||||
HASHER=0x83584f83f26aF4eDDA9CBe8C730bc87C364b28fe
|
||||
VERIFIER=0xce172ce1F20EC0B3728c9965470eaf994A03557A
|
||||
SALT=0x0000000000000000000000000000000000000000000000000000000047941987
|
||||
COMP_ADDRESS=0xc00e94Cb662C3520282E6f5717214004A7f26888
|
||||
|
||||
# Goerli
|
||||
DEPLOYER=0xCEe71753C9820f063b38FDbE4cFDAf1d3D928A80
|
||||
HASHER=0xf425b830943d086390b1C6CcB34033F2601a5341
|
||||
VERIFIER=0xe65A2C40f2a8975D4A238a2EaD06137b560aF387
|
||||
SALT=0x0000000000000000000000000000000000000000000000000000000047941987
|
||||
MERKLE_TREE_HEIGHT=23
|
||||
GOVERNANCE=
|
||||
OMNIBRIDGE=
|
||||
L2_TOKEN=
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
[submodule "tornado-core"]
|
||||
path = tornado-core
|
||||
url = https://github.com/tornadocash/tornado-core
|
||||
branch = create2
|
||||
[submodule "deployer"]
|
||||
path = deployer
|
||||
url = https://github.com/tornadocash/deployer
|
||||
[submodule "tornado-anonymity-mining"]
|
||||
path = tornado-anonymity-mining
|
||||
url = https://github.com/tornadocash/tornado-anonymity-mining
|
||||
[submodule "tornado-pool"]
|
||||
path = tornado-pool
|
||||
url = https://github.com/tornadocash/tornado-pool
|
||||
|
|
17
build.sh
17
build.sh
|
@ -1,24 +1,13 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# expecting node v12
|
||||
cd tornado-core
|
||||
mkdir -p build
|
||||
yarn install
|
||||
yarn build:contract
|
||||
cd ..
|
||||
|
||||
cd deployer
|
||||
yarn install
|
||||
yarn compile
|
||||
cd ..
|
||||
|
||||
cd tornado-anonymity-mining
|
||||
mkdir -p build/circuits
|
||||
pushd build/circuits
|
||||
wget https://github.com/tornadocash/tornado-anonymity-mining/releases/download/v1.0.0/RewardVerifier.sol
|
||||
wget https://github.com/tornadocash/tornado-anonymity-mining/releases/download/v1.0.0/WithdrawVerifier.sol
|
||||
wget https://github.com/tornadocash/tornado-anonymity-mining/releases/download/v1.0.0/TreeUpdateVerifier.sol
|
||||
popd
|
||||
cd tornado-pool
|
||||
yarn install
|
||||
yarn compile
|
||||
yarn circuit_prod
|
||||
npx hardhat compile
|
||||
cd ..
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"clean": "rm -rf torn-token/build && rm -rf tornado-anonymity-mining/build/contracts && rm -rf governance/build",
|
||||
"clean": "rm -rf tornado-pool/artifacts",
|
||||
"generate": "node src/generate.js",
|
||||
"ens": "node src/ens.js",
|
||||
"execute": "node src/execute.js",
|
||||
|
|
121
src/generate.js
121
src/generate.js
|
@ -4,17 +4,18 @@ const ethers = require('ethers')
|
|||
const { formatUnits, commify } = ethers.utils
|
||||
const { deploy, getContractData, expectedAddress } = require('./utils')
|
||||
|
||||
const { SALT, COMP_ADDRESS } = process.env
|
||||
const { SALT, MERKLE_TREE_HEIGHT, OMNIBRIDGE, GOVERNANCE, L2_TOKEN } = process.env
|
||||
|
||||
const instances = require('../instances')
|
||||
const deployer = getContractData('../deployer/build/contracts/Deployer.json')
|
||||
const verifier = getContractData('../tornado-core/build/contracts/Verifier.json')
|
||||
const hasher = getContractData('../tornado-core/build/contracts/Hasher.json')
|
||||
const ethTornado = getContractData('../tornado-core/build/contracts/ETHTornado.json')
|
||||
const ercTornado = getContractData('../tornado-core/build/contracts/ERC20Tornado.json')
|
||||
const compTornado = getContractData('../tornado-core/build/contracts/cTornado.json')
|
||||
const proxyLight = getContractData('../tornado-anonymity-mining/build/contracts/TornadoProxyLight.json')
|
||||
const echoer = getContractData('../tornado-anonymity-mining/build/contracts/Echoer.json')
|
||||
const verifier2 = getContractData('../tornado-pool/artifacts/contracts/Verifier2.sol/Verifier2.json')
|
||||
const verifier16 = getContractData('../tornado-pool/artifacts/contracts/Verifier16.sol/Verifier16.json')
|
||||
const hasher = getContractData('../tornado-pool/artifacts/contracts/Hasher.sol/Hasher.json')
|
||||
const tornadoPool = getContractData('../tornado-pool/artifacts/contracts/TornadoPool.sol/TornadoPool.json')
|
||||
const upgradeableProxy = getContractData(
|
||||
'../tornado-pool/artifacts/contracts/CrossChainUpgradeableProxy.sol.sol/CrossChainUpgradeableProxy.sol.json',
|
||||
)
|
||||
|
||||
const l1Helper = getContractData('../tornado-pool/artifacts/contracts/bridge/L1Helper.sol/L1Helper.json')
|
||||
|
||||
const actions = []
|
||||
|
||||
|
@ -26,7 +27,7 @@ const eipDeployer = {
|
|||
value: 0,
|
||||
data:
|
||||
'0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c63430006020033',
|
||||
gasLimit: 7247000, // more gas because it's arbitrum
|
||||
gasLimit: 7247000,
|
||||
},
|
||||
signature: {
|
||||
v: 27,
|
||||
|
@ -57,7 +58,7 @@ actions.push(
|
|||
domain: 'hasher.contract.tornadocash.eth',
|
||||
contract: hasher,
|
||||
title: 'Hasher',
|
||||
description: 'MiMC hasher contract',
|
||||
description: 'Poseidon hasher contract',
|
||||
dependsOn: ['deployer.contract.tornadocash.eth'],
|
||||
}),
|
||||
)
|
||||
|
@ -65,71 +66,71 @@ actions.push(
|
|||
// Deploy verifier
|
||||
actions.push(
|
||||
deploy({
|
||||
domain: 'verifier.contract.tornadocash.eth',
|
||||
contract: verifier,
|
||||
title: 'Verifier',
|
||||
description: 'zkSNARK verifier contract for withdrawals',
|
||||
domain: 'verifier2.contract.tornadocash.eth',
|
||||
contract: verifier2,
|
||||
title: 'Verifier2',
|
||||
description: 'zkSNARK verifier contract for 2 input operations',
|
||||
dependsOn: ['deployer.contract.tornadocash.eth'],
|
||||
}),
|
||||
)
|
||||
|
||||
// Deploy proxy
|
||||
actions.push(
|
||||
deploy({
|
||||
domain: 'proxy-light.contract.tornadocash.eth',
|
||||
contract: proxyLight,
|
||||
title: 'ProxyLight',
|
||||
description: 'Tornado proxy light for L2',
|
||||
domain: 'verifier16.contract.tornadocash.eth',
|
||||
contract: verifier16,
|
||||
title: 'Verifier16',
|
||||
description: 'zkSNARK verifier contract for 16 input operations',
|
||||
dependsOn: ['deployer.contract.tornadocash.eth'],
|
||||
}),
|
||||
)
|
||||
|
||||
// Deploy Echoer
|
||||
// Tornado implementation
|
||||
actions.push(
|
||||
deploy({
|
||||
domain: 'echoer.contract.tornadocash.eth',
|
||||
contract: echoer,
|
||||
title: 'Echoer',
|
||||
description: 'Utility contract that stores encrypted Note Accounts',
|
||||
domain: 'tornadoPool.contract.tornadocash.eth',
|
||||
contract: tornadoPool,
|
||||
title: 'Tornado Pool implementation',
|
||||
description: 'Tornado Pool proxy implementation',
|
||||
dependsOn: ['deployer.contract.tornadocash.eth'],
|
||||
args: [
|
||||
expectedAddress(actions, 'verifier2.contract.tornadocash.eth'),
|
||||
expectedAddress(actions, 'verifier16.contract.tornadocash.eth'),
|
||||
MERKLE_TREE_HEIGHT,
|
||||
expectedAddress(actions, 'hasher.contract.tornadocash.eth'),
|
||||
L2_TOKEN,
|
||||
OMNIBRIDGE,
|
||||
expectedAddress(actions, 'l1Helper.contract.tornadocash.eth'),
|
||||
GOVERNANCE,
|
||||
],
|
||||
}),
|
||||
)
|
||||
|
||||
// TODO Deploy and call
|
||||
// TODO hasher
|
||||
// TODO proxy and l1 args
|
||||
// TODO mark l1 as l1
|
||||
|
||||
// Deploy Proxy
|
||||
actions.push(
|
||||
deploy({
|
||||
domain: 'proxy.contract.tornadocash.eth',
|
||||
contract: upgradeableProxy,
|
||||
title: 'Cross-chain Upgradeable Proxy',
|
||||
description: 'Upgradability proxy contract for Tornado Pool owned by TornadoCash governance',
|
||||
dependsOn: ['deployer.contract.tornadocash.eth'],
|
||||
}),
|
||||
)
|
||||
|
||||
// Deploy instances
|
||||
for (const instance of instances) {
|
||||
const args = [
|
||||
expectedAddress(actions, 'verifier.contract.tornadocash.eth'),
|
||||
expectedAddress(actions, 'hasher.contract.tornadocash.eth'),
|
||||
instance.denomination,
|
||||
20,
|
||||
]
|
||||
if (!instance.isETH) {
|
||||
args.push(instance.tokenAddress)
|
||||
}
|
||||
if (instance.isCToken) {
|
||||
args.unshift(COMP_ADDRESS)
|
||||
}
|
||||
actions.push(
|
||||
deploy({
|
||||
domain: instance.domain,
|
||||
contract: instance.isETH ? ethTornado : instance.isCToken ? compTornado : ercTornado,
|
||||
args,
|
||||
title: `Tornado.cash instance for ${commify(
|
||||
formatUnits(instance.denomination, instance.decimals),
|
||||
).replace(/\.0$/, '')} of ${instance.symbol}`,
|
||||
description: `Tornado cash instance for ${commify(
|
||||
formatUnits(instance.denomination, instance.decimals),
|
||||
).replace(/\.0$/, '')} of ${instance.symbol}${
|
||||
instance.isETH ? '' : ` at address ${instance.tokenAddress}`
|
||||
}`,
|
||||
dependsOn: [
|
||||
'deployer.contract.tornadocash.eth',
|
||||
'hasher.contract.tornadocash.eth',
|
||||
'verifier.contract.tornadocash.eth',
|
||||
],
|
||||
}),
|
||||
)
|
||||
}
|
||||
// l1
|
||||
actions.push(
|
||||
deploy({
|
||||
domain: 'l1Helper.contract.tornadocash.eth',
|
||||
contract: l1Helper,
|
||||
title: 'L1 Omnibridge Helper',
|
||||
description: 'Utility contract for the xDAI Omnibridge on L1',
|
||||
dependsOn: ['deployer.contract.tornadocash.eth'],
|
||||
}),
|
||||
)
|
||||
|
||||
// Write output
|
||||
const result = {
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit ca446c79cd9d6867bc46019638062ad5d8d070bf
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 54a7bdcb04aa9d29b3726cf1f177aa5e955ec626
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 76cf0e95020883b65d3fdacf64469fe645033d3e
|
Loading…
Reference in New Issue