Giter VIP home page Giter VIP logo

deploy-v3's Introduction

Deploy Uniswap V3 Script

This package includes a CLI script for deploying the latest Uniswap V3 smart contracts to any EVM (Ethereum Virtual Machine) compatible network.

Licensing

Please note that Uniswap V3 is under BUSL license until the Change Date, currently 2023-04-01. Exceptions to the license may be specified by Uniswap Governance via Additional Use Grants, which can, for example, allow V3 to be deployed on new chains. Please follow the Uniswap Governance process to request a DAO vote for exceptions to the license, or to move up the Change Date.

License changes must be enacted via the ENS domain uniswap.eth, which is controlled by Uniswap Governance. This means (among other things) that Governance has the power to associate arbitrary text with any subdomain of the form X.uniswap.eth. Modifications of the Change Date should be specified at v3-core-license-date.uniswap.eth, and Additional Use Grants should be specified at v3-core-license-grants.uniswap.eth. The process for associating text with a subdomain is detailed below:

  1. If the subdomain does not already exist (which can be checked at this URL), the setSubnodeRecord function of the ENS registry should be called with the following arguments:
  • node: namehash('uniswap.eth') (0xa2a03459171c76bff45817330c10ef9f8af07011a33005b73b50189bbc7e7132)
  • label: keccak256('v3-core-license-date') (0xee55740591b0fd5d7a28a6edc49567f6ff3febbe942ec0e2fa49ee536595085b) or keccak256('v3-core-license-grants') (0x15ff9b5bd7642701a10e5ea8fb29c957ffda4854cd028e9f6218506e6b509af2)
  • owner: 0x1a9C8182C09F50C8318d769245beA52c32BE35BC, the Uniswap Governance Timelock
  • resolver: 0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41, the public ENS resolver.
  • ttl: 0
  1. Then, the setText function of the public resolver should be called with the following arguments:
  • node: namehash('v3-core-license-date.uniswap.eth') (0x0505ec7822d61b4cfb294f137d1a7f0ceedf162f555a4bf2f4be58a07cf266c5) or namehash('v3-core-license-grants.uniswap.eth') (0xa35d592ec6e5289a387cba1d5f82be794f495bd5a361a1fb314687c6aefea1f4)
  • key: A suitable label, such as notice.
  • value: The text of the change. Note that text may already be associated with the subdomain in question. If it does, it can be reviewed at the following URLs for either v3-core-license-date or v3-core-license-grants, and appended to as desired.

Note: setContentHash may also be used to associate text with a subdomain, but setText is presented above for simplicity.

These contract function calls should ultimately be encoded into a governance proposal, about which more details are available here.

Usage

This package vends a CLI for executing a deployment script that results in a full deployment of Uniswap Protocol v3. Get the arguments for running the latest version of the script via npx @uniswap/deploy-v3 --help.

As of v1.0.3 the arguments are:

> npx @uniswap/deploy-v3 --help
Usage: npx @uniswap/deploy-v3 [options]

Options:
  -pk, --private-key <string>               Private key used to deploy all contracts
  -j, --json-rpc <url>                      JSON RPC URL where the program should be deployed
  -w9, --weth9-address <address>            Address of the WETH9 contract on this chain
  -ncl, --native-currency-label <string>    Native currency label, e.g. ETH
  -o, --owner-address <address>             Contract address that will own the deployed artifacts after the script runs
  -s, --state <path>                        Path to the JSON file containing the migrations state (optional) (default: "./state.json")
  -v2, --v2-core-factory-address <address>  The V2 core factory address used in the swap router (optional)
  -g, --gas-price <number>                  The gas price to pay in GWEI for each transaction (optional)
  -c, --confirmations <number>              How many confirmations to wait for after each transaction (optional) (default: "2")
  -V, --version                             output the version number
  -h, --help                                display help for command

The script runs a set of migrations, each migration deploying a contract or executing a transaction. Migration state is saved in a JSON file at the supplied path (by default ./state.json).

To use the script, you must fund an address, and pass the private key of that address to the script so that it can construct and broadcast the deployment transactions.

The block explorer verification process (e.g. Etherscan) is specific to the network. For the existing deployments, we have used the @nomiclabs/hardhat-etherscan hardhat plugin in the individual repositories to verify the deployment addresses.

Note that in between deployment steps, the script waits for confirmations. By default, this is set to 2. If the network only mines blocks when the transactions is queued (e.g. a local testnet), you must set confirmations to 0.

Development

To run unit tests, run yarn test.

For testing the script, run yarn start.

To publish the script, first create a version: npm version <version identifier>, then publish via npm publish. Don't forget to push your tagged commit!

FAQs

How much gas should I expect to use for full completion?

We estimate 30M - 40M gas needed to run the full deploy script.

When I run the script, it says "Contract was already deployed..."

Delete state.json before a fresh deploy. state.json tracks which steps have already occurred. If there are any entries, the deploy script will attempt to pick up from the last step in state.json.

Where can I see all the addresses where each contract is deployed?

Check out state.json. It'll show you the final deployed addresses.

How long will the script take?

Depends on the confirmation times and gas parameter. The deploy script sends up to a total of 14 transactions.

Where should I ask questions or report issues?

You can file them in issues on this repo and we'll try our best to respond.

deploy-v3's People

Contributors

asood123 avatar lint-action avatar moodysalem avatar noahzinsmeister avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

deploy-v3's Issues

Deployment halts & fails after Step-1: v3CoreFactoryAddress

HELP NEEDED!!

I'm deploying Uniswap V3 ecosystem on Arbitrum Sepolia but while deploying, the scripts stop and revert with an error. If I'm missing something badly please correct me or if it's a persistent issue please fix it as soon as you can. I also tried to pass the manual gasPrice with the -g flag but it didn't work out at all.

ERROR:
image

Invalid private key!

Does anyone have an idea why it would throw such error, I have tried all possible measures

Contract compile options

Hi, what are the compile options? I mean, number of optimization and compiler version?

I'm testing the deployment script on Harmony, and there we don't have plugin to auto verify contracts, so I need to verify manually.

Feedback: after deploying v3 contracts to OP Sepolia

Deploy the v3 protocol contracts feedback

Following a long in the readme:

issue with npx command

The following command doesn't work for some reason:

soyboy@soyboys-Air deploy-v3 % npx @uniswap/deploy-v3 --help               
sh: deploy-v3: command not found

building from source

So I built it from source, but I got some issues. I changed my node version to v16 and that worked.

yarn
yarn build

running from source

Note, I think there should be a call out that the private key needs 0x prepended.

yarn start \
-pk <0xprivate-key> \
-j https://sepolia.optimism.io/ \
-w9 0x4200000000000000000000000000000000000006 \
-ncl ETH \
-o 0xA8F66A5DDb07f8dF3A4Ab7B708018d1B12C6e433

Success

state.json

{
  "v3CoreFactoryAddress": "0x8CE191193D15ea94e11d327b4c7ad8bbE520f6aF",
  "multicall2Address": "0x80e4e06841bb76AA9735E0448cB8d003C0EF009a",
  "proxyAdminAddress": "0x3D0bD47e6Bc053aa730c6c28DD89bA9145c86232",
  "tickLensAddress": "0xCb7f54747F58F8944973cea5b8f4ac2209BadDC5",
  "nftDescriptorLibraryAddressV1_3_0": "0x0CeBF58b0B561d6EfE36742e3A25De74E4D83036",
  "nonfungibleTokenPositionDescriptorAddressV1_3_0": "0x41570951276d17FFF1Ebf579F7d28F5ffB7e4480",
  "descriptorProxyAddress": "0x802c58698b21FC9ea7145C88bbB233C9188CdCe2",
  "nonfungibleTokenPositionManagerAddress": "0xdA75cEf1C93078e8b736FCA5D5a30adb97C8957d",
  "v3MigratorAddress": "0xE7EcbAAaA54D007A00dbb6c1d2f150066D69dA07",
  "v3StakerAddress": "0x78eF13931e5625C828ef8Ec455ba7fa09fDa9808",
  "quoterV2Address": "0x0FBEa6cf957d95ee9313490050F6A0DA68039404",
  "swapRouter02": "0x9203F5E91aA591940078916EDF1339D978F34b64"
}

Changes needed for docs

  • identify optional parameters
  • define what --state should look like for a fresh install
  • aseem to test deploy after docs are updated

Contract not validated on etherscan

Hey there, I keep getting problem where some of the contracts (Library NFTDescriptor, Contract NonfungibleTokenPositionDescriptor, and Contract SwapRouter02) aren't getting verified on etherscan should I just verify the contracts manually? Also, I'm only getting 13 transactions total when the documentation said there should be up to 14 transactions is that something I need to worry about? All of the steps are getting completed without any errors when I deploy. Thanks

Errors with Node version >16

When running the script on Node versions 17 or 19, I get the following error on macOS:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:140:10)
    at hashOf (/Users/user/dev/3rdPartyContractsDeploy/uniswap-v3/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1890023)
    at ncc (/Users/user/dev/3rdPartyContractsDeploy/uniswap-v3/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1894690)
    at runCmd (/Users/user/dev/3rdPartyContractsDeploy/uniswap-v3/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:52268)
    at 819 (/Users/user/dev/3rdPartyContractsDeploy/uniswap-v3/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:48838)
    at __webpack_require__ (/Users/user/dev/3rdPartyContractsDeploy/uniswap-v3/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:59076)
    at /Users/user/dev/3rdPartyContractsDeploy/uniswap-v3/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:59288
    at /Users/user/dev/3rdPartyContractsDeploy/uniswap-v3/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:59349
    at Object.<anonymous> (/Users/user/dev/3rdPartyContractsDeploy/uniswap-v3/node_modules/@vercel/ncc/dist/ncc/cli.js:8:28) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
error Command failed with exit code 1.

More discussion of this error.

Fixes:

  • Using nvm to deploy using version 16.
  • Run export NODE_OPTIONS=--openssl-legacy-provider prior to running script

Verify Contract

I have already deployed UniswapV3Contract and I got addresses to state.json.

But I have one question:
How can I verify the smart contracts on CLI?
If support eam has good solution, Let mek now.

Also, I am going to change name of smart contracts. Is this available for CLI deploy?

thanks for your consideration.
Good luck

Error while calling mint function in NonFungiblePositionManager.sol

Hi, i deployed all contracts on sepolia scroll testnet, while i want to call mint function i get this error in scan and the tx failed
positionManager contract address: 0xe2C71288E53e6b49A7C5949A16710C0f2B183B28
tx hash: 0x8f21d4e7423eaa51e28e30e6a470a721d81a273b17b0155c45cbaf98c5ef6113

feat/support for local hardhat node

Suggestion to add WETH deployment migration to allow using the deployments on a local hardhat node.
Atm it requires WETH9 to already exist in the deployment network.

@uniswap/deploy-v3 package not found in NPM registry

Hi there,

I noticed that the default installation command for @uniswap/deploy-v3 is currently broken. When running npx @uniswap/deploy-v3, I encountered the following error:

npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/@uniswap%2fdeploy-v3 - Not found npm ERR! 404 npm ERR! 404 '@uniswap/deploy-v3@latest' is not in this registry. npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

I've managed to get the package to run by cloning the repo and running the index file. But the current docs are pretty misleading.

deploy-v3: command not found

Right after cloning the project and running npm install, the readme states that I should be able to execute npx @uniswap/deploy-v3 ...

I get this error instead sh: deploy-v3: command not found, and I was able to deploy UniswapV3 with the following command: yarn start --pk ...

I guess I missed some operations between npm install and npx @uniswap/deploy-v3 ... which maybe are not documented

On a private testnet, how to get UI working?

For reasons I want to do development on a private testnet and make sure my ERC20 contracts work with Uniswap

I ran this script, and deployed some ERC20 tokens, and started hacking on the interface to make it work with the testnet using the addresses from state.json. Unfortunately I was only partially successful. Some documentation, or better yet a way I can dump state.json into the frontend and have it magically pick everything up, would be a big help.

error on running npx command

npx @uniswap/deploy-v3 --help
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@uniswap%2fdeploy-v3 - Not found
npm ERR! 404 
npm ERR! 404  '@uniswap/deploy-v3@latest' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mxb/.npm/_logs/2022-11-03T01_11_35_639Z-debug-0.log

I'm getting this error upon running the command

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.