From 9ff6229ebd1206b5a7bf3d64e5feef89f186ea97 Mon Sep 17 00:00:00 2001 From: mirru2532 Date: Sun, 24 Oct 2021 23:51:10 +0200 Subject: [PATCH] automatically detect n of instances coverage try build fix use create2 add core repo --- .env.example | 1 + .env.example.workflow | 3 + .github/workflows/build.js.yml | 3 +- .solcover.js | 6 + README.md | 48 +- .../CreateFactoryAndAddInstancesProposal.sol | 2 - contracts/ERC20TornadoCloneable.sol | 22 +- contracts/ERC20TornadoVirtual.sol | 6 +- contracts/TornadoInstanceCloneFactory.sol | 45 +- .../denomination_templates/Add1Instance.sol | 41 + .../denomination_templates/Add2Instances.sol | 59 + .../denomination_templates/Add3Instances.sol | 63 + .../Add4Instances.sol} | 6 +- .../denomination_templates/Add5Instances.sol | 71 + .../denomination_templates/Add6Instances.sol | 75 + contracts/{ => mock}/CompileDummy.sol | 0 contracts/tornado_proxy/TornadoProxy.sol | 6 +- hardhat.config.js | 4 +- package.json | 8 +- resources/instances.js | 4 - tasks/deploy_factory.js | 26 - tasks/deploy_factory_proposal.js | 27 + tasks/deploy_proposal.js | 45 +- ...2.js => instance.factory.proposal.test.js} | 17 +- ...h_factory.js => instance.proposal.test.js} | 19 +- yarn.lock | 9160 ++++++++++++++++- 26 files changed, 9434 insertions(+), 333 deletions(-) create mode 100644 contracts/denomination_templates/Add1Instance.sol create mode 100644 contracts/denomination_templates/Add2Instances.sol create mode 100644 contracts/denomination_templates/Add3Instances.sol rename contracts/{AddWithFactoryProposal.sol => denomination_templates/Add4Instances.sol} (93%) create mode 100644 contracts/denomination_templates/Add5Instances.sol create mode 100644 contracts/denomination_templates/Add6Instances.sol rename contracts/{ => mock}/CompileDummy.sol (100%) delete mode 100644 tasks/deploy_factory.js create mode 100644 tasks/deploy_factory_proposal.js rename test/{test_proposal_with_factory2.js => instance.factory.proposal.test.js} (96%) rename test/{test_proposal_with_factory.js => instance.proposal.test.js} (96%) diff --git a/.env.example b/.env.example index b931a83..48a8535 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,7 @@ goerli_rpc_key= mainnet_rpc_key= goerli_account_pk= mainnet_account_pk= +use_latest_block=false PROXY=0x722122dF12D4e14e13Ac3b6895a86e84145b6967 DEPLOYER=0xCEe71753C9820f063b38FDbE4cFDAf1d3D928A80 diff --git a/.env.example.workflow b/.env.example.workflow index a745fea..50fdc29 100644 --- a/.env.example.workflow +++ b/.env.example.workflow @@ -1,3 +1,6 @@ +use_latest_block=false + +PROXY=0x722122dF12D4e14e13Ac3b6895a86e84145b6967 DEPLOYER=0xCEe71753C9820f063b38FDbE4cFDAf1d3D928A80 HASHER=0x83584f83f26aF4eDDA9CBe8C730bc87C364b28fe VERIFIER=0xce172ce1F20EC0B3728c9965470eaf994A03557A diff --git a/.github/workflows/build.js.yml b/.github/workflows/build.js.yml index cd5fa3b..7440c01 100644 --- a/.github/workflows/build.js.yml +++ b/.github/workflows/build.js.yml @@ -25,8 +25,7 @@ jobs: - 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 + - run: yarn test - name: Generate coverage run: yarn coverage diff --git a/.solcover.js b/.solcover.js index 9cce62d..db331df 100644 --- a/.solcover.js +++ b/.solcover.js @@ -4,5 +4,11 @@ module.exports = { 'tornado_proxy/ITornadoTrees.sol', 'tornado_proxy/ITornadoInstance.sol', 'ERC20TornadoVirtual.sol', + 'denomination_templates/Add1Instance.sol', + 'denomination_templates/Add2Instances.sol', + 'denomination_templates/Add3Instances.sol', + 'denomination_templates/Add4Instances.sol', + 'denomination_templates/Add5Instances.sol', + 'denomination_templates/Add6Instances.sol', ], } diff --git a/README.md b/README.md index 0b0afc5..38b585e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # 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) +[![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/mirru2532/tornado-instances)](https://coveralls.io/github/mirru2532/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. +This repository serves as a general template repository for deploying proposals for governance for the addition of new tornado ERC20 instances to the tornado proxy. -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. +The contracts offer a template for the addition of 4 new instances for an ERC20 token (the standard way to add new instances) and can also be slightly modified to add a custom amount. The scripts deploy the contracts. + +The resources folder contains data necessary for the instances to be deployed and must be filled out. They are initially filled out with the RAI instance data. ### How-To: @@ -19,7 +21,7 @@ yarn cp .env.example .env ``` -Please fill out .env according to the template provided in it. +Please fill out .env according to the template provided in it. Please ensure that all of the example values are set to the correct addresses. ### Testing and running scripts: @@ -35,26 +37,20 @@ 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" +"deploy:proposal:factory": "yarn hardhat --network mainnet deploy_factory_proposal", +"deploy:proposal:factory:test": "yarn hardhat --network goerli deploy_factory_proposal", +"propose": "yarn hardhat --network mainnet propose_proposal --proposal-address", # as an example -yarn deploy:factory +yarn deploy:proposal:factory # to call a specific task yarn hardhat --network ``` -Running scripts (deprecated): - -```bash -yarn hardhat --network run scripts/