openlawteam / tribute-ui

Tribute - A modular DAO framework developed and coordinated by its members
https://demo.tributedao.com
Apache License 2.0
45 stars 40 forks source link

Tribute DAO DApp

Related supporting repositories:

Developer Setup

Local .env File

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:

Additional Required Environment Variables for KYC Onboarding

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:

Optional Environment Variables for ERC20 Onboarding

REACT_APP_ONBOARDING_TOKEN_ADDRESS=...

NOTE:

Note that this configuration should be consistent with how the actual Onboarding and KycOnboarding smart contracts have been configured.

Optional Environment Variables for Additional adapter/extension subgraphs

REACT_APP_GRAPH_COUPON_ONBOARDING_URL=...
REACT_APP_GRAPH_NFT_EXTENSION_URL=...

NOTE:

Optional Environment Variables for Local Development

##
# 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>

Ganache Blockchain Setup

Using Ganache CLI (more stable):

Using Ganache GUI app:


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.

Saving Ganache Data

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]

Ganache CLI Options

Troubleshooting

Running the Local graph-node

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.

GitHub Pages Deployments

Deployments for the development environment are handled automatically with a GitHub Action:

Developer Notes

Node Version

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.


Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

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.

npm test

Launches the test runner in the interactive watch mode.\ See the section about running tests for more information.

npm run build

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.

npm run eject

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.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.