• Stars
    star
    187
  • Rank 205,959 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 8 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Frontend app for the Balancer protocol

Balancer Frontend App (v2)

Official frontend app for the Balancer protocol (v2)

Alt

Development

To setup the development environment first clone the repo:

git clone https://github.com/balancer/frontend-v2.git && cd frontend-v2

Local env

Install dependencies:

npm install

Start the app:

npm run dev

The app should be live at http://localhost:8080

Testing

Run unit tests:

npm run test:unit

Run unit tests in watch mode:

npm run test:unit:watch

Run unit tests with coverage:

npm run test:unit:coverage

Run unit tests with only lcov coverage (useful when doing exploratory testing):

npm run test:unit:silent:coverage

Build

Run build:

npm run build

Preview build:

npm run preview

Run build in watch mode:

npm run build:watch

This mode is useful when you need to reproduce/fix bugs/issues in a production-like environment.

Docker

If you'd rather spin up the app in a docker container, first install dependencies to you local folder:

docker-compose build
docker-compose run --rm web npm i

and start the app:

docker-compose up

The app should be live at http://localhost:8080

If you are on Apple Silicon, try this:

export DOCKER_DEFAULT_PLATFORM=linux/amd64

source: https://stackoverflow.com/questions/65612411/forcing-docker-to-use-linux-amd64-platform-by-default-on-macos

Self-Hosting

As we believe in decentralization at all layers, we've made it easy to host your own Balancer Frontend.

Docker Production Image

We've created a production ready docker image runs a pre-built version of Balancer Frontend-v2 using nginx. You'll need your own Infura, Alchemy, and Blocknative API keys in order to fetch data and execute transactions.

Here's an example of how to run the container. This can also be found in scripts/run-docker.sh.

docker run \
  -e INFURA_PROJECT_ID=   \ # Required
  -e ALCHEMY_KEY=         \ # Required
  -e BLOCKNATIVE_DAPP_ID= \ # Required
  balancerfi/frontend-v2

Custom RPC urls

To override RPC network config set in src/lib/config, you can use the following environment variables:

VITE_RPC_URL_<networkId>=XXX

One Click Deploys

The frontend can easily be deployed to any static host. Use the buttons below to spin up an instance. You will be prompted to provide your Infura Project ID, Alchemy Key, and Blocknative Dapp ID as these are required for the frontend to work correctly.

Deploy to DO

Deploy to Netlify

Deploy with Vercel

Vite setup

This app is powered by vite, which:

  • Runs a development dev server with esbuild.
  • Builds production bundle with Rollup.

Both tools above rely on native ES modules but our app also depends on libraries like ethers.js which use Node.js built-in modules (like Buffer, stream or crypto) that require browser polyfills. Thats why our vite.config.ts uses node-pollyfills and rollup-plugin-polyfill-node.

unplugin-vue magic 🪄

We use some Vite plugins to improve the Vue developer experience.

unplugin-vue-components:

Auto imports components located in src/components/_global so that they are available from every other component in the application (and from vitest). (It also auto generates a d.ts file for the auto imported components).

Analyze bundle

Analyze and visualize the bundle dependencies:

npm run build:analyze

More Repositories

1

balancer-core

Balancer on the EVM
Solidity
333
star
2

balancer-v2-monorepo

Balancer V2 Monorepo
TypeScript
309
star
3

balancer-sor

Smart order router: off-chain linear optimization of routing orders across pools for best price execution
TypeScript
218
star
4

balancer-subgraph-v2

Subgraph (Graph Protocol) data layer for Balancer v2 vault, swaps, txs, users
TypeScript
118
star
5

balancer-exchange

Exchange dapp for token swaps
TypeScript
95
star
6

bal-mining-scripts

TypeScript
88
star
7

erc20-redeemable

Vue
79
star
8

balancer-sdk

TypeScript
77
star
9

frontend-v1

V1 Pool Management
Vue
75
star
10

balancer-subgraph

Subgraph (Graph Protocol) data layer for Balancer pools, swaps, txs, users
TypeScript
67
star
11

balpy

Tools for interacting with Balancer Protocol V2 in Python.
Python
64
star
12

docs

Documentation for Balancer
Vue
44
star
13

balancer-deployments

TypeScript
41
star
14

balancer-v3-monorepo

Solidity
38
star
15

configurable-rights-pool

JavaScript
34
star
16

tokenlists

TypeScript
30
star
17

assets

JavaScript
27
star
18

scaffold-balancer-v3

Starter kit for creating custom pools and hooks contracts on Balancer v3
TypeScript
24
star
19

pool-management

Pool management dapp
TypeScript
22
star
20

swap-frontend-v1

Balancer Protocol Frontend
Vue
21
star
21

exchange-proxy

Solidity
21
star
22

b-sdk

TypeScript
20
star
23

balancer-api

Deprecated
TypeScript
18
star
24

backend

TypeScript
16
star
25

docs-developers

15
star
26

balancer-registry

Solidity
14
star
27

docs-v1

13
star
28

bactions-proxy

Solidity
11
star
29

code-review

JavaScript
10
star
30

balancer-examples

Template repository to begin building on Balancer V2
TypeScript
9
star
31

frontend-v3

Official web application for the Balancer protocol.
TypeScript
9
star
32

docs-v2-archive

7
star
33

linear-pools

TypeScript
6
star
34

scaffold-balancer

TypeScript
5
star
35

brand-assets

4
star
36

balancer-sor-v1

Legacy SOR for V1
TypeScript
3
star
37

ipfs-push

TypeScript
3
star
38

balancer-cred

Shell
3
star
39

pebbles

grug stack rock
HTML
3
star
40

docs-v3

Vue
3
star
41

gauges-subgraph

Subgraph for Liquidity Gauges of the Balancer Protocol
TypeScript
3
star
42

cow-amm

Solidity
3
star
43

dune_queries

PLpgSQL
2
star
44

balancer-bounties

https://bounties.balancer.finance
Vue
2
star
45

helpers

Collection of contracts and JS code for common data dependencies
Solidity
2
star
46

frontend-monorepo

Balancer frontend apps and packages. Includes the official Balancer UI application.
TypeScript
2
star
47

metastable-rate-providers

Rate provider adaptors used by MetaStable pools
Solidity
1
star
48

marketing-site

Marketing site
Vue
1
star
49

frontend-e2e

TypeScript
1
star
50

sor-benchmark

TypeScript
1
star
51

metadata

1
star
52

pool-creator

A user friendly interface for creating and initializing pools
TypeScript
1
star