Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy the smart contracts to uniswap. #1295

Open
YangIsCoding opened this issue Oct 3, 2023 · 3 comments
Open

Deploy the smart contracts to uniswap. #1295

YangIsCoding opened this issue Oct 3, 2023 · 3 comments
Assignees
Labels
5 hard level 5 documentation Improvements or additions to documentation

Comments

@YangIsCoding
Copy link

Deploy everything to uniswap see if it works.

@YangIsCoding YangIsCoding added documentation Improvements or additions to documentation 5 hard level 5 labels Oct 3, 2023
@YangIsCoding YangIsCoding self-assigned this Oct 3, 2023
@YangIsCoding
Copy link
Author

今日目標為 uniswap 部署到uniswap 測試練上。
整體過程:
1.使用remix IDE, 設定一個新的workspace.
2.將 uniswap v3 core , 這包含uniswap facotry在內的核心合約,下載並放在workspace.
3.將 uniswap v3 periphery , 這是包含v3 router在內的外周圍合約,下載並放在workspace.
4.先找到UniswapFactory.sol 並編譯,接著轉換自己的metamask至 sepolia,部署這個工廠合約, 將合約地址記住
5.到etherscan 上找weth9合約(也可以自己部署),這邊我是用0xD0dF82dE051244f04BfF3A8bB1f62E1cD39eED92這個
6.找到swapRouter.sol 將factory, weth9 合約放置參數,接著部署。

@YangIsCoding
Copy link
Author

遇到的問題:
使用hardhat來部署會遇到許多的問題(僅供參考)。

  1. 測試合約沒有remix直觀
  2. 由於uniswap 上的solidity合約都有著不同的版本,經常會出現警告甚至錯誤。

uniswap 上的 hardhat-ve-deploy readme若照著做會出現一些錯誤

  1. 會出現要下載許多模組(解決)
  2. 還需要自己修改json內容(解決)
  3. TypeError: unsupported addressable value (argument="target", value=null, code=INVALID_ARGUMENT, version=6.7.1)
  4. npm run hardhat
    npm ERR! Missing script: "hardhat"(解決:加入scripts": {
    "start": "node index.js",
    "test": "jest",
    "hardhat": "npx hardhat"})
  5. 執行deploy.js會得到ethers.getSigners() 沒有返回預期的結果。(解決:需要自己更改程式碼)

@YangIsCoding
Copy link
Author

YangIsCoding commented Oct 6, 2023

現在面臨的問題:
若直接將v3 periphery下載下來編譯後會得到:
image
但是,我嘗試將etherscan上已經部署好的router編譯也會出現一樣的error,那他們是怎麼成功部署的呢?

如果一一將import進來的solidity版本手動修改後,雖然可以成功上傳到etherscan但是就無法通過verification.
我的作法: 將router flatten後複製到Verify & Publish會出現:
image
並且remix會編譯說 pragma abicoder v2 需要版本0.8.0以上,但是如果改動,其他只能支援0.7.6的imports就會錯誤
但是直接將abi.decoder這一行註解掉只剩一行,出現:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 hard level 5 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant