mirror of
https://github.com/tornadocash/tornado-trees.git
synced 2024-12-04 23:15:01 +01:00
add migration
This commit is contained in:
parent
5fe2429b89
commit
72133bfba6
2
.env.example
Normal file
2
.env.example
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
PRIVATE_KEY=0x
|
||||||
|
INFURA_TOKEN=
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ node_modules
|
|||||||
#Hardhat files
|
#Hardhat files
|
||||||
cache
|
cache
|
||||||
artifacts
|
artifacts
|
||||||
|
.env
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* global task, ethers */
|
/* global task, ethers */
|
||||||
require('@nomiclabs/hardhat-waffle')
|
require('@nomiclabs/hardhat-waffle')
|
||||||
|
require('dotenv').config()
|
||||||
// This is a sample Hardhat task. To learn how to create your own go to
|
// This is a sample Hardhat task. To learn how to create your own go to
|
||||||
// https://hardhat.org/guides/create-task.html
|
// https://hardhat.org/guides/create-task.html
|
||||||
task('accounts', 'Prints the list of accounts', async () => {
|
task('accounts', 'Prints the list of accounts', async () => {
|
||||||
@ -19,4 +19,10 @@ task('accounts', 'Prints the list of accounts', async () => {
|
|||||||
*/
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
solidity: '0.6.12',
|
solidity: '0.6.12',
|
||||||
|
networks: {
|
||||||
|
goerli: {
|
||||||
|
url: `https://goerli.infura.io/v3/${process.env.INFURA_TOKEN}`,
|
||||||
|
accounts: [process.env.PRIVATE_KEY],
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
// When running the script with `hardhat run <script>` you'll find the Hardhat
|
// When running the script with `hardhat run <script>` you'll find the Hardhat
|
||||||
// Runtime Environment's members available in the global scope.
|
// Runtime Environment's members available in the global scope.
|
||||||
const hre = require('hardhat')
|
const hre = require('hardhat')
|
||||||
|
const { toFixedHex, poseidonHash2 } = require('../src/utils')
|
||||||
|
const toEns = (addr) => toFixedHex(addr, 20).padEnd(66, '0')
|
||||||
|
const MerkleTree = require('fixed-merkle-tree')
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
// Hardhat always runs the compile task when running scripts with its command
|
// Hardhat always runs the compile task when running scripts with its command
|
||||||
@ -13,13 +16,26 @@ async function main() {
|
|||||||
// manually to make sure everything is compiled
|
// manually to make sure everything is compiled
|
||||||
// await hre.run('compile');
|
// await hre.run('compile');
|
||||||
|
|
||||||
// We get the contract to deploy
|
const BatchTreeUpdateVerifier = await hre.ethers.getContractFactory('BatchTreeUpdateVerifier')
|
||||||
const Greeter = await hre.ethers.getContractFactory('Greeter')
|
const verifier = await BatchTreeUpdateVerifier.deploy()
|
||||||
const greeter = await Greeter.deploy('Hello, Hardhat!')
|
await verifier.deployed()
|
||||||
|
const TornadoTrees = await hre.ethers.getContractFactory('TornadoTrees')
|
||||||
await greeter.deployed()
|
// bytes32 _governance,
|
||||||
|
// bytes32 _tornadoProxy,
|
||||||
console.log('Greeter deployed to:', greeter.address)
|
// bytes32 _treeUpdateVerifier,
|
||||||
|
// bytes32 _depositRoot,
|
||||||
|
// bytes32 _withdrawalRoot
|
||||||
|
const levels = 20
|
||||||
|
const tree = new MerkleTree(levels, [], { hashFunction: poseidonHash2 })
|
||||||
|
const tornadoTrees = await TornadoTrees.deploy(
|
||||||
|
toEns('0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce'),
|
||||||
|
toEns('0x905b63Fff465B9fFBF41DeA908CEb12478ec7601'),
|
||||||
|
toEns(verifier.address),
|
||||||
|
toFixedHex(tree.root()),
|
||||||
|
toFixedHex(tree.root()),
|
||||||
|
)
|
||||||
|
await tornadoTrees.deployed()
|
||||||
|
console.log('tornadoTrees deployed to:', tornadoTrees.address)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We recommend this pattern to be able to use async/await everywhere
|
// We recommend this pattern to be able to use async/await everywhere
|
||||||
|
Loading…
Reference in New Issue
Block a user