From acd77ed820d3693d5cd4b5e98821f19796459f5e Mon Sep 17 00:00:00 2001 From: Centaur AI Date: Wed, 13 May 2026 04:41:57 +0000 Subject: [PATCH 1/2] docs: add LZD wrapping steps for bridging out of Tempo via Stargate Tempo has no native gas token, so LayerZero messaging fees must be paid via LZEndpointDollar using a wrapped TIP-20 stablecoin (LZD). Before calling sendToken to bridge out, users need to: 1. Approve USDC.e to the LZD wrapper contract 2. Wrap USDC.e into LZD 3. Approve LZD to the Stargate pool Added these steps to both the cast and TypeScript examples in the 'Bridge from Tempo via Stargate' section, with a brief explanation of why the wrapping is necessary. Amp-Thread-ID: https://ampcode.com/threads/T-019e1f72-8b2f-72ee-825f-65ca36fc42d5 --- src/pages/guide/bridge-layerzero.mdx | 88 +++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 3 deletions(-) diff --git a/src/pages/guide/bridge-layerzero.mdx b/src/pages/guide/bridge-layerzero.mdx index f1722d84..836caa37 100644 --- a/src/pages/guide/bridge-layerzero.mdx +++ b/src/pages/guide/bridge-layerzero.mdx @@ -260,7 +260,9 @@ await walletClient.writeContract({ ### Bridge from Tempo via Stargate -To bridge from Tempo back to another chain, call `sendToken` on the Stargate OFT contract on Tempo. The process is the same - quote, approve, send - but the source contract and destination EID are swapped. +To bridge from Tempo back to another chain, call `sendToken` on the Stargate OFT contract on Tempo. The process is similar to bridging in - quote, approve, send - but includes additional steps to prepare the messaging fee. + +Because Tempo has no native gas token, LayerZero messaging fees are paid in a TIP-20 stablecoin via [LZEndpointDollar](#endpointdollar). Before sending a bridge transaction, you must wrap your USDC.e into an LZD (LayerZero Dollar) token that the endpoint can consume as a fee. This involves approving USDC.e to the LZD wrapper contract, wrapping it, and then approving the resulting LZD to the Stargate pool. #### Using cast (Foundry) @@ -280,6 +282,46 @@ cast call 0x8c76e2F6C5ceDA9AA7772e7efF30280226c44392 \ Take the first returned number as `` (in stablecoin units, not ETH). +### Approve USDC.e to the LZD wrapper + +Approve the `LZEndpointDollar` wrapper contract to spend `` of your USDC.e. This is the amount needed to cover the LayerZero messaging fee. + +```bash +cast send 0x20C000000000000000000000b9537d11c60E8b50 \ + "approve(address,uint256)" \ + 0x0cEb237E109eE22374a567c6b09F373C73FA4cBb \ + \ + --rpc-url https://rpc.tempo.xyz \ + --private-key $PRIVATE_KEY +``` + +### Wrap USDC.e into LZD + +Wrap your USDC.e into the LZD token so it can be used as a messaging fee by the LayerZero endpoint. + +```bash +cast send 0x0cEb237E109eE22374a567c6b09F373C73FA4cBb \ + "wrap(address,address,uint256)" \ + 0x20C000000000000000000000b9537d11c60E8b50 \ + \ + \ + --rpc-url https://rpc.tempo.xyz \ + --private-key $PRIVATE_KEY +``` + +### Approve LZD to Stargate + +Approve the Stargate OFT contract to spend your LZD so it can pay the messaging fee when sending. + +```bash +cast send 0x0cEb237E109eE22374a567c6b09F373C73FA4cBb \ + "approve(address,uint256)" \ + 0x8c76e2F6C5ceDA9AA7772e7efF30280226c44392 \ + \ + --rpc-url https://rpc.tempo.xyz \ + --private-key $PRIVATE_KEY +``` + ### Approve token on Tempo ```bash @@ -332,6 +374,8 @@ const walletClient = createWalletClient({ const stargateOFT = '0x8c76e2F6C5ceDA9AA7772e7efF30280226c44392' as const // USDC.e on Tempo const usdce = '0x20C000000000000000000000b9537d11c60E8b50' as const +// LZEndpointDollar wrapper +const lzd = '0x0cEb237E109eE22374a567c6b09F373C73FA4cBb' as const const amount = parseUnits('1', 6) // 1 USDC.e const minAmount = parseUnits('0.99', 6) // 1% slippage tolerance @@ -346,6 +390,20 @@ const sendParam = { oftCmd: '0x' as const, // taxi mode (immediate) } +const wrapAbi = [ + { + name: 'wrap', + type: 'function', + stateMutability: 'nonpayable', + inputs: [ + { name: 'token', type: 'address' }, + { name: 'to', type: 'address' }, + { name: 'amount', type: 'uint256' }, + ], + outputs: [], + }, +] as const + // 1. Quote the fee const publicClient = createPublicClient({ chain: tempo, transport: http() }) @@ -356,7 +414,31 @@ const msgFee = await publicClient.readContract({ args: [sendParam, false], }) -// 2. Approve token +// 2. Approve USDC.e to LZD wrapper (for the messaging fee) +await walletClient.writeContract({ + address: usdce, + abi: erc20Abi, + functionName: 'approve', + args: [lzd, msgFee.nativeFee], +}) + +// 3. Wrap USDC.e into LZD +await walletClient.writeContract({ + address: lzd, + abi: wrapAbi, + functionName: 'wrap', + args: [usdce, account.address, msgFee.nativeFee], +}) + +// 4. Approve LZD to Stargate (for the messaging fee) +await walletClient.writeContract({ + address: lzd, + abi: erc20Abi, + functionName: 'approve', + args: [stargateOFT, msgFee.nativeFee], +}) + +// 5. Approve USDC.e to Stargate (for the bridge amount) await walletClient.writeContract({ address: usdce, abi: erc20Abi, @@ -364,7 +446,7 @@ await walletClient.writeContract({ args: [stargateOFT, amount], }) -// 3. Send the bridge transaction (no value - fee handled via EndpointDollar) +// 6. Send the bridge transaction (no value - fee handled via EndpointDollar) await walletClient.writeContract({ address: stargateOFT, abi: stargateAbi, From b1b7cc48aa303eaacb4b065e38e5f155696e6370 Mon Sep 17 00:00:00 2001 From: Uddhav <255779543+letstokenize@users.noreply.github.com> Date: Tue, 12 May 2026 22:03:58 -0700 Subject: [PATCH 2/2] docs: promote Bridge to/from Tempo headers and drop 'via Stargate' Co-Authored-By: Uddhav <255779543+letstokenize@users.noreply.github.com> --- src/pages/guide/bridge-layerzero.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/guide/bridge-layerzero.mdx b/src/pages/guide/bridge-layerzero.mdx index 836caa37..0432874c 100644 --- a/src/pages/guide/bridge-layerzero.mdx +++ b/src/pages/guide/bridge-layerzero.mdx @@ -61,7 +61,7 @@ Tempo's LayerZero Endpoint ID is **`30410`**. | Polygon | `30109` | [`0x9Aa02D4Fae7F58b8E8f34c66E756cC734DAc7fe4`](https://polygonscan.com/address/0x9Aa02D4Fae7F58b8E8f34c66E756cC734DAc7fe4) | | Avalanche | `30106` | [`0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47`](https://snowtrace.io/address/0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47) | -### Bridge to Tempo via Stargate +## Bridge to Tempo #### Using the Stargate app @@ -258,7 +258,7 @@ await walletClient.writeContract({ }) ``` -### Bridge from Tempo via Stargate +## Bridge from Tempo To bridge from Tempo back to another chain, call `sendToken` on the Stargate OFT contract on Tempo. The process is similar to bridging in - quote, approve, send - but includes additional steps to prepare the messaging fee.