作者:资深区块链开发工程师-erick
这个教程只包含部署了swap和liquidity功能
准备源码
下载pancake-swap-core源码
Clonepancake-swap-coregitclone:pancakeswap/pancake-swap-core.gitcdpancake-swap-coregitcheckout-bfactory3b214306770e86bc3a64e67c2b5bdb566b4e94a7yarninstallyarncompile
下载pancake-swap-periphery源码
Clonepancake-swap-peripherygitclonegit
把ChainId.MAINNET换成ChainId.BSCTESTNET
exportconstCAKE=newToken(ChainId.BSCTESTNET,'0x4B13a328AFcc7EA26FA97436fB8a7346e6d2A6C6',18,'CAKE','PancakeSwapToken')exportconstWBNB=newToken(ChainId.BSCTESTNET,'0x3180356fa8082efEEf9523BE654c162242E4dcC0',18,'WBNB','WrappedBNB')exportconstDAI=newToken(ChainId.BSCTESTNET,'0x9D575ba54c57763d3b1e42957eBFE9D791DeeD39',18,'DAI','DaiStablecoin')exportconstBUSD=newToken(ChainId.BSCTESTNET,'0x7560AdfEca32ed5EC1b9101dD458e867Aec90cE3',18,'BUSD','BinanceUSD')exportconstUSDT=newToken(ChainId.BSCTESTNET,'0x02e996E902F5Ad8cC5037ECC5DCd552C565B6EBC',18,'USDT','TetherUSD')exportconstETH=newToken(ChainId.BSCTESTNET,'0xc34ad7105eb3B5F6c7A0198A346E26595A142291',18,'ETH','Binance-PegEthereumToken')exportconstBAKE=newToken(ChainId.BSCTESTNET,'0x94a42146Fab15a7EC00a8Bd95720cF0baDa65B42',18,'BAKE','BAKEToken')
更新和pancake-swap-interface-v1/hide/constants/token/pancakeswap.json将部署的token的address、chainId替换掉,logoURI可以替换成可以显示logo路径。
检查所有需要替换的都替换了
VERIFYCHANGESbyFindAlloldaddressesandreplacenewones:
WBNB:0xaE8E19eFB41e7b96815649A6a60785e1fbA84C1e
PancakeFactory:0xBCfCcbde45cE874adCB698cC183deBcF17952812
INIT_CODE_HASH:0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66
PancakeRouter01:0xf164fC0Ec4E93095b804a4795bBe1e041497b92a
PancakeRouter:0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F
MULTICALL_NETWORKS:0x301907b5835a2d723Fe3e9E8C5Bc5375d5c1236A
修改配置只显示swap和liquidity功能
Custommenuathide/components/Menu/config.tsimport{MenuEntry}from',]exportdefaultconfig
添加自己token
Deployyourowntokens
Deployyourowntokensandupdateinfo(tokenaddresschainIdto97)tohide/constants/token/pancakeswap.json
Rememberupdatetokeniconwithnameastokenaddressinlowercasemodetopublic/images/coins
UpdatesupportnetworkfromChainId.MAINNETtoChainId.BSCTESTNETathide/constants/index.ts
Updatecoinaddressestoyourathide/constants/index.ts
Updatehide/components/Menu/index.tsx:FrompriceData.data.pricetopriceData.data?.price??0
Updatehide/hooks/useGetDocumentTitlePrice.ts:FrompriceData.data.pricetopriceData.data?.price??0
StartandBuildFrontend
Startyarnstart
Buildyarnbuild
Deployment
WBNB:0x3180356fa8082efEEf9523BE654c162242E4dcC0
PancakeFactory:0xA7B372D22BeC0178ec561a74b87a95DF244E92a6
INIT_CODE_HASH:0x7f9a49918bf8ca6d4561dbce1f8d23f736f37c378e8a942d15ea4adf40d8ca6c
PancakeRouter01:0x07F0a23068F9cEa5F8D16ECE4354Fa4A5b670E36
PancakeRouter:0x953EDBf175792dB1161110543Cc2f4181fD6Dab5
Frontend:http://localhost:3000
MULTICALL_NETWORKS0xE3c149fc3252f9BF09cfb56B33a06A4b274B5d92
Tokens
tokenaddresshashBAKE0x94a42146Fab15a7EC00a8Bd95720cF0baDa65B420x6098e13955cf0853eb479f802bb4801f892258d8743f48178bd3b49e304d6bc9BUSD0x7560AdfEca32ed5EC1b9101dD458e867Aec90cE30xfba1330074958956f9cff9112f51bb4589df011f3ebac3a9e891627f6f1a7811ETH0xc34ad7105eb3B5F6c7A0198A346E26595A1422910x0ceefc7c3d22dc3bc030ad33e62e402315a8aaae57968595d4d57b046ee5160eUSDT0x02e996E902F5Ad8cC5037ECC5DCd552C565B6EBC0x95ed10809c17de41f2872708dcf646e43b4720c38293de57674454e893009db8XRP0x0eF680193492C1cc0a34a20411bA31eeA3298eeA0x45324f79100d845ae410d666ec87cbda3a2b2650dcb3f5dae7d0ca82a99a3cbfDAI0x9D575ba54c57763d3b1e42957eBFE9D791DeeD390x5fda7bdadfe57e8b0334b99c7d699a5d2afdf8a2c12c2ee87ac5432cb69c8e7cCAKE0x4B13a328AFcc7EA26FA97436fB8a7346e6d2A6C60xc1c54f99aea29f3845c77b7a3f9b6ebfbe9aabb29a8414bacd0d879ddbfa27edWBNB0x3180356fa8082efEEf9523BE654c162242E4dcC00x33c7311e0acd78c0709cbc8f2141d2d168667c7aae1e1b967a44f3a64e748b9b参考文献:
如何将pancakeSwap部署到BSC测试网https://github.com/nhancv/pancake-swap-testnet
pancakeSwap官方文档https://docs.pancakeswap.finance/code/contributing
参考资料
资深区块链开发工程师-erick:https://learnblockchain.cn/people/4396
免责声明:作为区块链信息平台,本站所发布文章仅代表作者个人观点,与链闻ChainNews立场无关。文章内的信息、意见等均仅供参考,并非作为或被视为实际投资建议。
本文来源于非小号媒体平台:
登链社区
现已在非小号资讯平台发布105篇作品,
非小号开放平台欢迎币圈作者入驻
入驻指南:
/apply_guide/
本文网址:
/news/10308878.html
免责声明:
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表非小号的观点或立场
上一篇:
每周编辑精选WeeklyEditors'Picks
郑重声明: 本文版权归原作者所有, 转载文章仅为传播更多信息之目的, 如作者信息标记有误, 请第一时间联系我们修改或删除, 多谢。