feat(rebalancer): implement LayerZeroBridge IExternalBridge#8347
Draft
Mo-Hussain wants to merge 25 commits intomainfrom
Draft
feat(rebalancer): implement LayerZeroBridge IExternalBridge#8347Mo-Hussain wants to merge 25 commits intomainfrom
Mo-Hussain wants to merge 25 commits intomainfrom
Conversation
5265e00 to
db5c926
Compare
Contributor
🦀 Rust Agent Docker Image Built Successfully
Full image paths |
9508152 to
c9dec3f
Compare
db5c926 to
49851e3
Compare
Mo-Hussain
commented
Apr 1, 2026
| // Contract Addresses | ||
| // ============================================================================ | ||
|
|
||
| export const OFT_CONTRACTS: Record<number, Record<number, string>> = { |
Collaborator
Author
There was a problem hiding this comment.
Are there layerzero packages that we can import to provide these addresses?
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
85e1b98 to
6d65b8a
Compare
c9dec3f to
8681013
Compare
43468ab to
88a1117
Compare
5aa780b to
bef9066
Compare
66c84e8 to
526d128
Compare
…d detectNetwork failure
…] not messages[])
Tron is not supported for rebalancing. Removed all Tron-specific code: TronWebLike type, toTronHexAddress/toEvmAddress helpers, Tron branches in quote()/execute(), waitForTronTx(), isTronChain(), normalizeTronAddress(), Tron entries from chain/contract mappings, Tron tests, and tronweb dependency.
Replaced custom addressToBytes32 in layerZeroUtils with delegation to @hyperlane-xyz/utils addressToBytes32. Removed custom toBigInt() helper in favor of BigInt(value.toString()) which handles ethers BigNumber.
Replaced hardcoded route pairs with a lookup against OFT_CONTRACTS, eliminating duplication between the route table and the validation check.
…mEID These were not referenced outside layerZeroUtils.ts.
Tests and mocks used 7758 for Plasma but OFT_CONTRACTS uses 9745 (the Hyperlane domain ID). Fixed to match the route configuration.
The USDT0 OFT program on Solana uses a custom OFTStore layout where tokenMint starts at byte 8 (immediately after the discriminator), unlike the standard SDK layout which expects oftType + ld2sdRate first. This caused the SDK's fetchOFTStore() to fail with EnumDiscriminatorOutOfRangeError. Replace the SDK deserializer with a raw account data read that extracts tokenEscrow directly from its known offset (byte 40).
The LZ SDK's SendHelper.getQuoteAccounts/getSendAccounts fails when passed web3.js PublicKey objects due to module instance mismatch with the instanceof check. Convert to UMI public key strings before passing.
526d128 to
ebc33dc
Compare
Contributor
Node Services Docker Image Built Successfully
Full image paths |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LayerZeroBridgeas a newIExternalBridgethat calls LayerZero OFT/Legacy Mesh contracts directly to bridge USDT between Ethereum (EID 30101), Arbitrum (EID 30110), Plasma (EID 30383), and Tron (EID 30420)ExternalBridgeType.LayerZeroinRebalancerContextFactoryDetails
New files:
LayerZeroBridge.ts(535 lines) —quote(),execute(),getStatus()implementingIExternalBridgelayerZeroUtils.ts(270 lines) — route config, ABI fragments, EID/chain mappings, helper functionsLayerZeroBridge.test.ts(525 lines) — 17 tests covering quote, execute, getStatus, error pathslayerZeroMocks.ts(189 lines) — test mocks for providers and TronWebModified files:
config/types.ts— addedExternalBridgeType.LayerZero = 'layerzero'andLayerZeroExternalBridgeConfigRebalancerContextFactory.ts— wiredLayerZeroBridgeintobuildExternalBridgeRegistry()package.json— addedtronweb: "catalog:"dependencyDesign decisions:
import('tronweb')(no top-level import)IExternalBridgeinterface orLiFiBridge.ts