chobynleo / pancakeswap-frontend-hardhat-testnet

Pancakeswap Front-end Configuration on Testnet
MIT License
45 stars 46 forks source link
front-end hardhat pancakeswap

A hardhat testnet environment base on pancake-frontend

Node Environment

(recommend)
nvm use 12

Install

sh install.sh

Serve

sh serve.sh

Deploy

sh deploy.sh

Start

sh start.sh

Running in the serve

If you plan to push your local project to the server:
Configuresrc/config/index.ts=>BASE_URLto address of the server

cd pancake-frontend
npm run build

local serve:

serve -s build -p 3000

Example

Image text Image text Image text

Configuration

If you want to try out the process of configuring Pancake-frontend for yourself and build your own testnet environment, the following will show you which files need to be modified:

Preparing source

tip: If you got a compilation error about: import @uniswap/v2-core/contracts/interfaces/IPancakePair.sol
Please refer to upchain

Setup

In the pancake-swap-coredirectory

In the pancake-swap-peripherydirectory

In the pancake-frontenddirectory

All the files that need to be modified:

/.env.development 
/.env.production
/src/config/constants/networks.ts
/src/config/constants/index.ts
/src/config/constants/tokens.ts
{
Local testnet(e.Hardhat):
/src/config/constants/lists.ts
/public/pancake-default.tokenlist.json
Other testnet:
/src/config/constants/lists.ts
/src/config/constants/tokenlists/pancake-default.tokenlist.json
}
/src/config/constants/contracts.ts
/scr/config/constants/farms.ts
/src/config/constants/pools.ts  
/src/config/constants/ifo.ts  
/src/config/constants/priceHelperLps.ts
/src/config/constants/types.ts
/src/config/index.ts
/src/config/constants/nftsCollections/index.ts

Switch to the pancake-swap-sdk directory, and modify the file

cd ../pancake-swap-sdk

Modify the file:

/src/constants.ts

and run:

$ pancake-swap-sdk/
npm run build
cp -r ./dist ./local-pancakeswap-libs/sdk/
cp -r ./local-pancakeswap-libs ../pancake-frontend/node_modules

The following is the specific content to be modified: