Deploy a Warp Route
Create an interchain route for your token
Last updated
Create an interchain route for your token
Last updated
A Warp Route is a type of Router application, requiring a HypERC20
or HypERC721
token contract to be deployed on each chain you wish to support.
The hyperlane-deploy repo includes a script to configure and deploy a Warp Route for your desired token.
Clone the hyperlane-deploy repo and run the following commands:
You will need to create a WarpRouteConfig
in hyperlane-deploy/config/warp_tokens.ts
to define your Warp Route. This will include information such as:
Which token, on which chain, is this Warp Route being created for?
Optional: Hyperlane connection details including contract addresses for Mailbox, , and Interchain security modules.
Optional: The token standard - fungible tokens using ERC20 or NFTs using ERC721. Defaults to ERC20.
Your WarpRouteConfig
must have exactly one base
entry. Here you will configure details about the token for which you are creating a warp route.
chainName: Set this equal to the chain on which your token exists
type: Set this to TokenType.collateral
to create a warp route for an ERC20/ERC721 token, or TokenType.native
to create a warp route for a native token (e.g. ether)
address: If using TokenType.collateral
, the address of the ERC20/ERC721 contract for which to create a route
isNft: If using TokenType.collateral
for an ERC721 contract, set to true
.
Your WarpRouteConfig
must have at least one synthetics
entry. Here you will configure details about the remote chains supported by your warp route.
chainName: Set this equal to the chain on which you want a wrapped version of your token
You may specify the following optional values in your base
and synthetics
entries. If no values are provided, defaults will be populated from hyperlane-deploy/artifacts/addresses.json
and the SDK (if present).
mailbox: The address of the Mailboxcontract to use to send and receive messages
interchainSecurityModule: The address of an Interchain security modules to verify interchain messages
interchainGasPaymaster: The address of a Interchain gas payments to pay for the gas needed to deliver interchain messages
An example WarpRouteConfig
is provided in hyperlane-deploy/config/warp_tokens.ts
that defines a warp route for a native token between two local chains.
This Warp Route is secured by the default Interchain security modules that are set on the Mailboxes
for those chains.
The Warp Route deployer will be aware of the connection details (e.g. RPC URL) for many standard chains.
If you would like to deploy a Warp Route to a chain that is not included in the Hyperlane SDK, you can specify a ChainMetadata
entry in hyperlane-deploy/config/chains.ts
.
An example has been populated for you for anvil
.
An example chain config for a Warp Route is shown below. The blocks
and blockExplorers
properties are optional.
Run the following script to deploy your Warp Route. You will need to provide the following arguments:
key
: A hexadecimal private key for transaction signing
When the command finishes, it will output the list of contracts addresses to hyperlane-deploy/artifacts/warp-token-addresses.json.
The deployer will also output a token list file to hyperlane-deploy/artifacts/warp-ui-token-list.ts
which can be used to Deploy a UI for your Warp Route.
Run the following script to test your Warp Route by transferring tokens from one chain to another. You will need to provide the following arguments:
origin
: The name of the chain that you are sending tokens from
destination
: The name of the chain that you are sending tokens to
wei
: The value of tokens to transfer, in wei
recipient
: The address to send the tokens to on the destination chain
key
: A hexadecimal private key for transaction signing
If everything goes well, you should see the following output: