Skip to content

Underlying Technology

Wormhole NTT (M Portal)

M Portal (Standard) is built using the Wormhole Native Token Transfer (NTT) framework.

  • Integration: HubPortal and SpokePortal inherit from Wormhole's NttManager abstract contract. This provides the base functionality for interacting with Wormhole Transceivers, encoding/decoding messages, and handling standard NTT flows.
  • Customization: M0 extends this base functionality to:
    • Implement the specific Lock/Release (Hub) and Mint/Burn (Spoke) logic.
    • Handle the automatic unwrap/wrap mechanism for $M extensions.
    • Inject the M0-specific metadata (like $M Earning Index) into the additionalPayload field of standard NTT messages.
    • Define and handle custom message types for explicit metadata propagation.
  • Abstraction: Using the NTT framework allows M Portals to leverage Wormhole's established messaging infrastructure while focusing on M0-specific logic.

Hyperlane (M Portal Lite)

M Portal Lite uses Hyperlane as its messaging layer and features a more modular design.

  • Integration: The Portal contracts do not inherit from a bridge-specific contract. Instead, they hold an address of a contract that implements the generic IBridge interface. The HyperlaneBridge.sol contract is the concrete implementation that connects the Portals to the Hyperlane protocol.
  • Decoupling: This design decouples the token bridging logic from the cross-chain messaging logic. The Portals are only aware of the IBridge interface, making the system potentially adaptable to other messaging bridges in the future.
  • Message Flow:
    1. A Portal contract calls sendMessage() on the configured HyperlaneBridge.
    2. HyperlaneBridge formats the message and dispatches it through the Hyperlane IMailbox contract.
    3. On the destination chain, the Hyperlane network delivers the message to the destination HyperlaneBridge by calling its handle() function.
    4. The destination HyperlaneBridge authenticates the message (verifying it comes from the Mailbox and a known peer) and then calls receiveMessage() on its local Portal contract, delivering the payload.