Detailed Setup Guide
Hello! π This section will guide you through the process of setting up your xERC20
token.
Prerequisites
Let's begin by getting a comprehensive understanding of the required steps based on your token's current situation.
1. Categorize your token
Determine which of the following categories best describes your token's current state.
Category A: The token is new and is not deployed anywhere.
Category B: The token already exists on one chain.
Category C: The token already exists on multiple chains.
2. Define your token's "home" chain
Based on your token's category:
Category A: Choose one chain to be the home chain.
Category B: The chain where your token is currently deployed will be the home chain.
Category C: Choose one chain (among the ones your token is currently deployed) to be the home chain.
3. Prepare to deploy tokens
Category A:
You will deploy an
xERC20
on each chain you wish to support, including the home chain.
Category B and Category C:
On each chain with an existing token, you need to figure out if a Lockbox setup is needed (next section).
On all other chains you wish to support, you will just deploy an
xERC20
.
Lockbox Setup
A Lockbox allows any existing ERC20 to become compatible with the ERC-7281 (xERC20) standard. The Lockbox is just a simple wrapper contract, analogous to Wrapped ETH.
For Category B and Category C, there are tokens that already exist on certain chains. For each of these tokens, follow this flowchart to determine if you need to have a Lockbox setup on that token's chain.
Example: NEXT token
To better understand how a Lockbox setup operates, consider the NEXT
token as a real-world example.
On Ethereum: Both the
NEXT
token andxNEXT
token are deployed with aLockbox
.On Arbitrum: Only the
xNEXT
token is deployed.
Bridging from Ethereum to Arbitrum:
[Ethereum] User deposits
NEXT
into the Lockbox and receivesxNEXT
[Ethereum] User calls the bridge using
xNEXT
[Arbitrum] Bridge delivers
xNEXT
to the user
Bridging from Arbitrum to Ethereum:
[Arbitrum] User calls the bridge using
xNEXT
[Ethereum] Bridge withdraws
NEXT
from the Lockbox using the bridgedxNEXT
[Ethereum] Bridge delivers
NEXT
to the user
Deploying Contracts
Now that you have an idea of how your tokens should be set up, let's move on to the actual deployment procedures.
xERC20s and Lockboxes
We suggest you deploy from a fork of this repo, please see the README
for instructions. You will configure the scripts based on which chains you need to have Lockbox setups.
If you wish to roll your own version of an xERC20, make sure your custom implementation is compliant with the standard.
LockboxAdapter
You might have noticed there's a LockBoxAdapter
contract in the diagram above when you have a Lockbox setup. This contract facilitates the unwrapping of xERC20 -> ERC20
on the destination chain and is needed for UIs to do this step automatically for users.
Whitelisting bridges
As the token issuer, you have the power to decide which bridges can mint/burn your token and the ability to set rate limits per bridge:
These limits will replenish after_DURATION
(by default the repo deploys xERC20
with a value of 1 day).
Once your token is deployed, you can call setLimits
to grant any bridge the privilege to mint/burn your token on that chain.
Enabling Connext as a Bridge
Set rate limits for Connext.
For each chain where your xERC20 is deployed, add an object keyed by its address like this:
Under the
assets
key in the configuration object, add another object to the list like this:The
canonical
object should always have11111
as thedomain
. Change theaddress
anddecimals
to match your home chain xERC20. For example,RADAR
's home chain is Ethereum.For each chain where your xERC20 is deployed (including the home chain), add an entry into the
representations
field keyed on the chain'sdomainId
.You can look up each chain's domainId here. We encourage commenting the chain name above each entry.
local
andadopted
should both be set to the xERC20 address. These exist as separate fields for non-xERC20 assets.Note:
domainId
is a Connext-specific identifier per chain that exists for forward compatibility with non-evm chains.
Once this is done, the Connext Labs team will review your PRs to sanity check deployment details. Once your PR is approved, your tokens will be whitelisted and transferrable across chains!
Connextscan and Bridge UI Support
Router Liquidity
At this point, your token should be transferrable across chains with no added fees or slippage. However, because of how Connextβs model works, these transfers will happen in large batches through Ethereum L1 roughly once every 2-3 hours.
If your usecase requires fast (i.e. <2 minute) transfers across chains, you will need some routers in our network to supply some liquidity to execute transactions immediately on behalf of users.
Please reach out to the Connext team and we can help work through options here with our router partners.
Last updated