Skip to content

Cross-Chain Bridging

Overview

King's Vault uses Chainlink CCIP (integrated with Circle CCTP) for all cross-chain operations between Ethereum Mainnet and HyperEVM. CCIP handles both USDC transfers (via burn-and-mint) and encoded instruction messages.


CCIP Architecture

Component Role
Router Entry point for sending CCIP messages on both source and destination chains.
OnRamp Receives messages on the source chain, interacts with Token Pool.
OffRamp Verifies proofs on the destination chain, delivers messages to receivers.
Token Pool Manages USDC cross-chain: burn on source, mint on destination (via Circle CCTP).
Committing DON Monitors source-chain transactions, submits Merkle roots to destination.
Executing DON Executes messages on destination chain; requests Circle attestation for USDC minting.
Risk Management Network Independent anomaly monitoring layer for cross-chain transfers.

Direction 1: Ethereum → HyperEVM (Deposit to HLP)

sequenceDiagram
    actor Tr as Trader
    participant Vault as KingsVault (ETH)
    participant Router as CCIP Router (ETH)
    participant DON as Chainlink DON
    participant RouterH as CCIP Router (HEVM)
    participant Strat as HyperStrategy (HEVM)
    participant CW as CoreWriter (0x333...333)
    participant HLP as HLP Pool (HyperCore)

    Tr->>Vault: depositPool(hyperPoolAddr, amount)
    Vault->>Vault: abi.encode("PUSH_TO_CORE", poolAddr, amount)
    Vault->>Vault: Calculate CCIP fee (LINK)
    Vault->>Router: ccipSend(destChainSelector, message)
    Router->>Router: Lock/Burn USDC via Token Pool

    Note over DON: Wait for finality (~15-20 min)
    DON->>RouterH: Deliver message + mint USDC

    RouterH->>Strat: ccipReceive(message)
    Strat->>Strat: abi.decode → "PUSH_TO_CORE"
    Strat->>CW: sendRawAction(Action 2: Vault Transfer)
    Note over CW: Header: 0x01000002<br/>Payload: (vaultAddr, isDeposit=true, amount)
    CW->>HLP: Deposit funds
    Note over HLP: Delayed execution (~seconds)<br/>Enqueuing → Executing

Key Parameters

Parameter Value
Destination Chain Selector (HyperEVM) 2442541497099098535
Source Chain Selector (Ethereum) 5009297550715157269
CCIP Gas Limit 250,000
Fee Token LINK
Action ID (Vault Transfer) 2
CoreWriter Payload (address vaultAddr, bool isDeposit, uint64 amount)

Direction 2: HyperEVM → Ethereum (Withdrawal)

The withdrawal path requires two HyperCore actions before CCIP:

sequenceDiagram
    participant Strat as HyperStrategy (HEVM)
    participant CW as CoreWriter
    participant Core as HyperCore Spot
    participant Sys as System Address (0x20...)
    participant Router as CCIP Router (HEVM)
    participant DON as Chainlink DON
    participant Vault as KingsVault (ETH)

    Note over Strat,Core: Step 1: HLP → Core Spot
    Strat->>CW: sendRawAction(Action 2: Vault Transfer, isDeposit=false)
    CW->>Core: Move funds from HLP equity to spot balance
    Note over Core: Wait for internal settlement

    Note over Strat,Sys: Step 2: Core Spot → HyperEVM
    Strat->>CW: sendRawAction(Action 6: Spot Send)
    Note over CW: destAddr = 0x20 + [USDC Token Index]<br/>Sends to System Address
    CW->>Sys: Transfer to system address
    Sys->>Strat: ERC20 transfer(KingsVault_HEVM, amount)

    Note over Strat,Vault: Step 3: CCIP back to Ethereum
    Strat->>Strat: USDC.approve(router, amount)
    Strat->>Router: ccipSend(ethChainSelector, message)
    DON->>Vault: Deliver USDC + data
    Vault->>Vault: Mark requestId as Claimable

Action Reference

Step Action ID Name ABI Encode Header
1 (HLP → Spot) 2 Vault Transfer (address, bool isDeposit=false, uint64 amount) 0x01000002
2 (Spot → EVM) 6 Spot Send (address destAddr, uint64 amount, uint64 nonce) 0x01000006

Direction 3: HyperEVM → Ethereum (Settlement Report)

Used during settlement to report total HyperCore assets back to Ethereum for PPS calculation.

Step Action Detail
1 Read HLP equity. L1Read precompile 0x800vaultEquity query.
2 Read spot balance. L1Read precompile 0x800clearinghouseState query.
3 Read EVM idle balance. USDC.balanceOf(HyperStrategy) on HyperEVM.
4 Sum total. TVL_Hyper = vaultEquity + spotBalance + EVM_idle
5 Send via CCIP. ccipSend(ethChainSelector, abi.encode(totalAsset))
6 Receive on ETH. _ccipReceive() on KingsVault triggers PPS update.

CCIP Security Configuration

Allowlisting

Both sender and receiver contracts must be explicitly allowlisted:

Chain Function Parameter
ETH (Sender) allowlistDestinationChain 2442541497099098535 (HyperEVM), true
HEVM (Receiver) allowlistSourceChain 5009297550715157269 (Ethereum), true
HEVM (Receiver) allowlistSender ETH sender contract address, true

Message Validation

The _ccipReceive function is protected by the Router — only the CCIP Router contract may call it. Additional validation:

  • Verify sourceChainSelector matches expected origin chain.
  • Verify sender matches the authorized counterpart contract address.
  • Decode and validate message payload before executing logic.

CCTP V2 Hooks

CCTP V2 includes a hookData field in the message body. King's Vault uses this to pass custom instructions (e.g., PUSH_TO_CORE) alongside the USDC transfer. Key properties:

  • CCTP does not execute hook logic — it is opaque metadata.
  • The integrator (HyperStrategy) is responsible for decoding and executing hook data.
  • Developers control execution timing (before or after mint) and error handling.

Gas & Fee Considerations

Item Detail
CCIP fee payment LINK token (both chains)
CCIP Gas Limit 250,000 (sufficient for approve + deposit on receiver)
Core → EVM transfer ~200k gas (fixed)
EVM → Core transfer Standard ERC-20 transfer cost
CoreWriter base call ~47,000 gas (~25,000 burned for Core processing)

Failure Handling

Failure Mode Impact Mitigation
CCIP message stuck Funds locked in bridge Manual execution via CCIP Explorer; admin monitoring + Telegram alerts.
HLP withdrawal paused Cannot retrieve funds from HyperCore Pause requestRedeem on ETH side; notify users.
Circle attestation delay USDC minting delayed on destination CCIP handles retries; DON requests attestation.
Invalid CoreWriter data Action reverts, gas consumed Validate payload format before sendRawAction.