generated from Uniswap/foundry-template
-
Notifications
You must be signed in to change notification settings - Fork 49
Add new chain deploy guidelines #124
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
Open
gretzke
wants to merge
1
commit into
main
Choose a base branch
from
new-chain-deploy-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| - [Requirements for merge](#requirements-for-merge) | ||
| - [Adding a new repository](#adding-a-new-repository) | ||
| - [Adding a deployer](#adding-a-deployer) | ||
| - [Deploying to a new chain](#deploying-to-a-new-chain) | ||
| - [Deploying](#deploying) | ||
|
|
||
| ## Install | ||
|
|
@@ -231,6 +232,65 @@ Within the protocol section the to be deployed contract is defined in, read the | |
|
|
||
| Should the contract have dependencies that need to be resolved at runtime (e.g., the factory when deploying a router), ensure that the dependency contracts are deployed before the current contract. | ||
|
|
||
| ## Deploying to a new chain | ||
|
|
||
| Before deploying Uniswap contracts to a new chain, verify the following prerequisites and gather the required information. | ||
|
|
||
| ### Pre-deployment checklist | ||
|
|
||
| - **EVM version and equivalence**: Check the last supported EVM version / hard fork on the target chain. Important versions: | ||
|
|
||
| - **Cancun**: Required for Uniswap v4 support | ||
| - **Prague**: Required for EIP-7702 / Calibur support | ||
|
|
||
| Non-EVM-equivalent chains can be supported, but differences need to be explored and evaluated for potential impact on the protocols. | ||
|
|
||
| - **WETH9**: Confirm a wrapped native token exists following the [WETH9 interface](https://etherscan.io/address/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2#code) | ||
| - **Bridge availability**: Check if [Wormhole](https://wormhole.com/) or [LayerZero](https://layerzero.network/) is available on the chain (required for governance on non-OP-Stack chains) | ||
| - **Permit2**: Check if Permit2 has already been deployed on the chain at the deterministic address. If not, the deployment script will also deploy the deterministic deployment proxy required for other deployments | ||
|
|
||
| ### Governance setup | ||
|
|
||
| The admin address is used for governance functions across deployed contracts. | ||
|
|
||
| **For OP-Stack chains:** | ||
| Use the aliased address of the [Uniswap Timelock](https://etherscan.io/address/0x1a9c8182c09f50c8318d769245bea52c32be35bc#code): `0x2BAD8182C09F50c8318d769245beA52C32Be46CD` | ||
|
|
||
| The aliased address is calculated by adding `0x1111000000000000000000000000000000001111` to the timelock address (standard OP-Stack L1→L2 address aliasing offset). | ||
|
|
||
| **For non-OP-Stack chains:** | ||
| Use the Uniswap Wormhole Message Receiver or a LayerZero receiver. See the [Uniswap-Wormhole-Bridge repository](https://github.com/uniswapfoundation/Uniswap-Wormhole-Bridge) for implementation details. | ||
|
|
||
| ### UnsupportedProtocol | ||
|
|
||
| If any constructor arguments reference contracts or protocols that do not exist on the target chain, deploy the `UnsupportedProtocol` contract and use its address as a placeholder. This applies to: | ||
|
|
||
| - External protocols not available on the chain (e.g., Across Spokepool) | ||
| - Uniswap protocols not being deployed (e.g., Uniswap v3 is not deployed on this chain) | ||
|
|
||
| Deploy `UnsupportedProtocol` first, then use its address for any missing dependencies. | ||
|
|
||
| ### Deployment parameters | ||
|
|
||
| When creating a deployment config, use the following guidance for common parameters: | ||
|
|
||
| | Parameter | Value | | ||
| | -------------------------------- | ------------------------------------------------------------------------------------------------------------ | | ||
| | `feeToSetter` (UniswapV2Factory) | Admin address | | ||
| | `WETH` | Chain's wrapped native token address | | ||
| | `unsubscribeGasLimit` | 300000 (typical) | | ||
| | `Across` | Across Spokepool contract address for the chain, or `UnsupportedProtocol` address if Across is not available | | ||
|
|
||
| ### What to deploy | ||
|
|
||
| - Deploy all contracts **except v4 hooks** for initial chain deployments | ||
| - `FeeCollector` is no longer needed and should not be deployed | ||
| - To add new contracts to the deployment system, see [Adding a deployer](#adding-a-deployer) | ||
|
|
||
| ### Verification | ||
|
|
||
| Obtain an API key for the chain's block explorer to enable automatic contract verification during deployment. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. List of the supported block explorers could help! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point |
||
|
|
||
| ## Deploying | ||
|
|
||
| Follow these steps from the [README](README.md#deployment) and launch the `deploy-cli` to deploy contracts. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any more guidance about in which cases we would set a different limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we always set 300k, only on Ethereum we set 150k back then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth mentioning it like that