Skip to content

zero-vix/usdt0-solana-multihop-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

USDT0 Multihop Bridge: Solana → Arbitrum → Plasma

Bridge USDT0 from Solana to Plasma in a single transaction using LayerZero multihop compose. The transfer routes through Arbitrum as the hub chain.

Solana --[LayerZero]--> Arbitrum (MultiHopComposer) --[LayerZero]--> Plasma

Quick Start

# Install dependencies
pnpm install

# Configure your settings in index.ts (recipient, amount, private key)
# Or set SOLANA_PRIVATE_KEY in a .env file

# Run
pnpm start

Configuration

Edit USER_CONFIG in index.ts:

Setting Description
privateKey Solana private key (base58 or JSON array). Can use SOLANA_PRIVATE_KEY env var
recipient EVM destination address on Plasma (0x...)
amount USDT amount to bridge (e.g., 1.5 = $1.50)
dstEid LayerZero endpoint ID for final destination (default: 30383 for Plasma)

Requirements

  • USDT0 tokens in your Solana wallet
  • ~0.01 SOL for LayerZero fees (covers both hops) + transaction costs

How It Works

  1. Quote hop fee - Calls quoteSend on the Arbitrum OFT contract to get the fee for the second hop (Arbitrum → Plasma)
  2. Build compose message - ABI-encodes the hop chain SendParams (destination, recipient, amount, options) as the compose message
  3. Build executor options - Creates TYPE_3 options with addExecutorComposeOption that includes enough gas and native ETH to pay for the second hop on Arbitrum
  4. Quote Solana fee - Simulates the full transaction on Solana to get the total LayerZero fee (with 3x safety margin to cover both hops)
  5. Send - Executes the Solana transaction, which sends to the MultiHopComposer contract on Arbitrum
  6. Auto-forward - The MultiHopComposer on Arbitrum receives the compose callback, decodes the SendParams, and automatically sends the tokens to Plasma

Key Addresses

Contract Address
Arbitrum OFT Proxy 0x14e4a1b13bf7f943c8ff7c51fb60fa964a298d92
Arbitrum MultiHopComposer 0x759BA420bF1ded1765F18C2DC3Fc57A1964A2Ad1
Solana OFT Program Fuww9mfc8ntAwxPUzFia7VJFAdvLppyZwhPJoXySZXf7

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors