> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enso.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Berachain: Mint rUSD to enter Dolomite

> Round-trip crosschain minting strategy with USDCe bridging, rUSD minting, and Dolomite vault deposits for yield generation

export const date_0 = "2025-09-25"

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.

```mermaid theme={null}
flowchart LR
    subgraph berachain ["🐻 Berachain"]
        USDC_BERA((USDCe)) --> A1(( ))
    end
    
    A1 -.-> |balance<br/>check| USDC_ETH((USDC))
    
    subgraph ethereum ["🌐 Ethereum"]
        
        USDC_ETH((USDC)) -->|reservoir<br/>deposit| rUSD_ETH((rUSD))
    end

    rUSD_ETH -.-> |balance<br/>check|rUSD_BERA((rUSD))
    
    subgraph berachain ["🐻 Berachain"]
        rUSD_BERA((rUSD)) -->|dolomite<br/>deposit| dsrUSD((Dolomite LP))
    end
```

**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

<Note>
  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:

  ```js theme={null}
  {
    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.
</Note>

```typescript lines highlight={24, 30, 49-50, 57, 68-69, 80-81, 91-92, 111-112} theme={null}
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

## Related Documentation

* [Bridge Action Reference](/pages/build/reference/actions#bridge) - Technical details on crosschain bridging
* [Crosschain Bridging Guide](/pages/build/examples/bridging) - Getting started with multi-chain workflows
* [getLayerZeroPool SDK Method](https://github.com/EnsoBuild/sdk-ts?tab=readme-ov-file#bridging-pool-address) - Finding available bridge pools programmatically

<div className="text-right text-xs gray-200 font-semibold w-full" style={{marginTop: '0'}}>
  <p style={{
        color: "#b2b2b2"  
    }}>Updated {date_0}</p>
</div>
