Update instructions for new pool

This commit is contained in:
Brian Li 2021-07-09 10:46:12 -07:00
parent 3af3379688
commit 90df50ead1
4 changed files with 40 additions and 39 deletions

View File

@ -1,14 +1,18 @@
MERKLE_TREE_HEIGHT=20
# 0.1 in 18 decimals
ETH_AMOUNT=100000000000000000
TOKEN_AMOUNT=100000000000000000
PRIVATE_KEY=
# RPC_URL=https://forno.celo.org
VERIFIER=0x6aD19D84bB1b4EBa2543Ebf2862EAFD116EA10c5
FEE_MANAGER=0x7DA532a6F59232936320011106585521B9F18362
RPC_URL=https://forno.celo.org
# RPC_URL=https://alfajores-forno.celo-testnet.org
# Enable for tests
# 0.1 in 18 decimals
TOKEN_AMOUNT=100000000000000000
# Without the 0x
PRIVATE_KEY=
ERC20_TOKEN=
# CELO on Mainnet
# ERC20_TOKEN=0x471ece3750da237f93b8e339c536989b8978a438
# CELO on Alfajores
# ERC20_TOKEN=0xf194afdf50b03e69bd7d057c1aa9e10c9954e4c9
# Enable for tests
# ETH_AMOUNT=100000000000000000

View File

@ -8,6 +8,26 @@ Later, the user decides to make a withdrawal. To do that, the user should provid
You can read more about it in [this medium article](https://medium.com/@tornado.cash/introducing-private-transactions-on-ethereum-now-42ee915babe0)
## Requirements
1. `node v11.15.0`
2. `npm install -g npx`
## Deploy ERC20 Poof Cash
NOTE:
1. `npm i`
2. `npm run download`
3. `npm run build:contract`
4. `cp .env.example .env`. Edit your .env:
- For `TOKEN_AMOUNT`, specify the size of the pool you want to support
- For `PRIVATE_KEY` specify the private key you want to deploy with
- For `ERC20_TOKEN` specify the token address you want to support
5. `npx truffle migrate --network alfajores --reset --f 5`
**Note**. If you want to reuse the same verifier for all the instances, then after you deployed one of the instances you should only run the 5th migration (`--f 5`). Likely, you will want to tune your .env parameters for each run of the 5th migration.
## Specs
- Deposit gas cost: 1088354 (43381 + 50859 \* tree_depth)
@ -26,11 +46,6 @@ You can read more about it in [this medium article](https://medium.com/@tornado.
Poof.cash has not yet been audited. Please use Poof.cash at your own risk.
## Requirements
1. `node v11.15.0`
2. `npm install -g npx`
## Usage
You can see example usage in cli.js, it works both in the console and in the browser.
@ -95,18 +110,6 @@ Example:
> Transaction mined in block 17036120
> Done
## Deploy ERC20 Poof Cash
1. `npm i`
1. `npm run download`
1. `npm run build:contract`
1. `cp .env.example .env`
1. Tune all necessary params
1. `npx truffle migrate --network alfajores --reset --f 2 --to 4`
1. `npx truffle migrate --network alfajores --reset --f 5`
**Note**. If you want to reuse the same verifier for all the instances, then after you deployed one of the instances you should only run the 5th migration (`--f 5`). Likely, you will want to tune your .env parameters for each run of the 5th migration.
## How to resolve ENS name to DNS name for a relayer
NOTE: Not yet relevant for CELO
1. Visit https://etherscan.io/enslookup and put relayer ENS name to the form.

View File

@ -1,18 +1,20 @@
/* global artifacts */
require('dotenv').config({path: '../.env'})
const ERC20Tornado = artifacts.require('ERC20Tornado')
const Verifier = artifacts.require('Verifier')
const FeeManager = artifacts.require('FeeManager')
const hasherContract = artifacts.require('Hasher')
const ERC20Mock = artifacts.require('ERC20Mock')
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"
const {
MERKLE_TREE_HEIGHT,
ERC20_TOKEN,
TOKEN_AMOUNT,
VERIFIER,
FEE_MANAGER,
} = process.env
module.exports = function (deployer, network, accounts) {
return deployer.then(async () => {
const {MERKLE_TREE_HEIGHT, ERC20_TOKEN, TOKEN_AMOUNT} = process.env
const verifier = await Verifier.deployed()
const feeManager = await FeeManager.deployed()
const hasherInstance = await hasherContract.deployed()
await ERC20Tornado.link(hasherContract, hasherInstance.address)
let token = ERC20_TOKEN
@ -23,15 +25,13 @@ module.exports = function (deployer, network, accounts) {
console.log(`Deploying ERC20Tornado with token ${ERC20_TOKEN} and denomination ${TOKEN_AMOUNT}`)
const tornado = await deployer.deploy(
ERC20Tornado,
verifier.address,
feeManager.address,
VERIFIER,
FEE_MANAGER,
TOKEN_AMOUNT,
MERKLE_TREE_HEIGHT,
accounts[0],
ZERO_ADDRESS,
token,
)
console.log('ERC20Tornado\'s address ', tornado.address)
tornado.changeOwner(ZERO_ADDRESS)
console.log('Changed ERC20Tornado contract owner to zero address')
})
}

View File

@ -10,12 +10,6 @@ const path = require('path')
const web3 = new Web3(process.env.RPC_URL)
const kit = ContractKit.newKitFromWeb3(web3)
kit.addAccount(process.env.PRIVATE_KEY)
// const kit = Kit.newKit('https://forno.celo.org') // mainnet endpoint
// const infuraKey = "fj4jll3k.....";
//
// const fs = require('fs');
// const mnemonic = fs.readFileSync(".secret").toString().trim();
module.exports = {
contracts_build_directory: path.join(__dirname, "client/contracts"),