Skip to content

Instantly share code, notes, and snippets.

import { Options } from "@layerzerolabs/lz-v2-utilities";
import { ethers, parseUnits, zeroPadValue } from "ethers";
import { TronWeb } from "tronweb";
import {
MessagingFee,
OFT_ABI,
SendParam
} from "./abis";
import {
@sedhu-orbitx
sedhu-orbitx / evm.ts
Created October 10, 2025 05:37
evm usdt0 poc
import { Options } from "@layerzerolabs/lz-v2-utilities";
import { ethers, MaxUint256, parseEther, parseUnits, zeroPadValue } from "ethers";
import { LAYERZERO_EIDS, USDT0_CONTRACTS } from "./constants";
const MAX_UINT256 = MaxUint256;
// Helper function to calculate minimum amount with slippage
function calculateMinAmount(amountLD: bigint, slippageBps: number): bigint {
/**
* USDT0 Contract Addresses and Configuration
* Based on official USDT0 documentation: https://docs.usdt0.to/technical-documentation/developer
*/
// LayerZero Endpoint IDs (EID)
export const LAYERZERO_EIDS = {
ETHEREUM: 30101,
ARBITRUM: 30110,
POLYGON: 30109,
/**
* Composed MultiHop Transfer Implementation following tron-exmaple.ts pattern
* Handles single-transaction multi-hop transfers: Tron → Arbitrum → Polygon
* Uses composed message pattern for seamless multi-hop transfers
* Uses TronWeb for Tron operations and ethers.js for EVM chains
*
* Based on LayerZero UI Bridge SDK pattern and USDT0 documentation
*/