hyperlane-xyz / hyperlane-monorepo

The home for Hyperlane core contracts, sdk packages, and other infrastructure
https://hyperlane.xyz
Other
338 stars 373 forks source link

Implement Connext's xERC20 Standard #3486

Closed nambrot closed 6 months ago

nambrot commented 8 months ago

xERC20 Standard

xERC20, pioneered by Connext, is a simple extension to the ERC-20 interface that enables token issuers to maintain control and flexibility over their token as they navigate the bridge risk landscape. xERC20 users can flexibly whitelist and rate limit different bridges over time.

Hyperlane enables permissionless chain expansion, and is looking to add support for xERC20. In this way xERC20 users can mint their assets wherever Hyperlane is deployed.

To achieve this we are looking for support building a Hyperlane xERC20 adapter. Implementing the following work for the token standard needs of xERC20. would also address the USDC standard below.

Bounty

This bounty captures the work necessary for Chain deployers to take advantage of Hyperlane's permissionless nature, while being compatible with Connext's standard from day 1. In this model, Hyperlane can be used to pass messages back and forth between the L1 and the L2. Users will interact with a modified version of the Hyperlane Warp Router UI to bridge the ERC20. Tokens will be directly minted and burned.

Acceptance Criteria

To complete this bounty, PRs should be merged in and a test deployment should demonstrate the functionality

Engineering Lift

Prerequisites

Tasks

  1. Deploy the XERC20 + XERC20Factory to the L2.
  2. Create a HyperlaneXERC20Adapter contract. It should:
    • Follow the warp router interface for initiating a crosschain transfer, and burn the xerc20 + dispatch a hyperlane message.
    • Handle inbound hyperlane messages and mint the xerc20
  3. (optional) Audit the HyperlaneXERC20Adapter contract.
  4. Enlist the HyperlaneXERC20Adapter contract as a bridge on L1 and L2.
  5. Update hyperlane ui to point to adapter contract.
  6. Deploy hyperlane ui.

Tradeoffs + Assumptions

Bonus Scope - Circle USDC

Circle's USDC is a major asset that brings many benefits to a chain ecosystem. Circle has their own token bridging solution called CCTP which facilitates USDC burn and mints across supported chains https://www.circle.com/en/cross-chain-transfer-protocol. CCTP is the desired mechanism for USDC since there are no additional trust assumptions necessary. However, it is very difficult to get the official USDC (with Circle's first-party native mints and burns) from day 1 for a chain and native USDC requires specific token contracts which is why USDC migration has been a significant thing to plan around like on Arbitrum

Circle has created the Bridged USDC Standard to prevent this problem from happening by outlining the requirements for possible native support later down the line (which would avoid the token ecosystem migration).

Recommended Steps

While there is a lot of flexibility on how this could be implemented, here is a recommended path of action for USDC, similar to the xERC20 work:

jmrossy commented 8 months ago

Adding a few more pointers here:

Like other token adapters, the new EvmHypUsdcMinterAdapter adapater should fully implement the IHypTokenAdapter interface.

Once that's done, define a new TokenStandard for this (suggest EvmHypUsdcMinter) and update the maps in this file. Then update the Token class to wire up the standard to the adapter.

yorhodes commented 8 months ago

I think this can be implemented agnostically to FiatToken FiatToken.mint FiatToken.burn this token variant would work with any contract that supports this mint and burn interface https://docs.openzeppelin.com/contracts/2.x/api/token/erc20#ERC20Mintable https://docs.openzeppelin.com/contracts/2.x/api/token/erc20#ERC20Burnable

avious00 commented 7 months ago

this bounty is no longer available and was completed without bounty compensation by Abacus Works dev

yorhodes commented 7 months ago

completed without bounty compensation

😿