2.0.0 • Published 1 year ago

@bonsaiswapv3/deploy v2.0.0

Weekly downloads
-
License
GPL-3.0-or-later
Repository
gitlab
Last release
1 year ago

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.

abstract-leveldownabortcontroller-polyfillabort-controlleracceptsacornacorn-jsxadm-zipaes-jsagent-baseajvansi-regexansi-escapesansi-colorsantlr4anymatcharr-diffargarr-flattenargparseansi-stylesarray-uniquearray-flattenarray.prototype.reducearr-unionassert-plusarray-backasn1.jsast-parentsassertion-errorassign-symbolsastral-regexasyncasync-limiterasync-eventemitteratobat-least-nodeavailable-typed-arraysaws4aws-sign2babel-code-frameasynckitbabel-coreasn1babel-helper-call-delegatebabel-helper-builder-binary-assignment-operator-visitorbabel-generatorbabel-helper-explode-assignable-expressionbabel-helper-hoist-variablesbabel-helper-get-function-aritybabel-helper-optimise-call-expressionbabel-helper-regexbabel-helper-remap-async-to-generatorbabel-helper-function-namebabel-helper-replace-supersbabel-helper-define-mapbabel-messagesbabel-plugin-check-es2015-constantsbabel-plugin-syntax-async-functionsbabel-plugin-syntax-trailing-function-commasbabel-plugin-syntax-exponentiation-operatorbabel-plugin-transform-async-to-generatorbabel-plugin-transform-es2015-arrow-functionsbabel-helpersbabel-plugin-transform-es2015-block-scoped-functionsbabel-plugin-transform-es2015-block-scopingbabel-plugin-transform-es2015-classesbabel-plugin-transform-es2015-computed-propertiesbabel-plugin-transform-es2015-destructuringbabel-plugin-transform-es2015-for-ofbabel-plugin-transform-es2015-duplicate-keysbabel-plugin-transform-es2015-function-namebabel-plugin-transform-es2015-literalsbabel-plugin-transform-es2015-modules-amdbabel-plugin-transform-es2015-modules-umdbabel-plugin-transform-es2015-modules-commonjsbabel-plugin-transform-es2015-object-superbabel-plugin-transform-es2015-parametersbabel-plugin-transform-es2015-modules-systemjsbabel-plugin-transform-es2015-sticky-regexbabel-plugin-transform-es2015-spreadbabel-plugin-transform-es2015-shorthand-propertiesbabel-plugin-transform-es2015-typeof-symbolbabel-plugin-transform-es2015-unicode-regexbabel-plugin-transform-es2015-template-literalsbabel-plugin-transform-exponentiation-operatorbabel-plugin-transform-regeneratorbabel-plugin-transform-strict-modebabel-registerbabel-runtimebabel-preset-envbabel-traversebabel-templatebabel-typesbasebackoffbalanced-matchbabelifybabylonbase64-jsbase64-solbase-xbech32bcrypt-pbkdfbig.jsbignumber.jsblakejsbip39blbinary-extensionsbn.jsbrace-expansionbody-parserbrowserify-aesbrowser-stdoutbrowserify-cipherbrorandbluebirdbrowserify-rsabrowserify-signbrowserify-desbrowserslistbracesbs58bserbufferbuffer-to-arraybufferbuffer-xorbytesbs58checkbuffer-frombufferutilcache-basecacheable-requestcachedowncacheable-lookupbytewise-corecall-bindbytewisecaller-pathcallsitescamelcasecaller-callsitecaniuse-litecaselesscapture-exitcborchalkchardetcheck-errorcheckpoint-storechokidarchownrcipher-basecidsclass-iscli-cursorclass-utilsci-infoclone-responsecliuiclonecollect-v8-coveragecode-point-atcombined-streamcli-widthcollection-visitcommand-existscolor-convertcolor-namecommand-line-argsconcat-streamconcat-mapcontent-hashcontent-typecomponent-emitterconvert-source-mapcookie-signaturecookiecookiejarcontent-dispositioncopy-descriptorcore-jscosmiconfigcore-js-purecore-util-iscorscreate-hmaccreate-ecdhcrc-32create-hashcrypto-browserifycreate-requiredcross-spawndashdashdebugdecamelizedecode-uri-componentdecompress-responsecross-fetchdeep-isdeep-equaldefer-to-connectdeferred-leveldowndecimal.js-lightdefine-propertiesdefine-propertydefineddelayed-streamdes.jsdepddetect-indentdestroydiffdiff-sequencesdom-walkdiffie-hellmandir-to-objectdoctrineduplexer3dotenvecc-jsbnee-firstdeep-eqlelectron-to-chromiumdotignoreellipticemoji-regexencodeurlencoding-downencodingend-of-streamenquirererrnoes-abstracterror-exes-array-method-boxes-properlyes-set-tostringtages-to-primitivees6-promisees6-iteratorenv-pathses6-symbolescaladeescape-string-regexpes5-extescape-htmleslint-utilseslinteslint-scopeespreeesprimaesutilsestraverseeslint-visitor-keysesrecurseesqueryeth-block-trackereth-ens-namehasheth-json-rpc-infuraeth-json-rpc-middlewareeth-queryeth-sig-utilethereum-bloom-filtersetagethereum-commoneth-libethereum-cryptographyethereumjs-accountethereumjs-txethereumjs-blockchainethereumjs-utilethereumjs-blockethashjseth-tx-summaryethereumjs-commonethereumjs-abiethjs-unitethereumjs-vmeventemitter3event-target-shimeventsexec-shexit-on-epipeethjs-utilethereumjs-walletevp_bytestokeyexpand-bracketsexecaexpressextexpectextglobexternal-editorextend-shallowfake-merkle-patricia-treefast-deep-equalextendfast-levenshteinfb-watchmanextsprintffast-difffetch-ponyfillfiguresfast-json-stable-stringifyfile-entry-cachefill-rangefinalhandlerfind-package-jsonflatfind-replacefind-upfind-yarn-workspace-rootflat-cachefollow-redirectsflattedfor-eachfor-inform-data-encoderforwardedform-dataforever-agentfp-tsfreshflow-stoplightfragment-cachefs.realpathfs-extrafseventsfunction-bindfs-minipassfunction.prototype.namefunctions-have-namesget-caller-filefunctional-red-black-treeganache-coreget-func-nameget-streamget-valuegetpassglobglobalglob-parentglobalthisget-intrinsicget-symbol-descriptiongopdgotglobalsgrowlhar-validatorgraceful-fshar-schemahas-bigintshashas-ansihardhat-watcherhas-property-descriptorshas-flaghas-symbol-support-xhas-symbolshas-protohas-to-string-tag-xhas-tostringtaghas-valueshash-basehas-valueheaphehash.jshosted-git-infohome-or-tmphttp-httpshttp-errorshttp-signaturehmac-drbghttps-proxy-agentidna-uts46-hxieee754http2-wrapperhttp-cache-semanticsiconv-liteimmediateimmutableignoreimport-freshimurmurhashinquirerinflightinheritsio-tsinvariantinvert-kvinternal-slotis-accessor-descriptoris-arrayishipaddr.jsis-array-bufferis-binary-pathis-bigintis-bufferis-core-moduleis-callableis-ciis-data-descriptoris-argumentsis-directoryis-dockeris-extglobis-fnis-date-objectis-finiteis-descriptoris-boolean-objectis-functionis-fullwidth-code-pointis-globis-generator-functionis-hex-prefixedis-negative-zerois-numberis-number-objectis-objectis-extendableis-plain-objis-plain-objectis-shared-array-bufferis-symbolis-stringis-streamis-retry-allowedis-regexis-typed-arrayis-urlis-utf8is-weakrefis-typedarrayis-windowsis-wslisexeisobjectisurlisstreamjest-matcher-utilsjest-haste-mapisarrayjest-diffjest-pnp-resolverjest-message-utiljest-regex-utiljest-resolvejest-snapshotjest-serializerjest-utiljest-workerjest-get-typejs-sha3jsbijs-yamljson-parse-better-errorsjsbnjsescjs-tokensjson-bufferjson-rpc-errorjson-rpc-enginejson-parse-even-better-errorsjson-schemajson-stable-stringify-without-jsonifyjson-rpc-random-idjson-stable-stringifyjson-schema-traversejson5json-stringify-safejsonfilejsonifykeyvkind-ofjsprimklawklaw-synckeccaklcidlevel-errorslevel-concat-iteratorlevel-codeclevel-iterator-streamlevel-memlevel-packagerlevel-postlevel-supportsleveluplevel-wslevnload-json-filelevel-sublevellines-and-columnslodashlocate-pathlodash.assignlooperlog-symbolslowercase-keyslru-cacheloose-envifylru_mapltgtmake-errormakeerrormap-cachemap-age-cleanermedia-typermap-visitmcl-wasmmemmerge-descriptorsmemdownmd5.jsmerge-streammemorystreammerkle-patricia-treemiller-rabinmicromatchmethodsmimemime-typesmime-dbmimic-responseminimalistic-assertminimalistic-crypto-utilsmin-documentmimic-fnminimatchminipassminimistmkdirp-promisemixin-deepmnemonistmulticodecminizlibmultibasemsmkdirpmute-streamnano-json-stream-parsermultihashesnanomatchnatural-comparenegotiatormock-fsnext-ticknice-trynanoidnode-environment-flagsnode-fetchnode-int64nofilternormalize-pathnormalize-package-datanormalize-urlnumber-is-nannpm-run-pathnode-addon-apiobject-copynode-gyp-buildoauth-signobject-assignobject-inspectobject-isobject-visitobject-keysobliteratorobject.pickobject.getownpropertydescriptorsobject.assignonceon-finishedonetimeopenoptionatoros-localeoboeos-homedirnumber-to-bnp-deferp-finallyp-limitp-is-promiseos-tmpdirp-timeoutp-locatep-tryp-cancelableparent-moduleparse-asn1parse-headersparseurlparse-jsonpatch-packagepath-is-absolutepath-browserifypath-keypascalcasepath-is-insidepath-existspath-parsepathvalpbkdf2performance-nowpicomatchpifypath-to-regexppinkie-promisepinkieposix-character-classesprecondprepend-httppretty-formatpostinstall-postinstallprettier-linter-helperspath-typeprelude-lsprivateprogressprocessprocess-nextick-argspromise-to-callbackprrproxy-addrpull-catpull-deferprintjpublic-encryptpull-livepull-levelpull-pushablepull-streampull-windowpumppslquery-stringqsrandombytespseudomapquerystringquick-lrurange-parserpunycoderaw-bodyreact-israndomfillread-pkgreaddirpregeneratereadable-streamregenerator-transformread-pkg-upregex-notregexp.prototype.flagsregexppregexpu-coreregjsparserregjsgenrepeat-elementremove-trailing-separatorregenerator-runtimerepeat-stringrequestrequire-directoryrequire-from-stringrequire-main-filenameresolve-alpnresolve-urlrepeatingresponselikerestore-cursorresolveresumerretrlpripemd160rimrafrustbn.jsrsvpresolve-fromsafe-buffersafe-regexrxjssafe-event-emittersafer-bufferscrypt-jsrun-asyncsanesecp256k1safe-regex-testseedrandomscryptsysemaphoresemaphore-async-awaitserialize-javascriptsemversendset-blockingservifyset-valueset-immediate-shimsetimmediateserve-staticsetprototypeofsha.jsshebang-regexside-channelsimple-concatsignal-exitshebang-commandsimple-getslice-ansislashsnapdragonsnapdragon-nodesolidity-comments-extractorsource-mapsolcsnapdragon-utilsource-map-resolvesource-map-supportspdx-correctspdx-exceptionssource-map-urlspdx-expression-parsespdx-license-idssprintf-jssplit-stringstack-utilssshpkstatic-extendstrict-uri-encodestream-to-pull-streamstatusesstring-widthstring.prototype.trimstring.prototype.trimendstring_decoderstring.prototype.trimstartstacktrace-parserstrip-ansistrip-hex-prefixstrip-bomstrip-eofsupports-preserve-symlinks-flagtapesupports-colorswarm-jsstrip-json-commentstartabletest-valuetext-tabletestrpcthrough2tmpltiny-invarianttmpto-fast-propertiestimed-outto-readable-streamto-regex-rangetoidentifierthroughtough-cookieto-object-pathto-regextoformattr46true-case-pathtrim-rightts-essentialstsorttunnel-agenttweetnacl-utiltslibtypetweetnacltype-checktype-detecttype-festtypedarray-to-buffertypedarraytype-istypewisetypewiselitetypewise-coretyped-array-lengthunderscoreuniversalifyultronunbox-primitivetypicalunormunion-valueunset-valueuri-jsurl-set-queryunpipeurl-parse-laxurluseurl-to-optionsutf-8-validateutf8util-deprecateutilutils-mergeutil.promisifyvarinturixvalidate-npm-package-licenseuuidvaryweb3-bzzwalkerverrorweb3web3-coreweb3-core-helpersweb3-core-methodweb3-ethweb3-core-requestmanagerweb3-eth-abiweb3-eth-accountsweb3-core-promieventweb3-core-subscriptionsweb3-eth-ibanweb3-eth-personalweb3-providers-httpweb3-eth-ensweb3-netweb3-eth-contractweb3-providers-ipcweb3-providers-wsweb3-shhweb3-utilsweb3-provider-enginewebidl-conversionswebsocketwhatwg-urlwhatwg-fetchwhichwhich-boxed-primitivewhich-typed-arraywide-alignwhich-moduleword-wrapwindow-sizewrap-ansiwrappywritexhrxhr2-cookiesxhr-requestwsworkerpooly18nxtendyaetiyallistyamlyargs-unparserxhr-request-promiseyargsyargs-parseryocto-queueyn
2.0.0

1 year ago