Skip to content

Commit

Permalink
Enable goerli deploy and remove deprecated testnets (#569)
Browse files Browse the repository at this point in the history
* WIP goerli deploy setup and remove deprecated testnets

* fix: get factory events

* lint fix

* fix deployment code

* require node version

* add identities as part of the logs to help with verification. TODO: add DaoRegistry identity contract

* fix verification script

Co-authored-by: Felipe Forbeck <[email protected]>
Co-authored-by: david roon <[email protected]>
  • Loading branch information
3 people authored Oct 14, 2022
1 parent a718a13 commit c907c51
Show file tree
Hide file tree
Showing 19 changed files with 153 additions and 138 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
29 changes: 15 additions & 14 deletions .sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
# Set the name of your DAO. Make sure the DAO name is unique.
DAO_NAME=My Tribute DAO xyz...

# The public ethereum address that belongs to the Owner of the DAO,
# in this case, it is your public ethereum address on Rinkeby network.
# Make sure you have some ETH, otherwise the deployment will fail.
# It needs to be the address of the first account you have in metamask accounts,
# otherwise it won't work.
# The public ethereum address that belongs to the Owner of the DAO, in this
# case, it is your public ethereum address on the Goerli network. Make sure you
# have some ETH, otherwise the deployment will fail. It needs to be the address
# of the first account you have in metamask accounts, otherwise it won't work.
DAO_OWNER_ADDR=0x...

# The name of the ERC20 token of your DAO.
Expand All @@ -26,31 +25,33 @@ ERC20_TOKEN_DECIMALS=0
# these steps to get your ProjectId/API Key from Infura:
# https://blog.infura.io/getting-started-with-infura-28e41844cc89/
# Set your own Infura API or Alchemy API key
ETH_NODE_URL=https://rinkeby.infura.io/v3/your-infura-api-key
#ETH_NODE_URL=https://eth-rinkeby.alchemyapi.io/v2/your-alchemy-api-key
ETH_NODE_URL=https://goerli.infura.io/v3/<set-your-api-key-here>
#ETH_NODE_URL=https://eth-goerli.alchemyapi.io/v2/<set-your-api-key-here>
#ETH_NODE_URL=https://api.avax-test.network/ext/bc/C/rpc

# The 12 word "secret recovery phrase" for the ethereum address
# referenced in DAO_OWNER_ADDR above. This can be found in your wallet.
# It will be used to create the HD wallet and sign transactions on your behalf.
WALLET_MNEMONIC=...

######################## Snapshot Hub env vars ########################
ALCHEMY_API_URL=https://eth-goerli.alchemyapi.io/v2/<set-your-api-key-here>

######################## Tribute UI env vars ########################

# Configure the UI to use the Rinkeby network for local development
REACT_APP_DEFAULT_CHAIN_NAME_LOCAL=RINKEBY
# Configure the UI to use the Goerli network for local development
REACT_APP_DEFAULT_CHAIN_NAME_LOCAL=GOERLI

# It can be the same value you used for the Tribute DAO deployment.
REACT_APP_INFURA_PROJECT_ID_DEV=INFURA_API_KEY

# The address of the Multicall smart contract deployed to the Rinkeby network.
# Copy that from the tribute-contracts/build/deployed/contracts-rinkeby-YYYY-MM-DD-HH:mm:ss.json
# The address of the Multicall smart contract deployed to the Goerli network.
# Copy that from the tribute-contracts/build/deployed/contracts-goerli-YYYY-MM-DD-HH:mm:ss.json
REACT_APP_MULTICALL_CONTRACT_ADDRESS=0x...

# The address of the DaoRegistry smart contract deployed to the Rinkeby network.
# Copy that from the tribute-contracts/build/deployed/contracts-rinkeby-YYYY-MM-DD-HH:mm:ss.json
# The address of the DaoRegistry smart contract deployed to the Goerli network.
# Copy that from the tribute-contracts/build/deployed/contracts-goerli-YYYY-MM-DD-HH:mm:ss.json
REACT_APP_DAO_REGISTRY_CONTRACT_ADDRESS=0x...

# Enable Rinkeby network for Tribute UI
# Enable Goerli network for Tribute UI
REACT_APP_ENVIRONMENT=development
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,7 @@ npm run compile

### Deploy contracts

Deploy contracts to networks such as rinkeby, goerli, harmonytest, polygontest, ganache, mainnet, harmony, polygon or avalanche.

```sh
npm run deploy rinkeby
```

OR
Deploy contracts to networks such as goerli, harmonytest, polygontest, ganache, mainnet, harmony, polygon or avalanche.

```sh
npm run deploy goerli
Expand Down Expand Up @@ -238,7 +232,7 @@ For more information about the deployment, see the in logs [logs/contracts](logs
### Verify contracts

```sh
npm run verify rinkeby
npm run verify goerli
```

OR
Expand All @@ -254,21 +248,21 @@ In the same `.env` file created under the `tribute-contracts` folder, set the fo
```
######################## Tribute UI env vars ########################
# Configure the UI to use the Rinkeby network for local development
REACT_APP_DEFAULT_CHAIN_NAME_LOCAL=RINKEBY
# Configure the UI to use the Goerli network for local development
REACT_APP_DEFAULT_CHAIN_NAME_LOCAL=GOERLI
# It can be the same value you used for the Tribute DAO deployment.
REACT_APP_INFURA_PROJECT_ID_DEV=YOUR_INFURA_API_KEY
# The address of the Multicall smart contract deployed to the Rinkeby network.
# Copy that from the tribute-contracts/build/contracts-rinkeby-YYYY-MM-DD-HH:mm:ss.json
# The address of the Multicall smart contract deployed to the Goerli network.
# Copy that from the tribute-contracts/build/contracts-goerli-YYYY-MM-DD-HH:mm:ss.json
REACT_APP_MULTICALL_CONTRACT_ADDRESS=0x...
# The address of the DaoRegistry smart contract deployed to the Rinkeby network.
# Copy that from the tribute-contracts/build/contracts-rinkeby-YYYY-MM-DD-HH:mm:ss.json
# The address of the DaoRegistry smart contract deployed to the Goerli network.
# Copy that from the tribute-contracts/build/contracts-goerli-YYYY-MM-DD-HH:mm:ss.json
REACT_APP_DAO_REGISTRY_CONTRACT_ADDRESS=0x...
# Enable Rinkeby network for Tribute UI
# Enable Goerli network for Tribute UI
REACT_APP_ENVIRONMENT=development
```

Expand Down Expand Up @@ -332,7 +326,7 @@ Snapshot-hub:
- `ENV`: To indicate in which environment it is being executed: local, dev, or prod
- `USE_IPFS`: To indicated the pinning service on IPFS should be enabled/disabled (if enabled cause delay in the responses)
- `RELAYER_PK`: The PK of the account that will be used to sign the messages.
- `NETWORK`: The network name that will be used by the relayer (use testnet for: rinkeby or ropsten), and mainnet for the main eth network
- `NETWORK`: The network name that will be used by the relayer (use testnet for goerli and mainnet for the main ethereum network)
- `JAWSDB_URL`: The postgres url: postgres://user:pwd@host:5432/db-name
- `ALLOWED_DOMAINS`: The list of domains that should be allowed to send requests to the API
- `ALCHEMY_API_URL`: The relayer API (alternative to Infura)
Expand Down
23 changes: 0 additions & 23 deletions configs/networks/rinkeby.config.ts

This file was deleted.

3 changes: 1 addition & 2 deletions contracts/helpers/WETH.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//WETH-03.24.2020.sol
//deployed March 24,2020 Rinkeby - 0x8DD25714CCEce48767BaF266EC4F220B60f84D52
// WETH-03.24.2020.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

Expand Down
8 changes: 4 additions & 4 deletions docker/README-ganache.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In the root of `tribute-contracts` folder create a .env file. This file will con
DAO_NAME=My Tribute DAO xyz...
# The public ethereum address that belongs to the Owner of the DAO,
# in this case, it is your public ethereum address on Rinkeby network.
# in this case, it is your public ethereum address on the Ganache network.
# Make sure you have some ETH, otherwise the deployment will fail.
# It needs to be the address of the first account you have in metamask accounts,
# otherwise it won't work.
Expand All @@ -40,7 +40,7 @@ ERC20_TOKEN_DECIMALS=0
# The Ethereum Node URL to connect the Ethereum network. You can follow
# these steps to get your ProjectId/API Key from Infura:
# https://blog.infura.io/getting-started-with-infura-28e41844cc89/
# Or can use the default one from OpenLaw team, or set your own Infura/Alchemy API keys
# Set your own Infura/Alchemy API keys
ETH_NODE_URL=http://localhost:7545
# The 12 word "secret recovery phrase" for the ethereum address
Expand Down Expand Up @@ -88,11 +88,11 @@ REACT_APP_DEFAULT_CHAIN_NAME_LOCAL=GANACHE
# It can be the same value you used for the Tribute DAO deployment.
REACT_APP_INFURA_PROJECT_ID_DEV=set-your-infura-api-key-here
# The address of the Multicall smart contract deployed to the Rinkeby network.
# The address of the Multicall smart contract deployed to the Ganache network.
# Copy that from the tribute-contracts/build/deployed/contracts-ganache-YYYY-MM-DD-HH:mm:ss.json
REACT_APP_MULTICALL_CONTRACT_ADDRESS=0x...
# The address of the DaoRegistry smart contract deployed to the Rinkeby network.
# The address of the DaoRegistry smart contract deployed to the Ganache network.
# Copy that from the tribute-contracts/build/deployed/contracts-ganache-YYYY-MM-DD-HH:mm:ss.json
REACT_APP_DAO_REGISTRY_CONTRACT_ADDRESS=0x...
```
Expand Down
27 changes: 13 additions & 14 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Launching a Tribute DAO on Rinkeby
## Launching a Tribute DAO on Goerli

### 1. Clone tribute-contracts repository

Expand All @@ -19,7 +19,7 @@ In the root of `tribute-contracts` folder create a `.env` file. This file will c
DAO_NAME=My Tribute DAO xyz...
# The public ethereum address that belongs to the Owner of the DAO,
# in this case, it is your public ethereum address on Rinkeby network.
# in this case, it is your public ethereum address on the Goerli network.
# Make sure you have some ETH, otherwise the deployment will fail.
# It needs to be the address of the first account you have in metamask accounts,
# otherwise it won't work.
Expand All @@ -40,10 +40,9 @@ ERC20_TOKEN_DECIMALS=0
# The Ethereum Node URL to connect the Ethereum network. You can follow
# these steps to get your ProjectId/API Key from Infura:
# https://blog.infura.io/getting-started-with-infura-28e41844cc89/
# Or can use the default one from OpenLaw team, or set your own Infura/Alchemy API keys
ETH_NODE_URL=http://rinkeby.openlaw.io:8546
#ETH_NODE_URL=https://rinkeby.infura.io/v3/<set-your-api-key-here>
#ETH_NODE_URL=https://eth-rinkeby.alchemyapi.io/v2/<set-your-api-key-here>
# Set your own Infura/Alchemy API keys
ETH_NODE_URL=https://goerli.infura.io/v3/<set-your-api-key-here>
#ETH_NODE_URL=https://eth-goerli.alchemyapi.io/v2/<set-your-api-key-here>
# The 12 word "secret recovery phrase" for the ethereum address
# referenced in DAO_OWNER_ADDR above. This can be found in your wallet.
Expand All @@ -61,7 +60,7 @@ With the environment variables ready, we can install the project dependencies an

Using NodeJS v16.x, run:

- > npm run build && npm run deploy rinkeby
- > npm run build && npm run deploy goerli
### 4. Set the tribute-ui environment variables

Expand All @@ -72,21 +71,21 @@ In the same `.env` file created under the `tribute-contracts` folder, add the fo
```
######################## Tribute UI env vars ########################
# Configure the UI to use the Rinkeby network for local development
REACT_APP_DEFAULT_CHAIN_NAME_LOCAL=RINKEBY
# Configure the UI to use the Goerli network for local development
REACT_APP_DEFAULT_CHAIN_NAME_LOCAL=GOERLI
# It can be the same value you used for the Tribute DAO deployment.
REACT_APP_INFURA_PROJECT_ID_DEV=set-your-infura-api-key-here
# The address of the Multicall smart contract deployed to the Rinkeby network.
# Copy that from the tribute-contracts/build/deployed/contracts-rinkeby-YYYY-MM-DD-HH:mm:ss.json
# The address of the Multicall smart contract deployed to the Goerli network.
# Copy that from the tribute-contracts/build/deployed/contracts-goerli-YYYY-MM-DD-HH:mm:ss.json
REACT_APP_MULTICALL_CONTRACT_ADDRESS=0x...
# The address of the DaoRegistry smart contract deployed to the Rinkeby network.
# Copy that from the tribute-contracts/build/deployed/contracts-rinkeby-YYYY-MM-DD-HH:mm:ss.json
# The address of the DaoRegistry smart contract deployed to the Goerli network.
# Copy that from the tribute-contracts/build/deployed/contracts-goerli-YYYY-MM-DD-HH:mm:ss.json
REACT_APP_DAO_REGISTRY_CONTRACT_ADDRESS=0x...
# Enable Rinkeby network for Tribute UI
# Enable Goerli network for Tribute UI
REACT_APP_ENVIRONMENT=development
```

Expand Down
3 changes: 2 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ services:
trib-snapshot-hub:
image: openlaw/snapshot-hub:v5.0.1-erc712
container_name: trib-snapshot-hub
env_file:
- ../.env
environment:
ENV: "local"
PORT: 8080
RELAYER_PK: "0xb80a5165a59af8ce566266fcd0e919e13ed4ecbd57ae952e73ae2cddc08b84c6"
ALCHEMY_API_URL: "http://rinkeby.openlaw.io:8545"
JAWSDB_URL: "postgres://snap:pwd123@trib-snapshot-db:5432/snapshot-db"
IGNORE_VOTE_END_CONSTRAINT: "true"
ALLOWED_DOMAINS: "http://localhost:3000"
Expand Down
27 changes: 1 addition & 26 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,6 @@ module.exports = {
},
signerId: process.env.SIGNER || undefined,
},
rinkeby: {
url: process.env.ETH_NODE_URL,
network_id: 4,
chainId: 4,
skipDryRun: true,
gas: 2100000,
gasPrice: 4000000000,
accounts: {
mnemonic: process.env.WALLET_MNEMONIC || "",
count: 10,
},
signerId: process.env.SIGNER || undefined,
},
ropsten: {
url: process.env.ETH_NODE_URL,
network_id: 3,
chainId: 3,
gas: 2100000,
gasPrice: 4000000000,
accounts: {
mnemonic: process.env.WALLET_MNEMONIC || "",
count: 10,
},
signerId: process.env.SIGNER || undefined,
},
harmonytest: {
url: process.env.ETH_NODE_URL,
network_id: 1666700000,
Expand Down Expand Up @@ -223,7 +198,7 @@ module.exports = {

etherscan: {
apiKey: {
rinkeby: process.env.ETHERSCAN_API_KEY,
goerli: process.env.ETHERSCAN_API_KEY,
mainnet: process.env.ETHERSCAN_API_KEY,
},
},
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"main": "hardhat-config.js",
"directories": {
"test": "test"
},
"engines" : {
"npm" : ">=7.0.0 <9.0.0",
"node" : ">=16.0.0 <17.0.0"
},
"scripts": {
"build": "npm ci && npm run compile",
Expand Down
2 changes: 1 addition & 1 deletion signers/DefenderSignerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class DefenderSignerProvider extends ProviderWrapper {
) {
super(provider);
this.chainId = chainId;
const p = ethers.getDefaultProvider("rinkeby");
const p = ethers.getDefaultProvider("goerli");
this.signer = new DefenderRelaySigner(
{
apiKey: config.apiKey,
Expand Down
8 changes: 4 additions & 4 deletions signers/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Signers

A Signer Provider can be used to sign transactions using a private key managed by an external service, so that transaction can be send to the network using any sort of Network Provider.
A Signer Provider can be used to sign transactions using a private key managed by an external service, so that transaction can be sent to the network using any sort of Network Provider.

In this hardhat plugin we currently support two types of Signers: OZ Defender Signer and Google KMS Signer.

Expand All @@ -9,10 +9,10 @@ Both signers are acting as external signers only. We don't use them to forward t
In order to enable a signer for a particular network set the `signerId` to the network config in the `hardhat.config.ts` file:

```
rinkeby: {
goerli: {
url: process.env.ETH_NODE_URL,
network_id: 4,
chainId: 4,
network_id: 5,
chainId: 5,
skipDryRun: true,
gas: 2100000,
gasPrice: 4000000000,
Expand Down
Loading

0 comments on commit c907c51

Please sign in to comment.