Skip to main content

Contract Architecture

Melt’s smart contracts implement a Lock & Mint bridge pattern using LayerZero V2 for cross-chain messaging.
Source Chain                    HyperEVM
┌──────────────┐               ┌──────────────────────┐
│  MeltBridge  │──LayerZero──▶│      MeltHub         │
│  (Lock)      │◀─────────────│  (Mint/Burn)         │
└──────────────┘               │                      │
                               │  ┌─── MeltFactory    │
                               │  │    (Deploy)       │
                               │  │                   │
                               │  └─── MeltAsset[]    │
                               │       (ERC20+OFT)    │
                               └──────────┬───────────┘

                                    HyperCore
                                  (Precompiles)
                               ┌──────────────────┐
                               │  Spot Trading    │
                               │  Asset Bridges   │
                               └──────────────────┘

Contracts

ContractChainPurpose
MeltHubHyperEVMCentral hub — receives bridges, mints tokens, routes to HyperCore
MeltBridgeSource chainsLocks tokens, sends cross-chain messages to MeltHub
MeltAssetHyperEVMERC20 + OFT wrapped token with role-based access
MeltFactoryHyperEVMDeploys new MeltAsset tokens, manages HyperCore integration

Tech Stack

  • Solidity 0.8.22
  • Foundry (Forge + Cast) for testing and deployment
  • LayerZero V2 OApp for cross-chain messaging
  • OpenZeppelin Contracts for ERC20, AccessControl, Pausable, ReentrancyGuard

Key Concepts

Config Key

Tokens are identified by a configKey — the keccak256 hash of (originalToken, sourceEid). This allows the same underlying token to have different configs when bridged from different source chains.

Roles

RoleGranted ToPurpose
MINTER_ROLEMeltHub, MeltFactoryMint wrapped tokens
BURNER_ROLEMeltHubBurn wrapped tokens without approval
DEFAULT_ADMIN_ROLEMeltFactory (then transferable)Manage roles
ownerMultisigAdmin operations (register tokens, set fees, pause)