Skip to content
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

feat: add xERC20 Warp Route guide #308

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions docs/guides/xerc20-warp-route-guide.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Create your xERC20 Token Bridge

This guide walks you through deploying an xERC20 Warp Route between two networks of your choice. We'll use Ethereum as an example for the origin chain; however, you can select any supported network as the origin and destination.

## Prerequisites

To complete this walkthrough, you should have:

1. **An origin and destination network of choice**, between which you’d like to deploy the xERC20 warp route.
2. **The address of an xERC20 or xERC20Lockbox** on the origin and destination chain.
3. **Hyperlane CLI installed** and a **wallet private key set as the `HYP_KEY` environment variable**, funded on both origin and destination networks.

### Step 1: Initialize a New Warp Route

Run the following command to generate a warp route configuration:

```bash
hyperlane warp init
```

1. Select **Ethereum** (origin) and **YourChain** (destination) using space, then hit enter.
2. For Ethereum (origin), choose **xERC20** or **xERC20Lockbox**, and enter the contract address.
3. For YourChain (destination), choose **xERC20** or **xERC20Lockbox**, and enter the contract address.

:::info
Choosing Between xERC20 and xERC20Lockbox:

- **xERC20Lockbox**: Use this if your token is already deployed on the origin chain and requires a wrapped version for cross-chain transfers.
- **xERC20**: Use this if your token natively implements xERC20 and does not require a lockbox.

If you're unsure, review your token’s contract structure or deployment history to determine the correct choice.
:::

### Step 2: Deploy the xERC20 Warp Route

Run the following command to deploy the warp route:

```bash
hyperlane warp deploy
```

This deploys the *Hyperlane adapter contracts**, either:

- **HypXERC20Lockbox** (if using xERC20Lockbox)
- **HypXERC20** (if using xERC20)

*The CLI does not deploy non-Hyperlane contracts (e.g., existing ERC20 contracts). Those should already be deployed.*
edakturk14 marked this conversation as resolved.
Show resolved Hide resolved

### Step 3: Configure Minting Permissions

Once the xERC20 warp route contracts are deployed, you must configure minting permissions for the destination token.

Set the mint limit using the [`setLimits` function](https://github.com/defi-wonderland/xERC20/blob/main/solidity/contracts/XERC20.sol#L85) in your xERC20 contract.
edakturk14 marked this conversation as resolved.
Show resolved Hide resolved

### Step 4: Test Cross-Chain Transfers

Test transferring tokens across chains using:

```bash
hyperlane warp send --symbol <token_symbol> --amount <amount>
```

- Replace `<token_symbol>` with your token.
- Replace `<amount>` with the number of tokens to transfer.

###

🎉 Congrats! You have successfully created an **xERC20 Warp Route**. Your xERC20 tokens can now move across chains!

:::warning
Please note that cross-chain operations rely on **Interchain Security Modules (ISMs)**, and there are inherent risks, such as ISM trust assumptions.
:::

## Resources

For more resources on deploying xERC20 warp routes, check out:

- [xERC20 Token Standard](https://github.com/defi-wonderland/xERC20/blob/main/solidity/contracts/XERC20.sol)
- [xERC20 Token transfer limits](./manage-warp-route-limits.mdx)
7 changes: 6 additions & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const sidebars = {
type: "doc",
id: "protocol/warp-routes/warp-routes-yield-routes",
label: "Deploy Yield Routes",
},
},
{
type: "doc",
id: "protocol/warp-routes/warp-routes-custom-gas-fast-native",
Expand All @@ -114,6 +114,11 @@ const sidebars = {
id: "guides/extending-warp-route",
label: "Extending a Warp Route",
},
{
type: "doc",
id: "guides/xerc20-warp-route-guide",
label: "Deploy an xERC20 Warp Route",
},
{
type: "doc",
id: "guides/deploy-svm-warp-route",
Expand Down