Related supporting repositories:
- openlawteam/tribute-contracts
- openlawteam/tribute-subgraph
- openlawteam/snapshot-hub (erc-712 branch)
- openlawteam/snapshot-js-erc712
When running locally you'll need a .env
file in the root directory with the following environment variables:
REACT_APP_ENVIRONMENT=localhost
REACT_APP_INFURA_PROJECT_ID_LOCAL=...
REACT_APP_DAO_REGISTRY_CONTRACT_ADDRESS=...
REACT_APP_MULTICALL_CONTRACT_ADDRESS=...
REACT_APP_SNAPSHOT_HUB_API_URL=http://localhost:8081
REACT_APP_COUPON_API_URL=http://localhost:8080
REACT_APP_SNAPSHOT_SPACE=tribute
REACT_APP_GRAPH_CORE_URL=...
NOTE:
REACT_APP_INFURA_PROJECT_ID_LOCAL
is the value of your Infura PROJECT ID key.REACT_APP_DAO_REGISTRY_CONTRACT_ADDRESS
is the address of theDaoRegistry
smart contract deployed to your network.REACT_APP_MULTICALL_CONTRACT_ADDRESS
is the address of theMulticall
smart contract deployed to your network.REACT_APP_SNAPSHOT_HUB_API_URL
is the url of snaphot-hub running locally in a container.REACT_APP_COUPON_API_URL
is the url of the coupon-manager running locally in a container.REACT_APP_SNAPSHOT_SPACE
is the unique name registered in Snapshot Hub under which proposals, votes, etc. will be stored.REACT_APP_GRAPH_CORE_URL
is the url of the core subgraph running locally in a container.
If you want to use the KYC Onboarding adapter, you will also need the following environment variables:
REACT_APP_ENABLE_KYC_ONBOARDING=true
REACT_APP_KYC_BACKEND_URL=http://localhost:3003/kyc-certificate
REACT_APP_KYC_FORMS_URL=...
NOTE:
REACT_APP_KYC_BACKEND_URL
is the url of the KYC backend service running locally in a container.REACT_APP_KYC_FORMS_URL
is the url of the KYC forms interface.
REACT_APP_ONBOARDING_TOKEN_ADDRESS=...
NOTE:
REACT_APP_ONBOARDING_TOKEN_ADDRESS
is the address of the ERC20 token that will be contributed in exchange for membership units. By default, the Onboarding and KycOnboarding interfaces are configured to handle Ether as the contribution token. If a valid ERC20 address is set for this environment variable, the Onboarding and KycOnboarding interfaces will be configured to accept that ERC20 token instead.
Note that this configuration should be consistent with how the actual Onboarding and KycOnboarding smart contracts have been configured.
REACT_APP_GRAPH_COUPON_ONBOARDING_URL=...
REACT_APP_GRAPH_NFT_EXTENSION_URL=...
NOTE:
REACT_APP_GRAPH_COUPON_ONBOARDING_URL
is the url of the optional coupon onboarding subgraph running locally in a container.REACT_APP_GRAPH_NFT_EXTENSION_URL
is the url of the optional NFT extension subgraph running locally in a container.
##
# Alchemy API key
#
# i.e. Transfers API for getting total ETH amount contributed to DAO multi-sig.
##
REACT_APP_ALCHEMY_API_KEY=...
# Can be set to override using the Ganache private network as the default local development chain.
REACT_APP_DEFAULT_CHAIN_NAME_LOCAL=<MAINNET | ROPSTEN | RINKEBY | GOERLI | KOVAN | GANACHE | AVALANCHE_TEST | AVALANCHE_MAIN>
Using Ganache CLI (more stable):
npm install -g ganache-cli
(if not already installed)ganache-cli --port 7545 --networkId 1337 --chainId 1337 --blockTime 3
Using Ganache GUI app:
- Change the Network ID to
1337
. That is necessary in order to connect MetaMask to your Ganache network. The DApp is configured for Ganache to bechainId
1337
. - Turn off Automine and set the Mining Block Time (Seconds) to
3
.
Remember: After you deploy the DaoRegistry
and Multicall
smart contracts on your local Ganache network you must include the deployed contract's address in your local root .env
file. Additionally, you will need to add the contract addresses for the deployed adapters and extensions contracts to the config in /src/config.ts
.
If you want to use the same accounts (-d
) and data (--db
) from a previous Ganache chain, you can add the below arguments to the ganache-cli
command. The --db
path can be any path with any structure. Ganache creates many "loose" files, so it may be easiest to keep each chain in its own directory (e.g. some/path/your-ganache-dbs/01-01-1999
).
... -d --db some/path/your-ganache-dbs/[DIR_WHERE_CHAIN_DATA_WILL_BE_SAVED]
- Invalid address, and/or nonce-related errors: If you're developing on Ganache and the app will not start due to a vague error about an "invalid address", or you're receiving transaction errors from the app related to an incorrect nonce(s), then resetting your Ganache account(s) in MetaMask (or other wallet, if possible) should fix this. To reset your accounts in MetaMask (or other wallet) click: Settings->Advanced->Reset Account.
Follow the instructions here to set up and run the local graph-node and to deploy the mandatory core subgraph and any optional adapter/extension subgraphs.
Deployments for the development environment are handled automatically with a GitHub Action:
GitHub Pages development deployment
: push tomain
branch -> https://demo.tributedao.com
If developing and running manually using npm start
, or adding/updating NPM packages using npm install
, it's recommended to use Node ^14.0.0
and NPM ^7.0.0
(listed in our package.json
's engines
field). If using nvm
, run nvm use
inside the project root and the correct version of Node will be used (be aware Node 14 ships with NPM 6, so you will need to upgrade npm
using npm i -g npm
).
NVM (Node Version Manager) is an open-sourced tool which can easily switch between different versions of Node. For this project we currently use Node 14.x
. If you don't have NVM, it's easy to install. If you don't want to use NVM, just be sure you have Node 14.x and NPM 7.x.
This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.