Using node v12+
- 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
Install contract merger: https://www.npmjs.com/package/sol-merger
npm install sol-merger -g
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
- New File:
WBNB.sol
=> Copy source from https://github.com/ngocbd/pancanswap/blob/master/WBNB.sol - Compiler tab => Select compiler:
v0.8.3+commit.8d00100c
- Deploy tab => Select
WBNB
-> Deploy
- 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 asfeeToSetter
in constructor -> Deploy
- New File:
PancakeRouter01.sol
=> Copy source from./build/PancakeRouter01.sol
- Expand
PancakeFactory
deployed above -> ReadINIT_CODE_PAIR_HASH
-> Copy this hash without prefix0x
. Ex:bb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539
- Edit
PancakeRouter01
: FindPancakeLibrary
->pairFor
function => Replace new hex byINIT_CODE_PAIR_HASH
above. Ex:hex'd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66'
->hex'bb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539'
- Compiler tab => Select compiler:
v0.6.6+commit.6c089d02
- Deploy tab => Select
PancakeRouter01
-> FillPancakeFactory
address andWBNB
address as constructor params -> Deploy
- New File:
PancakeRouter.sol
=> Copy source from./build/PancakeRouter.sol
- Expand
PancakeFactory
deployed above -> ReadINIT_CODE_PAIR_HASH
-> Copy this hash without prefix0x
. Ex:bb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539
- Edit
PancakeRouter
: FindPancakeLibrary
->pairFor
function => Replace new hex byINIT_CODE_PAIR_HASH
above. Ex:hex'd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66'
->hex'bb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539'
- Compiler tab => Select compiler:
v0.6.6+commit.6c089d02
; Check onEnable optimization: 200
to avoidContract code size limit
issue - Deploy tab => Select
PancakeRouter
-> FillPancakeFactory
address andWBNB
address as constructor params -> Deploy
- Update .env
cd pancake-swap-interface-v1
cp .env.development .env
-
Update
PancakeRouter
address toROUTER_ADDRESS
atsrc/constants/index.ts
-
Update support chain to testnet at
src/connectors/index.ts
- Change from
supportedChainIds: [56, 97]
tosupportedChainIds: [97]
- Change from
56
to97
- Change from
-
Update
PancakeFactory
address and code hash toFACTORY_ADDRESS
andINIT_CODE_HASH
atnode_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
andnode_modules/@pancakeswap-libs/sdk/dist/sdk.esm.js
-
Update
PancakeFactory
address tov2 factory
;PancakeRouter01
address tov2 router 01
andPancakeRouter
address tov2 router 02
atsrc/state/swap/hooks.ts
-
Update
WBNB
address atnode_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
-
NOTE: if you deploy on testnet, please change value from mainnet to testnet
-
Change REACT_APP_NETWORK_URL & REACT_APP_CHAIN_ID from mainnet to testnet in .env, .evn.development, .env.production, .env.test:
- REACT_APP_NETWORK_URL="https://data-seed-prebsc-1-s1.binance.org:8545"
- REACT_APP_CHAIN_ID="97"
-
Change ChainId and smart contract address from MAINNET TO TESTNET in src/constant/index.ts : ChainId.BSCTESTNET
-
Change ChainId from 56 to 97 and smart contract address from MAINNET to TESTNET in src/constant/token/pancakeswap.json
-
-
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
toChainId.BSCTESTNET
atsrc/constants/index.ts
- Update coin addresses to your at
src/constants/index.ts
- Update
src/components/Menu/index.tsx
: FrompriceData.data[CAKE.address].price
topriceData.data[CAKE.address]?.price ?? 0
- Update
src/hooks/useGetDocumentTitlePrice.ts
: FrompriceData.data[CAKE.address].price
topriceData.data[CAKE.address]?.price ?? 0
- Deploy your own tokens and update info (token address + chainId to 97) to
-
Custom menu at
src/components/Menu/config.ts
- Start
yarn start
- Build
yarn build
- WBNB: 0x0dE8FCAE8421fc79B29adE9ffF97854a424Cad09
- PancakeFactory: 0x5Fe5cC0122403f06abE2A75DBba1860Edb762985
- INIT_CODE_HASH: 0xbb600ba95884f2c2837114fd2f157d00137e0b65b0fe5226523d720e4a4ce539
- PancakeRouter01: 0x3E2b14680108E8C5C45C3ab5Bc04E01397af14cB
- PancakeRouter: 0xCc7aDc94F3D80127849D2b41b6439b7CF1eB4Ae0
- Frontend demo : https://pancakeswap.impetus.fun
Tokens
- BAKE Token: 0xb289b361a633A9D2b0B39BAE76BB458d83f58CEC
- BUSD Token: 0xE0dFffc2E01A7f051069649aD4eb3F518430B6a4
- ETH Token: 0xE282a15DBad45e3131620C1b8AF85B7330Cb3b4B
- USDT Token: 0x7afd064DaE94d73ee37d19ff2D264f5A2903bBB0
- XRP Token: 0x3833B175Af1900b457cf83B839727AF6C9cF0bEe
- DAI Token: 0x3Cf204795c4995cCf9C1a0B3191F00c01B03C56C
- CAKE Token: 0xB8F5B50ed77596b5E638359d828000747bb3dd89