hedera-dev/hedera-skills

layerzero-messaging

LayerZero V2 messaging on Hedera.

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/hedera-dev/hedera-skills --skill layerzero-messaging

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

LayerZero Messaging (Hedera)

OFT pattern: deploy paired Omnichain Fungible Tokens — a standard OFT on the EVM side and an HTS connector OFT on Hedera — then setPeer both ways and send with LayerZero V2 fees.

text
OFT (EVM)  ←setPeer→  HTSConnectorOFT (Hedera)
  │ send / quoteSend          │ _debit burn / _credit mint (HTS 0x167)
  └──────── Endpoint V2 + ULN + DVN + Executor ────────┘

This skill focuses on LayerZero V2 OApp/OFT + Hedera HTS. Educational templates may use simple workers and a manual/UI lzReceive relay — not the same as production LayerZero Labs verification.

Quick Reference

ConceptRule
EndpointILayerZeroEndpointV2 per chain
PeersetPeer(remoteEid, bytes32(uint256(uint160(remoteOApp)))) on both sides
SendquoteSend(SendParam, payInLzToken) → send{value: nativeFee}(SendParam, fee, refund)
Receiverto in SendParam is bytes32 (padded address)
Hedera OFTHTS-backed connector — create HTS token, burn on send, mint on receive
HTS feeDeploy connector with native value to pay createFungibleToken
ApprovalUser must approve(connector, amount) on the HTS token before Hedera → EVM send
IDsUse LayerZero EIDs in peers/dstEid — not EVM chain IDs

See references/hedera-endpoints.md for where to source Endpoint/ULN/DVN addresses. See references/examples.md for wire and send sketches.

Critical: Wire Both Directions

Incomplete peer config bricks the pathway. For each local OApp:

  1. setPeer(remoteEid, remoteOAppAsBytes32)
  2. setSendLibrary / setReceiveLibrary (ULN302)
  3. setConfig — ExecutorConfig (type 1) on send lib; UlnConfig (type 2) on send + receive libs
  4. setEnforcedOptions — e.g. lzReceive gas for msgType 1 (token send)

Verify with peers(remoteEid) on both chains before sending.

Critical: Hedera HTS Connector Semantics

On Hedera, do not use a plain ERC-20 OFT as the primary path. Use an HTS-backed connector:

  • Constructor creates fungible HTS via precompile 0x167 (supply key = connector)
  • _debit: transfer HTS in → burn
  • _credit: mint → transfer HTS out
  • Amounts must fit int64 for HTS mint/burn/transfer
  • Associate the receiver account with the HTS token before EVM → Hedera receives
solidity
// Deploy with value so createFungibleToken fee is paid
new HTSConnectorOFT{ value: htsCreateValue }(name, symbol, lzEndpoint, owner);

Send Flow

solidity
SendParam memory sendParam = SendParam({
    dstEid: remoteEid,
    to: bytes32(uint256(uint160(receiver))),
    amountLD: amountLD,
    minAmountLD: (amountLD * 9) / 10,
    extraOptions: OptionsBuilder.newOptions().addExecutorLzReceiveOption(lzReceiveGas, 0),
    composeMsg: "",
    oftCmd: ""
});

MessagingFee memory fee = IOFT(localOFT).quoteSend(sendParam, false);
IOFT(localOFT).send{ value: fee.nativeFee }(sendParam, fee, payable(refundTo));

Hedera → EVM note: forge fee simulation can disagree with Hedera JSON-RPC wei/tinybar scaling — often quote via cast + scaled native fee for that direction.

Deploy Checklist (generic)

  1. Deploy EVM OFT (optional premint)
  2. Deploy Hedera HTS connector OFT with HTS create value
  3. Deploy workers (Labs DVN/executor or educational simple workers)
  4. Wire both OApps (setPeer + libraries + config + enforced options)
  5. Associate Hedera account with htsTokenAddress()
  6. Sync frontend config if applicable; fund relay key if using UI auto-relay
  7. Send small amount; track on LayerZero Scan (testnet/mainnet as appropriate)

Educational Relay

Some templates use simple DVN/executor mocks and an explicit lzReceive relay step. Treat that as a learning aid — production apps rely on LayerZero’s verification network, not a custom relayer key in the app server.

Checklist

  • [ ] Peers set both ways with correct EIDs (not EVM chain IDs)
  • [ ] Send/receive libraries + ULN/executor config applied
  • [ ] Hedera side is HTS connector; create fee paid; supply key is connector
  • [ ] Receiver associated with HTS token before inbound transfers
  • [ ] quoteSend native fee attached to send
  • [ ] Receiver address encoded as bytes32
  • [ ] Educational disclaimer: not audited / not for mainnet funds

References

관련 작업

같은 저장소의 Skills

더 많은 Skills

모든 Skills
hedera-dev
커뮤니티

agent-kit-plugin

This skill should be used when the user asks to "create a hedera plugin", "build a hedera agent kit plugin", "extend hedera agent kit", "create custom hedera tools", "add hedera functionality", "write a hedera tool", "implement hedera tool", or needs guidance on Hedera Agent Kit plugin architecture, tool definitions, mutation tools, query tools, or parameter schemas using Zod.

1시간 설치 수
3
GitHub Stars
28
업데이트
9월 3일
hedera-dev
커뮤니티

axelar-gmp

Axelar General Message Passing (GMP) on Hedera. Use when sending or receiving cross-chain contract calls via Axelar Gateway (callContract, payNativeGasForContractCall), building AxelarExecutable receivers, wiring Hedera↔EVM destinations, or separating bridge transport from destination handlers (orchestrated / scheduled flows).

1시간 설치 수
3
GitHub Stars
28
업데이트
9월 3일
hedera-dev
커뮤니티

ccip

Chainlink CCIP Cross-Chain Tokens on Hedera. Use when bridging burn-and-mint CCT between Hedera and EVM, registering TokenAdminRegistry / pools, calling ccipSend with chain selectors, or wiring HTS-backed wrappers (HtsBurnMintERC20) vs vanilla BurnMintERC20. Not for Chainlink Data Feeds / price oracles.

1시간 설치 수
3
GitHub Stars
28
업데이트
9월 3일
hedera-dev
커뮤니티

chainlink-data-feeds

Chainlink Data Feeds on Hedera. Use when reading AggregatorV3 price feeds on Hedera (testnet 296 / mainnet 295), calling latestRoundData, checking round completeness and staleness, or normalizing feed decimals. Not for Chainlink CCIP (cross-chain tokens).

1시간 설치 수
3
GitHub Stars
28
업데이트
9월 3일