Bridge Receiver

Description

Integration of LayerZero enables for cross chain native currency transfer accompanied with vault coordination and cross chain control.
Bridge Receiver is an immutable contract that can receive and validate calls from the layer zero resolver and execute operations provided in the payload.
→ Ditto introduces cross chain vault deploy for better user experience and enhanced features of cross chain vaults and assets management.
→ Ditto introduces cross chain vault upgrade and cross chain switch flag for even better user experience and enhanced security features.

Flow

  1. 1.
    If the frontend identifies that there is no vault on the destination chain, it checks the minimum required vault version on the destination chain to perform this action. This version, the creator's address of the vault and the vaultId are sent then in the cross-chain message.
  2. 2.
    Upon receiving on the destination chain, the dittoReceiver performs all sender and payload checks through LZ metadata.
    1. 1.
      If the vault has not yet been deployed on the destination chain, it is deployed through the factory using a method that can only receive calls from DittoBridgeReceiver.
  3. 3.
    Next, there is a call to the vault from the receiver.
    1. 1.
      The vault validates the ownership of the vault, and if the owner on the destination chain is equal to the creator, the cross-chain call is executed.
    2. 2.
      In the case of Stargate: if the destination and source vault addresses match, assets are sent to it regardless of who the owner is. If they do not match, the assets are sent to the sourceVaultOwnerAddress.