Closed nambrot closed 8 months ago
Remaining Scope Left:
UI
"Backend":
Docs:
Deployment is tricky as router deployment today takes about 3n transactions on n networks:
Router deployment Router initialization enrollRemoteRouters
There's probably a way to simplify this using CREATE2
, where you can know the address of the remote routers without them being deployed.
At some point it would be worth deploying a TokenRouterFactory
that uses minimal proxies to minimize the gas costs of deploying new tokens
Blast from the past cc @yorhodes :)
@nambrot @yorhodes any nuggets here that should be captured in docs?
Trade Route Product Spec
This document specifies the requirements for a token wrapping product called Trade Route.
Stakeholders and their needs
Asset issuers
Stakeholders who have a token (ERC20s or ERC721s) that are already issued on an existing single chain. They have an interested in a representation of said token to be available on another chain on which it can be used and it can be easily transferred to/from the issued chain. Ideally the issuer is able to easily include a transfer page on their UI or at least on their subdomain. Worst case they point their users to a generic version hosted by Abacus Works.
New Chains
New chains (especially ones deploying Hyperlane via #258 ) generally will want a way to "import value". This is commonly done via creating wrapped representations of high-liquidity tokens like ETH or USDC on Ethereum. That allows value on the new network to be bootstrapped easily without the need for centralized exchanges. New chain operators want to be able to point their users to a UI that allows them to actually import said value.
High-Level Requirements
Smart Contract Architecture
Synthetics are basically just
HypERC20
routers except on the canonical chain, they lock/mint from aHypERC20Collateral
contract which holds the canonical token as collateral.Since
HypERC20
just implement the router pattern, at deploy time, the owner of the synthetic effectively specifies things like security or upgradability. Each synthetic is effectively its own logical and isolated application, making TradeRoute technically a framework of applications, not an application in of itself. Synthetics can be identified by its uniqueHypERC20Collateral
contract address on the canonical chain. For UIs, all they have to specify is whichHypERC20Collateral
is to be used for a given canonical chain + destination chain (which is non-trivial from a UX perspective).Synthetic Lists: While most other token wrapping bridges have a single, permissioned Collateral contract, Trade Route is an entirely new concept. There can be many different
HypERC20Collateral
contracts which determines the synthetic that a user would get on the destination chain and thus have significant security and liquidity considerations that have to be communicated to the user. Approving a maliciousHypERC20Collateral
contract can (like approving any malicious contract) cause the loss of funds, not too dissimilar from swapping into the wrong token on a DEX. Thus having trusted sources forHypERC20Collateral
contracts becomes critical.DEXs have "solved" this problem with the use of Token lists (https://tokenlists.org/) which effectively encode a mapping from Token symbols (DAI) to contract addresses (0x..). We can piggyback upon this standard by having lists of
HypERC20Collateral
that the author of the lists deems as "trustworthy" or "vetted". The reference UI should only default to a very small list and stakeholders who fork the UI can replace the default (and thus take responsibility over the contents of that list).Synthetic lists exist mostly for security, not for disambiguation reasons. It is not expected there will actually be competing synthetics (remote HypERC20's on the same destination chain for the same canonical token on the origin chain) for the most part, as the existence of a synthetic will only be practical if the owner/issuer of the synthetic will build liquidity for it.
User flows
Deployment
Deployment Configuration:
Deployment is tricky as router deployment today takes about
3n
transactions onn
networks:Our router deployment tooling today is geared towards a non-interactive ethers-rs signer.
v0:
infra
script that takes some configuration format and then deploys a synthetic using the existingMultiProvider
based router deployment tooling (overlap with permissionless deployment scripting needs)v1:
v2:
End-User bridging UI
Users are mainly expected to use a fork of the reference UI or the reference UI itself. The reference UI uses a Synthetic List as specified above. For a given synthetic list, do pre-processing by fetching the full synthetic details of each
HypERC20Collateral
list entry (i.e. list of enrolled remote routers (address + chain).UI inputs:
XYZ
)Desired outputs before transfer submission:
XYZ
on origin chainXYZ
on destination chainFor a given Token symbol and origin/destination chain pair, there are the following cases:
To actually complete the transfer, there are the following two cases:
approve
theHypERC20Collateral
contract from the canonical token and 2) calltransferRemote
onHypERC20Collateral
transferRemote
onHypERC20
has to be calledOnce the transaction has been submitted, the UI should determine whether the message explorer API supports this chain pair and use it to indicate message processing status to the user.
Forkability
Stakeholders should be able to easily fork the app and make the following changes:
Open Questions
Terminology/Branding Really this token wrapping bridge is not a product in of itself, but more like a framework for quickly building a wrapped synthetic application for a given canonical token with associated tooling/UIs. All those "bridge applications" share their standardized use of Hyperlane, but aren't really connected more broadly speaking. So it seems like we should have terminology for 1) the framework itself 2) instantiations of the framework in the form of the synthetics
Trade Route for me makes more sense for a specific synthetic, i.e. the Fuel Trade Route, or the ImpactMarket trade route. For the framework, I wonder what we think of Caravanserai
Out of scope
msg.sender
of a message (since that will end up just being theHypERC20
/HypERC20Collateral
contracts) (likely requires scraper agent support)HypERC20
/caninical token (same as above) (likely requires scraper agent support)