🛠️How it works

Working

This bridge uses LayerZero to provide inter-blockchain communication, facilitating the transfer of LRTs between Ethereum and Aptos. For transfers from Ethereum to Aptos, it uses a lock and mint technique. First, assets are locked in Ethereum, after which a payload is constructed and delivered to Aptos using LayerZero. Once Aptos receives the payload, it decodes it and mints required assets on receivers address. Conversely, for transfers from Aptos to Ethereum, assets are burned in Aptos and subsequently released in Ethereum.

Apart from LRTs, all other assets supported by AptosBridge can also be bridged through same interface.

LRT Bridge flow

  • Token Selection: Choose from LRTs directly on the bridge interface.

  • Amount Specify: Enter the amount of LRT you wish to bridge.

  • Receiver Specify: Connect the receiver's address on the destination chain.

  • Transaction Confirmation & Updates: Confirm your transaction and receive real-time progress updates.

  • Receive: Receive LRT directly on the destination chain to the desired receiver address.

Ethereum bridge contracts

This contract mainly responsible for locking/releasing LRTs and sending/receiveing message using LayerZero. It consists of two main functions -

  1. bridgeLRT - This function is responsible for locking LRT, constructing payload and sending payload using LayerZero.

    function bridgeLRT(
            address _token, //Address of LRT to bridge
            uint256 _amount, //Amount of LRT to bridge
            uint16 _dstChainId, //Chain ID of destination chain
            bytes32 _dstReceiver //Address of destination receiver
    ) public payable {}
  2. lzReceive - This function is called by LayerZero endpoint for receiving messages. It decodes the received payload and releases locked LRTs

    function lzReceive(
              uint16 _srcChainId, //Chain Id of source chain
              bytes calldata _srcAddress, //Address of source sender
              uint64 _nonce, //Nonce
              bytes calldata _payload //Payload
     ) public {}

Aptos Bridge Contracts

This contract is responsible for minting/burning LRTs and sending/receiving messages using LayerZero

  1. send_coin - This function is responsible for burning assets, constructing payload, and sending it using LayerZero

    public fun send_coin<CoinType>(
            coin: Coin<CoinType>, //Coin to send
            dst_chain_id: u64, //Destination chain Id
            dst_receiver: vector<u8>, //Address of destination receiver
            fee: Coin<AptosCoin>, //LayerZero fees
            unwrap: bool, //False
            adapter_params: vector<u8>, 
            msglib_params: vector<u8>,
     )
  2. lz_receive - This function is called by LayerZero endpoint for receiving messages from LayerZero and minting assets.

     public entry fun lz_receive<CoinType>(
             src_chain_id: u64, //Source chain ID
             src_address: vector<u8>, //Source chain sender address
             payload: vector<u8> //Payload
      )

Last updated