Underlying Technology
Wormhole NTT (M Portal)
M Portal (Standard) is built using the Wormhole Native Token Transfer (NTT) framework.
- Integration:
HubPortal
andSpokePortal
inherit from Wormhole'sNttManager
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 theadditionalPayload
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 genericIBridge
interface. TheHyperlaneBridge.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:
- A
Portal
contract callssendMessage()
on the configuredHyperlaneBridge
. HyperlaneBridge
formats the message and dispatches it through the HyperlaneIMailbox
contract.- On the destination chain, the Hyperlane network delivers the message to the destination
HyperlaneBridge
by calling itshandle()
function. - The destination
HyperlaneBridge
authenticates the message (verifying it comes from the Mailbox and a known peer) and then callsreceiveMessage()
on its localPortal
contract, delivering the payload.
- A