• Stars
    star
    104
  • Rank 320,933 (Top 7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 10 months ago

Reviews

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

Repository Details

Setup pancake swap for testing

Preparing source

  • Clone pancake-swap-core
git clone [email protected]:pancakeswap/pancake-swap-core.git
cd pancake-swap-core
git checkout -b factory 3b214306770e86bc3a64e67c2b5bdb566b4e94a7
yarn install
yarn compile
  • Clone pancake-swap-periphery
git clone [email protected]:pancakeswap/pancake-swap-periphery.git
cd pancake-swap-periphery
git checkout -b router d769a6d136b74fde82502ec2f9334acc1afc0732
yarn install
yarn add @uniswap/v2-core@"file:../pancake-swap-core"
yarn compile
  • Clone pancake-swap-interface-v1
git clone [email protected]:pancakeswap/pancake-swap-interface-v1.git
cd pancake-swap-interface-v1
git checkout -b v1 0257017f2daaae2f67c24ded70b5829f74a01b3c
yarn install

Setup

Install contract merger: https://www.npmjs.com/package/sol-merger

npm install sol-merger -g

Prepare PancakeFactory and PancakeRouter

sol-merger pancake-swap-core/contracts/PancakeFactory.sol ./build
sol-merger pancake-swap-core/contracts/PancakePair.sol ./build
sol-merger pancake-swap-periphery/contracts/PancakeRouter01.sol ./build
sol-merger pancake-swap-periphery/contracts/PancakeRouter.sol ./build

Deploy PancakeFactory and PancakeRouter

Deploy WBNB

Deploy PancakeFactory

  • New File: PancakeFactory.sol => Copy source from ./build/PancakeFactory.sol
  • Compiler tab => Select compiler: v0.5.16+commit.9c3226ce
  • Deploy tab => Select PancakeFactory -> Fill your address as feeToSetter in constructor -> Deploy

Deploy PancakeRouter01

  • New File: PancakeRouter01.sol => Copy source from ./build/PancakeRouter01.sol
  • Expand PancakeFactory deployed above -> Read INIT_CODE_PAIR_HASH -> Copy this hash without prefix 0x. Ex: bb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539
  • Edit PancakeRouter01: Find PancakeLibrary -> pairFor function => Replace new hex by INIT_CODE_PAIR_HASH above. Ex: hex'd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66' -> hex'bb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539'
  • Compiler tab => Select compiler: v0.6.6+commit.6c089d02
  • Deploy tab => Select PancakeRouter01 -> Fill PancakeFactory address and WBNB address as constructor params -> Deploy

Deploy PancakeRouter (Main Router)

  • New File: PancakeRouter.sol => Copy source from ./build/PancakeRouter.sol
  • Expand PancakeFactory deployed above -> Read INIT_CODE_PAIR_HASH -> Copy this hash without prefix 0x. Ex: bb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539
  • Edit PancakeRouter: Find PancakeLibrary -> pairFor function => Replace new hex by INIT_CODE_PAIR_HASH above. Ex: hex'd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66' -> hex'bb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539'
  • Compiler tab => Select compiler: v0.6.6+commit.6c089d02; Check on Enable optimization: 200 to avoid Contract code size limit issue
  • Deploy tab => Select PancakeRouter -> Fill PancakeFactory address and WBNB address as constructor params -> Deploy

Setup Frontend

  • Update .env
cd pancake-swap-interface-v1
cp .env.development .env
  • Update PancakeRouter address to ROUTER_ADDRESS at src/constants/index.ts

  • Update support chain to testnet at src/connectors/index.ts

    • Change from supportedChainIds: [56, 97] to supportedChainIds: [97]
    • Change from 56 to 97
  • Update PancakeFactory address and code hash to FACTORY_ADDRESS and INIT_CODE_HASH at node_modules/@pancakeswap-libs/sdk/dist/constants.d.ts, node_modules/@pancakeswap-libs/sdk/dist/sdk.cjs.development.js, node_modules/@pancakeswap-libs/sdk/dist/sdk.cjs.production.min.js and node_modules/@pancakeswap-libs/sdk/dist/sdk.esm.js

  • Update PancakeFactory address to v2 factory; PancakeRouter01 address to v2 router 01 and PancakeRouter address to v2 router 02 at src/state/swap/hooks.ts

  • Update WBNB address at node_modules/@pancakeswap-libs/sdk/dist/sdk.cjs.development.js, node_modules/@pancakeswap-libs/sdk/dist/sdk.cjs.production.min.js, node_modules/@pancakeswap-libs/sdk/dist/sdk.esm.js

  • VERIFY CHANGES by Find All old addresses and replace new ones:

    • WBNB: 0xaE8E19eFB41e7b96815649A6a60785e1fbA84C1e
    • PancakeFactory: 0xBCfCcbde45cE874adCB698cC183deBcF17952812
    • INIT_CODE_HASH: 0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66
    • PancakeRouter01: 0xf164fC0Ec4E93095b804a4795bBe1e041497b92a
    • PancakeRouter: 0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F
  • Deploy your own tokens

    • Deploy your own tokens and update info (token address + chainId to 97) to src/constants/token/pancakeswap.json
    • Remember update token icon with name as token address in lowercase mode to public/images/coins
    • Update support network from ChainId.MAINNET to ChainId.BSCTESTNET at src/constants/index.ts
    • Update coin addresses to your at src/constants/index.ts
    • Update src/components/Menu/index.tsx: From priceData.data[CAKE.address].price to priceData.data[CAKE.address]?.price ?? 0
    • Update src/hooks/useGetDocumentTitlePrice.ts: From priceData.data[CAKE.address].price to priceData.data[CAKE.address]?.price ?? 0
  • Custom menu at src/components/Menu/config.ts

Start and Build Frontend

  • Start
yarn start
  • Build
yarn build

Deployment

  • WBNB: 0x0dE8FCAE8421fc79B29adE9ffF97854a424Cad09
  • PancakeFactory: 0x5Fe5cC0122403f06abE2A75DBba1860Edb762985
  • INIT_CODE_HASH: 0xbb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539
  • PancakeRouter01: 0x3E2b14680108E8C5C45C3ab5Bc04E01397af14cB
  • PancakeRouter: 0xCc7aDc94F3D80127849D2b41b6439b7CF1eB4Ae0
  • Frontend: https://pcs.nhancv.com

Tokens

  • BAKE Token: 0xb289b361a633A9D2b0B39BAE76BB458d83f58CEC
  • BUSD Token: 0xE0dFffc2E01A7f051069649aD4eb3F518430B6a4
  • ETH Token: 0xE282a15DBad45e3131620C1b8AF85B7330Cb3b4B
  • USDT Token: 0x7afd064DaE94d73ee37d19ff2D264f5A2903bBB0
  • XRP Token: 0x3833B175Af1900b457cf83B839727AF6C9cF0bEe
  • DAI Token: 0x3Cf204795c4995cCf9C1a0B3191F00c01B03C56C
  • CAKE Token: 0xB8F5B50ed77596b5E638359d828000747bb3dd89

Arbitrum Goerli Pancakeswap

- WBNB:            0xD8bbeA7e504851b0aa1c37475E7601c590cFa0B4
- PancakeFactory:  0x259E9786BB40eb5F656dbc16e15538a2340c2554
- INIT_CODE_HASH:  0x9fe1b508f2b0a84ca3b07189bfa32dd3309fb04b5ddec5e0456a232004b07194
- PancakeRouter01: 0x706B5c92d9E7fFD2dd50e56A69906C287C6C5550
- PancakeRouter:   0x8b707e7578059aD857f228FA63E82AA80E132b97
- Multicall:       0xb4B23070BE725100435457CE2E887aB716575EB2

More Repositories

1

nc_flutter_util

Flutter repo for testing ui
Dart
145
star
2

nc-flutter-webrtc-ex

Flutter WebRTC Example
Dart
101
star
3

nft

Flutter project template
Dart
97
star
4

nc-kurento-android

Demo kurento webrtc android (via webview and native using libjingle)
Java
62
star
5

nc-android-webrtcpeer

WebRtc peer connection client
Java
21
star
6

nc-rct-webrtc-server

React webrtc server. Custom from https://github.com/oney/react-native-webrtc-server
JavaScript
18
star
7

ot-kurento-node-webrtc

Custom something for demo in https://github.com/Kurento/kurento-tutorial-node
JavaScript
7
star
8

nc-core-php-mvc

PHP mvc architecture template
PHP
4
star
9

nc-csv2influxdb

Convert CSV to Line protocol for InfluxDb
Python
4
star
10

flutter_rally_app

Flutter rally theme
Dart
4
star
11

opencv-python

Opencv with python with sudoku solver example
Python
4
star
12

nc-ad-smack-xmpp

This application using smack api (https://www.igniterealtime.org/projects/smack/) for xmpp client
Java
3
star
13

n-chain

Deploy IBFT Ethereum Private Network with Hyperledger Besu, Ethstats, Ethernal to AWS Cloud via Terraform
HCL
2
star
14

nc-ad-facemask

Face mask
C++
2
star
15

nc-util-ad-access-db

access and copy db file to pc to use. (a part of Show android db flow - use SunnyPoint Utils plugin (https://github.com/nhancv/sp-util-intellij-plugin) to open db file)
Java
2
star
16

flutter-training-course

Flutter training course
2
star
17

terraform.aws.public

Web application with basic 3 tiers version. Deploy to AWS using Terraform
HCL
2
star
18

nc-nestjs-template

Nestjs.com template with Typescript
TypeScript
2
star
19

bc-dapp-template

ERC-20, ERC-721 Smartcontracts, Dapp template
TypeScript
2
star
20

npusher

Flutter pusher client, laravel echo
Dart
2
star
21

nc-tf-object-detection

Create your own Tensorflow Object Detection, build on ubuntu/linux
Python
2
star
22

nrandom

Flutter random index
Dart
2
star
23

nc-ad-nexpandable

ExpandableLayout
Java
1
star
24

nc-ad-card-reader

Example scan credit card using https://www.card.io/. Required: Card type is Visa and braille
Java
1
star
25

nc-rct-layout

Some examples about layout of react native
JavaScript
1
star
26

nhancv

Config files for my GitHub profile.
1
star
27

pancake-swap-arbitrum-goerli

Setup pancakeswap for arbitrum goerli
TypeScript
1
star
28

npreferences

Flutter local storage
Dart
1
star
29

nc-adb-install

Force install Apk file to avoid error some time happen cause on dex
Shell
1
star
30

ot-apprtc-demo

Base on https://github.com/njovy/AppRTCDemo, test on kurento
Java
1
star
31

rct-training-course

RCT training course
1
star
32

nc-nexpress-template

NodeJs + ExpressJS + HandlebarsJS + LESS
JavaScript
1
star
33

nhancv.github.io

Nhan Cao resume
CSS
1
star
34

fabric-first-network

Extract first-network of Hyperledger fabric sample (v1.2.1)
Shell
1
star
35

nc-liteforex-signal

Liteforex signal
TypeScript
1
star
36

firebase_messaging_call

Firebase messaging 7.0.3 custom for webrtc call from background
Java
1
star
37

ml-14days

Machine Learning Practitioner in 14 Days
Python
1
star
38

nc_flutter_ml

Flutter ML
Dart
1
star
39

nc-ad-timepicker

Android native time picker interactive
Java
1
star
40

nc-rct-demo

Demo: Images, Fonts, I18n, Setup Redux (DEPRECATED)
JavaScript
1
star
41

nc-ad-live-transcribe

Live transcribe with Google Cloud Speech API
Java
1
star
42

nc-kurento-composite

Example about kurento composite for combine multi stream
JavaScript
1
star
43

twilio_programmable_chat

Fork from https://gitlab.com/twilio-flutter/programmable-chat
Dart
1
star
44

nc-ad-datetime-picker

Calendar picker
Java
1
star
45

nc-unity-arkitzoombie

C#
1
star
46

nc-ad-sticky-header

Tiny class item decorator header for sticky header style in recycler view with 2 options (keep or non-keep header at top of list)
Java
1
star