nd you receive `spUSDC` in return, which represents your share in the lending pool.
```mermaid theme={null}
flowchart LR
USDC((USDC)) -->|spark-lend<br/>deposit| spUSDC((spUSDC))
```
```javascript lines theme={null}
const USDC = "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83";
const spUSDC = "0x5850d127a04ed0b4f1fcdfb051b3409fb9fe6b90";
const routeParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: 100, // Gnosis
amountIn: ["100000000"], // 100 USDC
tokenIn: [USDC],
tokenOut: [spUSDC],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
// approval TX
const approvalData = await client.getApprovalData({
chainId: 100,
fromAddress: userAddress,
amount: "100000000",
tokenAddress: USDC,
});
await sendEoa(approvalData.tx, approvalData.gas);
// Sending the actual transaction
await sendEoa(route.tx, route.gas);
```
***
# DEX Market Making
Source: https://docs.enso.build/pages/use-cases/market-makers/dex-market-making
Automate DEX market making, responding to market conditions programmatically to improve capital efficiency.
## Zap BERA into a Kodiak WBERA/HONEY position
This use case automates splitting BERA, swapping for HONEY, and depositing into a concentrated liquidity range on Kodiak.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x9659dc8c1565E0bd82627267e3b4eEd1a377ebE6)
**Route Mechanics:**
* Split native BERA into two portions using enso internal routing:
* First portion: deposit BERA into wrapped native to get WBERA
* Second portion: swap BERA to HONEY using openocean protocol
* Deposit both WBERA and HONEY into Kodiak Islands to create the LP position
```mermaid theme={null}
flowchart LR
BERA((BERA)) --> SPLIT{enso.split}
SPLIT -->|wrapped-native<br/>deposit| WBERA((WBERA))
SPLIT -->|openocean<br/>swap| STGUSDC((STGUSDC))
WBERA -->|kodiak-islands<br/>deposit| KODIAK_LP((KODIAK_LP))
STGUSDC -->|kodiak-islands<br/>deposit| KODIAK_LP
```
```ts theme={null}
export async function marketMakeBeraToKodiakLp(): {
const BERA: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const Kodiak_LP: Address = "0x9659dc8c1565E0bd82627267e3b4eEd1a377ebE6";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_CHAIN,
amountIn: ["1000000000000000000"], // 1 BERA
tokenIn: [BERA],
tokenOut: [Kodiak_LP],
routingStrategy: 'router'
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
# Overview
Source: https://docs.enso.build/pages/use-cases/market-makers/index
<div>
<Card href="/pages/use-cases/market-makers/dex-market-making" title="Dex Market Making">
Automate DEX market making, responding to market conditions programmatically to improve capital efficiency
</Card>
<Card href="/pages/use-cases/market-makers/pool-rebalancing" title="Liquidity Pool Rebalancing ">
Dynamically shift capital from one protocol to another to optimize yield
</Card>
</div>
# Liquidity Pool Rebalancing
Source: https://docs.enso.build/pages/use-cases/market-makers/pool-rebalancing
Dynamically shift capital from one protocol to another to optimize yield
## Rebalance from a Yearn vault to a Morpho Blue vault on Katana
This use case dynamically shifts capital from a Yearn vault to a Morpho Blue vault to optimize yield.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x80c34bd3a3569e126e7055831036aa7b212cb159\&tokenOut=0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d)
**Route Mechanics:**
* Redeem the Yearn v3 vault position to get FIXME (0x203a662b0bd271a6ed5a60edfbd04bfce608fd36)
* Redeem the intermediate token using vault bridge protocol to get FIXME (0xfd415d011ffaa8e6f17fa753cdb080d1de266784)
* Deposit the underlying asset back using vault bridge protocol to get FIXME (0x203a662b0bd271a6ed5a60edfbd04bfce608fd36)
* Deposit the prepared asset into Morpho Blue vault to receive the target vault token
```ts theme={null}
export async function rebalanceYearnToMorphoKatana(): Promise<{ route: any; tx: any }> {
const yvvbUSDC: Address = "0x80c34bd3a3569e126e7055831036aa7b212cb159";
const steakUSDC: Address = "0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_CHAIN,
amountIn: ["100000000"], // 100 yvvbUSDC
tokenIn: [yvvbUSDC],
tokenOut: [steakUSDC],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
# Overview
Source: https://docs.enso.build/pages/use-cases/nontokenized-deposits/index
<div>
<Card href="/pages/use-cases/nontokenized-deposits/orderly-vault-deposit" title="Orderly Vault Deposit">
Deposit directly into Orderly vaults with nontokenized positions router from
any token
</Card>
</div>
# Deposit into Orderly Vault
Source: https://docs.enso.build/pages/use-cases/nontokenized-deposits/orderly-vault-deposit
Deposit into Orderly vaults with nontokenized position router
## Discovering Orderly Vaults
You can use `/nontokenized` endpoint to discover all the available Orderly vaults:
```bash theme={null}
# Get all Orderly vaults
curl -X GET \
"https://api.enso.build/api/v1/nontokenized?protocolSlug=orderly" \
-H "Authorization: Bearer $ENSO_API_KEY" | jq
```
This returns a list of available Orderly vaults with their position IDs and details.
### Example response
For example, this is Orderly OmniVault position from `/nontokenized`
```json theme={null}
{
"chainId": 10,
"address": "0x70Fe7d65Ac7c1a1732f64d2E6fC0E33622D0C991",
"primaryAddress": "0x70Fe7d65Ac7c1a1732f64d2E6fC0E33622D0C991",
"name": "Orderly OmniVault",
"logosUri": [
"https://icons.llamao.fi/icons/protocols/orderly"
],
"positionId": "0xa3426a1cef4052c056fced18099be899d93f1427d13b9a1df1806b91fad3d0c2",
"protocol": "orderly",
"underlyingTokens": [
{
"chainId": 10,
"address": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
"type": "base",
"decimals": 6,
"name": "USDC",
"symbol": "USDC",
"logosUri": [
"https://assets.coingecko.com/coins/images/6319/thumb/usdc.png?1696506694"
]
}
]
},
```
## Route Example
Here's how to deposit into Orderly OmniVault (positionId `0xa3426a1cef4052c056fced18099be899d93f1427d13b9a1df1806b91fad3d0c2`).
**Route Mechanics:**
* Swap ETH to USDC if needed (Orderly OmniVault requires USDC deposits)
* Execute the deposit transaction to add USDC to the Orderly Omnivault
* Receive a nontokenized position in Orderly
<Note>
Fee in ETH is required for Orderly vault deposits. The fee will be added to
the native token of the chain and included in the `tx.value`.
</Note>
### Request Parameters
| Parameter | Description | Example |
| - | - | - |
| `chainId` | Chain ID of the network to execute on | `10` (Optimism) |
| `fromAddress` | The address making the request | `0xd8da6bf26964af9d7eed9e03e53415d37aa96045` |
| `routingStrategy` | Routing strategy to use | `router` |
| `tokenIn` | Address of token to swap from | `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` (ETH) |
| `positionOut` | Position ID of the target vault | `0xa3426a1cef4052c056fced18099be899d93f1427d13b9a1df1806b91fad3d0c2` |
| `amountIn` | Amount of tokenIn to deposit (in wei) | `1000000000000000000` (1 ETH) |
| `receiver` | Address to receive the vault position | `0xd8da6bf26964af9d7eed9e03e53415d37aa96045` |
```bash theme={null}
curl -X GET \
'https://api.enso.build/api/v1/shortcuts/route/nontokenized?chainId=10&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=router&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&positionOut=0xa3426a1cef4052c056fced18099be899d93f1427d13b9a1df1806b91fad3d0c2&amountIn=1000000000000000000&receiver=0xd8da6bf26964af9d7eed9e03e53415d37aa96045' \
-H "Authorization: Bearer $ENSO_API_KEY" | jq
```
### Route Response Example
The API returns a response with the following structure:
```json theme={null}
{
"amountDeposited": "3056348596",
"priceImpact": 10,
"gas": "3781112",
"createdAt": 145404112,
"route": [
{
"action": "swap",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0x0b2c639c533813f4aa9d7837caf62653d097ff85"],
"chainId": 10
},
{
"action": "deposit",
"protocol": "orderly",
"tokenIn": ["0x0b2c639c533813f4aa9d7837caf62653d097ff85"],
"chainId": 10
}
],
"tx": {
"data": "0x...",
"to": "0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf",
"from": "0x...",
"value": "1000003656373812635"
}
}
```
The route consists of two main actions:
1. **Swap**: Convert ETH to the required token for the vault (if needed)
2. **Deposit**: Deposit the converted token into the Orderly vault
## Key Points
* Use the `/shortcuts/route/nontokenized` endpoint for nontokenized position routing
* The `positionOut` parameter uses the vault's position ID
* Fees are charged in the chain's native token
* The response includes transaction data ready to be executed on-chain
# Berachain: Mint rUSD to enter Dolomite
Source: https://docs.enso.build/pages/use-cases/stablecoins/crosschain-deposit-rusd-bera-dolomite
Round-trip crosschain minting strategy with USDCe bridging, rUSD minting, and Dolomite vault deposits for yield generation
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>
<p>Updated </p>
</div>
# Berachain: Mint rUSD to enter Euler
Source: https://docs.enso.build/pages/use-cases/stablecoins/crosschain-deposit-rusd-bera-euler
Round-trip roundtrip minting strategy with USDCe bridging, rUSD creation, and Euler vault deposits for yield generation
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((USDCe))
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)) -->|euler-v2<br/>deposit| esrUSD((esrUSD))
end
```
Route Mechanics:
This advanced bundle orchestrates a complete crosschain yield strategy through multiple atomic transactions:
* Bridge USDCe from Berachain to Ethereum using Stargate protocol
* Check USDCe balance on Ethereum after successful bridge completion
* Mint rUSD using the bridged USDCe through Reservoir's minting contract
* Bridge newly minted rUSD back to Berachain via Stargate bridge
* Check rUSD balance on Berachain after bridging
* Deposit rUSD into Euler V2 vault for automated yield generation
```typescript mintOnBeraDepositOnMainnet.ts highlight={23, 51, 59,83, 91} lines 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 RUSD_BERACHAIN = "0x09D4214C03D01F49544C0448DBE3A27f768F2b34";
// Protocol addresses
const RESERVOIR_MINTING_CONTRACT =
"0x4809010926aec940b550D34a46A52739f996D75D";
const EULER_VAULT_E_RUSD_BERACHAIN =
"0xB8064453B25a91D7a4e8b7e7883A817D5742dE34"; // Euler vault srUSD/USDe on Berachain (need actual address)
const srUSD = "0x5475611dffb8ef4d697ae39df9395513b6e947d7";
const client = new EnsoClient({
apiKey: process.env.ENSO_API_KEY!,
});
const usdcBeraToEthPools = await client.getLayerZeroPool({
chainId: BERACHAIN_ID,
token: USDCE_BERACHAIN,
destinationChainId: ETHEREUM_ID + "",
});
const rusdEthToBeraPools = await client.getLayerZeroPool({
chainId: ETHEREUM_ID,
token: RUSD_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 USDC
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: Bridge newly minted rUSD back to Berachain
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: rusdEthToBeraPools[0].pool,
destinationChainId: BERACHAIN_ID,
tokenIn: RUSD_ETHEREUM,
amountIn: { useOutputOfCallAt: 1 }, // Use rUSD from minting
receiver: WALLET_ADDRESS,
// Callback executes on Berachain after rUSD arrives
callback: [
// Step 1: Check rUSD balance on Berachain
{
protocol: "enso",
action: "balance",
args: {
token: RUSD_BERACHAIN,
},
},
// Step 2: Route rUSD to srUSD
{
protocol: "enso",
action: "route",
args: {
tokenIn: RUSD_BERACHAIN,
tokenOut: srUSD,
amountIn: { useOutputOfCallAt: 0 },
},
},
// Step 3: deposit into Euler v2 srUSD vault
{
protocol: "euler-v2",
action: "deposit",
args: {
primaryAddress: EULER_VAULT_E_RUSD_BERACHAIN,
tokenIn: srUSD,
tokenOut: EULER_VAULT_E_RUSD_BERACHAIN,
amountIn: [{ useOutputOfCallAt: 1 }], // Use e-rUSD from balance check
receiver: WALLET_ADDRESS,
},
},
],
},
},
],
},
},
]
);
```
**Important Considerations**
* All crosschain operations exe프로젝트로 돌아가기