commit 96592be1817d33dae9bba8db3ad530455c7fcf7c Author: mirru2532 Date: Sun Oct 24 21:54:07 2021 +0200 rebasing diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..53b061a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..b931a83 --- /dev/null +++ b/.env.example @@ -0,0 +1,12 @@ +etherscan_api_key= +goerli_rpc_key= +mainnet_rpc_key= +goerli_account_pk= +mainnet_account_pk= + +PROXY=0x722122dF12D4e14e13Ac3b6895a86e84145b6967 +DEPLOYER=0xCEe71753C9820f063b38FDbE4cFDAf1d3D928A80 +HASHER=0x83584f83f26aF4eDDA9CBe8C730bc87C364b28fe +VERIFIER=0xce172ce1F20EC0B3728c9965470eaf994A03557A +SALT=0x0000000000000000000000000000000000000000000000000000000047941987 +COMP_ADDRESS=0xc00e94Cb662C3520282E6f5717214004A7f26888 \ No newline at end of file diff --git a/.env.example.workflow b/.env.example.workflow new file mode 100644 index 0000000..a745fea --- /dev/null +++ b/.env.example.workflow @@ -0,0 +1,5 @@ +DEPLOYER=0xCEe71753C9820f063b38FDbE4cFDAf1d3D928A80 +HASHER=0x83584f83f26aF4eDDA9CBe8C730bc87C364b28fe +VERIFIER=0xce172ce1F20EC0B3728c9965470eaf994A03557A +SALT=0x0000000000000000000000000000000000000000000000000000000047941987 +COMP_ADDRESS=0xc00e94Cb662C3520282E6f5717214004A7f26888 \ No newline at end of file diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..911d315 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,27 @@ +{ + "env": { + "node": true, + "browser": true, + "es6": true, + "mocha": true + }, + "extends": ["eslint:recommended", "plugin:prettier/recommended", "prettier"], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 2018 + }, + "rules": { + "indent": ["error", 2], + "linebreak-style": ["error", "unix"], + "quotes": ["error", "single"], + "semi": ["error", "never"], + "object-curly-spacing": ["error", "always"], + "comma-dangle": ["error", "always-multiline"], + "require-await": "error", + "prettier/prettier": ["error", { "printWidth": 110 }] + } +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7cc88f0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.sol linguist-language=Solidity \ No newline at end of file diff --git a/.github/workflows/build.js.yml b/.github/workflows/build.js.yml new file mode 100644 index 0000000..cd5fa3b --- /dev/null +++ b/.github/workflows/build.js.yml @@ -0,0 +1,37 @@ +name: build + +on: + push: + branches: ['*'] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + environment: secrets + env: + etherscan_api_key: ${{ secrets.ETHERSCAN_API_KEY }} + goerli_rpc_key: ${{ secrets.GOERLI_RPC_KEY }} + mainnet_rpc_key: ${{ secrets.MAINNET_RPC_KEY }} + goerli_account_pk: ${{ secrets.GOERLI_ACCOUNT_PK }} + mainnet_account_pk: ${{ secrets.MAINNET_ACCOUNT_PK }} + steps: + - name: Tests and setup + uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + - run: yarn install + - run: cp .env.example.workflow .env + - run: yarn prettier:fix + - run: yarn lint + - run: yarn test test/test_proposal_with_factory.js + - run: yarn test test/test_proposal_with_factory2.js + + - name: Generate coverage + run: yarn coverage + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..376909a --- /dev/null +++ b/.gitignore @@ -0,0 +1,109 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +artifacts +cache +coverage +coverage.json \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..da2d398 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +14 \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..a327bb0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ +.vscode +.idea +cache +artifacts +build +dist +coverage +coverage.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..f532b1b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,16 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": true, + "semi": false, + "printWidth": 110, + "overrides": [ + { + "files": "*.sol", + "options": { + "singleQuote": false, + "printWidth": 130 + } + } + ] +} diff --git a/.solcover.js b/.solcover.js new file mode 100644 index 0000000..9cce62d --- /dev/null +++ b/.solcover.js @@ -0,0 +1,8 @@ +module.exports = { + skipFiles: [ + 'tornado_proxy/TornadoProxy.sol', + 'tornado_proxy/ITornadoTrees.sol', + 'tornado_proxy/ITornadoInstance.sol', + 'ERC20TornadoVirtual.sol', + ], +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b0afc5 --- /dev/null +++ b/README.md @@ -0,0 +1,109 @@ +# Tornado Instances + +[![build](https://img.shields.io/github/workflow/status/mirru2532/tornado-instances/build)](https://github.com/h-ivor/tornado-instances/actions) [![Coveralls](https://img.shields.io/coveralls/github/mirru2352/tornado-instances)](https://coveralls.io/github/mirru2352/tornado-instances) + +## About + +This repository serves as a general template for deploying a tornado instance factory, deploying a proposal for the addition of multiple ERC20 tornado instances and proposing the registration of these instances with the Tornado Proxy (0x722122dF12D4e14e13Ac3b6895a86e84145b6967) through governance vote. + +The scripts should help users do this programmatically, quickly. There are three tasks (scripts). Note that non-task scripts have been deprecated but are still kept for more insight into the working process. + +### How-To: + +Setting up the repository: + +```bash +git clone https://github.com/mirru2532/tornado-instances.git +cd tornado-instances +yarn +cp .env.example .env +``` + +Please fill out .env according to the template provided in it. + +### Testing and running scripts: + +To run test scripts: + +```bash +yarn test +``` + +Test scripts cover instance factory deployment, proposal deployment and executing proposal (RAI instances). + +Running **tasks:** + +```bash +# a list of yarn scripts specifically for instance deployment +"deploy:factory": "yarn hardhat --network mainnet deploy_factory", +"deploy:proposal": "yarn hardhat --network mainnet deploy_proposal --factory-address", +"deploy:factory:test": "yarn hardhat --network goerli deploy_factory", +"deploy:proposal:test": "yarn hardhat --network goerli deploy_proposal --factory-address", +"propose": "yarn hardhat --network mainnet propose_proposal --proposal-address" + +# as an example +yarn deploy:factory + +# to call a specific task +yarn hardhat --network +``` + +Running scripts (deprecated): + +```bash +yarn hardhat --network run scripts/