{"id":21314129,"url":"https://github.com/bitxx/uniswap-v3","last_synced_at":"2025-04-14T20:32:35.358Z","repository":{"id":180619921,"uuid":"665394998","full_name":"bitxx/uniswap-v3","owner":"bitxx","description":"整合uniswap-v3，基于hardhat，快速部署和发布合约及其前端","archived":false,"fork":false,"pushed_at":"2023-07-14T10:01:32.000Z","size":7399,"stargazers_count":15,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T08:51:11.838Z","etag":null,"topics":["contract","hardhat","solidity","uniswap","uniswapv3"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitxx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-12T05:42:39.000Z","updated_at":"2025-03-26T14:11:05.000Z","dependencies_parsed_at":"2023-07-26T14:15:40.190Z","dependency_job_id":null,"html_url":"https://github.com/bitxx/uniswap-v3","commit_stats":null,"previous_names":["jason-wj/uniswap-v3","bitxx/uniswap-v3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitxx%2Funiswap-v3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitxx%2Funiswap-v3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitxx%2Funiswap-v3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitxx%2Funiswap-v3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitxx","download_url":"https://codeload.github.com/bitxx/uniswap-v3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248955943,"owners_count":21189265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contract","hardhat","solidity","uniswap","uniswapv3"],"created_at":"2024-11-21T18:10:46.122Z","updated_at":"2025-04-14T20:32:35.328Z","avatar_url":"https://github.com/bitxx.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# uniswap-v3\n基于hardhat框架管理和发布uniswap v3\n建议结合本文来深入了解源码：\n1. [uniswap-v3设计详解](http://www.wjblog.top/articles/a0a6b822/) \n\n## 目录说明\nfrontend：前端代码，源自官方项目[interface](https://github.com/Uniswap/interface)  v3.3.6版\nhardhat：合约，基于hardhat框架  \nhardhat/contracts：其中有具体的solidity合约  \n\u0026emsp;\u0026emsp;1. factory：为工厂合约，v3核心业务逻辑均在此处，源自官方项目 [v3-core](https://github.com/Uniswap/v3-core) 分支0.8\n\u0026emsp;\u0026emsp;2. periphery：外围合约，该外围合约调用factory合约，实现完整的业务逻辑，，源自官方项目 [v3-periphery](https://github.com/Uniswap/v3-periphery)  分支0.8,其中包含以下几个独立合约：  \n\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;1. SwapRouter：路由合约，顾名思义，衔接工厂合约，接收外部请求，主要起中转作用  \n\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;2. NonfungiblePositionManager：NFT管理合约  \n\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;3. NonfungibleTokenPositionDescriptor：NFT仓位描述合约  \n\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;4. NFTDescriptor：NFT描述合约，这是一个library，需要和`NFT仓位描述`合约关联  \n\n## 合约编译\n```shell\ncd hardhat\nnpx hardhat compile\n```\n\n## 发布合约\n`说明`：weth9合约，可以查阅我以前uniswap-v2项目整合时的实现源码：[uniswap-v2 整合部署和发布](https://github.com/jason-wj/uniswap-v2)\n我在goerli测试网部署的 [weth9合约](https://goerli.etherscan.io/address/0xFe33eC9960E430608030e92860264B486Ae99Ef2) 地址是：0xFe33eC9960E430608030e92860264B486Ae99Ef2\n```shell\n# 1. 发布工厂合约\nnpx hardhat --network goerli run scripts/deploy_1_factory.js \n\n# 2. 发布路由合约，其中需要在deploy脚本中传入两个参数：第一步的factory合约地址以及weth9合约地址\n# 其中，weth9合约地址是什么，可以参考我上面的说明\nnpx hardhat --network goerli run scripts/deploy_2_router.js \n\n# 3. 发布NFT仓位描述合约\n# 该发布涉及到一个NFTDescriptor的library合约发布\n# 其中需要在deploy脚本中传入参数，第一个参数是weth9的合约地址，另一个是token名称(bytes32类型)，一般都是用`eth`表示，因此，一般情况，传入：`0x4554480000000000000000000000000000000000000000000000000000000000`即可\nnpx hardhat --network goerli run scripts/deploy_3_pd.js \n\n# 4. NFT管理合约发布\n# 其中需要在deploy脚本中传入参数：第一步的factory合约地址，weth9合约地址，第三步的仓位描述合约地址\nnpx hardhat --network goerli run scripts/deploy_4_mgr.js \n```\n\n## 前端部署\n当前只是把官方的前端[interface](https://github.com/Uniswap/interface)  v3.3.6版，迁移过来了，但里面内容都还没改，使用的参数等都是官方默认的\n```shell\ncd frontend\n\n# 先清一下缓存，以防编译异常，我遇到了，清理后一切恢复正常\nyarn cache clean --force\n\n# 启动\nyarn start\n\n# 备注：如果node verson\u003e=17，需要加入如下环境变量\nexport NODE_OPTIONS=--openssl-legacy-provider\n\n# 若要发布，可进行编译\nyarn build\n```\n\n\n## 信息整理\n使用本项目，goerli测试网自行发布信息如下：\n1. [Factory合约](https://goerli.etherscan.io/address/0xC5F57433074986CD739900242033Ca5E5f6da4be) 对应合约地址：`0xC5F57433074986CD739900242033Ca5E5f6da4be`\n2. [Router合约](https://goerli.etherscan.io/address/0x440402159426E17E6715E69D36253FeF77DB812B)  对应合约地址：`0x440402159426E17E6715E69D36253FeF77DB812B`\n3. [NFT仓位描述合约](https://goerli.etherscan.io/address/0xd28EC177C8f347F4C759a9a15055Ccf1A66E2342)  对应合约地址：`0xd28EC177C8f347F4C759a9a15055Ccf1A66E2342`\n4. [NFT管理合约发布](https://goerli.etherscan.io/address/0xA4B098cbd4a2DD037558e4888124B9fB6C732cE0)  对应合约地址：`0xA4B098cbd4a2DD037558e4888124B9fB6C732cE0`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitxx%2Funiswap-v3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitxx%2Funiswap-v3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitxx%2Funiswap-v3/lists"}