route
and bundle
API operate in crosschain mode.
For custom bundles, use the bridge
action to facilitate cross-chain token transfers using Stargate.
For example: bridge assets to chains where protocols exist, execute operations such as minting, then optionally bridge results back to your origin chain and deposit them in a yield-bearing position.
Quick Start
- Crosschain Stablecoin Minting
- Crosschain Swap
Use the GET
layerzero/pool
API to find the correct pool address and use it as the primaryAddress
for stargate.bridge
operation.Always start the post-bridging callback
with balance
action.Core Concepts
Bridging
Crosschain routing uses Stargate and LayerZero for bridging assets.
The
bridge
action’s parameter primaryAddress
must reference an appropriate pool contract, exposed by the layerZero/pool
API.Native Drop
Parent bridge calls calculate gas fees required for all child bridge operations and include these costs in the initial transaction fee using LayerZero’s native drop feature.
Post-Bridge Execution
Callback arrays of Enso Actions execute on the destination chain after bridge completion. All actions within a bundle execute atomically.
When to use Route vs Bundle API?
Use Route API for: Limitations: Cannot handle custom post-bridge logic or multi-step protocols interactions Use Bundle API for:- crosschain position minting
- crosschain yield strategies
- Limitations: Single callback sequence with up to 10 chained actions
Use the GET
layerzero/pool
API to find the correct pool address and use it as the primaryAddress
for stargate.bridge
operation.Examples
1. Simple Cross-Chain Swap
Use Route API for basic cross-chain operations with automatic pathfinding.SDK
2. Crosschain Vault Zap
In this example, we’ll bridge ETH from Ethereum to zap it to a Ether.fiweETH
vault on Base.
Try this route →
3. Cross-Chain Position Minting
Crosschain routing enables you to mint positions on different chains and bridge them back, while signing only once. In this example, we’ll bridge USDC from Berachain to Ethereum, mint e-rUSD using Reservoir protocol, then bridge rUSD back to Berachain. About Reservoir: Reservoir is a stablecoin protocol that mints rUSD (a USD-pegged stablecoin) by accepting USDC as collateral on Ethereum mainnet.Use the GET
layerzero/pool
API or client.getLayerZeroPool()
from the SDK
to find the correct pool address and use it as the primaryAddress
for stargate.bridge
operation.-
Atomic Safety: All callback actions execute as a single atomic transaction on the destination chain. If any action fails, the entire callback transaction reverts and bridged tokens are sent to the
refundReceiver
address. Funds never get stuck in an intermediate state. - Gas Management: The initial transaction on the source chain calculates and pays for all destination chain gas costs using LayerZero’s native drop feature. You don’t need to hold native tokens on every destination chain.
- Output Chaining: Callbacks can reference outputs from previous callback actions using useOutputOfCallAt, enabling complex multi-step workflows that adapt to actual bridged amounts rather than fixed values.
mintOnBeraFromMainnet.ts
4. Crosschain Yield Strategy
Nested callbacks enable multi-hop workflows, allowing operations that span multiple chains where different protocols exist. In this example, we’ll do an Euler deposit of rUSD tokens minted on a Berachain by using Ethereum Mainnet assets. The user starts with USDC on Berachain and ends with yield-generating vault shares with a single signature.mintOnBeraDepositOnMainnet.ts
Reference
Bridge Action Parameters
The [bridge
action] has the follwing parameters:
Parameter | Description | Required |
---|---|---|
primaryAddress | LayerZero pool contract address for the source chain | Yes |
destinationChainId | Target blockchain network ID | Yes |
tokenIn | Token address to bridge from source chain | Yes |
amountIn | Amount to bridge (with full decimals) or reference to previous action output | Yes |
receiver | Address to receive bridged tokens on destination chain | Yes |
callback | Array of actions to execute on destination chain after bridging | No |
refundReceiver | Address to receive bridged tokens if callback execution fails on destination chain. If not specified, receiver gets refunds. | No |
Callback Requirements
Critical: All callback sequences must begin with a balance check action to verify the bridged token amount on the destination chain.
- First action must be the
balance
action:
- Reference previous outputs: Use the
ouseOutputOfCallAt
to chain actions together
- Nested callbacks: Bridge actions within callbacks enable multi-hop workflows
Supported Chains and Tokens
Use the GETlayerzero/pool
API to find the correct pool address and use it as the primaryAddress
for stargate.bridge
operation.
Updated