helix-bridge / contracts

MIT License
7 stars 3 forks source link

XToken v4, an invariant entry contract for users to choose which bridge: (custodian_dapp, source_token, target_token) #69

Open hackfisher opened 5 months ago

hackfisher commented 5 months ago

XToken bridge will be defined by a three-element tuple: (custodian_dapp, source_token, target_token).

custodian_dapp consists of Backing contract(source chain) and Issuing contract(target chain). Its functions include the following parts:

xToken can offer an invariant entry contract(without owner and proxy) across each chain, allowing users and UI interfaces to select the bridge tuple that best suits their needs, it will provide interfaces for custodian_dapp to implement, custodian_dapp must follow these xToken interfaces for being able to used by users via xToken entry contract.

In this way, It becomes permissionless, granting users the freedom to choose any custodian they prefer for their bridge.

hackfisher commented 5 months ago

In xToken v3, source_token and target_token are normally managed by custodian_dapp, but actually they can be decoupled. In the cases of rollup bridges we learn from, such as Arbitrum and Optimism, Arbitrum DAO are acting as the custodian for all the assets bridged to Arbitrum One. Some parties might be professional or fit for custodian, not necessarily being related to the deployer of source_token or target_token. This is why we decouple source_token and target_token from custodian_dapp.

Why introduce an invariant xToken entry contract? As now, they might be many/various custodian_dapp existing, and if not specialized, most of them could serve arbitrary tokens. By providing xToken entry contract (or even UI ), various custodian_dapp can be presented as options to be chose by (merchant) users when they bridge.