Skip to main content

Overview

MeltAsset is the wrapped token contract deployed on HyperEVM for each bridged asset. It implements both ERC20 and LayerZero OFT (Omnichain Fungible Token) standards. Inherits: OFTCore (LayerZero), ERC20, AccessControl

Constructor

constructor(
    string memory name_,
    string memory symbol_,
    uint8 decimals_,
    address originalToken_,
    uint32 sourceChainId_,
    address lzEndpoint_,
    address admin_,
    address oftOwner_
)
ParameterDescription
name_Token name (e.g., “Melt Gold”)
symbol_Token symbol (e.g., “mGOLD”)
decimals_Token decimals
originalToken_Address of original token on source chain
sourceChainId_LayerZero endpoint ID of source chain
lzEndpoint_LayerZero endpoint on HyperEVM
admin_Receives DEFAULT_ADMIN_ROLE (typically MeltFactory)
oftOwner_OFT owner/multisig (controls setPeer)

Roles

RolePurposeGranted To
MINTER_ROLECan call mint()MeltHub, MeltFactory
BURNER_ROLECan call burnFrom() without approvalMeltHub
DEFAULT_ADMIN_ROLECan grant/revoke other rolesMeltFactory → transferable

Functions

mint

function mint(address to, uint256 amount) external
Mints tokens. Caller must have MINTER_ROLE. Reverts with Unauthorized otherwise.

burnFrom

function burnFrom(address from, uint256 amount) public
Burns tokens from a holder:
  • If caller has BURNER_ROLE: burns without approval check
  • Otherwise: requires and spends allowance

OFT Functions

MeltAsset implements LayerZero OFT for potential cross-chain token transfers:
  • _debit: Burns tokens for outbound cross-chain sends
  • _credit: Mints tokens for inbound cross-chain receives

Immutable Properties

PropertyDescription
originalTokenAddress of the original token on source chain
sourceChainIdLayerZero endpoint ID of the source chain