Merge branch 'hardhat' of github.com:tornadocash/tornado-trees into hardhat
This commit is contained in:
commit
362b126e17
2
.env.example
Normal file
2
.env.example
Normal file
@ -0,0 +1,2 @@
|
||||
PRIVATE_KEY=0x
|
||||
INFURA_TOKEN=
|
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
@ -20,12 +20,12 @@ jobs:
|
||||
- run: yarn circuit
|
||||
- run: yarn test
|
||||
- run: yarn lint
|
||||
# - name: Telegram Failure Notification
|
||||
# uses: appleboy/telegram-action@0.0.7
|
||||
# if: failure()
|
||||
# with:
|
||||
# message: ❗ Build failed for [${{ github.repository }}](https://github.com/${{ github.repository }}/actions) because of ${{ github.actor }}
|
||||
# format: markdown
|
||||
# to: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||||
# token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
- name: Telegram Failure Notification
|
||||
uses: appleboy/telegram-action@0.0.7
|
||||
if: failure()
|
||||
with:
|
||||
message: ❗ Build failed for [${{ github.repository }}](https://github.com/${{ github.repository }}/actions) because of ${{ github.actor }}
|
||||
format: markdown
|
||||
to: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||||
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ node_modules
|
||||
#Hardhat files
|
||||
cache
|
||||
artifacts
|
||||
.env
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Tornado.cash trees [![Build Status](https://github.com/tornadocash/tornado-anonymity-mining/workflows/build/badge.svg)](https://github.com/tornadocash/tornado-anonymity-mining/actions) [![npm](https://img.shields.io/npm/v/tornado-anonymity-mining)](https://www.npmjs.com/package/tornado-anonymity-mining)
|
||||
# Tornado.cash trees [![Build Status](https://github.com/tornadocash/tornado-trees/workflows/build/badge.svg)](https://github.com/tornadocash/tornado-trees/actions)
|
||||
|
||||
This repo implements a more optimized version of the [TornadoTrees](https://github.com/tornadocash/tornado-anonymity-mining/blob/080d0f83665fa686d7fe42dd57fb5975d0f1ca58/contracts/TornadoTrees.sol) mechanism.
|
||||
|
||||
@ -12,7 +12,6 @@ This repo implements a more optimized version of the [TornadoTrees](https://gith
|
||||
|
||||
```bash
|
||||
$ yarn
|
||||
$ cp .env.example .env
|
||||
$ yarn circuit
|
||||
$ yarn test
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* global task, ethers */
|
||||
require('@nomiclabs/hardhat-waffle')
|
||||
|
||||
require('dotenv').config()
|
||||
// This is a sample Hardhat task. To learn how to create your own go to
|
||||
// https://hardhat.org/guides/create-task.html
|
||||
task('accounts', 'Prints the list of accounts', async () => {
|
||||
@ -19,4 +19,10 @@ task('accounts', 'Prints the list of accounts', async () => {
|
||||
*/
|
||||
module.exports = {
|
||||
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
|
||||
// Runtime Environment's members available in the global scope.
|
||||
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() {
|
||||
// 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
|
||||
// await hre.run('compile');
|
||||
|
||||
// We get the contract to deploy
|
||||
const Greeter = await hre.ethers.getContractFactory('Greeter')
|
||||
const greeter = await Greeter.deploy('Hello, Hardhat!')
|
||||
|
||||
await greeter.deployed()
|
||||
|
||||
console.log('Greeter deployed to:', greeter.address)
|
||||
const BatchTreeUpdateVerifier = await hre.ethers.getContractFactory('BatchTreeUpdateVerifier')
|
||||
const verifier = await BatchTreeUpdateVerifier.deploy()
|
||||
await verifier.deployed()
|
||||
const TornadoTrees = await hre.ethers.getContractFactory('TornadoTrees')
|
||||
// bytes32 _governance,
|
||||
// bytes32 _tornadoProxy,
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user