This workflow demonstrates complex multi-hop crosschain operations where origin chain assets bridge to the minting chain, create new tokens, then return for yield deployment. The pattern shows how to leverage centralized minting while maintaining yield positions on preferred chains. Route Mechanics: This bundle consists of 2 atomic crosschain transactions:
  • Bridge USDCe from Berachain to Ethereum using Stargate
  • Check USDC balance on Ethereum after successful bridge completion
  • Mint rUSD using the bridged USDC through Reservoir’s minting contract
  • Route rUSD for srUSD on Ethereum
  • Bridge the newly minted rUSD back to Berachain via a Stargate bridge
  • Check srUSD balance on Berachain post-bridging
  • Deposit rUSD into Dolomite sRUSD vault for yield
Instead of explicitly minting rUSD (deposit USDCe to Reservoir) and swapping for srUSD (route rUSD to srUSD), you can achieve this in a single action:
{
  protocol: "enso",
  action: "route",
  args: {
    tokenIn: USDC_ETHEREM,
    tokenOut: SRUSD_ETHEREUM,
    amountIn: { useOutputOfCallAt: 1 }, // Use the the USDCe balance
    receiver: WALLET_ADDRESS,
  },
},
Note: Enso routing endine may optimize via swapping from USDCe to srUSD.
const BERACHAIN_ID = 80094;
const ETHEREUM_ID = 1;

// Common addresses
const WALLET_ADDRESS = "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11"; // User wallet

// Token addresses
const USDCE_BERACHAIN = "0x549943e04f40284185054145c6E4e9568C1D3241";
const USDC_ETHEREUM = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const RUSD_ETHEREUM = "0x09D4214C03D01F49544C0448DBE3A27f768F2b34";
const SRUSD_ETHEREUM = "0x738d1115B90efa71AE468F1287fc864775e23a31";
const SRUSD_BERACHAIN = "0x5475611Dffb8ef4d697Ae39df9395513b6E947d7";

// Protocol addresses
const RESERVOIR_MINTING_CONTRACT =
  "0x4809010926aec940b550D34a46A52739f996D75D";
const DOLOMITE_SRUSD_BERACHAIN = "0xb9816a01B116d86c8D9A1A4ED4CC644177b8FD67"; // Dolomite vault for srUSD on Berachain (need actual address)

const client = new EnsoClient({
  apiKey: process.env.ENSO_API_KEY!,
});

// LayerZero pool addresses
const usdcBeraToEthPools = await client.getLayerZeroPool({
  chainId: BERACHAIN_ID,
  token: USDCE_BERACHAIN,
  destinationChainId: ETHEREUM_ID + "",
});

const rusdEthToBeraPools = await client.getLayerZeroPool({
  chainId: ETHEREUM_ID,
  token: SRUSD_ETHEREUM,
  destinationChainId: BERACHAIN_ID + "",
});

if (!(usdcBeraToEthPools.length && usdcBeraToEthPools.length)) {
  throw new Error("Required pools not available");
}

const bundle = await client.getBundleData(
  {
    chainId: BERACHAIN_ID,
    fromAddress: WALLET_ADDRESS,
    spender: WALLET_ADDRESS,
    routingStrategy: "router",
  },
  [
    {
      protocol: "stargate",
      action: "bridge",
      args: {
        primaryAddress: usdcBeraToEthPools[0].pool,
        destinationChainId: ETHEREUM_ID,
        tokenIn: USDCE_BERACHAIN,
        amountIn: parseUnits("1000", 6).toString(), // 1000 USDCe
        receiver: WALLET_ADDRESS,
        callback: [
          // Step 1: Check USDCe balance on Ethereum after bridge
          {
            protocol: "enso",
            action: "balance",
            args: {
              token: USDC_ETHEREUM,
            },
          },
          // Step 2: Mint rUSD using bridged USDCe on Ethereum
          {
            protocol: "reservoir",
            action: "deposit",
            args: {
              primaryAddress: RESERVOIR_MINTING_CONTRACT,
              tokenIn: USDC_ETHEREUM,
              tokenOut: RUSD_ETHEREUM,
              amountIn: { useOutputOfCallAt: 0 }, // Use USDCe from balance check
              receiver: WALLET_ADDRESS,
            },
          },
          // Step 3: swap/route rUSD to srUSD
          {
            protocol: "enso",
            action: "route",
            args: {
              tokenIn: RUSD_ETHEREUM,
              tokenOut: SRUSD_ETHEREUM,
              amountIn: { useOutputOfCallAt: 1 }, // Use the minted RUSD
              receiver: WALLET_ADDRESS,
            },
          },
          // Step 4: Bridge newly minted rUSD back to Berachain
          {
            protocol: "stargate",
            action: "bridge",
            args: {
              primaryAddress: rusdEthToBeraPools[0].pool,
              destinationChainId: BERACHAIN_ID,
              tokenIn: SRUSD_ETHEREUM,
              amountIn: { useOutputOfCallAt: 2 }, // Use srUSD from minting
              receiver: WALLET_ADDRESS,
              // Callback executes on Berachain after srUSD arrives
              callback: [
                // Step 1: Check srUSD balance on Berachain
                {
                  protocol: "enso",
                  action: "balance",
                  args: {
                    token: SRUSD_BERACHAIN,
                  },
                },
                // Step 2: Deposit srUSD into Dolomite vault on Berachain
                {
                  protocol: "dolomite-erc4626",
                  action: "deposit",
                  args: {
                    primaryAddress: DOLOMITE_SRUSD_BERACHAIN,
                    tokenIn: SRUSD_BERACHAIN,
                    tokenOut: DOLOMITE_SRUSD_BERACHAIN, // ERC4626 vault token
                    amountIn: { useOutputOfCallAt: 0 }, // Use srUSD from balance check
                    // amountIn: "10000000000000000000",
                    receiver: WALLET_ADDRESS,
                  },
                },
              ],
            },
          },
        ],
      },
    },
  ]
);
Important Considerations
  • All crosschain operations execute atomically - if any step fails, the entire transaction reverts and funds are safely returned
  • Gas costs for all destination chains are calculated and paid upfront using LayerZero’s native drop feature
  • Bridge fees and slippage may cause slight variations in final amounts received

Updated