This repo contains a Hardhat script that can be used for deploying a set of Hyperlane Warp Routes executing a single
transaction in only one chain by reading the resulting warp-route-deployment.yaml
file generated with Hyperlane CLI
hyperlane warp init
command. It was created as a POC for solving
hyperlane-xyz/hyperlane-monorepo#3498
The solution makes use of Hyperlane InterchainAccountRouter
for sending the routes creation tx's to the destination
chains and CreateX
for precomputing resulting addresses and deploying.
They say a picture is worth a thousand words, so I'll try to explain the whole process with the following:
- Install dependencies
npm install
- Set required Hardhat configuration variables
PK
deployer's private key
npx hardhat vars set PK
ALCHEMY_API_KEY
your Alchemy API KEY
npx hardhat vars set ALCHEMY_API_KEY
- Run the script
After running Hyperlane CLI hyperlane warp init
command copy the resulting warp-route-deployment.yaml
file into the
configs
folder.
npm run warpDeploy -- --network NETWORK_NAME --routersalt SOME_SALT_FOR_ROUTER_IMPL --proxyadminsalt SOME_SALT_FOR_PROXY_ADMIN --proxysalt SOME_SALT_FOR_ROUTER_PROXY
There are some required params you need:
-
NETWORK_NAME
Name of the network from which the task is going to run. -
SOME_SALT_FOR_ROUTER_IMPL
A single use salt for deploying the router implementation. Max 11 characters address. -
SOME_SALT_FOR_PROXY_ADMIN
A single use salt for deploying the ProxyAdmin which will be set as theTransparentUpgradeableProxy
admin. Ownership of the ProxyRouter is assigned to user ICA. Max 11 characters -
SOME_SALT_FOR_ROUTER_PROXY
A single use salt for deploying the router proxy. Max 11 characters
For running the task on a given network it is required the presence of 3 smart contracts, Hyperlane
InterchainAccountRouter
,
MulticallFactory
and CreateX
.
This repository already supports the following networks:
- Base Sepolia
- Optimism Sepolia
- Arbitrum Sepolia
- Sepolia
I you need to run this from a different chain you would need to make sure that InterchainAccountRouter
and CreateX
deployed and deploy a new MulticallFactory
by following the next steps:
-
Add the network configs on the
hardhat.config.ts
file -
Run
npm run multicallFactory -- --network YOUR_NETWORK
- Add the resulting address into the
registry.json
file, like
{
... OTHER NETWORKS,
"YOR NETWORK ID": {
"multicallFactory": "RESULTING ADDRESS"
}
}
This solution is a POC so it contains several limitation:
It only supports Synthetix
and Collateral
warp routes.
Gas payment is calculated using a 2456224 as gas limit.
The solution make use of some smart contracts that were not audited.
It does not provide a way to verify the created smart contracts. Using
npx hardhat verify --network NETWORK_NAME CONTRACT_ADDRESS CONSTRUCTOR_PARAMS
should work.
It does no check the status of the messages. But at the end it prints some useful information, like messageId
of all
InterchainAccountRouter
calls that you can use on https://explorer.hyperlane.xyz
It does not write results to the configuration files.
Like every good piece of software it contains technical debts.