This repo hosts the source code that runs 3 of Ribbon Finance's webapps, the landing page and the v1 webapp.
Getting Started
To begin, check your node version. Use node v14.18.1.
node -v
Install the node dependencies:
yarn install
The frontend repo is a monorepo. Each package in the monorepo is a Yarn workspace. Structuring the repo as a monorepo allows us to share components across multiple webapps.
Setting up your environment
The webapp uses environment variables to talk to the blockchain. Copy paste these variables and create a new file webapp/.env.
You will need to have access to a node to fill up REACT_APP_MAINNET_URI and REACT_APP_TESTNET_URI, we recommend either Infura or Alchemy.
# Used to track which branch is used to deploy the app. 'staging' uses mainnet for URLs
REACT_APP_VERCEL_GIT_COMMIT_REF=staging
REACT_APP_GOOGLE_ANALYTICS_TRACKING_ID=your_analytics_id
REACT_APP_MAINNET_URI=https://mainnet.infura.io/v3/d43d838246464b5690f8b10337b446d7
REACT_APP_TESTNET_URI=https://kovan.infura.io/v3/d43d838246464b5690f8b10337b446d7
REACT_APP_SUBGRAPHQL_URL=https://api.thegraph.com/subgraphs/name/kenchangh/ribbon-finance
REACT_APP_KOVAN_SUBGRAPHQL_URL=https://api.thegraph.com/subgraphs/name/kenchangh/ribbon-finance-kovan
REACT_APP_AIRTABLE_API_KEY=keymgnfgwnQHmH4pl
REACT_APP_AIRTABLE_BASE_ID=app5c70grFW2INfkN
REACT_APP_AVAX_URI=https://api.avax.network/ext/bc/C/rpc
REACT_APP_FUJI_URI=https://api.avax-test.network/ext/bc/C/rpc
REACT_APP_AVAX_SUBGRAPHQL_URL=https://api.thegraph.com/subgraph/name/kenchangh/ribbon-avax
REACT_APP_SOLANA_TESTNET_URI=https://api.devnet.solana.com
REACT_APP_SOLANA_MAINNET_URI=https://api.mainnet-beta.solana.com
In order to switch between the development environment and a production environment, we can change the REACT_APP_VERCEL_GIT_COMMIT_REF env var.
REACT_APP_VERCEL_GIT_COMMIT_REF=staging # used to see mainnet data
REACT_APP_VERCEL_GIT_COMMIT_REF=development # used to see testnet (kovan) data
Running the webapp
To run the webapp, you need to open two terminals, one in shared and another in webapp. We
start with running yarn start in shared.
cd shared/
yarn start
Now, in the webapp directory, we can start the build server.
请发表评论