Overview
MeltFactory handles the full lifecycle of deploying new mAssets: creating the wrapped token, registering it with MeltHub, and linking it to HyperCore.
Inherits: Ownable
Constructor
| Parameter | Description |
|---|---|
_hub | MeltHub contract address |
_owner | Factory owner |
_lzEndpoint | LayerZero endpoint |
_oftOwner | OFT owner for new token deployments |
Token Deployment
deployToken
- Creates new
MeltAssetinstance - Grants
MINTER_ROLEandBURNER_ROLEto MeltHub - Grants
MINTER_ROLEto Factory (for HyperCore preparation) - Registers token with MeltHub
- Returns wrapped token address and configKey
HyperCore Integration
Two-step process to link a token to HyperCore for spot trading:Step 1: prepareForCore
- Calculates asset bridge address from
expectedCoreIndex_ - Mints tokens directly to the asset bridge
- Records pending state
Step 2: completeCoreLinking
- Calls
hub.setCoreConfig()to finalize the link - Marks deployment as fully linked
Deployment State
Each deployment tracks its lifecycle:View Functions
| Function | Returns |
|---|---|
getDeployment(configKey) | Full deployment state |
getDeployedTokens() | Array of all deployed token addresses |
deployedTokenCount() | Number of deployed tokens |
getAssetBridge(coreIndexId) | Asset bridge address for a HyperCore index |
