Skip to main content
This sample demonstrates minting wsrUSD on Ethereum and routing to target chain lending markets through automated bridging and position creation workflows. The approach shows direct integration between centralized token issuance and distributed DeFi protocols. **Route Mechanics: **This bundle facilitates stablecoin diversification across chains through a the following process:
  • Convert USDC to wsrUSD_ETH on Ethereum using Enso’s routing
  • Bridge the newly minted rUSD from Ethereum to Katana chain via Stargate
  • Check wsrUSD balance on Katana after bridge completion
  • Deposit wsrUSD to wsrUSD/vbUSD Morpho position
The strategy enables users to access Katana’s DeFi ecosystem while starting with familiar USDC on Ethereum and relying on Reservoir Stablecoin.
const KATANA_ID = 747474;
const ETHEREUM_ID = 1;

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

// Token addresses
const MORPHO = "0xD50F2DffFd62f94Ee4AEd9ca05C61d0753268aBc";
const USDC_ETHEREUM = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const wsrUSD_KATANA = "0x4809010926aec940b550D34a46A52739f996D75D";
const wsrUSD_ETHEREUM = "0xd3fd63209fa2d55b07a0f6db36c2f43900be3094";

const wsrUSD_MORPHO_POSITION_ID =
  "0xd8a93a4cd16f843c385391e208a9a9f2fd75aedfcca05e4810e5fbfcaa6baec6";

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

// LayerZero pool addresses
const wsrEthToKatanaPools = await client.getLayerZeroPool({
  chainId: ETHEREUM_ID,
  token: wsrUSD_ETHEREUM,
  destinationChainId: KATANA_ID,
  destinationToken: wsrUSD_KATANA,
});

console.log(JSON.stringify(wsrEthToKatanaPools), !wsrEthToKatanaPools.length);

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

const bundle = await client.getBundleData(
  {
    chainId: ETHEREUM_ID,
    fromAddress: WALLET_ADDRESS,
    spender: WALLET_ADDRESS,
    routingStrategy: "router",
  },
  [
    // mint wsrUSD on Ethereum
    {
      protocol: "enso",
      action: "route",
      args: {
        amountIn: parseUnits("1000", 6).toString(), // 1000 USDC
        tokenIn: USDC_ETHEREUM,
        receiver: WALLET_ADDRESS,
        tokenOut: wsrUSD_ETHEREUM,
      },
    },
    {
      protocol: "stargate",
      action: "bridge",
      args: {
        primaryAddress: wsrEthToKatanaPools[0].pool as Address,
        destinationChainId: KATANA_ID,
        tokenIn: wsrUSD_ETHEREUM,
        amountIn: { useOutputOfCallAt: 0 },
        receiver: WALLET_ADDRESS,
        callback: [
          // Step 1: Check wsrUSD balance on Katana after bridge  
          {
            protocol: "enso",
            action: "balance",
            args: {
              token: wsrUSD_KATANA,
            },
          },
          {
            protocol: "morpho-markets-v1",
            action: "deposit",
            args: {
              amountIn: { useOutputOfCallAt: 0 },
              tokenIn: wsrUSD_KATANA,
              receiver: WALLET_ADDRESS,
              primaryAddress: MORPHO,
              positionId: wsrUSD_MORPHO_POSITION_ID,
            },
          },
        ],
      },
    },
  ]
);
Important Considerations
  • Bridge operations execute sequentially - Katana operations only proceed after successful Ethereum minting
  • LayerZero bridge fees apply for transfers between Ethereum and Katana
  • Gas costs for both chains are paid from the originating Ethereum transaction

Resources:

Updated