Skip to content

Commit

Permalink
docs: Update README and doc (#5090)
Browse files Browse the repository at this point in the history
doc: Update README and doc
  • Loading branch information
0xjojoex authored Oct 26, 2022
1 parent 7b5dd29 commit a9435e8
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 181 deletions.
42 changes: 38 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 🥞 Pancake Frontend

<p align="center">
<a href="https://pancakeswap.finance">
<img src="https://pancakeswap.finance/logo.png" height="128">
</a>
</p>

This project contains the main features of the pancake application.

If you want to contribute, please refer to the [contributing guidelines](./CONTRIBUTING.md) of this project.
Expand All @@ -9,11 +15,13 @@ If you want to contribute, please refer to the [contributing guidelines](./CONTR
- [Info](doc/Info.md)
- [Cypress tests](doc/Cypress.md)

> Install dependencies using **yarn**
## Quick Start

install dependencies using **yarn**

## `apps/web`
<details>
<summary>
How to start
</summary>
```sh
yarn
```
Expand All @@ -30,3 +38,29 @@ yarn build
# start the application after build
yarn start
```
</details>

## `apps/aptos`
<details>
<summary>
How to start
</summary>
```sh
yarn dev:aptos
```
```sh
yarn turbo run build --filter=aptos-web
```
</details>


## Packages

| Package | Description |
|---------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| [sdk](/packages/swap-sdk) | An SDK for building applications on top of Pancakeswap |
| [aptos-swap-sdk](/packages/aptos-swap-sdk) | Aptos version of Swap SDK |
| [swap-sdk-core](/packages/swap-sdk-core) | Swap SDK Shared code |
| [wagmi](/packages/wagmi) | Extension for [wagmi](https://github.com/wagmi-dev/wagmi), including bsc chain and binance wallet connector |
| [awgmi](/packages/awgmi) | connect to Aptos with similar wagmi React hooks. |

This file was deleted.

2 changes: 1 addition & 1 deletion doc/Farms.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## How to add a new farm

- Add an entry in `/config/constants/farms.ts`, below the farm with the pid 0
- Add an entry in `packages/farms/constants/[chainId].ts`, below the farm with the pid 0
- Insert informations, with the LP address and the correct tokens (See [Tokens](./Tokens.md))
- Run `yarn test:config` to make sure the data you set in the config match the data on chain

Expand Down
16 changes: 8 additions & 8 deletions doc/Info.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ A brief overview how Info part of PancakeSwap website works.

## Code structure

In terms of React components Info section is just another view (located in [src/views/Info](../src/views/Info)) that is assigned route (in [App.tsx](../src/App.tsx)).
There are also some Info-related components inside [src/components](../src/components) (InfoNav, InfoCharts, InfoTables and InfoSearch at the time of writing).
In terms of React components Info section is just another view (located in [apps/web/src/views/Info](../apps/web/src/views/Info)) that is assigned route (in [pages](../apps/web/src/pages)).
There are also some Info-related components inside [apps/web/src/components](../apps/web/src/components) (InfoNav, InfoCharts, InfoTables and InfoSearch at the time of writing).

There are helper functions to handle data formatting and requests - [src/utils/infoDataHelpers.ts](../src/utils/infoDataHelpers.ts) and [src/utils/infoQueryHelpers.ts](../src/utils/infoQueryHelpers.ts)
There are helper functions to handle data formatting and requests - [apps/web/src/views/Info/utils/infoDataHelpers.ts](../apps/web/src/views/Info/utils/infoDataHelpers.ts) and [apps/web/src/views/Info/utils/infoQueryHelpers.ts](../apps/web/src/views/Info/utils/infoQueryHelpers.ts)

Info section has it's own reducer in Redux store - [src/state/info](../src/state/info). It handles all data about pools, tokens and overall protocol. The only exception is token/pool watchlist that is stored under [src/state/user](../src/state/user) reducer.
Info section has it's own reducer in Redux store - [apps/web/src/state/info](../apps/web/src/state/info). It handles all data about pools, tokens and overall protocol. The only exception is token/pool watchlist that is stored under [src/state/user](../apps/web/src/state/user) reducer.

GraphQL request logic lives under [src/state/info/queries](../src/state/info/queries) directory. Code over there handles firing requests to StreamingFast subgraph as well as formatting returned values and calculating all the derived data we need.
GraphQL request logic lives under [apps/web/src/state/info/queries](../apps/web/src/state/info/queries) directory. Code over there handles firing requests to StreamingFast subgraph as well as formatting returned values and calculating all the derived data we need.

## Requests flow

When user visits Info page the following requests are fired (names as declared in [src/state/info/queries](../src/state/info/queries)):

`overview` - gets basic protocol data like volume, liquidity and transaction count. 3 requests are fired for current, 24h ago and 48h ago data.
`overviewCharts` - gets data to show liquidity and volume charts on overview page.
`overview` - gets basic protocol data like volume, liquidity and transaction count. 3 requests are fired for current, 24h ago and 48h ago data.
`overviewCharts` - gets data to show liquidity and volume charts on overview page.
`overviewTransactions` - gets data to show transaction table on overview page

`prices` - gets BNB prices (current, 24h, 48 and 7d ago) used in calculations (see [src/hooks/useBnbPrices.ts](../src/hooks/useBnbPrices.ts))
Expand All @@ -31,6 +31,6 @@ When user visits Info page the following requests are fired (names as declared i

There are also multiple `blocks` queries to retrieve block numbers at different timestamps.

The flow is controlled by [src/state/info/updaters.ts](../src/state/info/updaters.ts). When user navigates through the site more pools and tokens are automatically loaded, (e.g. you click on BNB token and pools for BNB are loaded automatically, if you click on BNB-BTCB then BTCB token will be loaded, etc)
The flow is controlled by [apps/web/src/state/info/updaters.ts](../apps/web/src/state/info/updaters.ts). When user navigates through the site more pools and tokens are automatically loaded, (e.g. you click on BNB token and pools for BNB are loaded automatically, if you click on BNB-BTCB then BTCB token will be loaded, etc)

There are additional requests for price chart and search that are fired when user uses these features.
4 changes: 2 additions & 2 deletions doc/Pools.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## How to add a new pool

- Add an entry in `/config/constants/pools.ts`, below the pool with the id 0
- Add an entry in `apps/web/src/config/constants/pools.tsx`, below the pool with the id 0
- Insert informations, with the contract address and the correct tokens (See [Tokens](./Tokens.md))
- Run `yarn test:config` to make sure the data you set in the config match the data on chain

Pools APRs depend on farm data to compute prices

## Pools data

Data are stored in the global redux state (`/state/pools`).
Data are stored in the global redux state (`apps/web/src/state/pools`).
2 changes: 1 addition & 1 deletion doc/Tokens.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tokens management

All the tokens are in `/config/constans/tokens.ts`. They are instances of the `Token` class defined in the SDK.
All the tokens are in `/packages/tokens/src/[chainId].ts`. They are instances of the `Token` class defined in the SDK.
Before adding a new **farm** or **pool** you need to make sure the Tokens are in this file.
To add a Token to the exchange lists:

Expand Down
3 changes: 3 additions & 0 deletions packages/aptos-swap-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# PancakeSwap Aptos Swap SDK

You can refer to the Uniswap SDK documentation [uniswap.org](https://docs.uniswap.org/sdk/2.0.0/).
2 changes: 1 addition & 1 deletion packages/swap-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pancakeswap SDK
# PancakeSwap SDK

Forked from the [Uniswap SDK](https://github.com/Uniswap/uniswap-v2-sdk/commit/a88048e9c4198a5bdaea00883ca00c8c8e582605).

Expand Down

0 comments on commit a9435e8

Please sign in to comment.