# Account ID
Source: https://docs.enso.build/api-reference/account/account-id
public/openapi.json get /api/v1/account/accountId
Gives the Account ID associated with the current user
# Approve Enso contract
Source: https://docs.enso.build/api-reference/defi-shortcuts/approve-enso-contract
public/openapi.json get /api/v1/wallet/approve
Returns a transaction that approves your Enso contracts to spend the given amount of specified tokens. Approve before sending the route transaction on-chain.
# Bundle a list of actions
Source: https://docs.enso.build/api-reference/defi-shortcuts/bundle-a-list-of-actions
public/openapi.json post /api/v1/shortcuts/bundle
Returns a single transaction bundling the submitted actions. For available actions, see `/actions` endpoint.
# Get transaction for IPOR shortcut
Source: https://docs.enso.build/api-reference/defi-shortcuts/get-transaction-for-ipor-shortcut
public/openapi.json post /api/v1/shortcuts/static/ipor
# Optimal route between two tokens
Source: https://docs.enso.build/api-reference/defi-shortcuts/optimal-route-between-two-tokens
public/openapi.json get /api/v1/shortcuts/route
Calculates optimal transaction with the best route between two tokens, which may involve several actions that interact with various DeFi protocols. To enter a non-tokenized position, use GET `shortcuts/route/nontokenized`.
# Optimal route between two tokens
Source: https://docs.enso.build/api-reference/defi-shortcuts/optimal-route-between-two-tokens-1
public/openapi.json post /api/v1/shortcuts/route
Calculates optimal transaction with the best route between two tokens, which may involve several actions that interact with various DeFi protocols. To enter a non-tokenized position, use the GET `/shortcuts/route/nontokenized`.
# Routing to a non-tokenized position
Source: https://docs.enso.build/api-reference/defi-shortcuts/routing-to-a-non-tokenized-position
public/openapi.json get /api/v1/shortcuts/route/nontokenized
Calculates optimal transaction with the best route entering a non-tokenized position, which may involve several actions that interact with various DeFi protocols.
# Chain and transactions volume
Source: https://docs.enso.build/api-reference/defi/chain-and-transactions-volume
public/openapi.json get /api/v1/volume/{chainId}
Returns total USD and transactions volume for the given chainId.
# Wallet balances
Source: https://docs.enso.build/api-reference/defi/wallet-balances
public/openapi.json get /api/v1/wallet/balances
Returns tokens balances for Enso Wallet associated with the given address across all supported chains. With `useEoa` set to true, it returns balances for the given EOA address instead.
# Actions for protocol
Source: https://docs.enso.build/api-reference/integration/actions-for-protocol
public/openapi.json get /api/v1/actions/{slug}
# Aggregators
Source: https://docs.enso.build/api-reference/integration/aggregators
public/openapi.json get /api/v1/aggregators
Fetches aggregators supported by Enso
# All Protocols
Source: https://docs.enso.build/api-reference/integration/all-protocols
public/openapi.json get /api/v1/protocols
Returns all available protocols with supported chains
# LayerZero pool
Source: https://docs.enso.build/api-reference/integration/layerzero-pool
public/openapi.json get /api/v1/layerzero/pool
Returns the LayerZero Stargate pool address for a given token address and chain ID. Returns null if no pool exists for the token on that chain.
# Networks
Source: https://docs.enso.build/api-reference/integration/networks
public/openapi.json get /api/v1/networks
Returns networks supported by Enso
# Projects
Source: https://docs.enso.build/api-reference/integration/projects
public/openapi.json get /api/v1/projects
Returns supported projects (e.g. `aave`) or platforms associated with available projects
# Protocols in a project
Source: https://docs.enso.build/api-reference/integration/protocols-in-a-project
public/openapi.json get /api/v1/projects/{project}/protocols
Returns all protocols available within the given project. For supported projects, see the `/projects` endpoint.
# Standard per protocol
Source: https://docs.enso.build/api-reference/integration/standard-per-protocol
public/openapi.json get /api/v1/standards/{slug}
Returns a standard matching the given `slug`, containing supported actions, exact `inputs`, and a list of chains the standard's supported on.
# Standards
Source: https://docs.enso.build/api-reference/integration/standards
public/openapi.json get /api/v1/standards
Returns standards available for bundling. Each element represents a protocol, with list of supported actions and chains the standard's supported on.
# Supported actions
Source: https://docs.enso.build/api-reference/integration/supported-actions
public/openapi.json get /api/v1/actions
Returns actions that can be bundled with `/shortcuts/bundle` endpoint. For specific protocol actions and exact action inputs, see [`/actions/{slug}`](/api-reference/integration/actions-for-a-given-protocol) endpoint.
# Nontokenized positions
Source: https://docs.enso.build/api-reference/tokens/nontokenized-positions
public/openapi.json get /api/v1/nontokenized
Returns a list of all nontokenized positions with details.
# Token Price
Source: https://docs.enso.build/api-reference/tokens/token-price
public/openapi.json get /api/v1/prices/{chainId}/{address}
Returns token price for the given address and chainId.
# Tokens
Source: https://docs.enso.build/api-reference/tokens/tokens
public/openapi.json get /api/v1/tokens
Returns tokens and their details. This APi includes cursor-based pagination with default 1000 items per page.
# Tokens Prices Batched
Source: https://docs.enso.build/api-reference/tokens/tokens-prices-batched
public/openapi.json get /api/v1/prices/{chainId}
Returns prices for a batch of tokens on a given chain.
# Enso Developer Documentation
Source: https://docs.enso.build/home
Enso Developer Documentation
Enso Developer Documentation
Shortcuts to executable calldata for DeFi Workflows.
Get started with Enso's core APIs and essential integration guides
Comprehensive API documentation for developers and integrators
Try out different widgets and use them the plug-and-play React templates to add blockchain functionality to your app
# Overview
Source: https://docs.enso.build/pages/api-reference/overview
Learn about Enso API and its capabilities.
export const date_0 = "2025-08-13"
The Enso API provides developers with a comprehensive set of tools to interact with DeFi protocols and execute complex transactions across multiple blockchain networks.
## Getting Started
Explore detailed documentation for each API endpoint using the API sandbox.
The Sandbox doesn't require authentication. For building and production use cases, use a dedicated API key.
### Authentication
In production, all API requests require authentication using an API key, as the API is [rate-limited](/pages/build/reference/faq##what-is-the-default-rate-limit-for-the-api?).
```bash theme={null}
-H "Authorization: Bearer YOUR_API_KEY"
```
1. Create an account on the [Enso Dashboard](https://developers.enso.build)
2. Generate an API key from your dashboard
3. Use this key in all API requests
## API Groups
The Enso API is organized into several functional groups:
### Shortcuts
Execute optimized token swaps and complex DeFi operations with single transactions.
* [`GET /v1/shortcuts/route`](/api-reference/defi-shortcuts/optimal-route-between-two-tokens) - Find optimal token swap routes
* [`POST /v1/shortcuts/bundle`](/api-reference/defi-shortcuts/bundle-a-list-of-actions) - Bundle multiple actions atomically
* [`GET /v1/wallet/approve`](/api-reference/defi-shortcuts/approve-enso-contract) - Approve token spending
### Integration
Access metadata about supported protocols, standards, and available actions.
* [`GET /v1/standards`](/api-reference/integration/standards) - Get available integration standards
* [`GET /v1/actions`](/api-reference/integration/supported-actions) - Get supported DeFi actions
* [`GET /v1/protocols`](/api-reference/integration/all-protocols) - Get all supported protocols
* [`GET /v1/networks`](/api-reference/integration/networks) - Get supported blockchain networks
* [`GET /v1/projects`](/api-reference/integration/projects) - Get protocol project groupings
### Tokens
Query token data including positions, prices, and wallet holdings.
* [`GET /v1/tokens`](/api-reference/tokens/tokens) - Get token details and metadata
* [`GET /v1/nontokenized`](/api-reference/tokens/nontokenized-positions) - Get non-tokenized DeFi positions
* [`GET /v1/prices/{chainId}/{address}`](/api-reference/tokens/token-price) - Get token price data
### DeFi
Access real-time DeFi metrics and wallet information.
* [`GET /v1/wallet/balances`](/api-reference/defi/wallet-balances) - Get wallet token balances
* [`GET /v1/volume/{chainId}`](/api-reference/defi/chain-and-transactions-volume) - Get chain trading volume
* [`GET /v1/aggregators`](/api-reference/integration/aggregators) - Get supported DEX aggregators
## Key Concepts
Before using the Enso API, familiarize yourself with these key concepts:
* [Projects, protocols, and standards](/pages/build/reference/concepts) - Understand the structure of Enso's data model
* [Shortcuts](/pages/build/examples/shortcuts) - Pre-configured paths for common DeFi operations
* [Actions](/pages/build/reference/actions) - Standardized interactions with DeFi protocols
* [Routing Strategies](/pages/build/reference/routing-strategies) - Different approaches to transaction execution
Updated {date_0}
# SDK
Source: https://docs.enso.build/pages/api-reference/sdk
Enso SDK is a JavaScript library for interacting with Enso API.
export const date_0 = "2025-08-07"
The Enso SDK provides a set of tools and methods to interact with the Enso API. It includes functionalities for token approvals, routing, quoting, and balance checking. The Route API is a highly-efficient DeFi aggregation and smart order routing REST API. With it, developers can easily tap into optimized routes for DeFi tokens/positions and multi-token swaps across various chains.
## Installation
Install the Enso SDK using your preferred package manager:
```bash npm theme={null}
npm install @ensofinance/sdk
```
```bash yarn theme={null}
yarn add @ensofinance/sdk
```
```bash pnpm theme={null}
pnpm add @ensofinance/sdk
```
```bash bun theme={null}
bun add @ensofinance/sdk
```
## Quick Start
This example shows how to swap ETH directly to a Yearn vault position:
```typescript theme={null}
import { EnsoClient } from '@ensofinance/sdk';
const enso = new EnsoClient({
apiKey: 'YOUR_API_KEY',
});
async function enterYearnVault() {
// First, get the transaction data
const routeData = await enso.getRouteData({
fromAddress: '0xYourWalletAddress',
receiver: '0xYourWalletAddress',
spender: '0xYourWalletAddress',
chainId: 1,
amountIn: ['1000000000000000000'], // 1 ETH
tokenIn: ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'], // ETH
tokenOut: ['0xa258C4606Ca8206D8aA700cE2143D7db854D168c'], // yvWETH
slippage: 50,
routingStrategy: 'router',
});
// The routeData.tx object can now be sent using your preferred web3 library
// Example with ethers.js:
// const provider = new ethers.providers.Web3Provider(window.ethereum);
// const signer = provider.getSigner();
// const tx = await signer.sendTransaction(routeData.tx);
// await tx.wait();
console.log('Transaction data:', routeData.tx);
console.log('Expected yvWETH amount:', routeData.amountOut);
}
enterYearnVault();
```
## Core Concepts
The Enso SDK abstracts complex DeFi operations through several key components:
1. **EnsoClient**: The main entry point for all SDK functionalities
2. **Routing Strategies**: Different execution paths for transactions
3. **Bundle Actions**: Compose multiple DeFi operations in a single transaction
4. **Approvals**: Manage token allowances for DeFi interactions
5. **Token Data**: Retrieve detailed information about tokens and protocols
## Routing Strategies
There are 3 routing strategies available depending on your use case:
* **`router`** - Uses a single contract which acts as a universal router
* **`delegate`** - Returns calldata in the form of delegateCalls for smart accounts
* **`delegate-legacy`** - Legacy version of delegate routing
* **`router-legacy`** - Legacy version of router routing
## Complete Methods Reference
### Primary Methods
#### getRouteData(params: RouteParams)
Calculates the optimal route for token swaps or entering/exiting DeFi positions.
**Parameters:**
* `fromAddress` (Address): Ethereum address of the wallet to send the transaction from
* `receiver?` (Address): Ethereum address of the receiver of the tokenOut
* `spender?` (Address): Ethereum address of the spender of the tokenIn
* `chainId` (number): Chain ID of the network to execute the transaction on
* `destinationChainId?` (number): Chain ID of the destination network for cross-chain bridging
* `amountIn` (Quantity\[]): Amount of tokenIn to swap in wei
* `slippage?` (Quantity): Slippage in basis points (1/10000)
* `minAmountOut?` (Quantity\[]): Minimum amount out in wei
* `tokenIn` (Address\[]): Ethereum address of the token to swap from
* `tokenOut` (Address\[]): Ethereum address of the token to swap to
* `routingStrategy` (RoutingStrategy): Routing strategy to use
* `fee?` (Quantity\[]): Fee in basis points for each amountIn value
* `feeReceiver?` (Address): Address that will receive the collected fee
* `ignoreAggregators?` (string\[]): List of swap aggregators to ignore
* `ignoreStandards?` (string\[]): List of standards to ignore
* `toEoa?` (boolean): Flag indicating if gained tokenOut should be sent to EOA
* `referralCode?` (string): Referral code included in on-chain event
**Returns:** `Promise`
```typescript theme={null}
const routeData = await enso.getRouteData({
fromAddress: '0xYourWalletAddress',
receiver: '0xYourWalletAddress',
spender: '0xYourWalletAddress',
chainId: 1,
amountIn: ['1000000000000000000'], // 1 ETH in wei
tokenIn: ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'], // ETH
tokenOut: ['0x6b175474e89094c44da98b954eedeac495271d0f'], // DAI
slippage: 50, // 0.5%
routingStrategy: 'router',
});
```
#### getApprovalData(params: ApproveParams)
Generates transaction data for approving tokens to be spent by Enso contracts.
**Parameters:**
* `fromAddress` (Address): Ethereum address of the wallet to send the transaction from
* `tokenAddress` (Address): ERC20 token address of the token to approve
* `chainId` (number): Chain ID of the network to execute the transaction on
* `amount` (Quantity): Amount of tokens to approve in wei
**Returns:** `Promise`
```typescript theme={null}
const approvalData = await enso.getApprovalData({
fromAddress: '0xYourWalletAddress',
tokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH
chainId: 1,
amount: '1000000000000000000', // 1 WETH in wei
});
```
#### getBundleData(params: BundleParams, actions: BundleAction\[])
Constructs bundled transaction data for multiple DeFi operations in a single transaction.
**Parameters:**
* `chainId` (number): Chain ID of the network to execute the transaction on
* `fromAddress` (Address): Ethereum address of the wallet to send the transaction from
* `routingStrategy` (RoutingStrategy): Routing strategy to use
* `receiver?` (Address): Ethereum address of the receiver of the tokenOut
* `spender?` (Address): Ethereum address of the spender of the tokenIn
* `ignoreAggregators?` (string\[]): List of swap aggregators to ignore
* `referralCode?` (string): Referral code included in on-chain event
* `ignoreStandards?` (string\[]): List of standards to ignore
* `actions` (BundleAction\[]): Array of actions to bundle
**Returns:** `Promise`
```typescript theme={null}
const bundle = await enso.getBundleData(
{
chainId: 1,
fromAddress: '0x123...',
routingStrategy: 'delegate',
},
[
{
protocol: 'enso',
action: 'route',
args: {
tokenIn: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
tokenOut: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
amountIn: '1000000000',
receiver: '0x123...'
}
}
]
);
```
### Data Retrieval Methods
#### getBalances(params: BalanceParams)
Retrieves token balances for a given wallet address.
**Parameters:**
* `chainId?` (number): Chain ID of the network to execute the transaction on
* `eoaAddress` (Address): Address of the EOA to associate with the ensoWallet for balances
* `useEoa?` (boolean): If true, returns balances for the provided eoaAddress instead of the associated ensoWallet
**Returns:** `Promise`
```typescript theme={null}
const balances = await enso.getBalances({
chainId: 1,
eoaAddress: '0xYourWalletAddress',
useEoa: true,
});
```
#### getTokenData(params: TokenParams)
Fetches detailed information about tokens, including DeFi tokens and their underlying assets.
**Parameters:**
* `project?` (string): The overarching project or platform associated with the DeFi token
* `protocolSlug?` (string): The specific standard integration or version of the DeFi project
* `underlyingTokens?` (MultiAddress): Underlying tokens of defi token
* `underlyingTokensExact?` (MultiAddress): Exact composition of underlying tokens
* `primaryAddress?` (MultiAddress): Ethereum addresses for contract interaction
* `address?` (MultiAddress): Ethereum addresses of the tokens
* `chainId?` (number): Chain ID of the network of the token
* `type?` (TokenType): Type of token ('defi' | 'base')
* `apyFrom?` (Quantity): Only include tokens with APY over this value
* `apyTo?` (Quantity): Only include tokens with APY below this value
* `tvlFrom?` (Quantity): Only include tokens with TVL over this value
* `tvlTo?` (Quantity): Only include tokens with TVL below this value
* `page?` (number): Pagination page number (pages are of length 1000)
* `cursor?` (number): Cursor for pagination
* `includeMetadata?` (boolean): Whether to include token metadata
* `name?` (string\[]): Names of the tokens
* `symbol?` (string\[]): Symbols of the tokens
**Returns:** `Promise`
```typescript theme={null}
const tokens = await enso.getTokenData({
chainId: 1,
type: 'defi',
includeMetadata: true,
page: 1
});
```
#### getPriceData(params: PriceParams)
Gets the current price data for a specific token.
**Parameters:**
* `chainId` (number): Chain ID of the network to search for
* `address` (Address): Address of the token to search for
**Returns:** `Promise`
```typescript theme={null}
const price = await enso.getPriceData({
chainId: 1,
address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH
});
```
#### getMultiplePriceData(params: MultiPriceParams)
Gets price data for multiple tokens.
**Parameters:**
* `chainId` (number): Chain ID of the network to search for
* `addresses` (Address\[]): Addresses of tokens to check prices for
**Returns:** `Promise`
```typescript theme={null}
const prices = await enso.getMultiplePriceData({
chainId: 1,
addresses: [
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' // USDC
]
});
```
### Protocol and Standard Methods
#### getProtocolData(params?: ProtocolParams)
Retrieves information about DeFi protocols supported by Enso.
**Parameters:**
* `chainId?` (number | string): Chain ID of the network to search for
* `slug?` (string): Slug of the project to search for
**Returns:** `Promise`
```typescript theme={null}
// Get all protocols
const allProtocols = await enso.getProtocolData();
// Get protocols for a specific chain
const ethereumProtocols = await enso.getProtocolData({ chainId: 1 });
// Get a specific protocol
const aaveProtocol = await enso.getProtocolData({ slug: 'aave-v3' });
```
#### getStandards()
Returns standards available for bundling with protocol information and supported actions.
**Returns:** `Promise`
```typescript theme={null}
const standards = await enso.getStandards();
```
#### getStandardBySlug(slug: string)
Returns a standard matching the given slug with supported actions and chains.
**Parameters:**
* `slug` (string): The protocol slug
**Returns:** `Promise`
```typescript theme={null}
const aaveStandard = await enso.getStandardBySlug('aave-v3');
```
#### getActions()
Returns all actions that can be bundled with the `/shortcuts/bundle` endpoint.
**Returns:** `Promise`
```typescript theme={null}
const actions = await enso.getActions();
```
#### getActionsBySlug(slug: string)
Gets actions for a specific protocol.
**Parameters:**
* `slug` (string): The protocol slug
**Returns:** `Promise`
```typescript theme={null}
const aaveActions = await enso.getActionsBySlug('aave-v3');
```
### Specialized Methods
#### getRouteNonTokenized(params: RouteNonTokenizedParams)
Gets execution data for best route to non-tokenized positions.
**Parameters:**
* `chainId` (number): Chain ID of the network to execute the transaction on
* `fromAddress` (Address): Ethereum address of the wallet to send the transaction from
* `routingStrategy` ('delegate' | 'delegate-legacy'): Routing strategy to use
* `tokenIn` (Address\[]): Input tokens
* `positionOut` (Address): Non-tokenized position to receive
* `slippage?` (Quantity): Slippage in basis points
* `fee?` (Quantity\[]): Fee in basis points
* `feeReceiver?` (Address): Fee receiver address
* `amountIn` (Quantity\[]): Amount to send
* `receiver` (Address): Receiver address
* `spender?` (Address): Spender address
* `referralCode?` (string): Referral code
**Returns:** `Promise`
```typescript theme={null}
const route = await enso.getRouteNonTokenized({
fromAddress: '0x123...',
chainId: 1,
routingStrategy: 'delegate',
tokenIn: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'],
positionOut: '0xPositionAddress',
amountIn: ['1000000000'],
receiver: '0x123...',
slippage: 50,
});
```
#### getIporShortcut(params, data: IporShortcutInputData)
Returns a transaction for IPOR shortcut operations.
**Parameters:**
* `chainId?` (number): Chain ID (optional)
* `fromAddress` (string): Ethereum address of the wallet
* `data` (IporShortcutInputData): IPOR shortcut input data
**Returns:** `Promise`
```typescript theme={null}
const iporShortcut = await enso.getIporShortcut(
{ chainId: 1, fromAddress: '0x123...' },
{
amountIn: '1000000000000000000',
tokenIn: '0xTokenAddress',
tokenBToBuy: '0xTokenBAddress',
percentageForTokenB: 5000, // 50%
slippage: 50,
simulate: true
}
);
```
#### getNonTokenizedPositions(params?: NonTokenizedParams)
Gets all non-tokenized positions with details.
**Parameters:**
* `project?` (string): The overarching project or platform
* `protocolSlug?` (string): The specific standard integration
* `chainId?` (number): Chain ID of the network
* `destinationChainId?` (number): Destination chain ID for cross-chain bridging
* `address?` (Address\[]): Ethereum addresses of positions
* `primaryAddress?` (Address\[]): Ethereum addresses for contract interaction
* `page?` (number): Pagination page number
* `cursor?` (number): Cursor for pagination
**Returns:** `Promise`
```typescript theme={null}
const nonTokenizedPositions = await enso.getNonTokenizedPositions({
chainId: 1,
project: 'aave'
});
```
### Network and Utility Methods
#### getNetworks(params?: NetworkParams)
Returns networks supported by Enso.
**Parameters:**
* `name?` (string): Name of the network to search for
* `chainId?` (string): Chain ID of the network to search for
**Returns:** `Promise`
```typescript theme={null}
const networks = await enso.getNetworks();
const ethereum = await enso.getNetworks({ chainId: "1" });
```
#### getProjects()
Returns supported projects or platforms associated with available protocols.
**Returns:** `Promise`
```typescript theme={null}
const projects = await enso.getProjects();
```
#### getProtocolsByProject(project: string)
Returns all protocols available within the given project.
**Parameters:**
* `project` (string): The project name
**Returns:** `Promise`
```typescript theme={null}
const aaveProtocols = await enso.getProtocolsByProject('aave');
```
#### getAggregators(chainId?: number)
Fetches aggregators supported by Enso.
**Parameters:**
* `chainId?` (number): Chain ID to filter aggregators for
**Returns:** `Promise`
```typescript theme={null}
const aggregators = await enso.getAggregators(1);
```
#### getVolume(chainId: number)
Returns total USD and transactions volume for the given chainId.
**Parameters:**
* `chainId` (number): Chain ID to get volume for
**Returns:** `Promise`
```typescript theme={null}
const volume = await enso.getVolume(1);
```
#### getAccountId()
Gets the account ID associated with the API key.
**Returns:** `Promise`
```typescript theme={null}
const accountId = await enso.getAccountId();
```
## Working with Large Numbers
The SDK properly handles large numbers common in blockchain transactions:
```typescript theme={null}
// Using string representation for large numbers (recommended)
const largeAmount = "1000000000000000000000000"; // 1 million tokens with 18 decimals
// You can also use JavaScript numbers for smaller values
const smallAmount = 1000000; // 1 USDC with 6 decimals
```
## Bundle Actions
The Bundle API supports a variety of actions for interacting with DeFi protocols. For an up-to-date reference of all available actions and their parameters:
```typescript theme={null}
// Get all available actions
const actions = await enso.getActions();
// Get actions for a specific protocol
const aaveActions = await enso.getActionsBySlug("aave-v3");
```
Common bundle actions include:
* **Route**: Token swaps and conversions
* **Deposit**: Deposit tokens into DeFi protocols
* **Redeem**: Withdraw tokens from DeFi protocols
* **Approve**: Token approvals
* **Borrow**: Borrow tokens from lending protocols
* **Repay**: Repay loans to lending protocols
* **Transfer**: Transfer tokens between addresses
* **Bridge**: Cross-chain token transfers
## Error Handling
The SDK includes proper error handling with custom error types:
```typescript theme={null}
import { EnsoClient, EnsoApiError } from '@ensofinance/sdk';
try {
const routeData = await enso.getRouteData(params);
} catch (error) {
if (error instanceof EnsoApiError) {
console.error('API Error:', error.statusCode, error.responseData);
} else {
console.error('Request Error:', error.message);
}
}
```
## Best Practices
1. **Use String Representations**: Always use string representations for token amounts to avoid precision issues with large numbers
2. **Handle Slippage**: Set appropriate slippage values (in basis points) to protect against price movements
3. **Gas Estimation**: Use the returned `gas` estimate to set appropriate gas limits
4. **Error Handling**: Implement proper error handling for network issues and API errors
5. **Rate Limiting**: Be mindful of API rate limits when making multiple requests
## Next Steps
Explore these resources to fully leverage the Enso SDK:
* [Routing Strategies](/pages/build/reference/routing-strategies) - Learn about the different routing options and when to use each one
* [Available Actions for Bundle API](/pages/build/reference/actions) - Explore all supported DeFi actions like swaps, deposits, borrows, and more
* [Shortcuts](/pages/build/examples/shortcuts) - See practical examples of common DeFi operations implemented with the SDK
* [Non-tokenized Positions](/pages/build/examples/route-nontokenized) - Discover how to interact with non-tokenized DeFi positions like Aave borrows or Liquity CDPs
* [GitHub Repository](https://github.com/EnsoBuild/sdk-ts) - Access the source code, report issues, or contribute to the SDK
* [Developer Chat](https://t.me/enso_shortcuts) - Join our Telegram group for technical support and discussions
Updated {date_0}
# Swagger
Source: https://docs.enso.build/pages/api-reference/swagger
Swagger
TODO
# Custom Contract Calls Bundle
Source: https://docs.enso.build/pages/build/examples/custom-call-bundle
Bundle routing with non-standard ways to interact with protocols Enso supports
export const date_0 = "2025-08-07"
When a standard `enso:route` isn't enough for protocols with unique function signatures (e.g., requiring a referral code as an argument), you can use the `/bundle` endpoint.
By chaining actions like `enso:route` and `enso:call`, you can combine optimal routing with custom contract calls.
### Use Case: Swap and Deposit with a Custom Referral Code
Let's explore a scenario where a user wants to swap `USDT` for `STAKED_HYPE`, and then deposit it for `LHYPE`, through a contract whose `deposit` function requires a custom `communityCode` argument.
When the transaction is from an EOA, the Enso Router contract executes the sequence.
This requires explicit approvals for the router to operate on input tokens.
#### Bundle Design
In pseudo-code, the bundle looks as follows:
```
0: enso.route(in: USDT, out: STAKED_HYPE, receiver: ENSO_ROUTER)
1: erc20.approve(STAKED_HYPE, HYPE_DEPOSITOR, amount: outputOfCallAt(1))
2: enso.call(
HYPE_DEPOSITOR.deposit(STAKED_HYPE, outputOf(1), 0, SENDER, "0x1234")
)
```
* **Setup: approve transaction**. The user approves the Enso Router to spend their input `USDT`, which is a required first step to grant the router permission for the swap.
* **Action 0: `enso:route`**. The router swaps `USDT` for `STAKED_HYPE`. The `receiver` is critically set to the `ENSO_ROUTER` itself so it can hold the tokens for the next steps.
* **Action 1: `erc20:approve`**. The Enso Router approves the final `HYPE_DEPOSITOR` contract, using `{ useOutputOfCallAt: 1 }` to dynamically set the approval amount to the exact output from the previous swap.
* **Action 2: `enso:call`**. The router calls the final `deposit` function, passing the dynamic swap amount (again with `{ useOutputOfCallAt: 1 }`), the user's address as the recipient, and the required static `communityCode`.
```ts routeCustomCallEOA.ts theme={null}
import { EnsoClient } from "@ensofinance/sdk";
const client = new EnsoClient({
apiKey: "YOUR_API_KEY", // Replace with your Enso API key
});
// Define asset and contract addresses
const USDT = "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb";
const STAKED_HYPE = "0xffaa4a3d97fe9107cef8a3f48c069f577ff76cc1";
const HYPE_DEPOSITOR = "0x6e358dd1204c3fb1D24e569DF0899f48faBE5337";
const SENDER = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"; // The user's EOA address
const ENSO_ROUTER = "0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf"; // Enso's Router contract
// Approve Enso router to use USDT
const approval = await client.getApprovalData({
amount: USDT_AMOUNT,
chainId: 999,
fromAddress: SENDER,
tokenAddress: USDT,
});
// create the bundle
const bundle = await client.getBundleData(
{
chainId: 999,
fromAddress: SENDER,
routingStrategy: "router",
receiver: SENDER,
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDT,
tokenOut: STAKED_HYPE,
amountIn: USDT_AMOUNT,
},
},
{
protocol: "erc20",
action: "approve",
args: {
amount: { useOutputOfCallAt: 0 },
spender: HYPE_DEPOSITOR,
token: STAKED_HYPE,
},
},
{
protocol: "enso",
action: "call",
args: {
tokenIn: STAKED_HYPE,
tokenOut: LOOPED_HYPE,
address: HYPE_DEPOSITOR,
args: [
STAKED_HYPE,
{ useOutputOfCallAt: 0 },
0,
SENDER,
"0x1234",
],
method: "deposit",
abi: "function deposit(address depositAsset, uint256 depositAmount, uint256 minimumMint, address to, bytes communityCode) external returns (uint256 shares)",
},
},
],
);
await signEoa(approval.tx, approval.gas);
await signEoa(bundle.tx, bundle.gas);
console.log("Approval", {gas: approval.gas, tx: approval.tx})
console.log("Bundle", JSON.stringify(bundle, null, 2));
```
### Smart Wallet Example (`routingStrategy: 'delegate'`)
With a Smart Wallet, the wallet executes the bundle directly, simplifying the approval flow into fewer steps.
#### Bundle Design
In pseudo-code, we need to do the following:
```
0: enso.route(in: USDT, out: STAKED_HYPE, receiver: SENDER) |
1: erc20.approve(STAKED_HYPE, HYPE_DEPOSITOR, amount: outputOfCallAt(0)) |
2: enso.call(
HYPE_DEPOSITOR.deposit(STAKED_HYPE, outputOf(0), 0, SENDER, "0x1234")
)
```
* **Action 0: `enso:route`**. The Smart Wallet swaps `USDT` for `STAKED_HYPE` and receives the output tokens directly.
* **Action 1: `erc20:approve`**. The Smart Wallet approves the final `HYPE_DEPOSITOR` contract, using `{ useOutputOfCallAt: 0 }` to dynamically approve the exact amount received from the swap.
* **Action 2: `enso:call`**. The Smart Wallet calls the custom `deposit` function, passing the dynamic swap amount (again using `{ useOutputOfCallAt: 0 }`), the user's address as the recipient, and the required static `communityCode`.
```ts routeCustomCallSmartWallet.ts theme={null}
import { EnsoClient } from "@ensofinance/sdk";
const client = new EnsoClient({
apiKey: "YOUR_API_KEY", // Replace with your Enso API key
});
// Define asset and contract addresses
const USDT = "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb";
const STAKED_HYPE = "0xffaa4a3d97fe9107cef8a3f48c069f577ff76cc1";
const HYPE_DEPOSITOR = "0x6e358dd1204c3fb1D24e569DF0899f48faBE5337";
const SENDER = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const bundle = await client.getBundleData(
{
chainId: 999,
fromAddress: SENDER,
routingStrategy: "delegate",
receiver: SENDER,
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDT,
tokenOut: STAKED_HYPE,
amountIn: "100000000",
receiver: SENDER,
},
},
{
protocol: "erc20",
action: "approve",
args: {
token: STAKED_HYPE,
spender: HYPE_DEPOSITOR,
amount: { useOutputOfCallAt: 0 },
},
},
{
protocol: "enso",
action: "call",
args: {
address: HYPE_DEPOSITOR,
method: "deposit",
abi: "function deposit(address depositAsset, uint256 depositAmount, uint256 minimumMint, address to, bytes communityCode) external returns (uint256 shares)",
args: [STAKED_HYPE, { useOutputOfCallAt: 0 }, 0, SENDER, "0x1234"],
},
},
]
);
console.log(JSON.stringify(bundle, null, 2));
```
Updated {date_0}
# Request Tracking
Source: https://docs.enso.build/pages/build/examples/request-referral
Tag requests with a referral code to track usage and rewards.
export const date_0 = "2025-08-14"
With `/bundle` and `/route` APIs you can tag transactions with a `referralCode`, allowing you to track usage and rewards associated with that code.
Every transaction these APIs create will emit a `ShortcusExecuted` event with the referral code:
```solidity theme={null}
ShortcusExecuted(accountId: bytes32, requestId: bytes32)
```
To implement the tracking, you'll need to analyze the `ShortcusExecuted` events emitted by the Enso smart contract executing your transaction. This event contains two key pieces of information:
* Use `accountId`, uniquely associated with your account, to identify all requests made through your project's integration with Enso.
* Use the `requestId` (a unique identifier for each request) where the higher 16 bytes represent contain the `referralCode`.
Updated {date_0}
# Non-tokenized DeFi Positions
Source: https://docs.enso.build/pages/build/examples/route-nontokenized
Get calldata for routing to non-tokenized positions.
export const date_0 = "2025-07-07"
The [GET `shortcuts/route/nontokenized`](/api-reference/defi-shortcuts/routing-to-a-non-tokenized-position) endpoint constructs an optimal conversion route. This API allows entering a non-tokenized DeFi position from any ERC20 or native token.
You must use `delegate` strategy when working with non-tokenized positions.
1. Create an API key using [Enso Dashboard](https://developers.enso.build).
2. Securely store your API key and make it available in your environment:
```bash authentication.sh theme={null}
ENSO_API_KEY="$ENSO_API_KEY"
echo $ENSO_API_KEY >> .env
git ignore .env
source .env
```
Unlike tokenized positions where you receive a token representing your position (like aTokens in Aave), non-tokenized positions are stored directly in a smart contract (usually a Smart Wallet). This endpoint is specifically designed for interacting with these types of positions.
Common examples include:
* Borrowing on lending protocols
* Creating CDPs (Collateralized Debt Positions)
* Complex multi-step DeFi interactions
Note: This endpoint requires the use of a Smart Wallet or a delegatecall-compatible contract.
Send the transaction via a Smart Wallet, by using the `tx.to` for recipient, and `tx.data` to get the calldata. The transaction will be sent to the [`EnsoShortcutsDelegate`](/pages/build/reference/deployments), which will handle the execution of the route.
* Explore the [Shortucts Library](/pages/build/examples/shortcuts) for common DeFi workflows.
* Check out the [API Reference](/api-reference/defi-shortcuts/routing-to-a-non-tokenized-position) for full parameter details
Updated {date_0}
# Shortcuts Library
Source: https://docs.enso.build/pages/build/examples/shortcuts
Explore shortcuts for common DeFi workflows.
export const date_0 = "2025-11-03"
The Enso Shortcuts system offers two powerful APIs for building DeFi workflows:
* **Automated Routing**: The [POST `shortcuts/route`](/api-reference/defi-shortcuts/optimal-route-between-two-tokens) API calculates optimized multi-step paths for entering/exiting DeFi positions or swapping ERC20 tokens. It automatically creates a path between two positions specified in the request.
* **Bundling DeFi Actions**: The [POST `shortcuts/bundle`](/api-reference/defi-shortcuts/bundle-a-list-of-actions) API lets you orchestrate DeFi workflows by composing multi-step sequences of [Actions](/pages/build/reference/actions) of your choosing.
**Would `route` do the job?**
The `route` API might be the simpler way to route your assets.
Before using the bundle API, check if `route` would work using [happypath](https://happypath.enso.build).
Both APIs return a transaction object with calldata representing your workflow, ready to be submitted to [`EnsoShortcutRouter`](https://etherscan.io/address/0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E#code) for execution.
## 1. Automated Routing
The POST `route` API is suitable for single-path operations with automatic optimization.
### Token Swaps
Optimize conversions between tokens by leveraging automated routing across DEXs.
**Example**: Swapping 1 ETH to USDC with the best execution price and 0.5% slippage
* **Input**: 1 ETH
* **Slippage**: 0.5%
* **Output**: USDC worth of 1 ETH
```ts Typescript SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
// Define amount
const amountInEth = parseUnits("1", 18); // 1 ETH
const route = await ensoClient.getRouteData({
chainId,
fromAddress,
receiver: fromAddress,
routingStrategy: "router",
tokenIn: [ETH],
tokenOut: [USDC],
amountIn: [amountInEth],
slippage: "50" // 0.5%
});
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/route' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "router",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],
"amountIn": ["1000000000000000000"],
"slippage": "50"
}' | jq
```
### Multi-Token Deposits
Deposit multiple tokens simultaneously into a liquidity pool to receive LP tokens in a single transaction.
**Example**: Depositig 10 DAI + 10 USDC + 10 USDT to 3Crv LP tokens (Curve 3pool) in one step
* **Input**: 10 DAI, 10 USDC, 10 USDT
* **Slippage**: 0.5%
* **Output**: 3Crv LP tokens
```ts SDK theme={null}
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const receiver = "0x742d35Cc6634C0532925a3b844Bc454e4438f44e";
// Token Addresses
const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const USDT = "0xdAC17F958D2ee523a2206206994597C13D831ec7";
const curve3poolLp = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490";
// Define amounts
const amountInDAI = parseUnits("10", 18);
const amountInUSDC = parseUnits("10", 6);
const amountInUSDT = parseUnits("10", 6);
const route = await ensoClient.getRouteData({
chainId,
fromAddress,
receiver,
routingStrategy: "delegate",
tokenIn: [DAI, USDC, USDT],
tokenOut: [curve3poolLp],
amountIn: [
amountInDAI,
amountInUSDC,
amountInUSDT,
],
slippage: "50" // 0.5%
});
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/route' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "delegate",
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"tokenIn": [
"0x6B175474E89094C44Da98b954EedeAC495271d0F",
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"0xdAC17F958D2ee523a2206206994597C13D831ec7"
],
"tokenOut": ["0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"],
"amountIn": [
"10000000000000000000",
"10000000",
"10000000"
],
"slippage": "50"
}' | jq
```
### LST Staking Entry
Transform base tokens directly into staked liquid staking positions with a single call.
**Example**: Converting 1 ETH to stETH (Lido Staked ETH) in one step
* **Input**: 1 ETH
* **Slippage**: 0.5%
* **Output**: stETH
```typescript SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84";
// Define amount
const amountIn = parseUnits("1", 18); // 1 ETH
const route = await ensoClient.getRouteData({
chainId,
fromAddress,
receiver: fromAddress,
routingStrategy: "router",
tokenIn: [ETH],
tokenOut: [stETH],
amountIn: [amountIn],
slippage: "50" // 0.5%
});
```
```bash theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/route' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "router",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],
"amountIn": ["1000000000000000000"],
"slippage": "50"
}' | jq
```
### Yield Position Entry
Enter yield-generating positions from base assets.
**Example**: Moving from 1 WETH to a Yearn vault (yvWETH)
* **Input**: 1 WETH
Output: yvWETH (exact amount depends on the vault's share price)
* **Slippage**: 0.5%
```ts SDK theme={null}
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
const yvWETH = "0xa258c4606ca8206d8aa700ce2143d7db854d168c";
// Define amount
const amountIn = parseUnits("1", 18); // 1 WETH
const route = await ensoClient.getRouteData({
chainId,
fromAddress,
receiver: fromAddress,
routingStrategy: "router",
tokenIn: [WETH],
tokenOut: [yvWETH],
amountIn: [amountIn],
slippage: "50" // 0.5%
});
```
```bash theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/route' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "router",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
"tokenOut": ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"],
"amountIn": ["1000000000000000000"],
"slippage": "50"
}' | jq
```
### Position Exit (Single Token)
Exit completely from a DeFi position back to a single base token.
**Example**: Converting 1 yvWETH (Yearn ETH vault) back to WETH
* **Input**: 1 yvWETH
* **Output**: WETH (actual amount depends on accrued yield)
* **Slippage**: 0.5%
```typescript SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const yvWETH = "0xa258c4606ca8206d8aa700ce2143d7db854d168c";
const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
// Define amount
const amountIn = parseUnits("1", 18); // 1 yvWETH
const route = await ensoClient.getRouteData({
chainId,
fromAddress,
receiver: fromAddress,
routingStrategy: "router",
tokenIn: [yvWETH],
tokenOut: [WETH],
amountIn: [amountIn],
slippage: "50" // 0.5%
});
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/route' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "router",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"],
"tokenOut": ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
"amountIn": ["1000000000000000000"],
"slippage": "50"
}'
```
### LP Position Entry
Enter into LP token positions with automatic routing and slippage protection.
**Example**: Going from 1 ETH to ETH/USDC Uniswap LP tokens
* **Output**: \~0.92 ETH/USDC LP tokens (varies with pool composition)
* **Slippage**: 1%
```ts SDK theme={null}
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const uniswap_ETH_USDC_LP = "0x06325440d014e39736583c165c2963ba99faf14e";
// Define amount
const amountIn = parseUnits("1", 18); // 1 ETH
const route = await ensoClient.getRouteData({
chainId,
fromAddress,
receiver: fromAddress,
routingStrategy: "router",
tokenIn: [ETH],
tokenOut: [uniswap_ETH_USDC_LP],
amountIn: [amountIn],
slippage: "100" // 1%
});
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/route' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "router",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0x06325440d014e39736583c165c2963ba99faf14e"],
"amountIn": ["1000000000000000000"],
"slippage": "100"
}' | jq
```
### Zap into a Morpho Blue Vault
Zap a Morpho USDC vault position, represented by `0xc1fc3492f7b9c64871389d2a223eef6ccc165fb0`.
**Example**: Going from 1 ETH to Morpho USDC position
* **Output**: Morpho Blue USDC vault tokens
* **Slippage**: 3%
```typescript SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const morphoUsdcVault = "0xBEeFFF209270748ddd194831b3fa287a5386f5bC";
// Define amount
const amountIn = parseUnits("1", 18); // 1 ETH
const route = await ensoClient.getRouteData({
chainId,
fromAddress,
receiver: fromAddress,
routingStrategy: "router",
tokenIn: [ETH],
tokenOut: [morphoUsdcVault],
amountIn: [amountIn],
slippage: "300" // 3%
});
```
```bash theme={null}
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation" \
-d '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"amountIn": ["1000000000000000000"],
"slippage": "300",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0xBEeFFF209270748ddd194831b3fa287a5386f5bC"],
"routingStrategy": "router"
}' \
"https://api.enso.finance/api/v1/shortcuts/route" \
| jq
```
### Simple LST Zapping
Direct entry into or exit from liquid staking tokens.
**Example**: Converting 1 stETH back to ETH
* **Input**: 1 stETH (Lido Staked ETH)
* **Output**: ETH (varies with current discount/premium)
* **Slippage**: 1%
```ts SDK theme={null}
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84";
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
// Define amount
const amountIn = parseUnits("1", 18); // 1 stETH
const route = await ensoClient.getRouteData({
chainId,
fromAddress,
receiver: fromAddress,
routingStrategy: "router",
tokenIn: [stETH],
tokenOut: [ETH],
amountIn: [amountIn],
slippage: "100" // 1%
});
```
```bash theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/route' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "router",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],
"tokenOut": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"amountIn": ["1000000000000000000"],
"slippage": "100"
}' | jq
```
*Note*: Limited to simple LST interactions without complex staking steps. Use Bundle API for multi-step LST staking flows.
## 2. Bundling DeFi Actions
The Bundle API (POST `/v1/shortcuts/bundle`) excels at orchestrating complex sequences of operations.
### Multi-Position Entry
Splitting funds across several positions simultaneously
**Example**: Distributing 1 ETH into three LST tokens in one transaction
* **Input**: 1 ETH
* **Slippage**: 1% for each conversion
* **Outputs**:
1. stETH (Lido Staked ETH)
2. rETH (Rocket Pool ETH)
3. cbETH (Coinbase Staked ETH)
* **Process**:
1. Convert 1/3 ETH (0.333 ETH) to stETH
2. Convert 1/3 ETH (0.333 ETH) to rETH
3. Convert 1/3 ETH (0.334 ETH) to cbETH
```typescript SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84";
const rETH = "0xae78736cd615f374d3085123a210448e74fc6393";
const cbETH = "0xbe9895146f7af43049ca1c1ae358b0541ea49704";
// Define amounts
const amountToStEth = parseUnits("0.333", 18);
const amountToREth = parseUnits("0.333", 18);
const amountToCbEth = parseUnits("0.334", 18);
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: stETH,
amountIn: amountToStEth,
slippage: "100",
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: rETH,
amountIn: amountToREth,
slippage: "100",
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: cbETH,
amountIn: amountToCbEth,
slippage: "100",
},
},
],
);
```
```bash theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
"amountIn": "333000000000000000",
"slippage": "100"
}
},
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0xae78736cd615f374d3085123a210448e74fc6393",
"amountIn": "333000000000000000",
"slippage": "100"
}
},
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0xbe9895146f7af43049ca1c1ae358b0541ea49704",
"amountIn": "334000000000000000",
"slippage": "100"
}
}
]' | jq
```
### Single-Asset Zap into Uniswap V3 Concentrated Liquidity
Provide liquidity to a two-asset Uniswap V3 pool using a single token as input.
Enso automatically handles swapping for the second token and balancing the pair before depositing.
**Example**: Use AAVE to provide concentrated liquidity to a WETH/AAVE pool on Uniswap v3 on Arbitrum.
* **Input**: 10 AAVE
* **Output token**: the `NonfungiblePositionManager` that mints and manages NFT-based receipts for provided liquidity.
* **Final Result**: A Uniswap V3 NFT representing a concentrated liquidity position in the WETH/AAVE pool.
* **Process**:
1. The `enso.split` action takes the input AAVE and swaps the optimal amount for WETH to create a balanced pair required by the Uniswap pool.
2. The `uniswap-v3.depositclmm` action takes the resulting WETH and AAVE from the previous step.
3. It deposits both tokens as liquidity into the specified pool within the defined tick range (`25320` to `25980`).
```ts SDK theme={null}
const chainId = 42161; // Arbitrum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const tokenIn_AAVE = "0xba5ddd1f9d7f570dc94a51479a000e3bce967196";
const tokenOut_WETH = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1";
const uniswapManager = "0xc36442b4a4522e871399cd717abdd847ab11fe88";
// Define amount
const amountIn = parseUnits("10", 18); // 10 AAVE
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "router",
},
[
{
// Split AAVE into 2 equal parts
// Converts the first half into WETH
// needed for AAVE/WETH pool
protocol: "enso",
action: "split",
args: {
tokenIn: tokenIn_AAVE,
tokenOut: [tokenOut_WETH, tokenIn_AAVE],
amountIn: amountIn,
},
},
{
protocol: "uniswap-v3",
action: "depositclmm",
args: {
tokenOut: uniswapManager,
ticks: [25320, 25980],
tokenIn: [tokenOut_WETH, tokenIn_AAVE],
poolFee: "3000",
amountIn: [
// use output from the split call
{ useOutputOfCallAt: 0, index: 0 },
{ useOutputOfCallAt: 0, index: 1 },
],
},
},
]);
const approvalData = await client.getApprovalData({
amount: amountIn,
chainId,
fromAddress,
tokenAddress: tokenIn_AAVE,
});
// Approve Enso Router contract (bundle.tx.to) to operate with tokens
await signEoa(approvalData.tx, approvalData.gas);
// Sign and send transaction with simulated gas to out-of-gas errors
await signEoa(bundle.tx, bundle.gas);
```
```bash cURL theme={null}
curl -X POST \
"https://api.enso.finance/api/v1/shortcuts/bundle?chainId=42161&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=router" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d "[
{
"protocol": "enso",
"action": "split",
"args": {
"tokenIn": "0xba5ddd1f9d7f570dc94a51479a000e3bce967196",
"tokenOut": [
"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
"0xba5ddd1f9d7f570dc94a51479a000e3bce967196"
],
"amountIn": "10000000000000000000"
}
},
{
"protocol": "uniswap-v3",
"action": "depositclmm",
"args": {
"tokenOut": "0xc36442b4a4522e871399cd717abdd847ab11fe88",
"ticks": [
25320,
25980
],
"tokenIn": [
"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
"0xba5ddd1f9d7f570dc94a51479a000e3bce967196"
],
"poolFee": "3000",
"amountIn": [
{
"useOutputOfCallAt": 0,
"index": 0
},
{
"useOutputOfCallAt": 0,
"index": 1
}
]
}
}
]" | jq
```
### Multiple-Asset Zap to SushiSwap V3 LP
To deposit into Sushiswap V3 `AUSD/USDC` poool, you need to use the `bundle` API.
```mermaid theme={null}
flowchart LR
A((USDC)) --> B{enso.split}
subgraph split ["enso.split"]
B -->|swap via enso| E((AUSD))
B -->|keep as USDC| F((USDC))
end
E -->|depositclmm via sushiswap-v3| G((LP NFT))
F -->|depositclmm via sushiswap-v3| G
```
**Bundle Design**:
* Input of 100 `USDC` must be split into 2 tokens: `AUSD` and `USDC`, using Enso's `split` action that converts 50% of USDC into AUSD, and keeps the rest untouched
* Deposit using `depositclmm` action of `sushiswap-v3` protocol.
* `tokenIn` are the pool's tokens (`USDC/AUSD`)
* `amountIn` is an array of amounts obtained from the split into `USDC` and `AUSD` respectively, using dynamic quantity reference (`useOutputOfCallAt`).
* The `tokenOut` value is the address of Sushiswap's position manager contract.
* Provide correct fee and ticks.
```ts linenums="1" theme={null}
export async function sushiswapV3() {
const chainId = 747474;
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const tokenIn_USDC = "0x203A662b0BD271A6ed5a60EdFbd04bFce608FD36";
const tokenOut_AUSD = "0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a";
const sushiswapManager = "0x2659C6085D26144117D904C46B48B6d180393d27";
const amountIn = parseUnits("100", 6); // 100 USDC
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "router",
},
[
{
// Split USDC into 2 parts for the LP position
protocol: "enso",
action: "split",
args: {
tokenIn: tokenIn_USDC,
tokenOut: [tokenOut_AUSD, tokenIn_USDC],
amountIn: amountIn.toString(),
},
},
{
protocol: "sushiswap-v3",
action: "depositclmm",
args: {
tokenOut: sushiswapManager,
ticks: [-114, -86],
poolFee: "100",
tokenIn: [tokenOut_AUSD, tokenIn_USDC],
amountIn: [
{ useOutputOfCallAt: 0, index: 0 }, // AUSD from split
{ useOutputOfCallAt: 0, index: 1 }, // USDC from split
],
},
},
]
);
const approvalData = await client.getApprovalData({
amount: amountIn.toString(),
chainId,
fromAddress,
tokenAddress: tokenIn_USDC,
});
// Approve Enso Router contract to operate with USDC
await sendEoa(approvalData.tx, approvalData.gas);
// Execute the bundle transaction
await sendEoa(bundle.tx, bundle.gas);
return bundle;
}
```
### Staking Pipeline
Chain multiple actions together to create a complete Curve LP staking workflow.
**Example**: Creating a staked Curve 3pool position starting with 1 ETH
* **Input**: 1 ETH
* **Final Output**: 3pool LP tokens staked in Curve gauge
* **Process**:
1. Swap 1 ETH to USDC
2. Deposit USDC into Curve 3pool to get 3pool LP tokens
3. Stake 3pool LP tokens in the Curve gauge
```typescript SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const curve3poolLp = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490";
const curve3poolGauge = "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A";
const curve3pool = "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7";
// Define amount
const amountIn = parseUnits("1", 18); // 1 ETH
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: USDC,
amountIn: amountIn,
slippage: "300",
},
},
{
protocol: "curve",
action: "deposit",
args: {
tokenIn: USDC,
tokenOut: curve3poolLp,
amountIn: { useOutputOfCallAt: 0 },
primaryAddress: curve3pool,
},
},
{
protocol: "curve-gauge",
action: "deposit",
args: {
tokenIn: curve3poolLp,
tokenOut: curve3poolGauge,
amountIn: { useOutputOfCallAt: 1 },
primaryAddress: curve3poolGauge,
},
},
]);
```
```bash theme={null}
curl -X 'POST' \
"https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate" \
-H 'accept: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-H 'Content-Type: application/json' \
-d '[
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"amountIn": '1000000000000000000',
"slippage": "300"
}
},
{
"protocol": "curve",
"action": "deposit",
"args": {
"tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
"amountIn": {
"useOutputOfCallAt": 0
},
"primaryAddress": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7"
}
},
{
"protocol": "curve-gauge",
"action": "deposit",
"args": {
"tokenIn": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
"tokenOut": "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A",
"amountIn": {
"useOutputOfCallAt": 1
},
"primaryAddress": "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A"
}
}
]' | jq
```
### Portfolio Rebalancing
Adjusting position sizes across multiple protocols.
**Example**: Rebalancing from 70% `ETH` + 30% `USDC` to 50% `ETH` + 50% `USDC` across Aave positions
* **Input**: 0.6 WETH (for reallocation)
* **Output**:
1. 0.4 WETH deposited to Aave (aWETH)
2. \~\$580 USDC (from 0.2 WETH) deposited to Aave (aUSDC)
* **Process**:
1. Convert 0.2 WETH to USDC
2. Deposit 0.4 WETH into Aave (aWETH position)
3. Deposit the acquired USDC into Aave (aUSDC position)
```ts SDK theme={null}
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const aWETH = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
const aUSDC = "0xbcca60bb61934080951369a648fb03df4f96263c";
const aaveV3Pool = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
// Define amounts
const amountToSwap = parseUnits("0.2", 18);
const amountToDeposit = parseUnits("0.4", 18);
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: WETH,
tokenOut: USDC,
amountIn: amountToSwap,
slippage: "100",
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: WETH,
tokenOut: aWETH,
amountIn: amountToDeposit,
primaryAddress: aaveV3Pool,
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: USDC,
tokenOut: aUSDC,
amountIn: { useOutputOfCallAt: 0 },
primaryAddress: aaveV3Pool,
},
},
]);
```
```bash theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"amountIn": "200000000000000000",
"slippage": "100"
}
},
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
"amountIn": "400000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0xbcca60bb61934080951369a648fb03df4f96263c",
"amountIn": {
"useOutputOfCallAt": 0
},
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
}
]' | jq
```
### Position Migration
Moving from one protocol to another
**Example**: Migrating 1 aWETH from Aave to Compound's cETH
* **Input**: 1 aWETH (Aave WETH)
* **Output**: cETH (Compound ETH)
* **Process**:
1. Withdraw 1 WETH from Aave by redeeming aWETH
2. Unwrap WETH to ETH
3. Deposit ETH into Compound to get cETH
```typescript SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const aWETH = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const cETH = "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5";
const aaveV3Pool = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
const compoundCEth = "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5";
// Define amount
const amountIn = parseUnits("1", 18); // 1 aWETH
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "redeem",
args: {
tokenIn: aWETH,
tokenOut: WETH,
amountIn: amountIn,
primaryAddress: aaveV3Pool,
},
},
{
protocol: "wrapped-native",
action: "redeem",
args: {
tokenIn: WETH,
tokenOut: ETH,
amountIn: { useOutputOfCallAt: 0 },
primaryAddress: WETH,
},
},
{
protocol: "compound-v2",
action: "deposit",
args: {
tokenIn: ETH,
tokenOut: cETH,
amountIn: { useOutputOfCallAt: 1 },
primaryAddress: compoundCEth,
},
},
],
);
```
```bash theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "aave-v3",
"action": "redeem",
"args": {
"tokenIn": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
"tokenOut": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amountIn": "1000000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "wrapped-native",
"action": "redeem",
"args": {
"tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"amountIn": {
"useOutputOfCallAt": 0
},
"primaryAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
}
},
{
"protocol": "compound-v2",
"action": "deposit",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5",
"amountIn": {
"useOutputOfCallAt": 1
},
"primaryAddress": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5"
}
}
]' | jq
```
### Leveraged Positions
Creating leveraged positions through multiple actions
**Example**: Creating a 2x ETH position using Aave
* **Input**: 1 WETH initial collateral
* **Final Result**: WETH worth of collateral in Aave
* **Process**:
1. Deposit 1 WETH as collateral in Aave
2. Borrow \~1,000 USDC against the WETH collateral
3. Swap the borrowed 1,000 USDC back to \~0.35 WETH
4. Deposit the additional WETH back into Aave as more collateral
```ts SDK theme={null}
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
const aWETH = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const aaveV3Pool = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
// Define amounts
const initialDeposit = parseUnits("1", 18);
const borrowAmount = parseUnits("1000", 6);
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: WETH,
tokenOut: aWETH,
amountIn: initialDeposit,
primaryAddress: aaveV3Pool,
},
},
{
protocol: "aave-v3",
action: "borrow",
args: {
collateral: WETH,
tokenOut: USDC,
amountOut: borrowAmount,
primaryAddress: aaveV3Pool,
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDC,
tokenOut: WETH,
amountIn: { useOutputOfCallAt: 1 },
slippage: "100",
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: WETH,
tokenOut: aWETH,
amountIn: { useOutputOfCallAt: 2 },
primaryAddress: aaveV3Pool,
},
},
],
);
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
"amountIn": "1000000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "aave-v3",
"action": "borrow",
"args": {
"collateral": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"amountOut": "1000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amountIn": {
"useOutputOfCallAt": 1
},
"slippage": "100"
}
},
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
"amountIn": {
"useOutputOfCallAt": 2
},
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
}
]' | jq
```
### Zap into multiple LPs
Multi-step entry into or exit from liquid staking tokens with additional operations.
**Example**: Creating diversified LP and LST positions with 1 ETH
* **Input**: 1 ETH split evenly
* **Slippage**: 3% for each conversion
* **Process**:
1. Convert 0.5 ETH to stETH/ETH Curve LP tokens
2. Convert 0.5 ETH to BAL/WETH Balancer LP tokens
```ts SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const curve_stETH_ETH_Lp = "0x06325440D014e39736583c165C2963BA99fAf14E";
const balancer_BAL_WETH_Lp = "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56";
// Define amount
const amountIn = parseUnits("0.5", 18);
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: curve_stETH_ETH_Lp,
amountIn: amountIn,
slippage: "300",
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: balancer_BAL_WETH_Lp,
amountIn: amountIn,
slippage: "300",
},
},
]);
```
```bash theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0x06325440D014e39736583c165C2963BA99fAf14E",
"amountIn": "500000000000000000",
"slippage": "300"
}
},
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56",
"amountIn": "500000000000000000",
"slippage": "300"
}
}
]' | jq
```
### Yield Compounding Flow
Automate yield compounding by harvesting rewards, swapping, and redepositing in a single transaction.
**Example**: Compounding Curve gauge rewards back into the stETH/ETH pool
* **Input**: Existing position in stETH/ETH Curve gauge
* **Slippage**: 3%
* **Process**:
1. Harvest accumulated wstETH rewards from the Curve gauge
2. Convert wstETH rewards to stETH
3. Deposit stETH back into the stETH/ETH Curve pool
```ts SDK theme={null}
// Token and Protocol Addresses
const rewardToken_wstETH = "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0";
const depositToken_stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84";
const lpToken_curve_stETH_ETH = "0x06325440d014e39736583c165c2963ba99faf14e";
const curveGauge = "0x182B723a58739a9c974cFDB385ceaDb237453c28";
const curvePool = "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022";
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
receiver: fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "curve-gauge",
action: "harvest",
args: {
token: rewardToken_wstETH,
primaryAddress: curveGauge,
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: rewardToken_wstETH,
tokenOut: depositToken_stETH,
amountIn: { useOutputOfCallAt: 0 },
slippage: "300",
},
},
{
protocol: "curve",
action: "deposit",
args: {
tokenIn: depositToken_stETH,
tokenOut: lpToken_curve_stETH_ETH,
amountIn: { useOutputOfCallAt: 1 },
primaryAddress: curvePool,
},
},
],
);
```
```bash theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate&receiver=0xd8da6bf26964af9d7eed9e03e53415d37aa96045' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "curve-gauge",
"action": "harvest",
"args": {
"token": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
"primaryAddress": "0x182B723a58739a9c974cFDB385ceaDb237453c28"
}
},
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
"amountIn": { "useOutputOfCallAt": 0 },
"slippage": "300"
}
},
{
"protocol": "curve",
"action": "deposit",
"args": {
"tokenIn": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
"tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
"amountIn": { "useOutputOfCallAt": 1 },
"primaryAddress": "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022"
}
}
]
' | jq
```
### Liquid Staking Derivative Looping
Create a leveraged position with liquid staking tokens through recursive borrowing and depositing in a lending protocol.
**Example**: Implement a multi-loop leveraged position on Lido Staked ETH (wstETH) using Aave V3 as the lending platform.
* **Input**: 10 wstETH
* **Final Result**: \~18.32 wstETH deposited with \~8.32 wstETH borrowed (1.83x leverage)
* **Process**:
1. Deposit 10 wstETH as collateral into Aave V3
2. Borrow 5.4 wstETH against your deposited collateral
3. Deposit the borrowed wstETH back as additional collateral
4. Borrow 2.916 wstETH against your increased collateral
5. Deposit this amount back again as additional collateral
```typescript SDK theme={null}
import { parseUnits } from "ethers/lib/utils";
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const wstETH = "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0";
const aWstETH = "0x0B925eD163218f6662a35E0F0371Ac234F9E9371";
const aaveV3Pool = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
// Define amounts
const initialDeposit = parseUnits("10", 18);
const firstBorrow = parseUnits("5.4", 18);
const secondBorrow = parseUnits("2.916", 18);
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: wstETH,
tokenOut: aWstETH,
amountIn: initialDeposit,
primaryAddress: aaveV3Pool,
},
},
{
protocol: "aave-v3",
action: "borrow",
args: {
collateral: wstETH,
tokenOut: wstETH,
amountOut: firstBorrow,
primaryAddress: aaveV3Pool,
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: wstETH,
tokenOut: aWstETH,
amountIn: firstBorrow,
primaryAddress: aaveV3Pool,
},
},
{
protocol: "aave-v3",
action: "borrow",
args: {
collateral: wstETH,
tokenOut: wstETH,
amountOut: secondBorrow,
primaryAddress: aaveV3Pool,
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: wstETH,
tokenOut: aWstETH,
amountIn: secondBorrow,
primaryAddress: aaveV3Pool,
},
},
],
);
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"tokenOut": "0x0B925eD163218f6662a35E0F0371Ac234F9E9371",
"amountIn": "10000000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "aave-v3",
"action": "borrow",
"args": {
"collateral": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"tokenOut": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"amountOut": "5400000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"tokenOut": "0x0B925eD163218f6662a35E0F0371Ac234F9E9371",
"amountIn": "5400000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "aave-v3",
"action": "borrow",
"args": {
"collateral": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"tokenOut": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"amountOut": "2916000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"tokenOut": "0x0B925eD163218f6662a35E0F0371Ac234F9E9371",
"amountIn": "2916000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
}
]' | jq
```
### Cross-Chain Route-Bridge
Execute a route and bridge tokens to another chain in a single transaction using the route-bridge functionality.
**Example**: Bridging 1 ETH from Ethereum to Optimism and converting to USDT
* **Input**: 1 ETH on Ethereum
* **Output**: USDT on Optimism
* **Process**:
1. Route 1 ETH to USDT on Ethereum
2. Bridge the resulting USDT to Optimism
3. Receive USDT on Optimism
**Important**: When using `destinationChainId`, you **must** include `refundReceiver` to handle any potential refunds from failed bridge operations.
```ts SDK theme={null}
const chainId = 1; // Ethereum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token Addresses
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const USDT_optimism = "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58";
// Define amount
const amountIn = parseUnits("1", 18); // 1 ETH
const bundle = await ensoClient.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH, // ETH on Ethereum
tokenOut: USDT_optimism, // USDT on Optimism
amountIn: amountIn,
destinationChainId: 10, // Optimism
refundReceiver: fromAddress, // Required for route-bridge
},
},
],
);
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",
"amountIn": "1000000000000000000",
"destinationChainId": 10,
}
}
]' | jq
```
Updated {date_0}
# Authentication
Source: https://docs.enso.build/pages/build/get-started/authentication
Obtain Enso API key to access the Enso API.
export const date_0 = "2025-04-11"
## Obtain API Key
1. Create an API key using [Enso Dashboard](https://developers.enso.build).
2. Securely store your API key and make it available in your environment:
```bash authentication.sh theme={null}
ENSO_API_KEY="$ENSO_API_KEY"
echo $ENSO_API_KEY >> .env
git ignore .env
source .env
```
## Test
```bash theme={null}
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"http://api.enso.finance/api/v1/shortcuts/route?chainId=1&fromAddress=0x9008D19f58AAbD9eD0D60971565AA8510560ab41&tokenIn=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&tokenOut=0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56&amountIn=326880000000000000000&tokenInAmountToTransfer=326880000000000000000" \
| jq
```
## Rate Limiting
API calls are limited to 10 RPS (60 requests per minute). It can be increased on demand.
If you exceed the limit, you'll receive a `429 Too Many Requests` error.
Updated {date_0}
# Get Balances
Source: https://docs.enso.build/pages/build/get-started/balances
Get balances of tokens in a wallet address.
## Balances Information
The `/balances` endpoint returns all wallet balances across protocols and networks Enso supports.
**API Reference:** [GET `/v1/wallet/balances`](/api-reference/defi/wallet-balances)
```json theme={null}
[
{
"token": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"amount": "7568910913750864",
"decimals": 18,
"price": 2559.27,
"name": "ETH",
"symbol": "ETH",
"logoUri": "https://static.debank.com/image/coin/logo_url/eth/6443cdccced33e204d90cb723c632917.png"
},
{
"token": "0x030ba81f1c18d280636f32af80b9aad02cf0854e",
"amount": "2455429",
"decimals": 18,
"price": 2509.83,
"name": "Aave interest bearing WETH",
"symbol": "aWETH",
"logoUri": "https://static.debank.com/image/eth_token/logo_url/0x030ba81f1c18d280636f32af80b9aad02cf0854e/b6910e236da889f08602435e79c08f98.png"
}
]
```
## Example Request
```ts EnsoSDK theme={null}
import { EnsoClient } from '@ensofinance/sdk';
// Initialize the client with your API key
const enso = new EnsoClient({
apiKey: 'YOUR_API_KEY' // Replace with your actual API key
});
// Get user balances across all protocols on a specific chain
async function getUserBalances(chainId: number, address: string) {
try {
const balances = await enso.getBalances({
chainId,
eoaAddress: address,
useEoa: true // Get balances for EOA; set to false for Enso Smart Wallet
});
console.log(`Balances for ${address} on chain ${chainId}:`, balances);
return balances;
} catch (error) {
console.error('Error fetching user balances:', error);
throw error;
}
}
// Get user balances on Ethereum
getUserBalances(1, '0xd8da6bf26964af9d7eed9e03e53415d37aa96045');
```
```bash cURL theme={null}
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.finance/api/v1/wallet/balances?chainId=1&eoaAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&useEoa=true" \
| jq
```
# Bundling Actions
Source: https://docs.enso.build/pages/build/get-started/bundling-actions
Bundle several DeFi actions into a single transaction using the `bundle` API.
The Bundle API is Enso's **multi-action orchestration engine** that executes complex DeFi workflows atomically.
**Would `route` do the job?**
The `route` API might be the simpler way to route your assets.
Before using the bundle API, check if `route` would work using [happypath](https://happypath.enso.build).
While the Route API automatically finds optimal paths between positions, the Bundle API gives you precise control over each action in your sequence - perfect for custom strategies, multi-protocol operations, and advanced DeFi automation.
**Bundle vs Route**: Choose Bundle when you need specific execution order, multi-protocol interactions, or actions beyond simple swaps and deposits. Use Route when you want Enso to handle the optimization automatically.
**Atomic execution**: All actions in a bundle succeed together or revert entirely - no partial executions or stuck funds.
## Quick Start
The Bundle API accepts an array of actions that execute sequentially. Each action can use outputs from previous actions, enabling complex workflows impossible with separate transactions.
Bundle supports 15+ action types across 50+ protocols. Common actions include `swap`, `deposit`, `borrow`, `harvest`, and `bridge`. See our [Actions Reference](/pages/build/reference/actions) for the complete list.
```typescript theme={null}
// Harvest rewards → Swap to base token → Redeposit
[
{
protocol: "curve-gauge",
action: "harvest",
args: {
token: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
primaryAddress: "0x182B723a58739a9c974cFDB385ceaDb237453c28"
}
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
tokenOut: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
amountIn: { useOutputOfCallAt: 0 }, // Use harvested amount
slippage: "300"
}
},
{
protocol: "curve",
action: "deposit",
args: {
tokenIn: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
tokenOut: "0x06325440d014e39736583c165c2963ba99faf14e",
amountIn: { useOutputOfCallAt: 1 }, // Use swapped amount
primaryAddress: "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022"
}
}
]
```
```typescript theme={null}
// Split 1 ETH across three liquid staking tokens
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
tokenOut: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", // stETH
amountIn: "333000000000000000",
slippage: "100"
}
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
tokenOut: "0xae78736cd615f374d3085123a210448e74fc6393", // rETH
amountIn: "333000000000000000",
slippage: "100"
}
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
tokenOut: "0xbe9895146f7af43049ca1c1ae358b0541ea49704", // cbETH
amountIn: "334000000000000000",
slippage: "100"
}
}
]
```
```typescript theme={null}
// Exit Aave → Enter Compound
[
{
protocol: "aave-v3",
action: "redeem",
args: {
tokenIn: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", // aWETH
tokenOut: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH
amountIn: "1000000000000000000",
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
protocol: "wrapped-native",
action: "redeem",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
tokenOut: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
amountIn: { useOutputOfCallAt: 0 },
primaryAddress: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
}
},
{
protocol: "compound-v2",
action: "deposit",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
tokenOut: "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5", // cETH
amountIn: { useOutputOfCallAt: 1 },
primaryAddress: "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5"
}
}
]
```
```typescript theme={null}
// Deposit → Borrow → Swap → Redeposit (2x leverage)
[
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH
tokenOut: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", // aWETH
amountIn: "1000000000000000000", // 1 WETH
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
protocol: "aave-v3",
action: "borrow",
args: {
collateral: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
amountOut: "2000000000", // 2000 USDC
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
tokenOut: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
amountIn: { useOutputOfCallAt: 1 },
slippage: "100"
}
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
tokenOut: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
amountIn: { useOutputOfCallAt: 2 },
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
}
]
```
## Core Concepts
Each action requires: `protocol` (where to execute), `action` (what to do), and `args` (action-specific parameters). Actions execute in array order.
Use `useOutputOfCallAt` to reference previous action outputs. This enables chaining without knowing amounts in advance - critical for harvesting, compounding, and multi-step strategies.
All actions succeed or all revert. No partial executions, no stuck funds. Failed actions revert the entire bundle, protecting against incomplete workflows.
One transaction instead of many. Bundle saves 20-40% on gas compared to separate transactions, plus reduced MEV exposure.
Not all actions work for every protocol! To check which actions are supported per protocol, use the SDK's `getActionsBySlug` ([GET `/v1/actions/{protocol}`](/api-reference/integration/actions-for-protocol)) method.
## Request Structure
Each action in the bundle array follows this structure:
```typescript theme={null}
{
protocol: string, // Protocol identifier (e.g., "aave-v3", "uniswap-v2")
action: string, // Action type (e.g., "deposit", "swap", "borrow")
args: { // Action-specific arguments
tokenIn?: string,
tokenOut?: string,
amountIn?: string | { useOutputOfCallAt: number },
primaryAddress?: string,
// ... other protocol-specific args
}
}
```
**Key parameters:**
* **`primaryAddress`**: Protocol's main contract (pool, vault, router)
* **`useOutputOfCallAt`**: Reference output from action at index N
* **`receiver`**: Optional override for output recipient
* **`slippage`**: Basis points for price protection (100 = 1%)
## Examples
### 0. Install & Authenticate
You can interact with the API using Enso SDK or directly via REST API.
```bash npm theme={null}
npm i @ensofinance/sdk
```
```bash pnpm theme={null}
pnpm i @ensofinance/sdk
```
```bash yarn theme={null}
yarn add @ensofinance/sdk
```
To use the API, authenticate using your [API key](/pages/build/get-started/authentication).
```typescript SDK theme={null}
import { EnsoClient } from '@ensofinance/sdk';
const ensoClient = new EnsoClient({
apiKey: 'your-api-key-here'
});
```
```bash Environment theme={null}
export ENSO_API_KEY="your-api-key-here"
```
### 1. Basic Bundle: Swap and Deposit
Start with a simple two-action bundle that swaps ETH for USDC, then deposits into Aave.
The first action (`route`) will invoke Enso's automatic routing engine and optimize ETH → USDC path,
This simple example is completely achievable with [DeFi Swap and Routing](/pages/build/get-started/route). This is for illustrative purposes only.
```typescript SDK theme={null}
const bundle = await ensoClient.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate"
},
[
// Step 1: Swap ETH to USDC
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH
tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
amountIn: "1000000000000000000", // 1 ETH
slippage: "100" // 1%
}
},
// Step 2: Deposit USDC to Aave (fixed amount)
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
tokenOut: "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c", // aUSDC
amountIn: "2000000000", // 2000 USDC
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
}
]
);
// Execute the bundle
await wallet.sendTransaction(bundle.tx);
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"amountIn": "1000000000000000000",
"slippage": "100"
}
},
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c",
"amountIn": "2000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
}
]' | jq
```
**What's happening**: This bundle swaps 1 ETH for USDC, then deposits exactly 2000 USDC to Aave. Note the fixed amount in the second action - we'll make this dynamic next.
### 2. Dynamic Chaining: Harvest and Compound
Use `useOutputOfCallAt` to chain actions dynamically.
```typescript SDK theme={null}
const bundle = await ensoClient.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate"
},
[
// Step 1: Split 1 ETH into 3 equal portions
{
protocol: "enso",
action: "split",
args: {
tokenIn: ETH,
tokenOut: [ETH, ETH, ETH],
amountIn: "1000000000000000000", // 1 ETH
receiver: userAddress,
},
},
// Step 2: Route first portion to stETH
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: stETH,
amountIn: { useOutputOfCallAt: [0, 0] }, // First output from split
slippage: "100",
receiver: userAddress,
},
},
// Step 3: Route second portion to rETH
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: rETH,
amountIn: { useOutputOfCallAt: [0, 1] }, // Second output from split
slippage: "100",
receiver: userAddress,
},
},
// Step 4: Route third portion to cbETH
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH,
tokenOut: cbETH,
amountIn: { useOutputOfCallAt: [0, 2] }, // Third output from split
slippage: "100",
receiver: userAddress,
},
},
]
);
console.log('Compound tx ready:', bundle.tx);
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "curve-gauge",
"action": "harvest",
"args": {
"token": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
"primaryAddress": "0x182B723a58739a9c974cFDB385ceaDb237453c28"
}
},
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
"amountIn": { "useOutputOfCallAt": 0 },
"slippage": "300"
}
},
{
"protocol": "curve",
"action": "deposit",
"args": {
"tokenIn": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
"tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
"amountIn": { "useOutputOfCallAt": 1 },
"primaryAddress": "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022"
}
}
]' | jq
```
**Key concept**: `useOutputOfCallAt: 0` references the output from the first action (index 0). This enables compound strategies without knowing reward amounts in advance.
### 4. Leveraged Position
Create a 2x leveraged position by borrowing against deposited collateral.
```typescript SDK theme={null}
const bundle = await ensoClient.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate"
},
[
// Deposit WETH as collateral
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH
tokenOut: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", // aWETH
amountIn: "1000000000000000000", // 1 WETH
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
// Borrow USDC against WETH
{
protocol: "aave-v3",
action: "borrow",
args: {
collateral: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
amountOut: "2000000000", // 2000 USDC
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
// Swap borrowed USDC back to WETH
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
tokenOut: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
amountIn: { useOutputOfCallAt: 1 }, // All borrowed USDC
slippage: "100"
}
},
// Deposit the additional WETH
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
tokenOut: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
amountIn: { useOutputOfCallAt: 2 }, // All swapped WETH
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
}
]
);
console.log('2x leveraged WETH position created');
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
"amountIn": "1000000000000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "aave-v3",
"action": "borrow",
"args": {
"collateral": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"amountOut": "2000000000",
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
},
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amountIn": { "useOutputOfCallAt": 1 },
"slippage": "100"
}
},
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
"amountIn": { "useOutputOfCallAt": 2 },
"primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
}
}
]' | jq
```
**Leverage mechanics**: Deposit → Borrow → Swap → Redeposit creates leveraged exposure.
### 5. Cross-chain Bundle with Callbacks
Bridge assets and execute actions on the destination chain - all atomically.
**What's happening**: The `callback` array executes atomically on the destination chain. If any callback action fails, the entire operation (including the bridge) reverts - true cross-chain atomicity!
```typescript SDK theme={null}
export async function bridgeUsdcAndDepositToAave() {
const bundle = await client.getBundleData(
{
chainId: ETHEREUM_CHAIN_ID,
fromAddress: USER_ADDRESS,
routingStrategy: "delegate",
},
[
// Convert USDC to ETH for bridge fee
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDC_ETHEREUM,
tokenOut: ETH_ADDRESS,
amountIn: USDC_AMOUNT,
slippage: "100",
},
},
// Bridge ETH to Base with callback actions
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: STARGATE_PRIMARY_ADDRESS,
destinationChainId: BASE_CHAIN_ID,
tokenIn: ETH_ADDRESS,
amountIn: { useOutputOfCallAt: 0 },
receiver: USER_ADDRESS,
// These actions execute on Base after bridging!
callback: [
{
protocol: "enso",
action: "balance",
args: {
token: ETH_ADDRESS,
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: ETH_ADDRESS,
tokenOut: CBETH_BASE,
// amountIn: "10000000000000",
amountIn: { useOutputOfCallAt: 0 }, // Use bridged ETH
slippage: "200",
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: CBETH_BASE,
tokenOut: ACBETH_BASE,
amountIn: { useOutputOfCallAt: 1 }, // From the swap above
primaryAddress: AAVE_V3_PRIMARY_ADDRESS,
},
},
],
},
},
]
);
console.log("Cross-chain deposit ready:", bundle.tx);
}
// Addresses
const ETHEREUM_CHAIN_ID = 1;
const BASE_CHAIN_ID = 8453;
// User addresses
const USER_ADDRESS = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token addresses - Ethereum
const USDC_ETHEREUM = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
// Token addresses - Base
const CBETH_BASE = "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22";
const ACBETH_BASE = "0xcf3D55c10DB69f28fD1A75Bd73f3D8A2d9c595ad";
// Protocol addresses
const STARGATE_PRIMARY_ADDRESS = "0x77b2043768d28e9c9ab44e1abfc95944bce57931";
const AAVE_V3_PRIMARY_ADDRESS = "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5";
// Amounts
const USDC_AMOUNT = "3000000000"; // 3000 USDC
```
```bash cURL theme={null}
curl -X POST \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-d '[
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"amountIn": "3000000000",
"slippage": "100"
}
},
{
"protocol": "stargate",
"action": "bridge",
"args": {
"primaryAddress": "0x77b2043768d28e9c9ab44e1abfc95944bce57931",
"destinationChainId": 8453,
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"amountIn": { "useOutputOfCallAt": 0 },
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"callback": [
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0x2Ae3F1Ec7F328C4243D5eE",
"amountIn": { "useOutputOfCallAt": 0 },
"slippage": "200"
}
},
{
"protocol": "aave-v3",
"action": "deposit",
"args": {
"tokenIn": "0x2Ae3F1Ec7F328C4243D5eE",
"tokenOut": "0x078f358208685046a11C85e8ad32895DED33A249",
"amountIn": { "useOutputOfCallAt": 0 },
"primaryAddress": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5"
}
}
]
}
}
]' | jq
```
## Utility Actions
Bundle API includes helper actions for safety and flow control:
Get token balance mid-bundle:
```json theme={null}
{
"protocol": "enso",
"action": "balance",
"args": {
"token": "0xa0b8...b48"
}
}
```
Apply slippage to any output:
```json theme={null}
{
"protocol": "enso",
"action": "slippage",
"args": {
"amountOut": { "useOutputOfCallAt": 0 },
"bps": "100"
}
}
```
Enforce minimum amounts:
```json theme={null}
{
"protocol": "enso",
"action": "minAmountOut",
"args": {
"amountOut": { "useOutputOfCallAt": 0 },
"minAmountOut": "1000000000"
}
}
```
Take protocol fees:
```json theme={null}
{
"protocol": "enso",
"action": "fee",
"args": {
"token": "0xeee...eee",
"amount": { "useOutputOfCallAt": 0 },
"bps": "250",
"receiver": "0xfee...add"
}
}
```
## Next Steps
From here, you can explore other resources:
* **[Actions Reference](/pages/build/reference/actions)**: Complete list of supported actions and protocols
* **[Routing Strategies](/pages/build/reference/routing-strategies)**: Overview of `delegate` and `router` strategies for action execution\*\*.\*\*
* **[Shortcuts Library](/pages/build/examples/shortcuts)**: 20+ production-ready bundle examples
* **[Route API](/pages/build/get-started/route)**: When automatic routing is better than custom bundles
# Crosschain Routing
Source: https://docs.enso.build/pages/build/get-started/crosschain-routing
Execute complex DeFi operations across multiple blockchains using bridge callbacks and post-bridge execution
export const date_0 = "2025-09-30"
Crosschain routing enables complex multichain workflows that execute DeFi operations across multiple blockchains atomically. Unlike simple token transfers, crosschain routing orchestrates sophisticated strategies that span several chains.
Both `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.
```mermaid theme={null}
flowchart LR
subgraph berachain ["🐻 Berachain"]
USDC_BERA((USDC)) --> A1(( ))
end
A1 -.-> |balance check| USDC_ETH((USDC))
subgraph ethereum ["🌐 Ethereum"]
USDC_ETH((USDC)) -->|reservoir deposit| rUSD_ETH((rUSD))
end
rUSD_ETH -.-> |balance check|rUSD_BERA((rUSD))
subgraph berachain ["🐻 Berachain"]
rUSD_BERA((rUSD)) -->|euler-v2 deposit| erUSD((erUSD))
end
```
## Quick Start
Use the [GET `layerzero/pool`](/api-reference/integration/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.
```ts theme={null}
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: rusdEthToBeraPools[0].pool,
destinationChainId: ETHEREUM_ID,
...
callback: [
// Mint e-rUSD using bridged USDC on Ethereum
{
protocol: "reservoir",
action: "deposit",
args: {...},
},
// Bridge newly minted e-rUSD back to Berachain
{
protocol: "stargate",
action: "bridge",
args: {
destinationChainId: BERACHAIN_ID,
...
// Callback executes on Berachain after e-rUSD arrives
callback: [
// Deposit e-rUSD into Euler vault on Berachain
{
protocol: "euler-v2",
action: "deposit",
args: {...},
},
],
},
},
],
},
},
```
[**Try this route →**](https://happypath.enso.build/?chainId=1\&destinationChainId=8453\&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045\&routingStrategy=delegate\&tokenIn=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\&tokenOut=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\&amountIn=1000000000)
To simply bridge an asset, use the `route` API with automatic route optimization from input and output token/chain pairs.
```typescript SDK theme={null}
// Basic USDC transfer: Ethereum → Base
const route = await ensoClient.getRouteData({
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
chainId: 1, // Ethereum
destinationChainId: 8453, // Base
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC Ethereum
tokenOut: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], // USDC Base
amountIn: ["1000000000"], // 1,000 USDC
slippage: "300", // 3%
routingStrategy: "delegate"
});
await wallet.sendTransaction(route.tx);
```
```bash cURL theme={null}
curl --request POST \
--url https://api.enso.finance/api/v1/shortcuts/route \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ENSO_API_KEY" \
--data '{
"chainId": 1,
"destinationChainId": 8453,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "delegate",
"tokenIn": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"],
"tokenOut": ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"],
"amountIn": ["1000000000"],
"slippage": "300"
}' | jq
```
## Core Concepts
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.
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.
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:
* [simple crosschain swaps](#1-simple-cross-chain-swap)
* [crosschain zap deposits](#2-crosschain-vault-zap)
**Limitations**: Cannot handle custom post-bridge logic or multi-step protocols interactions
Use **Bundle API** for:
* [crosschain position minting](#3-cross-chain-position-minting)
* [crosschain yield strategies](#4-crosschain-yield-strategy)
* **Limitations**: Single callback sequence with up to 10 chained actions
Use the [GET `layerzero/pool`](/api-reference/integration/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.
```mermaid theme={null}
flowchart LR
subgraph ethereum ["🌐 Ethereum"]
ETH((ETH)) --> A1(( ))
end
A1 -.->|stargate bridge| B1
subgraph base ["🔵 Base"]
B1(( )) -->|balance check| USDC((USDC))
end
```
```typescript SDK theme={null}
// ETH on Ethereum → USDC on Base
const route = await ensoClient.getRouteData({
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
chainId: 1, // Ethereum
destinationChainId: 8453, // Base
tokenIn: ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"], // ETH
tokenOut: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], // USDC Base
amountIn: ["1000000000000000000"], // 1 ETH
slippage: "300", // 3%
routingStrategy: "delegate"
});
```
```bash cURL theme={null}
curl --request POST \
--url https://api.enso.finance/api/v1/shortcuts/route \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ENSO_API_KEY" \
--data '{
"chainId": 1,
"destinationChainId": 8453,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "delegate",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"],
"amountIn": ["1000000000000000000"],
"slippage": "300"
}' | jq
```
### 2. Crosschain Vault Zap
In this example, we'll bridge ETH from Ethereum to zap it to a Ether.fi `weETH` vault on Base.
[**Try this route →**](https://happypath.enso.build/?tokenIn=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\&outChainId=8453\&chainId=1\&tokenOut=0x04c0599ae5a44757c0af6f9ec3b93da8976c150a)
```mermaid theme={null}
flowchart LR
subgraph ethereum ["🌐 Ethereum"]
ETH((ETH)) --> A1(( ))
end
A1 -.->|stargate bridge| B1
subgraph base ["🔵 Base"]
B1(( )) -->|balance check| ETH_B((ETH))
ETH_B --> |ether.fi deposit|WEETH((weETH))
end
```
```typescript theme={null}
const route = await ensoClient.getRouteData({
fromAddress: "0x...",
chainId: 1, // Ethereum
destinationChainId: 8453, // Base
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC Ethereum
tokenOut: ["0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A"], // weETH vault on Base
amountIn: ["1000000000"], // 1,000 USDC
slippage: "500", // 5% (complex operation)
routingStrategy: "delegate"
});
// Bridge + vault entry in one transaction
await wallet.sendTransaction(route.tx);
```
### 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.
```mermaid theme={null}
flowchart LR
subgraph berachain ["🐻 Berachain"]
USDC_BERA((USDC)) --> A1(( ))
end
A1 -.-> B1
subgraph ethereum ["🌐 Ethereum"]
B1(( )) -->|balance check| USDC_ETH((USDC))
USDC_ETH -->|reservoir deposit| A2(( )) --> rUSD_ETH((rUSD))
end
rUSD_ETH -.-> C1
subgraph berachain ["🐻 Berachain"]
C1(( )) -->|balance check| rUSD_BERA((rUSD))
end
```
Use the [GET `layerzero/pool`](/api-reference/integration/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.
**What's happening**: This workflow demonstrates a complete round-trip bridge operation - taking USDC from Berachain, minting a stablecoin on Ethereum where the protocol exists, then bringing the newly minted e-rUSD back to the origin chain.
**Understanding callbacks execution**
Callbacks execute on the destination chain after the bridge completes, but they're not separate transactions. The bridge operation includes encoded instructions that execute atomically using Enso's crosschain execution engine. This means:
* **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.
```typescript mintOnBeraFromMainnet.ts highlight={21, 27, 48, 55, 79} lines theme={null}
// Chain IDs
const BERACHAIN_ID = 80094;
const ETHEREUM_ID = 1;
// Common addresses
const WALLET_ADDRESS = "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11"; // User wallet
// Token addresses
const USDC_BERACHAIN = "0x549943e04f40284185054145c6E4e9568C1D3241";
const USDC_ETHEREUM = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const RUSD_ETHEREUM = "0x09D4214C03D01F49544C0448DBE3A27f768F2b34";
// Protocol addresses
const RESERVOIR_MINTING_CONTRACT =
"0x4809010926aec940b550D34a46A52739f996D75D";
const client = new EnsoClient({
apiKey: process.env.ENSO_API_KEY || "your-api-key-here",
});
const usdcBeraToEthPools = await client.getLayerZeroPool({
chainId: BERACHAIN_ID,
token: USDC_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",
refundReceiver: WALLET_ADDRESS,
},
[
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: usdcBeraToEthPools[0].pool,
destinationChainId: ETHEREUM_ID,
tokenIn: USDC_BERACHAIN,
amountIn: parseUnits("1000", 6).toString(), // 1000 USDC
receiver: WALLET_ADDRESS,
callback: [
// Step 1: Check USDC balance on Ethereum after bridge
{
protocol: "enso",
action: "balance",
args: {
token: USDC_ETHEREUM,
},
},
// Step 2: Mint e-rUSD using bridged USDC
{
protocol: "reservoir",
action: "deposit",
args: {
primaryAddress: RESERVOIR_MINTING_CONTRACT,
tokenIn: USDC_ETHEREUM,
tokenOut: RUSD_ETHEREUM,
amountIn: { useOutputOfCallAt: 0 }, // Use USDC from balance check
receiver: WALLET_ADDRESS,
},
},
// Step 3: Bridge newly minted e-rUSD back to Berachain
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: rusdEthToBeraPools[0].pool,
destinationChainId: BERACHAIN_ID,
tokenIn: RUSD_ETHEREUM,
amountIn: { useOutputOfCallAt: 1 }, // Use e-rUSD from minting
receiver: WALLET_ADDRESS,
},
},
],
},
},
]
);
```
### 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.
```mermaid theme={null}
flowchart LR
subgraph berachain ["🐻 Berachain"]
USDC_BERA((USDC)) --> A1(( ))
end
A1 -.-> |balance check| USDC_ETH((USDC))
subgraph ethereum ["🌐 Ethereum"]
USDC_ETH((USDC)) -->|reservoir deposit| rUSD_ETH((rUSD))
end
rUSD_ETH -.-> |balance check|rUSD_BERA((rUSD))
subgraph berachain ["🐻 Berachain"]
rUSD_BERA((rUSD)) -->|euler-v2 deposit| erUSD((erUSD))
end
```
```typescript mintOnBeraDepositOnMainnet.ts highlight={50, 57, 81, 89, 23, 29} lines theme={null}
const BERACHAIN_ID = 80094;
const ETHEREUM_ID = 1;
// Common addresses
const WALLET_ADDRESS = "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11"; // User wallet
// Token addresses
const USDC_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 =
"0x109D6D1799f62216B4a7b0c6e245844AbD4DD281"; // Euler vault for e-rUSD on Berachain (need actual address)
const client = new EnsoClient({
apiKey: process.env.ENSO_API_KEY!,
});
const usdcBeraToEthPools = await client.getLayerZeroPool({
chainId: BERACHAIN_ID,
token: USDC_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",
refundReceiver: WALLET_ADDRESS,
},
[
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: rusdEthToBeraPools[0].pool,
destinationChainId: ETHEREUM_ID,
tokenIn: USDC_BERACHAIN,
amountIn: parseUnits("1000", 6).toString(), // 1000 USDC
receiver: WALLET_ADDRESS,
callback: [
// Step 1: Check USDC balance on Ethereum after bridge
{
protocol: "enso",
action: "balance",
args: {
token: USDC_ETHEREUM,
},
},
// Step 2: Mint e-rUSD using bridged USDC on Ethereum
{
protocol: "reservoir",
action: "deposit",
args: {
primaryAddress: RESERVOIR_MINTING_CONTRACT,
tokenIn: USDC_ETHEREUM,
tokenOut: RUSD_ETHEREUM,
amountIn: { useOutputOfCallAt: 0 }, // Use USDC from balance check
receiver: WALLET_ADDRESS,
},
},
// Step 3: Bridge newly minted e-rUSD back to Berachain
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: rusdEthToBeraPools[0].pool,
destinationChainId: BERACHAIN_ID,
tokenIn: RUSD_ETHEREUM,
amountIn: { useOutputOfCallAt: 1 }, // Use e-rUSD from minting
receiver: WALLET_ADDRESS,
// Callback executes on Berachain after e-rUSD arrives
callback: [
// Step 4: Check e-rUSD balance on Berachain
{
protocol: "enso",
action: "balance",
args: {
token: RUSD_BERACHAIN,
},
},
// Step 5: Deposit e-rUSD into Euler vault on Berachain
{
protocol: "euler-v2",
action: "deposit",
args: {
primaryAddress: EULER_VAULT_E_RUSD_BERACHAIN,
tokenIn: RUSD_BERACHAIN,
tokenOut: EULER_VAULT_E_RUSD_BERACHAIN, // ERC4626 vault token
amountIn: { useOutputOfCallAt: 0 }, // Use e-rUSD from balance check
receiver: WALLET_ADDRESS,
},
},
],
},
},
],
},
},
]
);
```
## 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.
1. **First action must be the `balance` action**:
```json theme={null}
{ protocol: "enso", action: "balance", args: { token: "bridged_token_address" } }`
```
2. **Reference previous outputs**: Use the `ouseOutputOfCallAt` to chain actions together
```json theme={null}
{ useOutputOfCallAt: callIndex, index: outVarIndex }
```
3. **Nested callbacks**: Bridge actions within callbacks enable multi-hop workflows
### Supported Chains and Tokens
Use the [GET `layerzero/pool`](/api-reference/integration/layerzero-pool) API to find the correct pool address and use it as the `primaryAddress` for `stargate.bridge` operation.
Updated {date_0}
# Get Started
Source: https://docs.enso.build/pages/build/get-started/overview
Enso Shortcuts convert high-level specifications of crosschain DeFi operations into runnable calldata
export const date_0 = "2025-09-12"
Find optimal paths for entering/exiting DeFi positions or swapping ERC20 tokens with `route` API.
Execute complex DeFi operations across multiple blockchains using bridge callbacks and post-bridge execution
Bundle several DeFi actions into a single transaction using `bundle` API.
Access DeFi protocols' and tokens' data through a set of Enso APIs.
## When to use: Route vs Bundle API?
Use **Route API** for:
1. Redeeming, swapping, direct position deposits
2. Automatically optimized swaps based on current market conditions (`enso.route`)
3. [Zapping into liquidity](/pages/build/get-started/route#2-zap-into-vault) from any token with automatic swaps
4. [Simple crosschain swaps](/pages/build/get-started/crosschain-routing#1-simple-cross-chain-swap) between two chains
5. [Crosschain zap deposits](/pages/build/get-started/crosschain-routing#2-crosschain-vault-zap) from any token to any vault on another chain with automatic swaps
**Limitations**:
* Cannot handle custom post-bridge logic or multi-step protocols interactions.
Use **Bundle API** for:
1. Borrowing, harvesting/claiming rewards, opening CLMM positions
2. Routing with predetermined positions
3. Creating multichain DeFi strategies
4. [Crosschain stablecoin minting](/pages/build/get-started/crosschain-routing#3-cross-chain-position-minting)
5. [Crosschain yield strategies](/pages/build/get-started/crosschain-routing#4-crosschain-yield-strategy) with minting tokens on different chains
**Limitations**:
* Single callback sequence with up to 10 chained actions
Updated {date_0}
# Get Protocol Data
Source: https://docs.enso.build/pages/build/get-started/protocol-data
Access DeFi protocols and tokens data through Enso's API
export const date_0 = "2025-08-07"
With Enso API, you can retrieve detailed information about DeFi protocols, tokens, and user balances.
These endpoints enable you to build data-rich applications with comprehensive DeFi protocol information.
## Protocol Information
The Protocol API endpoints provide access to DeFi protocol data, standards, and volume metrics.
### Get Supported Protocols
Retrieve a list of all protocols supported by Enso, including names, logos, and supported chains.
**API Reference:** [GET `/v1/protocols`](/api-reference/integration/all-protocols)
```ts EnsoSDK theme={null}
import { EnsoClient } from '@ensofinance/sdk';
// Initialize the client with your API key
const enso = new EnsoClient({
apiKey: 'YOUR_API_KEY' // Replace with your actual API key
});
// Get all supported protocols
async function getAllProtocols() {
try {
const protocols = await enso.getProtocolData();
console.log('Supported protocols:', protocols);
return protocols;
} catch (error) {
console.error('Error fetching protocols:', error);
throw error;
}
}
getAllProtocols();
```
```bash cURL theme={null}
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.finance/api/v1/protocols" \
| jq
```
### Get Protocol Standards and Actions
Access detailed information about protocols' supported actions and standards.
This helps you understand which operations can be performed with specific protocols.
**API Reference:** [GET `/v1/standards`](/api-reference/integration/standards)
```ts EnsoSDK theme={null}
// Get all available standards (protocols and their actions)
async function getProtocolStandards() {
try {
const response = await fetch('https://api.enso.finance/api/v1/standards', {
headers: {
'Authorization': `Bearer ${enso.apiKey}`,
'Content-Type': 'application/json'
}
});
const standards = await response.json();
console.log('Protocol standards and actions:', standards);
return standards;
} catch (error) {
console.error('Error fetching standards:', error);
throw error;
}
}
// Get specific protocol standard
async function getProtocolStandardBySlug(slug) {
try {
const response = await fetch(`https://api.enso.finance/api/v1/integration/${slug}`, {
headers: {
'Authorization': `Bearer ${enso.apiKey}`,
'Content-Type': 'application/json'
}
});
const standard = await response.json();
console.log(`Standard for ${slug}:`, standard);
return standard;
} catch (error) {
console.error(`Error fetching standard for ${slug}:`, error);
throw error;
}
}
getProtocolStandards();
getProtocolStandardBySlug('aave-v3');
```
```bash cURL theme={null}
# Get all standards
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.finance/api/v1/standards" \
| jq
# Get specific protocol standard
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.finance/api/v1/integration/aave-v3" \
| jq
```
### Get Protocol Volume Data
Retrieve transaction volume on a given chain.
**API Reference:** [GET `/volume/{chainId}`](/api-reference/defi/chain-and-transactions-volume)
```ts EnsoSDK theme={null}
// Get protocol volume data for a specific chain
async function getChainVolume(chainId: number) {
try {
const response = await fetch(`https://api.enso.finance/api/v1/volume/${chainId}`, {
headers: {
'Authorization': `Bearer ${enso.apiKey}`,
'Content-Type': 'application/json'
}
});
const volumeData = await response.json();
console.log(`Volume data for chain ${chainId}:`, volumeData);
return volumeData;
} catch (error) {
console.error(`Error fetching volume data for chain ${chainId}:`, error);
throw error;
}
}
// Get volume data for Ethereum
getChainVolume(1);
```
```bash cURL theme={null}
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.finance/api/v1/volume/1" \
| jq
```
## Position Information
The Token API delivers data about DeFi assets including pricing, composition, and yield metrics. Filter tokens by protocol, chain, underlying assets, APY, or TVL to discover specific DeFi opportunities.
### Filter Supported Tokens
Query tokens based on various criteria like protocol, underlying assets, or token type. This helps users discover specific DeFi opportunities.
**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens)
```ts EnsoSDK theme={null}
import { EnsoClient } from '@ensofinance/sdk';
// Initialize the client with your API key
const enso = new EnsoClient({
apiKey: 'YOUR_API_KEY' // Replace with your actual API key
});
// Get Aave V3 DeFi tokens on Ethereum mainnet (chainId 1) with USDT as underlying
async function getAaveV3UsdtTokensOnEthereum() {
try {
const tokenData = await enso.getTokenData({
chainId: 1, // Ethereum mainnet
protocolSlug: 'aave-v3',
type: 'defi',
underlyingTokens: '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDT
includeMetadata: true
});
console.log('Aave V3 DeFi tokens with USDT as underlying on Ethereum:', tokenData.data);
return tokenData.data;
} catch (error) {
console.error('Error fetching tokens:', error);
throw error;
}
}
getAaveV3UsdtTokensOnEthereum();
```
```bash cURL theme={null}
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.finance/api/v1/tokens?chainId=1&protocolSlug=aave-v3&type=defi&underlyingTokens=0xdAC17F958D2ee523a2206206994597C13D831ec7&includeMetadata=true" \
| jq
```
### Get Protocol TVL and APY Data
Access yield and total value locked (TVL) information for DeFi protocols. This data is crucial for comparing investment opportunities across the DeFi landscape.
**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens) with APY filters
```ts EnsoSDK theme={null}
import { EnsoClient } from '@ensofinance/sdk';
// Initialize the client with your API key
const enso = new EnsoClient({
apiKey: 'YOUR_API_KEY' // Replace with your actual API key
});
// Get tokens with APY over 5% for a specific protocol
async function getHighYieldTokensForProtocol(protocolSlug: string, minApy: number = 5) {
try {
const tokenData = await enso.getTokenData({
chainId: 1,
protocolSlug: protocolSlug,
type: 'defi',
apyFrom: minApy,
includeMetadata: true
});
console.log(`${protocolSlug} tokens with APY > ${minApy}%:`, tokenData.data);
return tokenData.data;
} catch (error) {
console.error('Error fetching high-yield tokens:', error);
throw error;
}
}
getHighYieldTokensForProtocol('yearn');
```
```bash cURL theme={null}
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.finance/api/v1/tokens?chainId=1&protocolSlug=yearn-v2&type=defi&apyFrom=5&includeMetadata=true" \
| jq
```
### Get Token Prices
Retrieve current token prices with confidence scores, supporting decision-making around token swaps and valuations.
**API Reference:** [GET `/prices/token-price`](/api-reference/tokens/token-price)
```ts EnsoSDK theme={null}
import { EnsoClient } from '@ensofinance/sdk';
// Initialize the client with your API key
const enso = new EnsoClient({
apiKey: 'YOUR_API_KEY' // Replace with your actual API key
});
// Get price data for a specific token
async function getTokenPrice(chainId: number, tokenAddress: string) {
try {
const priceData = await enso.getPriceData({
chainId,
address: tokenAddress
});
console.log(`Price data for ${tokenAddress} on chain ${chainId}:`, priceData);
return priceData;
} catch (error) {
console.error('Error fetching token price:', error);
throw error;
}
}
// Get price for WETH on Ethereum
getTokenPrice(1, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2');
```
```bash cURL theme={null}
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ENSO_API_KEY" \
"https://api.enso.finance/api/v1/prices/1/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" \
| jq
```
I'll add the token information use cases with the specified layout and examples:
### Get Information for Several Tokens
Retrieve detailed information about multiple tokens in a single request to support portfolio analysis or multi-token operations.
**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens)
```ts EnsoSDK theme={null}
// SDK Example
const ensoClient = new EnsoClient({
apiKey: "your-api-key"
});
const tokenData = await ensoClient.getTokenData({
chainId: 1,
address: [
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"0x6b175474e89094c44da98b954eedeac495271d0f"
],
includeMetadata: true
});
```
```bash cURL theme={null}
curl -X GET \
'https://api.enso.finance/api/v1/tokens?chainId=1&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&address=0x6b175474e89094c44da98b954eedeac495271d0f&includeMetadata=true' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-H 'accept: application/json'
```
### Fetch All Tokens from a Specific Protocol
Get a comprehensive list of all tokens associated with a particular protocol to understand available investment options.
**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens)
```ts EnsoSDK theme={null}
// SDK Example
const ensoClient = new EnsoClient({
apiKey: "your-api-key"
});
const aaveTokens = await ensoClient.getTokenData({
chainId: 1,
protocolSlug: "aave-v3",
includeMetadata: true
});
```
```bash cURL theme={null}
curl -X GET \
'https://api.enso.finance/api/v1/tokens?chainId=1&protocolSlug=aave-v3&includeMetadata=true' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-H 'accept: application/json'
```
### Filter by Token Type and Minimum TVL
Find specific token types with a minimum TVL (Total Value Locked) threshold to focus on well-established and liquid DeFi positions.
**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens)
```ts EnsoSDK theme={null}
// SDK Example
const ensoClient = new EnsoClient({
apiKey: "your-api-key"
});
const defiTokens = await ensoClient.getTokenData({
chainId: 1,
type: "defi",
tvl: 1000000, // $1M minimum TVL
includeMetadata: true
});
```
```bash cURL theme={null}
curl -X GET \
'https://api.enso.finance/api/v1/tokens?chainId=1&type=defi&tvlFrom=1000000&includeMetadata=true' \
-H "Authorization: Bearer $ENSO_API_KEY" \
-H 'accept: application/json'
```
Updated {date_0}
# DeFi and Swap Routing
Source: https://docs.enso.build/pages/build/get-started/route
Find optimal paths for crosschain entering/exiting DeFi positions or swapping ERC20 tokens.
export const date_0 = "2025-09-12"
The Route API is Enso's **crosschain automated pathfinding engine** that calculates optimal multi-step paths between any two DeFi positions - `tokenIn` and `tokenOut`. Whether you're swapping tokens, entering yield vaults, or moving assets across chains, the Route API handles the complex routing logic automatically.
**Would `route` do the job?**
The `route` API might be the simpler way to route your assets.
Before using the bundle API, check if `route` would work using [happypath](https://happypath.enso.build).
**Routing vs Bundling**: The Route API excels at single-path operations where you want Enso to determine the optimal route automatically. For custom multi-step workflows where you need precise control over each action, use the [Bundle API](/api-reference/defi-shortcuts/bundle-a-list-of-actions) instead.
**When to use routing**: Token swaps with optimal pricing, vault entries/exits, position migrations between protocols, crosschain transfers, and any scenario where you want automated route optimization rather than manually specifying each step.
## Quick Start
The `route` API produces an gas-optimized, atomic transaction between the two given positions, combining `swap`, `deposit`, and `redeem` operations.
Use the [Bundle API](/pages/build/get-started/bundling-actions) if you need other [actions Enso supports](/pages/build/reference/actions), such as `harvest`, `borrow`, `repay`.
## Sample requests
```typescript theme={null}
const route = await ensoClient.getRouteData({
fromAddress: "0x...",
chainId: 1,
tokenIn: ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"], // ETH
tokenOut: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC
amountIn: ["1000000000000000000"], // 1 ETH
slippage: "50", // 0.5%
routingStrategy: "delegate"
});
await wallet.sendTransaction(route.tx);
```
```typescript theme={null}
const route = await ensoClient.getRouteData({
fromAddress: "0x...",
chainId: 1,
tokenIn: ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"], // ETH
tokenOut: ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"], // yvWETH
amountIn: ["1000000000000000000"], // 1 ETH
slippage: "100", // 1%
routingStrategy: "delegate"
});
// ETH → WETH → Yearn vault automatically
await wallet.sendTransaction(route.tx);
```
```typescript theme={null}
const route = await ensoClient.getRouteData({
fromAddress: "0x...",
chainId: 1, // Ethereum
destinationChainId: 8453, // Base
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC Ethereum
tokenOut: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], // USDC Base
amountIn: ["1000000000"], // 1,000 USDC
slippage: "300", // 3% (higher for crosschain)
routingStrategy: "delegate"
});
// Bridge USDC from Ethereum to Base
await wallet.sendTransaction(route.tx);
```
```typescript theme={null}
const route = await ensoClient.getRouteData({
fromAddress: "0x...",
chainId: 1, // Ethereum
destinationChainId: 8453, // Base
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC Ethereum
tokenOut: ["0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A"], // weETH vault on Base
amountIn: ["1000000000"], // 1,000 USDC
slippage: "500", // 5% (complex operation)
routingStrategy: "delegate"
});
// Bridge + vault entry in one transaction
await wallet.sendTransaction(route.tx);
```
## Core Concepts
Specify any `tokenIn` and `tokenOut` - ERC20 tokens, LP tokens, vault shares, or yield positions. The Route API automatically finds the optimal path between any two DeFi positions across protocols and chains.
Response contains a complete transaction object ready to sign (`tx`), `amountOut` (expected output), `gas` (estimated), and `route` (optimized path taken).
Set slippage in basis points: `"50"` = 0.5%, `"300"` = 3%. Higher slippage for complex routes. **Cannot use both `slippage` and `minAmountOut`** - choose one protection method.
Add `destinationChainId` for crosschain routes. API automatically selects optimal bridges and calculates fees.
## Response Structure
The `route` response consists of the following fields:
* **`tx`**: Complete transaction object ready for submission. Contains the correct `to` address, `data`, `value`, and `gas` fields.
* **`amountOut`**: Simulated output amount - display this to users as expected returns. This is calculated through onchain simulation.
* **`gas`**: Estimated gas usage from simulation. Use this value to prevent out-of-gas failures.
* **`route`**: Array showing the optimization path Enso constructed. Shows the DEX(s) Enso selected for optimal pricing.
Always use the complete `tx` object returned by the API, and use the `gas` value for your transaction.
* The `to` address varies based on routing strategy, and other fields like `value` and `data` are precisely calculated for your specific route.
* The `gas` value estimate comes from actual simulation, out-of-gas transaction failures.
## Examples
The following examples progress from simple token swaps to complex crosschain vault interactions. Each example builds on concepts from previous ones, demonstrating how the Route API handles increasingly sophisticated DeFi operations automatically.
### 0. Install & Authenticate
You can interact with the API using Enso SDK or directly via a REST API.
You can explore Enso through [API Sandbox](/api-reference/).
To install the SDK run the following command:
```bash theme={null}
npm i @ensofinance/sdk
pnpm i @ensofinance/sdk
yarn add @ensofinance/sdk
```
To use the API, authenticate using the [API key](/pages/build/get-started/authentication).
### 1. Simple Token Swap
Start with the most basic routing operation: swapping ETH for USDC on Ethereum mainnet.
```typescript SDK theme={null}
import { EnsoClient } from '@ensofinance/sdk';
const ensoClient = new EnsoClient({
apiKey: 'your-api-key-here'
});
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const receiver = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const spender = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// ETH → USDC swap with 0.5% slippage
const swapRoute = await ensoClient.getRouteData({
fromAddress,
receiver,
spender,
chainId: 1,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"], // ETH
tokenOut: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC
slippage: "50", // 0.5%
routingStrategy: "delegate"
});
console.log('Expected USDC output:', swapRoute.amountOut);
console.log('Estimated gas:', swapRoute.gas);
console.log('Swap route complexity:', swapRoute.route.length, 'steps');
// Use route.tx to execute the transaction
const txHash = await wallet.sendTransaction(swapRoute.tx);
```
```bash cURL theme={null}
curl --request POST \
--url https://api.enso.finance/api/v1/shortcuts/route \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ENSO_API_KEY" \
--data '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "delegate",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"],
"amountIn": ["1000000000000000000"],
"slippage": "50"
}' | jq
```
### 2. Zap into Vault
Enter a Yearn vault directly from ETH, automatically handling any intermediate swaps and vault deposits.
```typescript SDK theme={null}
// ETH → yvWETH (Yearn WETH vault) with 1% slippage
const vaultEntry = await ensoClient.getRouteData({
fromAddress,
receiver,
spender,
chainId: 1,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"], // ETH
tokenOut: ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"], // yvWETH
slippage: "100", // 1%
routingStrategy: "delegate"
});
console.log('yvWETH shares received:', vaultEntry.amountOut);
console.log('Route complexity:', vaultEntry.route.length, 'steps');
// Route typically: ETH → WETH → deposit to Yearn vault
```
```bash cURL theme={null}
# ETH → yvWETH (Yearn WETH vault) with 1% slippage
curl --request POST \
--url https://api.enso.finance/api/v1/shortcuts/route \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ENSO_API_KEY" \
--data '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "delegate",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"],
"amountIn": ["1000000000000000000"],
"slippage": "100"
}' | jq
```
**What's happening:** The router automatically wraps ETH to WETH, then deposits into the Yearn vault. The `amountOut` represents vault shares, not underlying tokens.
### 3. Vault Migration
Move from one yield protocol to another - exit Yearn vault and enter Aave lending position.
```typescript SDK theme={null}
// yvWETH → aWETH (migrate from Yearn to Aave)
const migration = await ensoClient.getRouteData({
fromAddress,
receiver,
spender,
chainId: 1,
amountIn: ["1000000000000000000"], // 1 yvWETH
tokenIn: ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"], // yvWETH
tokenOut: ["0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8"], // aWETH
slippage: "100", // 1%
routingStrategy: "delegate"
});
console.log('aWETH tokens received:', migration.amountOut);
console.log('Migration complexity:', migration.route.length, 'steps');
// Route: yvWETH → withdraw to WETH → deposit to Aave → receive aWETH
```
```bash cURL theme={null}
# Route: yvWETH → withdraw to WETH → deposit to Aave → receive aWETH
curl --request POST \
--url https://api.enso.finance/api/v1/shortcuts/route \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ENSO_API_KEY" \
--data '{
"chainId": 1,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "delegate",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"],
"tokenOut": ["0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8"],
"amountIn": ["1000000000000000000"],
"slippage": "100"
}' | jq
```
**Complex routing:** This involves exiting one protocol (Yearn) and entering another (Aave). The route array will show multiple steps including withdrawal, potential swaps, and final deposit.
### 4. Crosschain Transfer
Move assets between blockchains using Enso's integrated bridge routing.
```typescript SDK theme={null}
// USDC from Ethereum → USDC.e on Plume Network
const crossChain = await ensoClient.getRouteData({
fromAddress,
receiver,
spender,
chainId: 1, // Ethereum
destinationChainId: 98866, // Plume Network
amountIn: ["1000000000"], // 1,000 USDC
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC on Ethereum
tokenOut: ["0x78adD880A697070c1e765Ac44D65323a0DcCE913"], // USDC.e on Plume
slippage: "300", // 3% (higher for crosschain)
routingStrategy: "delegate"
});
console.log('USDC.e on Plume:', crossChain.amountOut);
console.log('Bridge fee:', crossChain.feeAmount);
console.log('Crosschain complexity:', crossChain.route.length, 'steps');
```
```bash cURL theme={null}
# USDC from Ethereum → USDC.e on Plume Network
curl --request POST \
--url https://api.enso.finance/api/v1/shortcuts/route \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ENSO_API_KEY" \
--data '{
"chainId": 1,
"destinationChainId": 98866,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "delegate",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"],
"tokenOut": ["0x78adD880A697070c1e765Ac44D65323a0DcCE913"],
"amountIn": ["1000000000"],
"slippage": "300"
}' | jq
```
**Crosschain considerations:** Higher slippage accounts for bridge fees and potential price differences. The `feeAmount` shows bridge costs, and `route` reveals pre- and post- bridging steps.
### 5. Crosschain Vault Zapping
The most complex example: bridge assets and enter a vault on the destination chain in one transaction.
```typescript SDK theme={null}
// USDC Ethereum → myPUSD vault on Plume (crosschain vault zap)
const crossChainVault = await ensoClient.getRouteData({
fromAddress,
receiver,
spender,
chainId: 1, // Ethereum
destinationChainId: 98866, // Plume Network
amountIn: ["2000000000"], // 2,000 USDC
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC on Ethereum
tokenOut: ["0xAf5aEAb2248415716569Be5d24FbE10b16590D6c"], // myPUSD vault on Plume
slippage: "500", // 5% (complex crosschain + vault operation)
routingStrategy: "delegate"
});
console.log('myPUSD vault shares:', crossChainVault.amountOut);
console.log('Total route steps:', crossChainVault.route.length);
console.log('Estimated gas:', crossChainVault.gas);
```
```bash cURL theme={null}
# USDC Ethereum → myPUSD vault on Plume (crosschain vault zap)
curl --request POST \
--url https://api.enso.finance/api/v1/shortcuts/route \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ENSO_API_KEY" \
--data '{
"chainId": 1,
"destinationChainId": 98866,
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"routingStrategy": "delegate",
"receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"tokenIn": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"],
"tokenOut": ["0xAf5aEAb2248415716569Be5d24FbE10b16590D6c"],
"amountIn": ["2000000000"],
"slippage": "500"
}' | jq
```
**Maximum complexity:** This combines crosschain bridging with vault interaction.
## Related APIs & Next Steps
### When to Use Other APIs
* **[Bundle API](/api-reference/defi-shortcuts/bundle-a-list-of-actions)**: When you need custom multi-step logic or want to orchestrate specific actions in sequence, or you need actions beyond `swap`, `deposit` and `redeem` the route API uses
* **[Nontokenized Positions](/api-reference/defi-shortcuts/routing-to-a-non-tokenized-position)**: For lending positions that don't issue tokens (like Aave debt positions)
* **[Approval Endpoint](/api-reference/defi-shortcuts/approve-enso-contract)**: Managing token permissions when using `"router"` strategy
### Supporting APIs
* **[Tokens API](/api-reference/tokens/tokens)**: Discover available tokens and their addresses across chains
* **[Prices API](/api-reference/tokens/token-price)**: Get current token valuations for your UI
* **[Networks API](/api-reference/integration/networks)**: List supported chains and their details
Updated {date_0}
# Actions
Source: https://docs.enso.build/pages/build/reference/actions
Actions are interactions with DeFi protocols Enso supports.
export const date_0 = "2025-09-23"
Bundle API allows you to define blueprints of complex multi-step transactions composed out of Actions.
This reference guide explains all available actions and their parameters.
**Would `route` (`client.getRouteData`) do the job?**
The `route` API might be the simpler way to route your assets.
Before using the bundle API, check if [`route` would suffice.](/pages/build/get-started/overview#when-to-use-route-vs-bundle-api)
To get the up-to date list of available actions and parameters, use [GET `/integration/actions`](/api-reference/integration/supported-actions).
To get a list of actions available for a specific protocol, use [GET `standards/{slug}/`](https://docs.enso.build/api-reference/integration/standard-per-protocol).
## Chaining Actions
It's possible to chain actions: using the output of one action as the input for another.
To reference outputs from previous actions use the `useOutputOfCallAt` syntax.
For array-outputs such as `split`, you can specify the index within that action's output array
```typescript theme={null}
{
"amountIn": {
"useOutputOfCallAt": 0 // Use the output amount from the action at index 0
"index": 1 // Optional: access outputOfCallAt[0][1]
}
}
```
Here's an example of a more complex chaining sequence that splits WETH into three different portions:
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate"
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
tokenOut: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
amountIn: "1000000000" // 1000 USDC
}
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
amountIn: { "useOutputOfCallAt": 1, "index": 0 }, // First portion
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2" // Aave V3 pool
}
},
{
protocol: "curve",
action: "deposit",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
amountIn: { "useOutputOfCallAt": 1, "index": 1 }, // Second portion
primaryAddress: "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022" // Curve ETH/stETH pool
}
},
{
protocol: "yearn",
action: "deposit",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
amountIn: { "useOutputOfCallAt": 1, "index": 2 }, // Third portion
primaryAddress: "0xa258C4606Ca8206D8aA700cE2143D7db854D168c" // Yearn WETH vault
}
}
]
);
```
## Core Actions
### `route`
The route action determines the optimal path to swap one token for another across multiple DeFi protocols supported by Enso.
This action gets expanded into a combination of `swap`, `deposit`, and `redeem` actions, similar to `/route` API.
The `/bundle` API will return a `route` object that contains a list of all such actions.
When using the `route` action, slippage is automatically calculated and applied.
The action will revert if the received amount is below the expected output after applying slippage.
For other actions, make sure to add one of [slippage protection actions](#slippage-protection)
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH address
tokenOut: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", // stETH address
amountIn: "1000000000000000000", // Amount in wei (1 ETH)
slippage: "300", // 3% slippage tolerance (in basis points)
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver address
primaryAddress: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", // Optional: Primary contract address
poolFee: "3000", // Optional: Pool fee in basis points (e.g., 3000 for 0.3%)
},
},
],
);
```
#### Route-Bridge Example
When you need to route and bridge tokens to another chain, you can use the `destinationChainId` parameter. This converts the route into a cross-chain operation that handles both the swap and bridge in a single transaction.
**Important**: When using `destinationChainId`, you **must** include `refundReceiver` to handle any potential refunds from failed bridge operations. The `refundReceiver` parameter should only be set when `destinationChainId` is provided.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH
tokenOut: "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", // USDT
amountIn: "1000000000000000000", // 1 ETH in wei
destinationChainId: 10, // Optimism
refundReceiver: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045", // Required for route-bridge
},
},
],
);
```
| Parameter | Description | Required |
| -------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------- |
| `tokenIn` | Address of the token to send. For ETH, use `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` | Yes |
| `tokenOut` | Address of the token to receive | Yes |
| `amountIn` | Amount of `tokenIn` to send in wei (with full decimals) | Yes |
| `slippage` | Slippage tolerance in basis points (100 = 1%) | No |
| `receiver` | Address to receive the output tokens if not the caller | No |
| `primaryAddress` | Optional address of the router or primary contract to use | No |
| `poolFee` | Optional pool fee in basis points when using specific pools | No |
| `destinationChainId` | Target blockchain network ID for cross-chain routing (route-bridge) | No |
| `refundReceiver` | Address to receive refunds if bridge fails. Only used when `destinationChainId` is provided | Yes\* (when using `destinationChainId`) |
### `swap`
Swaps one token for another using a specific pool or exchange protocol.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "uniswap-v2",
action: "swap",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
amountIn: "1000000000000000000", // 1 WETH (18 decimals)
primaryAddress: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", // Uniswap V2 Router
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Receiver
slippage: "100", // Optional: 1% slippage (100 basis points)
poolFee: "3000", // Optional: Pool fee in basis points (e.g., 3000 for 0.3%)
},
},
],
);
```
| Parameter | Description | Required |
| ---------------- | ----------------------------------------------------------- | -------- |
| `tokenIn` | Address of token to swap from | Yes |
| `tokenOut` | Address of token to swap to | Yes |
| `amountIn` | Amount of `tokenIn` to swap in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the router or pool contract | No |
| `receiver` | Address to receive the output tokens | Yes |
| `slippage` | Slippage tolerance in basis points (100 = 1%) | No |
| `poolFee` | Optional pool fee in basis points when using specific pools | No |
| `poolId` | The ID to identify the liquidity pool | No |
### `deposit`
Deposits tokens into a protocol to receive a position token or add liquidity.
Use the optional `positionId` to deposit into.
```js theme={null}
{
protocol: "morpho-markets-v1",
action: "deposit",
args: {
amountIn: { useOutputOfCallAt: 0 },
tokenIn: TOKEN_IN_ADDRESS,
receiver: WALLET_ADDRESS,
primaryAddress: MORPHO,
positionId: MORPHO_POSITION_ID,
},
}
```
```js theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH address
tokenOut: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", // aWETH address (optional)
amountIn: "1000000000000000000", // Amount in wei (1 WETH)
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", // Aave V3 pool
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver address
},
},
],
);
```
| Parameter | Description | Required |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `tokenIn` | Address of token to deposit. Can be a single address or an array for multiple tokens | Yes |
| `tokenOut` | Address of token to receive. Can be a single address or an array for multiple tokens. Omit if position is not represented by a token. | No |
| `amountIn` | Amount of `tokenIn` to deposit in wei (with full decimals). Can be a single value or an array for multiple tokens | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the output tokens if not the caller | No |
| `positionId` | Position ID to deposit into (e.g. Morpho Markets' positions) | No |
### `redeem`
Redeems underlying assets from a protocol by exchanging shares or tokens. Use it to exit a position and retrieve the desired tokens.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
// Step 1: First deposit into the ERC4626 vault to get shares
{
protocol: "erc4626",
action: "deposit",
args: {
tokenIn: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI (underlying asset)
tokenOut: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // yvDAI (vault shares)
amountIn: "1000000000000000000", // 1 DAI
primaryAddress: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // Vault address
},
},
// Step 2: Now redeem the shares we just received
{
protocol: "erc4626",
action: "redeem",
args: {
tokenIn: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // yvDAI shares
tokenOut: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI (underlying asset)
amountIn: { useOutputOfCallAt: 0 }, // Use the shares from the deposit
primaryAddress: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // Vault address
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
```
| Parameter | Description | Required |
| ---------------- | ----------------------------------------------------------------------------------- | -------- |
| `tokenIn` | Address of shares/tokens to redeem | No |
| `tokenOut` | Address of token(s) to receive upon redemption. Can be a single address or an array | Yes |
| `amountIn` | Amount of shares/tokens to redeem in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the contract to interact with | Yes |
| `receiver` | Address to receive the output tokens if not the caller | No |
## Bridging
The `bridge` action lets you perform transactions spanning multiple chains.
It relies on Stargate and LayerZero to coordinate interactions.
### `bridge`
Facilitates cross-chain token transfers using various bridge protocols with optional callback actions on the destination chain.
When used with callback actions (`callback` array), it can automatically execute a series of actions on the destination chain once tokens arrive. Each callback action is executed sequentially on the destination chain.
**Important**: When using callbacks, the callback bundle MUST start with a balance action to check the bridged token balance on the destination chain.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
spender: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
routingStrategy: "router",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC on mainnet
amountIn: "1000000000", // 1000 USDC
tokenOut: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH
},
},
{
protocol: "enso",
action: "fee",
args: {
token: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
amount: { useOutputOfCallAt: 0 },
bps: 25,
receiver: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11", // Fee receiver
},
},
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: "0x77b2043768d28e9c9ab44e1abfc95944bce57931",
destinationChainId: 8453,
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
amountIn: { useOutputOfCallAt: 1 },
receiver: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
callback: [
{
protocol: "enso",
action: "balance",
args: {
token: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
},
},
{
protocol: "enso",
action: "split",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
tokenOut: [
"0x50c5725949a6f0c72e6c4a641f24049a917db0cb",
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
],
amountIn: { useOutputOfCallAt: 0 },
},
},
{
protocol: "enso",
action: "slippage",
args: {
amountOut: { useOutputOfCallAt: 1, index: 0 },
bps: 50,
},
},
{
protocol: "enso",
action: "slippage",
args: {
amountOut: { useOutputOfCallAt: 1, index: 1 },
bps: 50,
},
},
{
protocol: "uniswap-v4",
action: "depositclmm",
args: {
tokenOut: "0x7c5f5a4bbd8fd63184577525326123b519429bdc",
ticks: [-276842, -275842],
tokenIn: [
"0x50c5725949a6f0c72e6c4a641f24049a917db0cb",
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
],
poolFee: "100",
amountIn: [
{ useOutputOfCallAt: 1, index: 0 },
{ useOutputOfCallAt: 1, index: 1 },
],
},
},
{
protocol: "enso",
action: "slippage",
args: {
amountOut: { useOutputOfCallAt: 4 },
bps: 200,
},
},
],
},
},
],
);
```
| Parameter | Description | Required |
| -------------------- | ---------------------------------------------------------------------------------------------------- | -------- |
| `primaryAddress` | Source bridge pool address | Yes |
| `destinationChainId` | Target blockchain network ID | Yes |
| `tokenIn` | Token address to bridge from source chain | Yes |
| `amountIn` | Amount to bridge (with full decimals) or a reference to a previous action's output | Yes |
| `receiver` | Address to receive bridged tokens on destination chain | Yes |
| `callback` | Array of actions to execute on the destination chain after bridging (must start with balance action) | No |
| `callbackValue` | Additional value passed to the callback (in addition to bridge token) | No |
## Slippage Protection
Whereas the `route` action includes configurable slippage protection by default, but other actions require manual slippage configuration.
Always include slippage protection via the `slippage` or `minAmountOut` actions to prevent price impact.
### `slippage`
Applies slippage protection specified in basis points (`bps`) to ensure the received amount is within the acceptable range of the expected output.
The action calculates the minimum acceptable amount based on the specified slippage tolerance (`amountOut * (10000 - bps) / 10000`).
If the actual received amount falls below this threshold, the transaction will revert.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "slippage",
args: {
bps: "100", // 1% maximum slippage (100 basis points)
amountOut: { useOutputOfCallAt: 0 }, // Reference previous action's output
},
},
{
protocol: "uniswap-v2",
action: "swap",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
amountIn: "1000000000000000000", // 1 WETH
primaryAddress: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", // Uniswap V2 Router
receiver: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
},
},
],
);
```
| Parameter | Description | Required |
| ----------- | ------------------------------------------------------------------------------------------ | -------- |
| `amountOut` | Expected output amount - **must** be output of one of previous actions `useOutputOfCallAt` | Yes |
| `bps` | Maximum acceptable slippage in basis points (1 bps = 0.01%, 100 bps = 1%) | Yes |
### `minAmountOut`
Applies slippage protection specified in absolute amount (`minAmountOut`) to ensure the received amount is within the acceptable range of the expected output.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
// First action to get an output
{
protocol: "uniswap-v2",
action: "swap",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
amountIn: "1000000000000000000", // 1 WETH
primaryAddress: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", // Uniswap V2 Router
receiver: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
},
},
// Now apply minAmountOut check
{
protocol: "enso",
action: "minamountout",
args: {
amountOut: { useOutputOfCallAt: 0 }, // Reference to first action's output
minAmountOut: "1940000000", // Minimum amount (1.94 USDC)
},
},
],
);
```
| Parameter | Description | Required |
| -------------- | ------------------------------------------------------------------------------------------ | -------- |
| `amountOut` | Expected output amount - **must** be output of one of previous actions `useOutputOfCallAt` | Yes |
| `minAmountOut` | Minimum acceptable amount of out token | Yes |
## Deposit & Redeem Actions
### `depositCLMM`
Deposits tokens into a Concentrated Liquidity Market Maker pool (like Uniswap V3).
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
spender: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
routingStrategy: "router",
},
[
{
protocol: "uniswap-v4",
action: "depositclmm",
args: {
tokenOut: "0xbd216513d74c8cf14cf4747e6aaa6420ff64ee9e",
ticks: [-887270, 887270],
tokenIn: [
"0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT
"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", // WBTC
],
poolFee: "500",
amountIn: ["1000000000", "100000000"], // 1000 USDT (6 decimals), 1 WBTC (8 decimals)
},
},
],
);
```
| Parameter | Description | Required |
| ------------- | ------------------------------------------------------------------------------------------------- | -------- |
| `tokenIn` | Array of addresses of tokens to deposit (usually 2 tokens) | Yes |
| `tokenOut` | Address of the position NFT to receive | Yes |
| `amountIn` | Array of amounts to deposit in wei (with full decimals). Must match the length of `tokenIn` array | Yes |
| `ticks` | Array containing lower and upper tick bounds defining the price range | Yes |
| `poolFee` | Pool fee tier in basis points (e.g., 3000 for 0.3%) | Yes |
| `receiver` | Address to receive the position NFT if not the caller | No |
| `tickSpacing` | The minimum gap between valid price points for adding liquidity | No |
| `hook` | The hook address for Uniswap V4 pools | No |
### `redeemCLMM`
Redeems tokens from a Concentrated Liquidity Market Maker position (like Uniswap V3).
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "uniswap-v3",
action: "redeemclmm",
args: {
tokenIn: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", // UNI-V3-POS NFT
tokenOut: [
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
],
liquidity: "1000000000000", // Liquidity amount to withdraw
tokenId: "123456", // The NFT token ID
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
```
| Parameter | Description | Required |
| ----------- | ---------------------------------------------------------- | -------- |
| `tokenIn` | Address of the position NFT token | Yes |
| `tokenOut` | Array of addresses of tokens to receive | Yes |
| `liquidity` | Amount of liquidity to withdraw | Yes |
| `tokenId` | ID of the position NFT | Yes |
| `receiver` | Address to receive the underlying tokens if not the caller | No |
### `singleDeposit`
Deposits a single token into a protocol. This is a specialized version of the `deposit` action for single token deposits.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "yearn",
action: "singledeposit",
args: {
tokenIn: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI address
tokenOut: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // yvDAI address
amountIn: "10000000000000000000", // 10 DAI (18 decimals)
primaryAddress: "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // Yearn vault
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
```
| Parameter | Description | Required |
| ---------------- | ------------------------------------------------------------------ | -------- |
| `tokenIn` | Address of the single token to deposit | Yes |
| `tokenOut` | Address of the token to receive (usually a receipt or share token) | No |
| `amountIn` | Amount of `tokenIn` to deposit in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the output tokens if not the caller | No |
### `multiDeposit`
Deposits multiple tokens into a protocol (like Curve or Balancer) in a single operation.
```ts theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "curve",
action: "multideposit",
args: {
tokenIn: [
"0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
],
tokenOut: "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // 3Crv LP token
amountIn: [
"10000000000000000000", // 10 DAI (18 decimals)
"10000000", // 10 USDC (6 decimals)
"10000000", // 10 USDT (6 decimals)
],
primaryAddress: "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7", // Curve 3pool
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
console.log(JSON.stringify(bundle, null, 2));
```
| Parameter | Description | Required |
| ---------------- | ------------------------------------------------------------------------------------------------- | -------- |
| `tokenIn` | Array of addresses of tokens to deposit | Yes |
| `tokenOut` | Address of the LP token or receipt token to receive | No |
| `amountIn` | Array of amounts to deposit in wei (with full decimals). Must match the length of `tokenIn` array | Yes |
| `primaryAddress` | Address of the pool or protocol contract to interact with | Yes |
| `receiver` | Address to receive the LP tokens if not the caller | No |
### `tokenizedSingleDeposit`
**Deprecation Notice:** This action is deprecated in favor of using `singleDeposit` with the appropriate protocol. It will be removed in a future API version.
Deposits a single token and receives a tokenized position.
```json theme={null}
{
"protocol": "compound-v3",
"action": "tokenizedsingledeposit",
"args": {
"tokenIn": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"tokenOut": "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // cUSDCv3
"amountIn": "10000000", // 10 USDC (6 decimals)
"primaryAddress": "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // Compound market
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" // Optional: Receiver
}
}
```
| Parameter | Description | Required |
| ---------------- | ---------------------------------------------------------- | -------- |
| `tokenIn` | Address of token to deposit | Yes |
| `tokenOut` | Address of tokenized position to receive | Yes |
| `amountIn` | Amount of `tokenIn` to deposit in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the position tokens if not the caller | No |
### `tokenizedMultiDeposit`
**Deprecation Notice:** This action is deprecated in favor of using `multiDeposit` with the appropriate protocol. It will be removed in a future API version.
Deposits multiple tokens and receives a tokenized position.
```json theme={null}
{
"protocol": "balancer-v2",
"action": "tokenizedmultideposit",
"args": {
"tokenIn": [
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" // WETH
],
"tokenOut": "0x8353157092ED8Be69a9DF8F95af097bbF33Cb2aF", // BPT token
"amountIn": [
"100000", // 0.01 WBTC (8 decimals)
"10000000000000000" // 0.01 WETH (18 decimals)
],
"primaryAddress": "0x8353157092ED8Be69a9DF8F95af097bbF33Cb2aF", // Balancer Pool
"receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" // Optional: Receiver
}
}
```
| Parameter | Description | Required |
| ---------------- | ------------------------------------------------------------------------------------------------- | -------- |
| `tokenIn` | Array of addresses of tokens to deposit | Yes |
| `tokenOut` | Address of the tokenized position to receive | Yes |
| `amountIn` | Array of amounts to deposit in wei (with full decimals). Must match the length of `tokenIn` array | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the position token if not the caller | No |
### `multiOutSingleDeposit`
Deposits a single token and receives multiple output tokens (typically used for certain AMM positions).
```ts theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "uniswap-v3",
action: "multioutsingledeposit",
args: {
tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
tokenOut: [
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
],
amountIn: "1000000000000000000", // 1 WETH (18 decimals)
primaryAddress: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640", // Uniswap pool
receiver: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // Optional: Receiver
},
},
],
);
console.log(JSON.stringify(bundle, null, 2));
```
| Parameter | Description | Required |
| ---------------- | ---------------------------------------------------------- | -------- |
| `tokenIn` | Address of the single token to deposit | Yes |
| `tokenOut` | Array of addresses of tokens to receive | Yes |
| `amountIn` | Amount of `tokenIn` to deposit in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the protocol contract to interact with | Yes |
| `receiver` | Address to receive the output tokens if not the caller | No |
## Lending Actions
### `borrow`
Borrows a token from a lending protocol using a deposited token as collateral.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH address
tokenOut: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", // aWETH address (optional)
amountIn: "1000000000000000000", // Amount in wei (1 WETH)
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", // Aave V3 pool
receiver: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045", // Optional: Receiver address
},
},
{
protocol: "aave-v3",
action: "borrow",
args: {
collateral: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH address (collateral)
tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC address (to borrow)
amountOut: "1000000000", // Amount to borrow in wei (1000 USDC with 6 decimals)
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", // Aave V3 pool
},
},
],
);
```
| Parameter | Description | Required |
| ---------------- | --------------------------------------------------------------------------------------- | -------- |
| `collateral` | Address of the token used as collateral. Can be an array for multiple collateral tokens | Yes |
| `tokenOut` | Address of the token to borrow | Yes |
| `amountOut` | Amount to borrow in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the lending pool contract | Yes |
### `repay`
Repays a loan on a lending protocol.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH address
tokenOut: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", // aWETH address (optional)
amountIn: "1000000000000000000", // Amount in wei (1 WETH)
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", // Aave V3 pool
receiver: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045", // Optional: Receiver address
},
},
{
protocol: "aave-v3",
action: "borrow",
args: {
collateral: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH address (collateral)
tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC address (to borrow)
amountOut: "1000000000", // Amount to borrow in wei (1000 USDC with 6 decimals)
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", // Aave V3 pool
},
},
// Step 3: Now repay the borrowed USDT
{
protocol: "aave-v3",
action: "repay",
args: {
tokenIn: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
amountIn: "1000000000", // 100 USDC
primaryAddress: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2",
},
},
],
);
```
| Parameter | Description | Required |
| ---------------- | ------------------------------------------- | -------- |
| `tokenIn` | Address of token to repay | Yes |
| `amountIn` | Amount to repay in wei (with full decimals) | Yes |
| `primaryAddress` | Address of the lending pool contract | Yes |
| `onBehalfOf` | Address to repay debt for | Yes |
### `repay` on Behalf of Another address
Repay parameter `onBehalfOf` enables you to repay a loan on behalf of a given address:
```js theme={null}
const bundleData = await client.getBundleData(
{
chainId: 1, // Mainnet
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address,
routingStrategy: "delegate",
},
[
// 3. Repay the ETH debt
{
protocol: "compound-v2",
action: "repay",
args: {
tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH
amountIn: "300000000000000000",
primaryAddress: "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", // cETH contract
onBehalfOf: "0x80fCBfbC698Aca3B3BCB83ceB13301a639A39832",
},
},
],
);
console.log(bundleData);
```
## Yield Farming Actions
### `harvest`
Harvests rewards from yield-generating positions.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "curve-gauge",
action: "harvest",
args: {
token: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", // Token address (LP token or gauge token)
primaryAddress: "0x182B723a58739a9c974cFDB385ceaDb237453c28", // Curve gauge address
},
},
],
);
```
| Parameter | Description | Required |
| ---------------- | ------------------------------------------------------------ | -------- |
| `token` | Address of token to harvest rewards for | Yes |
| `primaryAddress` | Address of the contract to interact with (e.g., gauge, farm) | Yes |
## Token Management Actions
### `approve`
Approves a spender to use tokens.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "erc20",
action: "approve",
args: {
token: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH address
spender: "0xe592427a0aece92de3edee1f18e0157c05861564", // Spender address (e.g., Uniswap router)
amount: "1000000000000000000000000", // Amount to approve in wei (1M WETH)
},
},
],
);
```
| Parameter | Description | Required |
| --------- | --------------------------------------------- | -------- |
| `token` | Address of the token to approve | Yes |
| `spender` | Address of the spender (protocol or router) | Yes |
| `amount` | Amount to approve in wei (with full decimals) | Yes |
### `transfer`
Transfers tokens to a specified address.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "erc20",
action: "transfer",
args: {
token: "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07", // OMG token address
receiver: "0x80eba3855878739f4710233a8a19d89bdd2ffb8e", // Recipient address
amount: "1000000000000000000", // Amount to transfer in wei (1 OMG)
id: "1234", // Optional: ID for ERC721 or ERC1155 tokens
},
},
],
);
```
| Parameter | Description | Required |
| ---------- | ---------------------------------------------- | -------- |
| `token` | Address of the token to transfer | Yes |
| `receiver` | Address of the recipient | Yes |
| `amount` | Amount to transfer in wei (with full decimals) | Yes |
| `id` | Token ID for ERC721 or ERC1155 tokens | No |
### `transferFrom`
Transfers tokens from a specified address to another address.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "balance",
args: {
token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
},
},
{
protocol: "erc20",
action: "transferfrom",
args: {
token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // OMG token address
sender: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045", // Sender address
receiver: "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11", // Recipient address
amount: "1000000000000000000", // Amount to transfer in wei (1 OMG)
},
},
],
);
```
| Parameter | Description | Required |
| ---------- | ---------------------------------------------- | -------- |
| `token` | Address of the token to transfer | Yes |
| `sender` | Address of the sender | Yes |
| `receiver` | Address of the recipient | Yes |
| `amount` | Amount to transfer in wei (with full decimals) | Yes |
| `id` | Token ID for ERC721 or ERC1155 tokens | No |
### `permitTransferFrom`
Approves and transfers a token that supports permit in a single step using a signature. A permit signature needs to be generated offchain and passed to the API.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "permit2",
action: "permittransferfrom",
args: {
token: "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07", // Token address
amount: "1000000000000000000", // Amount in wei (1 token)
sender: "0xb67f3CE46bB9E1a1127796c27f38DbaB9f643ec0", // Sender address
receiver: "0x35a2839b617F7da6534d636f22945f6Cb6137130", // Receiver address
nonce: "1", // Nonce to prevent replay attacks
deadline: "1710150268", // Timestamp deadline for signature validity
signature: "0x...", // Permit signature
},
},
],
);
```
| Parameter | Description | Required |
| ----------- | ----------------------------------------------------------------------------------- | -------- |
| `token` | Address of the token to transfer. Can be an array for multiple tokens | Yes |
| `amount` | Amount to transfer in wei (with full decimals). Can be an array for multiple tokens | Yes |
| `sender` | Address of the sender | Yes |
| `receiver` | Address of the recipient | Yes |
| `nonce` | Nonce value to prevent signature replay | Yes |
| `deadline` | Timestamp after which the signature is invalid | Yes |
| `signature` | The EIP-2612 permit signature | Yes |
## Utility Actions
### `balance`
Gets the balance of a token for the caller's address.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "balance",
args: {
token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
},
},
],
);
```
| Parameter | Description | Required |
| --------- | ------------------------------------- | -------- |
| `token` | Address of the token to check balance | Yes |
### `split`
Splits a token into multiple outputs with specified token addresses and amounts.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "balance",
args: {
token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
},
},
{
protocol: "enso",
action: "split",
args: {
tokenIn: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
tokenOut: [
"0x6b175474e89094c44da98b954eedeac495271d0f", // DAI
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH
],
amountIn: { useOutputOfCallAt: 0 }, // Use the balance from the first action
},
},
],
);
```
| Parameter | Description | Required |
| ---------- | ---------------------------------------------- | -------- |
| `tokenIn` | Address of the token to split | Yes |
| `tokenOut` | Array of token addresses for the split outputs | Yes |
| `amountIn` | Amount to split in wei (with full decimals) | Yes |
| `receiver` | Address to receive the split tokens | No |
### `merge`
Merge multiple token inputs into a single output.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "merge",
args: {
tokenIn: [
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"0x6b175474e89094c44da98b954eedeac495271d0f", // DAI
],
tokenOut: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // Combined WETH
amountIn: [
"2000000000000000000000", // 2 USDC
"3000000000000000000000", // 3 DAI
],
receiver: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
},
},
],
);
```
| Parameter | Description | Required |
| ---------- | ------------------------------------------------------------ | -------- |
| `tokenIn` | Array of input token addresses | Yes |
| `tokenOut` | Address of the output token | Yes |
| `amountIn` | Array of amounts to merge (must be in the same denomination) | Yes |
| `receiver` | Address to receive the merged tokens | No |
### `call`
Makes an arbitrary call to any contract, allowing for custom interactions. For example, making a [custom contract call](/pages/build/examples/custom-call-bundle) when the protocol demands additional arguments.
This is useful for executing complex logic or interacting with contracts that are not directly supported by the Enso API.
To perform arithemtics over return values from previous actions, you can use the PercentageMathHelpers contract:
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "call",
args: {
address: "0xD0aF6F692bFa10d6a535A3A321Dc8377F4EeEF12", // Contract address
method: "percentMul", // Method name
abi: "function percentMul(uint256,uint256) external", // ABI signature
args: [
"1000000000000000000", // 1 ETH (first argument)
"7000", // 70% (second argument)
],
},
},
],
);
```
Add these parameters to the `call` action documentation:
| Parameter | Description | Required |
| ---------- | ----------------------------------------------------------- | -------- |
| `address` | Address of the contract to call | Yes |
| `method` | Name of the method to call | Yes |
| `abi` | ABI signature of the method | Yes |
| `args` | Array of arguments to pass to the method | Yes |
| `tokenIn` | Input token address (when tokens are involved in the call) | No |
| `tokenOut` | Output token address (when tokens are involved in the call) | No |
| `value` | ETH value to send with the transaction in wei | No |
### `fee`
Calculates and deducts a fee from a specified amount, sending the fee to a designated receiver. This action is typically prepended to bridge operations to facilitate fee collection.
The `fee` action calculates the fee as `amount * (bps/10000)` and sends this amount to the `receiver`. It returns `amount - fee`, which can be used in subsequent actions via `useOutputOfCallAt`.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "fee",
args: {
token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
amount: "1000000000000",
bps: "500",
receiver: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
},
},
],
);
```
| Parameter | Description | Required |
| ---------- | ---------------------------------------------------------------------------------------- | -------- |
| `token` | Token address to apply the fee to | Yes |
| `amount` | Amount to apply the fee to (with full decimals) or a return value from a previous action | Yes |
| `bps` | Fee percentage in basis points (1 bps = 0.01%, 100 bps = 1%) | Yes |
| `receiver` | Address to receive the fee | Yes |
### `ensofee`
Calculates and deducts Enso's protocol fee from a specified amount.
The `fee` action calculates the fee as `amount * (bps/10000)` and sends this amount to Enso.
It returns `amount - fee`, which can be used in subsequent actions via `useOutputOfCallAt`.
```typescript theme={null}
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
routingStrategy: "delegate",
},
[
{
protocol: "enso",
action: "ensofee",
args: {
token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
amount: "1000000000", // 1000 USDC
bps: "25", // 0.25% fee (25 basis points)
},
},
],
);
```
| Parameter | Description | Required |
| --------- | ---------------------------------------------------------------------------------------- | -------- |
| `token` | Token address to apply the fee to | Yes |
| `amount` | Amount to apply the fee to (with full decimals) or a return value from a previous action | Yes |
| `bps` | Fee percentage in basis points (1 bps = 0.01%, 100 bps = 1%) | Yes |
## Protocol Support
The Bundle API supports a wide range of protocols. Some common ones include:
* `aave-v2`, `aave-v3`: Aave lending/borrowing
* `balancer-v2`: Balancer liquidity pools
* `curve`: Curve Finance stable swaps and gauges
* `curve-gauge`: Curve gauges for staking
* `erc20`: Standard token operations
* `erc4626`: ERC4626 vaults
* `enso`: General Enso operations including route and arbitrary calls
* `permit2`: Uniswap's Permit2 operations
* `uniswap-v2`, `uniswap-v3`: Uniswap pools and routers
* `yearn`: Yearn Finance vaults
* `compound-v2`, `compound-v3`: Compound lending/borrowing
* `stargate`: Cross-chain bridging
For a complete list of supported protocols, use the Projects API endpoint: [GET `/standards`](/api-reference/integration/standards).
Updated {date_0}
# Concepts
Source: https://docs.enso.build/pages/build/reference/concepts
Understand Enso's core concepts and how they work.
export const date_0 = "2025-07-07"
## Projects
A project in Enso represents an overarching blockchain platform or financial service with multiple protocol implementations. Projects serve as the top-level categorization in Enso's data model, grouping related protocols
Example: The "Aave" project encompasses protocols "aave-v2" and "aave-v3".
**API Reference:**
* [GET `/projects`](/api-reference/integration/projects) - Returns all available projects
* [GET `/projects/protocols`](/api-reference/integration/protocols-in-a-project) - Returns protocols available for a specific project
## Protocols
A protocol is a specific implementation or version of a project deployed on one or more blockchain networks. Each protocol has a unique identifier (slug), defined functionality, and standardized interfaces.
For example, "uniswap-v3" specifies the exact smart contract implementations, supported chains, and available actions for that particular version of Uniswap.
**API Reference:**
* [GET `/projects/protocols`](/api-reference/integration/protocols-in-a-project) - Returns all supported protocols and their metadata
* [GET `/integration/{slug}`](/api-reference/integration/standard-per-protocol) - Returns details for a specific protocol by slug
## Standards
A standard defines the interface specifications and methods for interacting with protocols. Standards document the common patterns across similar protocols, including required inputs, function signatures, and expected outputs.
This standardization layer enables Enso to abstract implementation details and *provide consistent interfaces* across varied DeFi protocols.
**API Reference:**
* [GET `/standards`](/api-reference/integration/standards) - Returns all available standards and their methods
* [GET `/actions`](/api-reference/integration/supported-actions) - Returns all standardized actions available for protocols
## Actions
An action is a discrete operation performed on a protocol (e.g., "deposit", "withdraw", "swap", "borrow"). Actions specify the required input parameters and expected outputs for each operation type.
Enso's action abstraction allows developers to *execute the same conceptual operation* across different protocols without handling protocol-specific implementation details. Actions can be bundled into atomic multi-step transactions.
**API Reference:**
* [GET `/actions`](/api-reference/integration/supported-actions) - Returns all available actions and their input parameters
* [POST `/shortcuts/bundle`](/api-reference/defi-shortcuts/bundle-a-list-of-actions) - Allows bundling multiple actions into a single transaction
## Tokens
Enso recognizes two primary token types:
1. **Base Token**: Standard cryptocurrency assets without DeFi positioning (e.g., ETH, WETH, USDC, DAI). These tokens serve as the building blocks for DeFi operations.
2. **DeFi Token**: Tokens representing positions in DeFi protocols (e.g., yvWETH for Yearn-deposited WETH, aDAI for Aave-deposited DAI). These tokens contain metadata about their protocol association, underlying assets, APY, and TVL metrics.
**API Reference:**
* [GET `/tokens/tokens`](/api-reference/tokens/tokens) - Returns all supported tokens with filtering options for type, protocol, etc.
* [GET `/defi/prices`](/api-reference/tokens/token-price) - Returns price data for a specific token
Both token types include core properties (address, chainId, decimals, symbol, name, logoUri), with DeFi tokens containing additional protocol-specific metadata.
Updated {date_0}
# Contracts and Deployments
Source: https://docs.enso.build/pages/build/reference/deployments
Enso contracts deployment addresses
export const date_0 = "2025-10-22"
The onchain interactions—executing the calldata Enso composes—happens via two smart contracts:
* **EnsoRouter** that executes the submitted route with `router` strategy (`router-legacy` for V1).
* **DelegateEnsoShortcuts** that executes the shortcut with `delegate` strategy (`delegate-legacy` for V1).
Use the `response.tx.to` field from the [`/route`](/api-reference/defi-shortcuts/optimal-route-between-two-tokens) and [`/bundle`](/api-reference/defi-shortcuts/bundle-a-list-of-actions) endpoints instead of hardcoding Router and DelegateEnsoShortcuts addresses in your code.
## V2 Contracts
Deployment addresses for EnsoRouter and Delegate V2 on supported networks.
Network
Router V2
Delegate V2
Ethereum `1`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Optimism `10`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Binance `56`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Gnosis `100`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Unichain `130`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Polygon `137`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Sonic `146`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
ZkSync `324`
`0x1BD8CefD703CF6b8fF886AD2E32653C32bc62b5C`
`0x4c3Db0fFf66f98d84429Bf60E7622e206Fc4947c`
World `480`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Hyper `999`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Soneium `1868`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Base `8453`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Arbitrum `42161`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Avalanche `43114`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Ink `57073`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Linea
`0xA146d46823f3F594B785200102Be5385CAfCE9B5`
`0xEe41aB55411a957c43C469F74867fa4671F9f017`
Berachain `80094`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Plume `98866`
`0x3067BDBa0e6628497d527bEF511c22DA8b32cA3F`
`0x973e7203f1B7fbcc156b4BD8734fc66790e689C5`
Sepolia `11155111`
`0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf`
`0x7663fd40081dcCd47805c00e613B6beAc3B87F08`
Katana `747474`
`0x3067BDBa0e6628497d527bEF511c22DA8b32cA3F`
`0x973e7203f1B7fbcc156b4BD8734fc66790e689C5`
Plasma `9745`
`0xCfBAa9Cfce952Ca4F4069874fF1Df8c05e37a3c7`
`0xA2F4f9C6ec598CA8c633024f8851c79CA5F43e48`
## V1 Contracts
Deployment addresses for EnsoRouter and Delegate V1 on supported networks.
Network
Router V1
Delegate V1
Ethereum `1`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Optimism `10`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Binance `56`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Gnosis `100`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Unichain `130`
-
-
Polygon `137`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Sonic `146`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
ZkSync `324`
`0xd12ecDD67300D5ef0A68576CfDF038bAB5b5054a`
`0x43BD12326142568D5Cc33c7326A68Ca4e0be9292`
World `480`
-
-
Hyper `999`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Soneium `1868`
-
-
Base `8453`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Arbitrum `42161`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Avalanche `43114`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Ink `57073`
-
-
Linea `59144`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Berachain `80094`
`0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E`
`0x38147794ff247e5fc179edbae6c37fff88f68c52`
Sepolia `11155111`
-
-
Katana `747474`
-
-
Plume `98866`
-
-
Updated {date_0}
# FAQ
Source: https://docs.enso.build/pages/build/reference/faq
Find answers to common questions.
export const date_0 = "2025-09-18"
## Integration
### What networks does Enso support?
Enso supports multiple EVM-compatible networks. Check the [Supported Networks](/pages/build/reference/supported-networks) page for the latest list.
***
### What protocols does Enso support?
Enso supports 140+ protocols across various categories.
Use the [GET `/standards`](/api-reference/integration/standards) endpoint to get the latest list.
Here's a complete list of supported protocols:
* "bex"
* "aave"
* "radiant"
* "zerolend"
* "spark"
* "angle"
* "ankr"
* "aura"
* "avalon"
* "balancer"
* "burrbear"
* "bancor"
* "bedrock"
* "beefy"
* "beets"
* "berachain-honey"
* "compound-finance"
* "venus"
* "apeswap"
* "flux-finance"
* "iron-bank"
* "moonwell"
* "benqi"
* "compound"
* "convex"
* "aura-lp"
* "curve"
* "dinero"
* "erc20"
* "erc4626"
* "frax-finance"
* "inverse-finance"
* "gearbox"
* "ethena"
* "adapter-fi"
* "mstable"
* "idle"
* "yieldnest"
* "morpho"
* "exactly"
* "cian-protocol"
* "reserve-protocol"
* "d2-finance"
* "mountain-protocol"
* "gains-network"
* "dolomite"
* "concrete"
* "acorn-wabtc"
* "resolv"
* "tokemak"
* "liftdollar"
* "rings"
* "beraborrow"
* "origami"
* "the-honey-jar"
* "dahlia"
* "origin-protocol"
* "infrared"
* "yield-fi"
* "etherfi"
* "euler"
* "fluid"
* "frax"
* "genesis-lrt"
* "gmx"
* "goldilocks"
* "harvest-finance"
* "inception-lrt"
* "ipor"
* "kelp"
* "kelp-rseth-wrapped"
* "kernel"
* "kiln"
* "kodiak"
* "lido"
* "locus"
* "lorenzo"
* "mantle"
* "maverick"
* "moby"
* "molten"
* "mozaic"
* "pendle"
* "permit2"
* "pickle"
* "polygon"
* "pooltogether"
* "primex"
* "prisma"
* "pumpbtc"
* "renzo"
* "reserve"
* "reservoir"
* "restake"
* "rocketpool"
* "origin"
* "stakestone"
* "satlayer"
* "silo"
* "sky"
* "solv"
* "sommelier"
* "stability"
* "stable-jack"
* "stader"
* "stakedao"
* "stargate"
* "steer"
* "summer-fi"
* "swell"
* "symbiotic"
* "shibaswap"
* "verse"
* "uniswap"
* "unsheth"
* "usual"
* "vaultcraft"
* "vector"
* "veda"
* "velodrome"
* "aerodrome"
* "vesper"
* "wrapped-native"
* "yearn"
* "pancakeswap"
* "sushiswap"
* "pangolin"
* "beradrome"
* "camelot"
* "trader-joe"
* "pancakeswap-amm-v3"
* "bakerdao"
* "treehouse"
* "shadow-exchange"
* "swapx"
* "vicuna"
* "yeet"
* "level
***
### Is it safe and secure to use Enso as a third party service?
Enso prioritizes security in the following ways:
* Smart contract code is [audited](https://github.com/EnsoBuild/enso-audits).
* All transactions are simulated before execution, with actual values returned in the API response
* End users can independently simulate transactions using Tenderly before on-chain execution
***
### What is the default rate limit for the API?
Rate limits can be increased [on demand](https://t.me/enso_shortcuts).
The default rate limit is 10 requests per second (RPS).
When the limit is exceeded, you'll receive a `429 Too Many Requests` error.
***
### How do I request support for a new token or protocol?
We are constantly expanding our support for new assets and protocols.
If you'd like to request an integration, please reach out to our BD or DevRel team in [Telegram Dev Channel](https://t.me/enso_shortcuts) or our shared channel.
## API Basics
### What's the difference between `route` and `bundle` endpoints?
**The `route` is optimally pre-populated `bundle`**
The `route` API automatically creates a bundle of actions in order to find the optimal route for your desired outcome.
The `bundle` API allows you to specify the exact actions and protocols you want to use in your transaction.
* The [POST `/shortcuts/route`](/api-reference/defi-shortcuts/optimal-route-between-two-tokens) API endpoint is used when:
* You want an optimal path from any token `tokenIn` to any token `tokenOut`
* You don't care about the specific actions and intermediary tokens on the route
* You're using tokenized positions (for non-tokenized positions, use the `nontokenized` endpoint)
* The [POST `/shortcuts/bundle`](/api-reference/defi-shortcuts/bundle-a-list-of-actions) endpoint is used when:
* You want to to bundle multiple actions into a single transaction
* You want to use specific protocols for your route
* You want to actions like `harvest` and `redeem`
***
### What's the difference between `route` and `nontokenized` endpoints?
* The [POST `/shortcuts/route`](/api-reference/defi-shortcuts/optimal-route-between-two-tokens) API endpoint is used for tokenized positions where you receive a token representing your position (like aTokens in Aave).
* The [GET `/shortcuts/route/nontokenized`](/api-reference/defi-shortcuts/routing-to-a-non-tokenized-position) endpoint is for non-tokenized positions, which are stored directly in a smart contract (usually a Smart Wallet).
***
### When do I need to use a Smart Wallet?
Use the Smart Wallet (mandatory `delegate` routing strategy) with either `shortcuts/route`, `shortcuts/bundle` and `shortcuts/route/nontokenized` when:
* You are using a Smart Wallet (like Argent or Gnosis Safe)
* You want a `POST /shortcuts/bundle` including [`harvest`](/pages/build/reference/actions#harvest) or [`redeem`](/pages/build/reference/actions#redeem) actions
* You want to use `GET /shortcuts/route/nontokenized` endpoint
* You want to specify a [`spender` address](/api-reference/defi-shortcuts/optimal-route-between-two-tokens-1#body-spender) for `redeem` actions
***
### What is the difference between `router` and `delegate` routing strategies?
Both routing strategies are used with `POST /shortcuts/route`, and `POST /shortcuts/bundle`, and `POST /shortcuts/route/nontokenized` endpoints:
* `router`: Standard routing strategy for EOAs (Externally Owned Accounts). With this strategy, prior to executing your route, you must approve Enso Router to spend input tokens. You can do so by using [`approve` API](/api-reference/defi-shortcuts/approve-enso-contract).
* `delegate`: Routing strategy for smart wallets, allowing for delegate calls. No approvals necessary prior to sending transaction. You also must use `delegate` for actions such as `borrow`, `harvest`, and `repay`.
The routing strategy instructs the API on how to build the transaction calldata, and which of Enso's smart contracts to use for execution. The API response contains the calldata and the correct recipient in `tx.to` field, that points to [one of Enso's contracts](/pages/build/reference/deployments).
Learn more about [routing strategies](/pages/build/reference/routing-strategies).
***
### How do I authenticate API requests?
API requests require an authentication token in the Authorization header:
```
-H 'Authorization: Bearer YOUR_API_KEY'
```
***
### How do I get and use the returned calldata?
The API returns transaction calldata that should be sent to the [`EnsoShortcutRouter`](https://etherscan.io/address/0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E#code) contract.
## Routing Mechanics
### How does the routing work behind the scenes?
Enso's router functions as a configurable multicall that can execute multiple actions in a single transaction on a specific chain. It optimizes the route based on current market conditions to find the best path for your transaction, whether it's a swap, zap, deposit and so on.
***
### Does Enso support cross-chain transactions?
Both `route` and `bundle` API support crosschain routing.
***
### What contract does the calldata interact with?
The calldata should be sent to the [`EnsoShortcutRouter`](https://etherscan.io/address/0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E#code) contract on the respective chain.
***
### How does Enso handle wallet types?
Enso recognizes two different [routing strategies](/pages/build/reference/routing-strategies).
* The standard `route` routing strategy is designed for EOAs (Externally Owned Accounts). To use a smart wallet, use `delegate` routing strategy.
***
### What happens if the user doesn't have sufficient funds?
The API will return a route, but transaction execution will fail if sufficient funds aren't available.
## OneStable (crosschain routing)
### How do I do complex multichain routing
For complex multichain routing, you can use nested bridge actions with callbacks, chaining operations across multiple chains in a single bundle.
[**Crosschain Routing**](/pages/build/get-started/crosschain-routing)
***
### Are there any limitations on callback complexity?
* **Maximum actions**: Bundles support up to 10 actions total (including those in callbacks)
***
### How do I ensure my funds are safe during cross-chain operations?
Always set both `receiver` and `refundReceiver` addresses when using bridge callbacks. The `refundReceiver` gets the refund if callback actions fail on the destination chain. If `refundReceiver` is not set, tokens go to the `receiver` address on failure.
***
### How do I estimate the total gas cost across multiple chains, including callback execution?
The bundle API returns the simulated gas it will use in the response. You can provide an additional `callbackGasLimit` parameter to control the maximum gas the transaction can spend on the destination chain to avoid excessive gas consumption.
***
### Can I query the status of a pending bridge transaction?
You can use the LayerZero Scan API to track bridge transaction status by passing the transaction hash:
```
https://scan.layerzero-api.com/v1/messages/tx/{txHash}
```
This allows you to monitor the bridge status after submitting the transaction through the Enso SDK.
***
### What happens to my bridge callback actions if one fails midway?
If the transaction on the destination chain fails/reverts, the bridged tokens are sent to the refundReceiver address (or receiver if no refundReceiver is specified).Retry
***
### How do I know if a token has a valid pool on both source and destination chains?
The SDK provides the getLayerZeroPool() method to check if a pool exists for a token/chain combination. Additionally, when you make a bundle request, it will simulate the entire cross-chain transaction and fail if pools don't exist.
```typescript theme={null}
const poolsInfo = await client.getLayerZeroPool({
chainId: 1,
token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
destinationChainId: '8453',
destinationToken: '0x...'
});
console.log(poolsInfo[0]);
```
***
### What happens if the destination pool doesn't have enough liquidity?
## Error Handling
### How can I test transactions before executing them?
You can simulate transactions using Tenderly before executing them on-chain.
## Enso Contracts
### Are the Enso smart contracts upgradable? What are the security implications?
Our core routing logic is handled by immutable, audited smart contracts to ensure maximum security.
We use a delegate proxy pattern to enable simplified interaction when signing via Smart Wallets, controlled by the [`routingStrategy` API parameter](#what-is-the-difference-between-router-and-delegate-routing-strategies).
All contract updates undergo rigorous internal testing and external audits before deployment.
Learn more about [Enso contracts](/pages/build/reference/deployments).
## Integration Patterns
### How should I implement recurring transactions?
Since routes are dynamic and market conditions change, the best approach for recurring transactions is to use an off-chain actor that calls the API periodically to get the latest optimal route.
***
### How can I integrate Enso with a custom smart contract?
You can create a custom contract that calls the [`EnsoShortcutRouter`](https://etherscan.io/address/0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E#code) with the data returned from the API.
***
### Can I integrate Enso with a bot?
Yes, Enso's API is suitable for bot integration, such as for dutch auction fills, liquidation bots, or automated trading strategies.
***
### What types of DeFi operations does Enso support?
Enso supports a wide [range of DeFi operations](/pages/build/reference/actions) including swaps, deposits, lending, borrowing, staking into LSTs, and complex compositions of these actions.
## DeFi FAQ
### How is slippage handled in routes?
Slippage is specified in basis points as a parameter in API calls (e.g., 300 = 3%).
The response amount `tokenOut` accounts for any slippage, as the API simulates the transaction before returning the route.
***
### How do I know the price imapct of my route?
When using `POST /shortcuts/route`, `POST /shortcuts/bundle`, or `POST /shortcuts/route/nontokenized`, the API returns the `priceImpact` field. This value is obtained from a transaction simulation, and indicates the expected price impact.
***
### Does `redeem` action withdraw additional pool rewards?
The `redeem` action does not withdraw additional pool rewards.
It only redeems the underlying asset from the pool. To withdraw rewards, use the `harvest` action.
## Common Errors and Solutions
### "Could not build shortcuts for route" Error
This error in `/shortcuts/route` API indicates that Enso couldn't find a valid route between the specified tokens on the specified network.
Possible solutions:
* Verify token addresses are correct
* Check if the token pair is supported on the specified chain
* Verify the protocol integration is working
* Check if your operation demands a `redeem` or `harvest` action, which must be used via the `bundle` endpoint, using the `delegate` routing strategy.
Updated {date_0}
# Licence & Legal
Source: https://docs.enso.build/pages/build/reference/legal
Understand the legal aspects of using Enso API.
export const date_0 = "2025-06-30"
# Legal Information for Enso API Builders
## Overview
As an Enso API builder, it's important to understand the legal framework governing your use of our APIs. This page provides key information about legal considerations and links to our comprehensive legal documentation.
## API License Agreement
Before integrating with the Enso API, please review our API License Agreement. This agreement outlines the terms and conditions for using our APIs, including:
* License scope and limitations
* Intellectual property rights
* Usage restrictions
* Data privacy considerations
* Support provisions
* Payment terms (if applicable)
* Confidentiality requirements
* Termination conditions
## Key Legal Considerations
When building with the Enso API, keep these important legal points in mind:
1. **License Limitations**: The license granted is limited, non-exclusive, non-transferable, and may not be sublicensed.
2. **Usage Restrictions**: There are specific restrictions on how you can use the API, including prohibitions against reverse engineering and competing services.
3. **End User Agreements**: You must have appropriate agreements with your end users that protect Enso's rights.
4. **Ownership**: Enso maintains ownership of the API, platform, content, and related intellectual property.
5. **Data Privacy**: When using the API, certain information is shared with Enso and must be handled in accordance with data protection laws.
## Documentation Links
For complete legal information, please review the following documentation:
By accessing and using the API, you accept to be bound by the linked license agreement.
You must read the Agreement carefully.
* [API License Agreement](https://drive.google.com/file/d/1Z_szzLwwLqx9v6liyslKsos75I17obDS/view?usp=sharing)
## Questions or Concerns
If you have any questions about the legal aspects of using the Enso API, please contact us at [partners@enso.finance](mailto:partners@enso.finance).
***
**Note**: The information on this page is provided for guidance only. Always refer to the complete legal documents for definitive information about your rights and obligations when using the Enso API.
Updated {date_0}
# Routing Strategies
Source: https://docs.enso.build/pages/build/reference/routing-strategies
Understand `delegate` and `route` routing strategies for shortcuts APIs.
export const date_0 = "2025-08-07"
When using the Shortcuts endpoints (`/shortcuts/route` and `/shortcuts/bundle`), you must choose between two routing strategies: `router` and `delegate`.
Based on the strategy you choose, the Enso API will route your transaction through the appropriate smart contract.
**Use the `tx.to` response value** when sending on-chain a shortcut transaction you obtained.
By avoiding hardcoded addresses, your shortcuts will always be routed to the correct contract, even if the address changes in the future.
For specific addresses, check out [Deployments](/pages/build/reference/deployments)
## When to use `delegate` or `router`?
You must use `delegate` when:
* dealing with [non-tokenized positions](/pages/build/examples/route-nontokenized) where the state is stored in the protocol rather than represented by a token
* you need the state to persist in the user's smart wallet.
## Smart Wallets with `delegate`
Smart Wallet executes the bundle directly through delegate calls, by calling [`EnsoShortcutsDelegate` contract](./deployments), and the wallet itself doesn't hold any tokens during the execution.
```ts theme={null}
// no approvals of input tokens needed
const route = await client.getRouteData({
routingStrategy: "delegate",
//...
});
await signSmartWallet(route.tx, route.gas);
```
Use `delegate` for smart wallets supporting `delegatecall`:
* Enables both tokenized and non-tokenized interactions
* The state stays in the smart wallet itself.
* Complex, multi-step operations are more efficient and safer when executed through a smart wallet
* Simple approval model
* Limited to token-based operations
## EOAs with `router`
With `router` strategy, the Enso Router contract will hold the intermediate tokens between actions.
With this strategy, you must approve the Enso router contract to operate with your input tokens:
```ts theme={null}
const approval1 = await client.getApprovalData({
tokenAddress: token1,
amount: amt1,
chainId,
fromAddress,
});
const approval2 = await client.getApprovalData({
tokenAddress: token2,
amount: amt2,
chainId,
fromAddress,
});
const route = await client.getRouteData({
routingStrategy: "router",
//...
});
await signEoa(approval1.tx, approval1.gas);
await signEoa(approval2.tx, approval2.gas);
await signEoa(route.tx, route.gas);
```
Use `router` strategy for EOAs or simpler smart wallets:
* Works with tokenized interactions only
* Uses the universal router contract.
* Supports tokenized and non-tokenized interactions
* Enables complex DeFi strategies
* Works with lending positions and other stateful interactions
Updated {date_0}
# Supported Networks
Source: https://docs.enso.build/pages/build/reference/supported-networks
Chains supported by Enso API.
export const date_0 = "2025-07-31"
Enso currently supports the following networks:
* Ethereum (1)
* Arbitrum (42161)
* Avalanche (43114)
* Base (8453)
* Berachain (80094)
* Binance (56)
* Gnosis (100)
* Hyper (999)
* Ink (57073)
* Linea (59144)
* Optimism (10)
* Plume (98866)
* Polygon (137)
* Sepolia (11155111)
* Soneium (1868)
* Sonic (146)
* Unichain (130)
* World (480)
* Zksync (324)
* Katana (747474)
* Plasma (9745)
You can use the [GET `/networks`](/api-reference/integration/networks) endpoint to get the list of supported networks programmatically.
```bash theme={null}
curl -X 'GET' \
'https://api.enso.finance/api/v1/networks' \
-H 'accept: application/json' \
-H "Authorization: Bearer $ENSO_API_KEY" \
| jq -r '.[] | "\(.name) (\(.id))"' | paste -sd '\n' -
```
Updated {date_0}
# Whitepaper
Source: https://docs.enso.build/pages/build/reference/whitepaper
Whitepaper
TODO
# Changelog
Source: https://docs.enso.build/pages/changelog
Latest updates on API changes, supported protocols, positions, and chains in Enso.
# Changelog
### Enso Checkout
Enso Checkout is the universal payment layer for Web3. It allows users to accept payments from anywhere:
* Deposit from any chain into any protocol
* Use CEX funds onchain (Binance, Bybit, OKX + more)
* Fiat onramp: card + bank
### SDK update
The new version of Enso SDK is available:
* Utility methods to get crosschain routing Layer Zero pools
* Extended responses with additional fields
Get started:
```bash theme={null}
pnpm install @ensofinance/sdk
```
Lear more
### New Protocols
### Layer Zero Pools Endpoint
The new [Layer Zero pools endpoint](/api-reference/integration/layerzero-pool) lets you fetch exact pools for [crosschain routing](/pages/build/get-started/crosschain-routing).
### New Protocols
Beefy CLM (Concentrated Liquidity Manager) vaults and Hyperbloom now support full deposit and redemption capabilities, enabling automated position management in concentrated liquidity pools.
### OneStable
OneStable, a crosschain stablecoin issuance layer, is released!
To learn more about using OneStable, explore the [website](https://onestable.xyz/) and [hands-on examples](/pages/use-cases/stablecoins).
### New Protocols
### Enhanced Swap Routing
The routing engine is improved to get more accurate swap amounts,
improving route accuracy and reducing slippage on complex multi-step transactions.
### New Protocols
Midas RWA (Real World Assets) integration brings tokenized real-world assets into Enso's routing capabilities.
### Curve Llamalend Integration
Curve's Llamalend protocol is now fully supported with deposit, redeem, and repay operations. This lending market integration expands borrowing and yield opportunities on Curve's infrastructure.
### Curve Gauge Pricing
Improved pricing mechanisms for Curve gauge tokens provide more accurate valuations for staked LP positions.
### HyperEVM Bridge Support
Bridges on the HyperEVM network are now enabled with improved routing logic that prioritizes HyperEVM bridges for faster cross-chain transfers.
### New Protocols
StakeDAO integrations enable automated yield strategies across Curve, Yearn, and Pendle protocols.
### Enhanced Bridge Routing
The [bridge action](/pages/build/reference/actions#bridge) improvements provide better route selection and execution for cross-chain transfers, with optimized handling of complex multi-step bridge operations.
### New Network & Protocols 🚀
This update brings support for the new **Hyper network** and adds numerous protocols across **Katana**, **Berachain**, and **Ethereum**, expanding your cross-chain DeFi possibilities.
#### ✨ New Network
### Welcome, Katana Network! ⚔️
You can now use Enso's routing and execution capabilities on Katana.
Explore all available [projects](https://navigator.enso.build/projects?chainId=747474) and [positions](https://navigator.enso.build/tokens?chainId=747474).
#### New Chain
### Enhanced Route API with Cross-chain Support
The [POST `/route`](/pages/build/get-started/route) endpoint now supports cross-chain routing with the new `destinationChainId` parameter. This enables seamless routing between any two positions across different chains:
```javascript theme={null}
const crossChainRoute = await ensoClient.getRouteData({
fromAddress,
receiver,
spender,
chainId: 1, // Ethereum
destinationChainId: 98866, // Plume Network
amountIn: ["2000000000"], // 2,000 USDC
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC on Ethereum
tokenOut: ["0xAf5aEAb2248415716569Be5d24FbE10b16590D6c"], // myPUSD vault on Plume
slippage: "500", // 5% (complex crosschain + vault operation)
routingStrategy: "delegate"
});
```
This unlocks powerful cross-chain DeFi strategies, allowing users to move assets from one chain directly into yield-generating positions on another chain in a single transaction.
### New Protocols
Mellow ALM deposits and redeems are now fully supported across multiple chains, enabling automated liquidity management strategies with enhanced capital efficiency.
### New Account ID Endpoint
The new [GET `/account/{accountId}`](/api-reference/account/account-id) endpoint returns the accountId used in on-chain events for your API key:
```bash theme={null}
curl --request GET \
--url 'https://api.enso.finance/api/v1/account/accountId' \
--header 'Authorization: Bearer YOUR_API_KEY'
```
This accountId can be used to track and analyze your transactions in on-chain event logs.
### New Protocols
### Bundle Endpoint Route Information
The [POST `/bundle`](/api-reference/defi-shortcuts/bundle-a-list-of-actions) endpoint now returns route information similar to the `/route` endpoint when bundled actions involve routing. This provides better transparency into the execution path of complex bundled transactions.
### Nontokenized Routing Referral Support
The [GET `/route/nontokenized`](/api-reference/defi-shortcuts/routing-to-a-non-tokenized-position) endpoint now supports the `referralCode` parameter, enabling referral tracking for non-tokenized position routing.
### New Protocols
Origin superOETH and wrapped superOETH are now available on Plume Network, along with Rooster YAPs supporting both deposits and redemptions.
### New Protocols
### Notable Additions
* **Stable Jack** brings advanced stablecoin strategies to Avalanche
* **Stargate** cross-chain infrastructure now available on Plume
* **Midas vaults** integrated for Turtle Club TAC on Ethereum
### New Protocols
The [POST `route` API](/pages/build/get-started/route) now supports `destinationChainId` parameter that lets you do routing between any two positions on any two chains:
```javascript theme={null}
const crossChainVault = await ensoClient.getRouteData({
fromAddress,
receiver,
spender,
chainId: 1, // Ethereum
destinationChainId: 98866, // Plume Network
amountIn: ["2000000000"], // 2,000 USDC
tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], // USDC on Ethereum
tokenOut: ["0xAf5aEAb2248415716569Be5d24FbE10b16590D6c"], // myPUSD vault on Plume
slippage: "500", // 5% (complex crosschain + vault operation)
routingStrategy: "delegate"
});
console.log('myPUSD vault shares:', crossChainVault.amountOut);
console.log('Total route steps:', crossChainVault.route.length);
console.log('Estimated gas:', crossChainVault.gas);
```
This week, we're relasing several enhancements to Enso's APIs:
* clearer link between `projects` and `protocols`
* additional filters available on `/tokens`
* possibility to get prices for several tokens in a single request.
### The `/projects` API links to protocols
The [GET `/projects`](/api-reference/integration/projects) API recognizes overarching DeFi projects behind specific protocols.
The API now returns:
* `projectId` - the ID of the project, e.g. `aave`,
* `protocols` - the list of `aave` protocols, e.g. `aave-v3`, `aave-static-atokens`, and `aave-v2`
* `chains` - the list of chain IDs the protocol is supported on by Enso.
### The `/tokens` filters
The [GET `/tokens`](/api-reference/tokens/tokens) endpoint is useful for filtering through 2,292,738 tokens recognized by Enso.
The new filters are:
* `symbol`, e.g. `BERA` or `mooBeraswapBerachainUSDC.e/HONEY`
* `name`, e.g. `EVK Vault eUSDC.e-1`
Examples:
```bash theme={null}
curl --request GET \
--url 'https://api.enso.finance/api/v1/tokens?chainId=146&name=EVK%20Vault%20eUSDC'
curl --request GET \
--url 'https://api.enso.finance/api/v1/tokens?symbol=escETH-1&type=defi'
```
### Fetching token prices
The [GET `/prices`](/api-reference/tokens/tokens-prices-batched) endpoint now has an option to fetch prices for multiple tokens in a single batch:
```bash theme={null}
curl --request GET \
--url 'https://api.enso.finance/api/v1/prices/10?addresses=0x4200000000000000000000000000000000000006&addresses=0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4'
```
First half of May gives you the following protocols and tokens.
### New Protocols
### Unichain Migrator Widget
Enso's released the Unichain Migrator widget in collaboration with Layer0 and Stargate.
This widget allows users to migrate assets from major chains to Unichain using Stargate's cross-chain capabilities and Layer0's infrastructure, together with Enso's routing.
The Unichain Migrator widget can be used as a standalone app or as a React component ready for integration into your dapp.
* [Integration docs](/pages/templates/uniswap-migrator)
* [Unichain Migrator Demo](https://migrate.enso.build/)
### New Protocols (15)
### V2 `EnsoRouter` and `DelegateEnsoShortcuts`
We released V2 of EnsoRouter and DelegateEnsoShortcuts contract addresses on supported chains. This change affects you only if you've hard-coded the contract addresses in your code.
Check the [Deployments](/pages/build/reference/deployments) page for the latest addresses on each supported chain.
Don't hardcode the addresses.
We recommend using `tx.to` from `/route` and `/bundle` endpoints to send the transaction to the correct contract address. This way, you won't need to update your code with future upgrades.
### Nontokenized Routing
The new `GET /route/nontokenized` endpoint enables automatic routing when entering non-tokenized positions.
For these transactions, a smart wallet is necessary, and `routingStrategy: "delegate"` is necessary.
Explore:
* API [`GET /route/nontokenized`](/api-reference/defi-shortcuts/routing-to-a-non-tokenized-position)
* [Guide to routing to non-tokenized positions](/pages/build/examples/route-nontokenized)
### New Protocols (12)
### Tokens Pagination
The `/tokens` API now implements cursor-based pagination for the [`GET /tokens`](/api-reference/tokens/tokens) API endpoint, enabling more efficient retrieval of token data.
# Validators
Source: https://docs.enso.build/pages/network/network-participants/validators
Participants who secure the Enso Network by validating solutions and maintaining integrity
## Overview
Validators secure the Enso network by accepting valid consumer requests by simulating and proving the calldata generated can be executed, and is safe to be executed.
## Conclusion
Validators are key to the Enso network, ensuring that the solutions generated are accurate, secure, and reliable. Their work upholds the network's integrity, making it a trustworthy platform for decentralized applications across multiple blockchains.
# Enso Network
Source: https://docs.enso.build/pages/network/overview
Introduction to Enso network
## Overview
Enso is a unified network that connects all blockchains, empowering developers to build composable applications for millions of users across Web2 and Web3.
## Shared Network State
Each individual blockchain framework stores its own state data, which is not shared with other blockchain frameworks. For example, suppose Aave is deployed on Ethereum mainnet and not on Arbitrum. In that case, the state data of Aave on Ethereum mainnet is not shared with Aave on Arbitrum or accessible. Resulting in developers building manual integrations for each blockchain framework, and smart contract.
The Enso Network stores all data required for execution, and data fetching for each smart contract on each framework. In the above example for Aave, Aave is represented as an entity in the graph, and the relevant ChainIDs associated to associate the blockchains that Aave is deployed on. Particular data such as function signatures, inputs, outputs, validation, and getters for state validation are added within the Aave entity.
The underlying action that within the protocol entity is [identified as an action type](/pages/build/reference/actions), such as: `Lend`, `Borrow`, `Swap`, `NFT`, `Transfer`, `Approve`, `Deposit`, `Repay`, and many more. By having each action type identified, consumption can be easily done, and developers can embed more smart contract types into their applications. For example, an LLM wishing to do data harvesting and analysis across all lending protocols can easily consume the `Lend` action type from the Enso Network.
## Consumption
By having a shared network state aware of all information across all blockchain frameworks, developers can now simply express their desired outcome as an `intent` request. An `intent` request does not explicitly need to be for only one use case; it can encompass multiple smart contract interaction types across multiple blockchain frameworks.
# Tokenomics
Source: https://docs.enso.build/pages/network/token
Token utility and usage
Enso is the native token used within the Enso network. The Enso token is a critical component of the Enso ecosystem, and the network cannot function without the token.
| Property | Value |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Ticker | ENSO |
| Total token supply(genesis) | 100,000,000 |
| Max token supply | 127,339,703 (Initial annual inflation starts at 8% and gradually decays monthly to 0.35468% by year 10, after which inflation ceases) |
| Token address(ETH) | [https://etherscan.io/token/0x699F088b5DddcAFB7c4824db5B10B57B37cB0C66](https://etherscan.io/token/0x699F088b5DddcAFB7c4824db5B10B57B37cB0C66) |
| Token address(BSC) | [https://bscscan.com/address/0xfeb339236d25d3e415f280189bc7c2fbab6ae9ef](https://bscscan.com/address/0xfeb339236d25d3e415f280189bc7c2fbab6ae9ef) |
## Token Distribution
This table illustrates the allocation of ENSO tokens among the different participants within the Enso ecosystem.
| Category | Description | Token Allocation (%) |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -------------------- |
| Ecosystem | To foster the ecosystem, drive research and development, and ensure the network’s sustainable expansion over time. Including airdrop | 21.59% |
| Foundation | To cover operational costs, strengthen governance, and ensure the Enso Foundation’s sustainable development. | 16.605% |
| Community Round | Oversubscribed community round conducted on CoinList. | 4% |
| Advisor | To two advisors who guided Enso before its founding and have continued their support across its full journey. | 1.5% |
| Investors | Investors who have supported Enso since inception. | 31.305% |
| Team | To reward the ongoing alignment and long-term contributions of both current and future team members. | 25% |
| **Total** | **Total token supply** | 100% |
## Unlock Schedule
ENSO is unlocked according to the schedule depicted below. The schedule illustrates how ENSO will be distributed among different groups, including the Enso ecosystem, Advisors, Community round participants, investors, team, and the Enso Foundation.
Investors, team and advisors are subject to a 1-year lockup (cliff). At 1 year, tokens are released linearly, block by block, over 24 months.
## Key Functionality
1. **Governance**: Enso Token serve as governance token that can be staked (locked in wallet) to participate through voting in the Enso decentralized autonomous organisation (DAO) that governs the further development of the Protocol smart contracts (will be updated through new versions; while the old versions will still exist). The DAO does not host any votes on the allocation of assets to the Enso Token holders or on the amount of assets allocated to them. Further, there will be no staking reward for such staking in order to vote. The voting will require a quorum. If the quorum is reached and the vote is successful, the proposal can be implemented.
2. **Validation**: Enso Tokens need to be staked (locked in wallet) in order to validate action calldata, including Shortcuts, returned by the Protocol and external third parties, by simulating transactions using simulation software, via a proof-of-stake mechanism (Validators) in accordance with the following characteristics (Validation Function):
* The Validation Function has the purpose to support the security and operations of the Protocol.
* Enso Tokens are staked, i.e. locked by the system within the wallet of the Validator, in order to serve as a collateral ("stake") for ensuring the provision of correct validation of the action calldata, including Shortcuts.
3. **Delegation**: Enso Tokens can be staked for the benefit of a Validator for validating calldata, including Shortcuts, against a share of the Validation Revenue earned by such Validator.
# Checkout Widget
Source: https://docs.enso.build/pages/templates/checkout-widget
A React component for seamless cryptocurrency deposits with wallet and exchange integration
export const date_0 = "2025-09-23"
The Checkout Widget supports multiple funding sources including wallet transfers and exchange deposits, with built-in cross-chain routing and DeFi token swapping capabilities.
Try out the checkout flow
Add to your app
Key features include:
* **Multiple funding sources**: Connect wallets (MetaMask, Rabby) or exchanges (Binance)
* **Cross-chain deposits**: Automatic routing between different blockchain networks
* **Real-time quotes**: Live pricing and gas estimates
* **Customizable theming**: Full control over appearance and branding
* **Transaction tracking**: Real-time status updates with block explorer links
## How it Works
The widget provides multiple deposit flows depending on the user's preferred funding source:
1. **Wallet Flow**: Connect existing wallets and transfer tokens directly
2. **Exchange Flow**: Link exchange accounts (Binance) for seamless withdrawals
3. **Card Deposits**: Traditional payment methods (coming soon)
## Integrate
Install the widget:
```
npm i @ensofinance/checkout-widget
```
You can get an API key from the [Developer Portal](https://developers.enso.build).
Import and configure the widget.
To enable Binance deposits, add the `enableExchange` configuration.
**Domain whitelisting required**: Contact [Enso support](https://t.me/enso_shortcuts) to whitelist your domain(s) before enabling exchange integration.
```tsx theme={null}
import { CheckoutModal } from '@ensofinance/checkout-widget';
export function MyCheckoutComponentModal() {
const [isCheckoutActive, setIsCheckoutActive] = useState(false);
return (
);
}
```
```tsx theme={null}
import { Checkout } from '@ensofinance/checkout-widget';
export function MyCheckoutComponent() {
return (
);
}
```
The widget requires Wagmi and React Query providers. Set up your app's root component:
```tsx theme={null}
import { WagmiProvider, createConfig, http } from 'wagmi';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { base, mainnet, arbitrum } from 'wagmi/chains';
import { injected, walletConnect } from 'wagmi/connectors';
// Configure supported chains and connectors
const config = createConfig({
chains: [mainnet, base, arbitrum],
connectors: [
injected(), // MetaMask, Rabby, etc.
walletConnect({
projectId: 'YOUR_WALLETCONNECT_PROJECT_ID'
}),
],
transports: {
[mainnet.id]: http(),
[base.id]: http(),
[arbitrum.id]: http(),
},
});
const queryClient = new QueryClient();
function App() {
return (
{/* Your app components */}
)
}
```
The widget accepts a complete Chakra UI v3 `SystemConfig` for theming.
For advanced theming, refer to the [Chakra UI theming documentation](https://v3.chakra-ui.com/docs/theming/semantic-tokens).
```tsx theme={null}
import { CheckoutModal, type WidgetTheme } from '@ensofinance/checkout-widget';
const customTheme: WidgetTheme = {
theme: {
semanticTokens: {
colors: {
// Background colors
bg: { value: "#ffffff" },
"bg.subtle": { value: "#f8fafc" },
"bg.emphasized": { value: "#f1f5f9" },
// Foreground/text colors
fg: { value: "#0f172a" },
"fg.muted": { value: "#64748b" },
"fg.subtle": { value: "#94a3b8" },
// Border colors
border: { value: "#e2e8f0" },
"border.emphasized": { value: "#cbd5e1" },
// Primary accent color
primary: { value: "#3b82f6" },
"primary.emphasis": { value: "#2563eb" },
// Status colors
success: { value: "#10b981" },
warning: { value: "#f59e0b" },
error: { value: "#ef4444" },
},
},
// Custom button variants
recipes: {
button: {
variants: {
solid: {
bg: "primary",
color: "white",
_hover: { bg: "primary.emphasis" }
}
}
}
}
}
};
function App() {
return (
);
}
```
## Configuration Props
### CheckoutConfig Properties
The following checkout config exists:
| Parameter | Type | Description | Required |
| ---------------- | ---------------------- | -------------------------------------------- | -------- |
| `apiKey` | `string` | Your Enso API key | Yes |
| `tokenOut` | `string` | Destination token address | Yes |
| `chainIdOut` | `number` | Destination chain ID | Yes |
| `theme` | `WidgetTheme` | Custom Chakra UI theme config | No |
| `enableExchange` | `SupportedExchanges[]` | Enable exchange integrations (`["binance"]`) | No |
### CheckoutModalProps
The `CheckoutModal` expands `CheckoutConfig` with modal-related properties and callbacks:
| Parameter | Type | Description | Required |
| ------------- | --------------------------- | ---------------------------------------------------------- | -------- |
| `config` | `CheckoutConfig` | Widget [configuration object](#checkout-config-properties) | Yes |
| `isActive` | `boolean` | Controls modal visibility | Yes |
| `setIsActive` | `(active: boolean) => void` | Modal state setter | Yes |
| `onClose` | `() => void` | Close callback function | No |
## Supported Networks
The widget supports deposits across all networks:
* Ethereum (Chain ID: 1)
* Base (Chain ID: 8453)
* Arbitrum (Chain ID: 42161)
* Optimism (Chain ID: 10)
* Polygon (Chain ID: 137)
* Avalanche (Chain ID: 43114)
* BSC (Chain ID: 56)
* And [many more](/pages/build/reference/supported-networks)
## Learn more
* [Crosschain routing](/pages/build/get-started/crosschain-routing)
* [Use Cases](/pages/use-cases)
Updated {date_0}
# Cross-chain Route Widget
Source: https://docs.enso.build/pages/templates/cross-chain-route-widget
A React component and web app for cross-chain routing of DeFi positions and tokens.
export const date_0 = "2025-06-17"
The Cross-chain Route Widget lets you add cross-chain token routing feature to your app. Under the hood, it uses the Enso API to find the best route, and bridge the tokens to the destination chain via Stargate.
Highly customizable, the widget allows you to configure various parameters, including:
* **Source and destination chains**: configure specific source and destination chains for the routing process.
* **input and output tokens**: allow free choice or restrict to specific tokens for specialized use cases.
* **The output project**: destination project for the output token for building protocol-specific flows.
Try it out!
Source code
Integrate cross-chain routing widget in your app
## How it Works
After selecting the input token on the source chain, and the output token on the destination chain,
the widget will show the best route for the tokens before you sign and send the transaction.
## Integrate
Follow these steps to integrate the Cross-Chain Route Widget into your React application.
Install the package:
```bash theme={null}
npm install @ensofinance/shortcuts-widget
```
Import the component and use it in your app. To get your API key, visit the [Developer portal](https://developers.enso.finance/developers).
The widget must be used within a `WagmiConfig` provider.
```tsx theme={null}
import SwapWidget from '@ensofinance/shortcuts-widget';
function App() {
return
}
export default App;
```
```tsx theme={null}
import SwapWidget from '@ensofinance/shortcuts-widget';
function App() {
return
}
const darkThemeConfig = {
theme: {
tokens: {
spacing: {
1: "10px",
2: "20px",
},
},
semanticTokens: {
colors: {
// Background colors
bg: { value: "#0f172a" }, // Dark blue-gray
"bg.subtle": { value: "#1e293b" }, // Lighter blue-gray
"bg.emphasized": { value: "#334155" }, // Medium blue-gray
"bg.muted": { value: "#141e33" }, // Slightly lighter than base bg
// Foreground colors
fg: { value: "#f8fafc" }, // Almost white
"fg.muted": { value: "#cbd5e1" }, // Light gray
"fg.subtle": { value: "#94a3b8" }, // Medium gray
// Border colors
border: { value: "#334155" }, // Medium blue-gray
"border.emphasized": { value: "#475569" }, // Darker blue-gray
"border.subtle": { value: "#1e293b" }, // Lighter blue-gray
// Primary accent colors
primary: { value: "#3b82f6" }, // Vibrant blue
"primary.emphasis": { value: "#2563eb" }, // Darker blue
"primary.muted": { value: "#60a5fa" }, // Lighter blue
// Status colors
success: { value: "#10b981" }, // Green
warning: { value: "#f59e0b" }, // Amber
error: { value: "#ef4444" }, // Red
info: { value: "#0ea5e9" }, // Sky blue
},
},
},
};
export default App;
```
Here are the available props for the widget:
| Parameter | Description | Required |
| -------------------- | ------------------------------------------------------------------- | -------- |
| `apiKey` | Your Enso API key | Yes |
| `tokenIn` | The input token address (you can use to pin the input token) | No |
| `tokenOut` | The output token address (you can use to pin the output token) | No |
| `chainId` | The starting position's chain ID (required with token addresses) | Yes\* |
| `destinationChainId` | The destination chain ID (you can use to pin the destination chain) | No |
| `themeConfig` | Theme settings | No |
| `enableShare` | Enable route sharing functionality copy with button | No |
| `obligateSelection` | Force token selection | No |
| `indicateRoute` | Show swap route path | No |
| `showRoute` | Show the route | No |
| `showRouteDetails` | Show route details | No |
| `themeConfig` | Customize the Widget theme | No |
\*Required when using token addresses
## Next Steps
From here, you can explore the API and the widget further:
* [Explore the Bundle API](/api-reference/defi-shortcuts/bundle-a-list-of-actions)
* [Explore the `bridge` action](/pages/build/reference/actions#bridge)
Updated {date_0}
# Feeling Lucky
Source: https://docs.enso.build/pages/templates/feeling-lucky
A dApp that helps users diversify into random tokens from selected sectors using the Enso SDK.
export const date_0 = "2025-04-11"
Can't decide where to ape in? Feeling lucky is here to help you out.
Source code
Try it out!
## Overview
Feeling Lucky is a Next.js application that enables users to "ape" into random tokens from their preferred sectors. The app leverages Enso's Router API to execute token swaps with optimal routing across multiple exchanges and protocols.
## Features
* **Random Token Selection**: Discover and invest in random tokens from specific sectors
* **Any-to-Any Swaps**: Use any token in your wallet to purchase the randomly selected token
* **Optimal Routing**: Get the best execution price through Enso's aggregation
* **Transaction Preview**: View expected output amount and price impact before execution
* **Wallet Integration**: Connect easily via Privy or WalletConnect
## Technology Stack
* **Frontend**: React, Next.js, Chakra UI
* **Web3**: wagmi, viem, Privy
* **DeFi Integration**: Enso Finance SDK
* **Build Tools**: TypeScript
## Implementation Example
```tsx theme={null}
import { useEnsoRouterData } from '@ensofinance/sdk-ts';
function FeelingLuckySwap({ tokenIn, randomToken }) {
const { data, isLoading } = useEnsoRouterData({
fromAddress: address,
chainId: 1,
tokenIn: tokenIn.address,
tokenOut: randomToken.address,
amountIn: swapValue,
slippage: 200, // 2%
});
async function executeSwap() {
// Using ethers/viem to send the transaction
const tx = await walletClient.sendTransaction({
to: data.tx.to,
data: data.tx.data,
value: data.tx.value,
});
await publicClient.waitForTransactionReceipt({ hash: tx });
}
return (
);
}
```
## Environment Setup
Required environment variables:
* `NEXT_PUBLIC_ENSO_API_KEY`: Your Enso API key
* `NEXT_PUBLIC_PRIVY_KEY`: Privy authentication key
## Key Components
* **TokenSelector**: Interface for selecting input tokens
* **SectorSelector**: UI for choosing token categories
* **TransactionPreview**: Displays swap details before execution
## Development
```bash theme={null}
# Install dependencies
pnpm install
# Start development server
pnpm dev
```
Updated {date_0}
# Enso DeFi Navigator
Source: https://docs.enso.build/pages/templates/navigator
A UI to navigate projects, protocols, and positions in the Enso ecosystem, always up-to-date with live integrations.
export const date_0 = "2025-07-15"
The Enso DeFi Navigator is a helper tool to explore and interact with the Enso ecosystem.
This tool is designed to make it easier to assemble and debug routes, by finding the accurate information about projets, tokens and their primary contracts.
Use the Enso DeFi Navigator
Source code
It provides an interface to navigate through supported projects, protocols, and positions.
* **Projects**: Browse integrated networks and projects
* **Protocols**: View supported projects versinons and access supported tokens
* **Tokens**: Query supported tokens by address, symbol, primary address, underlying tokens and more
Next steps:
* [Try the Navigator](https://navigator.enso.build/)
* [Learn about Enso's APIs](/pages/build/get-started/overview)
* [Integrate the SDK](https://github.com/EnsoBuild/sdk-ts)
Updated {date_0}
# Overview
Source: https://docs.enso.build/pages/templates/overview
Ready-to-use components and applications that leverage Enso's APIs for immediate integration into your frontend.
export const date_0 = "2025-09-23"
Seamless cryptocurrency deposits with wallet and exchange integration
Crosschain position routing feature to your app.
Migration of base tokens and DeFi positions from Uniswap V3 to V4 across leading chains.
A UI to navigate projects, protocols, and positions in the Enso ecosystem, always up-to-date with live integrations.
A complete token swapping and DeFi position entry widget that handles token selection, routing and transaction execution.
Helps users migrate between yield-bearing positions to optimize returns across protocols.
Lets users "ape" into random tokens from selected sectors with optimal routing.
## Why Use Enso Widgets
* **Zero Integration Effort**: Drop-in components with minimal configuration
* **Full DeFi Functionality**: Access to complex DeFi operations through simple UI
* **Pre-built User Experiences**: Tested interfaces for common DeFi actions
* **Customizable Themes**: Adapt to your application's design system
## Quick Implementation
All widgets require just a few lines of code to implement:
```jsx theme={null}
// Example: Route Widget implementation
import SwapWidget from '@ensofinance/shortcuts-widget';
function App() {
return ;
}
```
## Try Before You Integrate
Test any widget functionality with our live demos to see how they work before adding them to your application.
## Get Started
1. Choose a widget that fits your use case
2. Get your [Enso API key](https://developers.enso.build)
3. Install the package and add the component to your application
4. Customize appearance and behavior as needed
Each widget documentation page includes detailed implementation examples and configuration options.
Updated {date_0}
# Uniswap Migrator
Source: https://docs.enso.build/pages/templates/uniswap-migrator
A React component and web app that enables migration of base tokens and DeFi positions from Uniswap V3 to V4 across all supported chains.
export const date_0 = "2025-06-13"
The Uniswap Migrator Widget allows users to:
* migrate base tokens to any chain and
* migrate Uniswap liquidity positions Uniswap V4 pools.
Migrate positions to Uniswap V4 pools
Integrate Uniswap Migrator widget in your app
## How it Works
The Uniswap Migrator Widget is an interface to an orchestration of Enso's routing capacities, Stargate bridging system, and Layer0's notification system.
Roughly, the flow is as follows:
1. The user selects the asset to migrate, and the destination Uniswap V4 pool. The user approves Enso's contracts to spend the asset.
2. The user initiates the migration.
2.1. The user initiates the migration.
Enso issues a [transaction bundle](/pages/build/get-started/bundling-actions) that:
2.2. [Redeems](/pages/build/reference/actions#redeem) the assets underlying the user's position on Uniswap V3.
2.3. Swaps the assets to bridge tokens.
3. Bridging takes place
3.1. Enso sends the assets to Stargate.
3.2. Stargate bridges them to the destination chain.
3.3. Stargate notifies Layer0, which notifies Enso.
4. Enso issues a transaction on the destination chain that deposits the assets into the destination V4 pool.
## Integrate
To integrate the Uniswap yield migrator widget, follow the steps below.
```bash theme={null}
pnpm i @ensofinance/uniswap-migrator
```
In case you're starting from scratch, set up a RainbowKit project:
```bash theme={null}
pnpm install @rainbow-me/rainbowkit wagmi viem@2.x @tanstack/react-query
```
Then, edit `package.json` and adjust the version for `viem` to `2.x`:
```json theme={null}
"viem": "2.x",
```
Include the `WidgetWrapper` component in your `/src/pages/index.tsx` file.
```tsx src/App.tsx {6-12, 21} theme={null}
import { ConnectButton } from '@rainbow-me/rainbowkit';
import type { NextPage } from 'next';
import styles from '../styles/Home.module.css';
import dynamic from 'next/dynamic';
const WidgetWrapper = dynamic(
() =>
import("@ensofinance/uniswap-migrator").then((mod) => mod.WidgetWrapper),
{
ssr: false,
}
);
const apiKey = process.env.NEXT_PUBLIC_ENSO_API_KEY || "1e02632d-6feb-4a75-a157-documentation";
const Home: NextPage = () => {
return (
);
};
export default Home;
```
Now you can run your app and see the Uniswap Migrator widget in action!
```bash theme={null}
pnpm run dev
```
Open your browser and navigate to `http://localhost:3000` 🎉
## Next Steps
* [Try the Uniswap Migrator Widget](https://migrate.enso.build/)
* [Learn more about Stargate](https://stargateprotocol.gitbook.io/stargate)
* [Explore Layer0](https://docs.layerzero.network/v2)
* [Find more about Enso's routing capabilities](/pages/build/get-started/route)
Updated {date_0}
# Route Widget
Source: https://docs.enso.build/pages/templates/widget
A React component that integrates the Enso API to provide token swapping and DeFi operations directly in your application.
export const date_0 = "2025-07-07"
Source code
Try it out!
## Features
* **Desired operation**: Any-to-any token swaps and position entry/exit across multiple chains (zap-in, deposit, stake, and more)
* **Automatic route building**: Automatically constructs an optimal transaction involving multiple protocols and tokens
* **Shortcut preview**: Previews of token balances, USD values, and price impact preview
## Integration
You can integrate the Enso shortcuts widget into your React application.
### 1. Install the package
```bash theme={null}
npm install @ensofinance/shortcuts-widget
```
**Note**: Requires `wagmi` and `viem` as peer dependencies.
### 2. Import and use the component
```jsx theme={null}
import SwapWidget from '@ensofinance/shortcuts-widget';
function App() {
return ;
}
export default App;
```
### 3. Props & Configuration
| Prop | Type | Description | Required |
| ------------------- | ------- | ---------------------------- | ----------------------------- |
| `apiKey` | string | Enso API key | Yes |
| `tokenIn` | string | Input token address | No |
| `tokenOut` | string | Output token address | No |
| `chainId` | number | Starting position's chain ID | Required with token addresses |
| `themeConfig` | object | Theme settings | No |
| `enableShare` | boolean | Enable route sharing | No |
| `obligateSelection` | boolean | Force token selection | No |
| `indicateRoute` | boolean | Show swap route path | No |
## Examples
### Pre-selected Tokens
```jsx theme={null}
```
### Custom Theme
```jsx theme={null}
```
## APIs used
The Widget uses the following APIs:
* `GET /tokens` to fetch the token and positions on the selected
* `GET /balances` to fetch the user's token balances and display the exact amount for each position
* `GET /route` to get the optimal route for user's intended operation
## Get Your API Key
Register at [Enso Developer Dashboard](https://developers.enso.build) to obtain your API key.
Updated {date_0}
# Yield Migrator
Source: https://docs.enso.build/pages/templates/yield-migrator
A DeFi application that optimizes returns by migrating yield-bearing positions between protocols using the Enso SDK.
export const date_0 = "2025-04-11"
Source code
Try it out!
## Overview
Yield Migrator is a React/Vite web application that simplifies the process of moving funds between yield-generating protocols. The application leverages Enso's Router API to execute complex multi-step transactions in a single operation.
## Features
* **Position Discovery**: Automatically detects user's current yield-bearing positions across protocols
* **APY Comparison**: Displays potential yield improvements across alternative protocols
* **One-Click Migration**: Executes the entire migration process in a single transaction
* **Transaction Preview**: Shows expected APY improvement, fees, gas costs, and price impact before execution
* **Cross-Protocol Support**: Works with major lending, staking, and liquidity protocols
## Technology Stack
* **Frontend**: React, Chakra UI
* **Web3**: wagmi, viem, RainbowKit
* **DeFi Integration**: Enso Finance SDK
* **Build Tools**: Vite, TypeScript
## Implementation Example
```jsx theme={null}
import { useEnsoBundleApi } from '@ensofinance/sdk-react';
function MigratePosition({ currentPosition, targetPosition }) {
const { createBundleTransaction } = useEnsoBundleApi();
async function handleMigrate() {
// Create migration bundle with Enso SDK
const bundleTransaction = await createBundleTransaction({
actions: [
// Withdraw from current position
{
protocol: currentPosition.protocol,
action: "withdraw",
args: {
tokenIn: currentPosition.address,
amountIn: currentPosition.balance,
primaryAddress: currentPosition.contractAddress
}
},
// Deposit into new position
{
protocol: targetPosition.protocol,
action: "deposit",
args: {
tokenIn: "0x...", // Underlying token
tokenOut: targetPosition.address,
// Use output from previous action
amountIn: { useOutputOfCallAt: 0 },
primaryAddress: targetPosition.contractAddress
}
}
]
});
// Execute the transaction
await bundleTransaction.execute();
}
return (
);
}
```
Maximize user deposits by accepting any token and zapping it directly into a staking or vault position
Simplify withdrawal from yield-generating vaults and liquidity pools.
Simplify position migration between vaults to keep capital within ecosystem
# Position Migration
Source: https://docs.enso.build/pages/use-cases/deposits/position-migration
Simplify position migration between vaults to keep capital within ecosystem.
## Migrate from Yearn yvDAI vault to yvUSDC vault
This use case enables 1-click migration between different vaults on the same platform to retain user capital.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xda816459f1ab5631232fe5e97a05bbbb94970c95\&tokenOut=0xa354f35829ae975e850e23e9615b11da1b3dc4de)
**Route Mechanics**:
The routing involves a three-step process.
* It first redeems the yvDAI from the yearn-v2 vault to get DAI.
* Then, it swaps the DAI for USDC using the odos protocol.
* Finally, it deposits the USDC into the yearn-v2 vault to get the final yvUSDC position.
```mermaid theme={null}
flowchart LR
yvDAI((yvDAI)) --> A1
A1[yearn-v2.redeem] --> DAI((DAI))
A2[odos.swap] --> USDC((USDC))
A3[yearn-v2.deposit] --> yvUSDC((yvUSDC))
DAI --> A2
USDC --> A3
```
```ts theme={null}
export async function migrateYearnDaiToUsdc(): Promise<{ route: any; tx: any }> {
const yvDAI: Address = "0xda816459f1ab5631232fe5e97a05bbbb94970c95";
const yvUSDC: Address = "0xa354f35829ae975e850e23e9615b11da1b3dc4de";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 yvDAI
tokenIn: [yvDAI],
tokenOut: [yvUSDC],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
# Withdrawal
Source: https://docs.enso.build/pages/use-cases/deposits/withdrawal
Simplify withdrawal from yield-generating vaults and liquidity pools
### Unstake styHONEY to BERA
Unstake a `styHONEY` position and convert it back to the native gas token, `BERA`, on Berachain.
[**Try this route →**](https://happypath.enso.build/?chainId=80094\&tokenIn=0x99d6a0fb9420f3995fd07dcc36ac827a8e146cf9\&tokenOut=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&outChainId=80094)
**Route Mechanics:**
* Redeem `styHONEY` to receive `yHONEY`.
* Redeem `yHONEY` to receive `HONEY`.
* Swap `HONEY` to `BERA` through Enso's routing.
```mermaid theme={null}
flowchart LR
styHONEY((styHONEY)) -->|bearn redeem| yHONEY((yHONEY))
yHONEY -->|bearn redeem| HONEY((HONEY))
HONEY -->|openocean swap| BERA((BERA))
```
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const styHONEY = "0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const HONEY = "0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce" as Address;
const BERA = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1000000000000000000"], // 1 styHONEY
tokenIn: [styHONEY],
tokenOut: [BERA],
routingStrategy: "delegate",
slippage: "300", // 3% slippage for redemption
referralCode: "styhoney-bera",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
***
### Withdraw Yearn Curve mUSD Vault to USDC
Unwind a Yearn Curve `mUSD` vault position back to the base asset, `USDC`, on Ethereum.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0x8cc94ccd0f3841a468184aca3cc478d2148e1757\&tokenOut=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
```javascript theme={null}
const CurveMUSD_yVault = "0x8cc94ccd0f3841a468184aca3cc478d2148e1757" as Address; // Yearn Curve mUSD Pool yVault
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // Example amount for yVault token
tokenIn: [CurveMUSD_yVault],
tokenOut: [USDC],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem from Yearn Curve mUSD Pool yVault ( `0x8cc94ccd0f3841a468184aca3cc478d2148e1757` ) to receive Curve mUSD LP tokens
* Redeem from Curve.fi mUSD Pool ( `0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6` ) to receive Curve 3pool LP tokens
* Redeem from Curve.fi 3pool ( `0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7` ) to receive USDC
***
### Withdraw Yearn Curve alUSD Vault to USDC
Unwind a Yearn Curve `alUSD` vault position back to the base asset, `USDC`, on Ethereum.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xa74d4b67b3368e83797a35382afb776baae4f5c8\&tokenOut=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
```javascript theme={null}
const CurveAlUSD_yVault = "0xa74d4b67b3368e83797a35382afb776baae4f5c8" as Address; // Yearn Curve alUSD Pool yVault
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // Example amount for yVault token
tokenIn: [CurveAlUSD_yVault],
tokenOut: [USDC],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem from Yearn Curve alUSD Pool yVault ( `0xa74d4b67b3368e83797a35382afb776baae4f5c8` ) to receive Curve alUSD LP tokens
* Redeem from Curve.fi alUSD Pool ( `0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c` ) to receive Curve 3pool LP tokens
* Redeem from Curve.fi 3pool ( `0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7` ) to receive USDC
***
### Withdraw Rooster LP (nALPHA/pUSD) to Native Plume
Completely unwind a Rooster YAP LP (`nALPHA`/`pUSD`) position back to the native `Plume` token on Plume.
[**Try this route →**](https://happypath.enso.build/?chainId=98866\&tokenIn=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038\&tokenOut=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)
```javascript theme={null}
const ROOSTER_YAP_NALPHA_PUSD = "0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038" as Address;
const PLUME = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 Rooster YAP tokens
tokenIn: [ROOSTER_YAP_NALPHA_PUSD],
tokenOut: [PLUME],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-exit-native",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem Rooster YAP pool tokens to underlying PUSD and nALPHA
* Merge tokens using the enso.merge action
* Swap PUSD to native Plume via internal exchange
* Swap nALPHA to native Plume via internal exchange
* Consolidate native Plume tokens in user wallet
***
### Unstake kHYPE to USDT0
Unstake `kHYPE` and convert the underlying assets to the `USDT0` stablecoin on HyperEVM.
[**Try this route →**](https://happypath.enso.build/?chainId=999\&tokenIn=0xfd739d4e423301ce9385c1fb8850539d657c296d\&tokenOut=0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb)
```javascript theme={null}
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const USDT0 = "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 kHYPE
tokenIn: [KHYPE],
tokenOut: [USDT0],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "kinetiq-withdraw",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Unstake kHYPE to HYPE via Kinetiq Protocol
* Swap HYPE to USDT0 via internal exchange
* Transfer USDT0 to user wallet
***
### Unstake kHYPE to Native HYPE
Unstake `kHYPE` back to the native `HYPE` token on HyperEVM.
[**Try this route →**](https://happypath.enso.build/?chainId=999\&tokenIn=0xfd739d4e423301ce9385c1fb8850539d657c296d\&tokenOut=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)
```javascript theme={null}
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const HYPE = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 kHYPE
tokenIn: [KHYPE],
tokenOut: [HYPE],
routingStrategy: "delegate",
slippage: "50", // 0.5% slippage
referralCode: "kinetiq-unstake-native",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Unstake kHYPE to native HYPE.
***
### Unstake kHYPE to KEI
Unstake `kHYPE` and convert the underlying assets to Wrapped Ethereum (`KEI`) on HyperEVM.
[**Try this route →**](https://happypath.enso.build/?chainId=999\&tokenIn=0xfd739d4e423301ce9385c1fb8850539d657c296d\&tokenOut=0xb5fe77d323d69eb352a02006ea8ecc38d882620c)
```javascript theme={null}
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const KEI = "0xb5fe77d323d69eb352a02006ea8ecc38d882620c" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 kHYPE
tokenIn: [KHYPE],
tokenOut: [KEI],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "kinetiq-unstake-weth",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Unstake kHYPE to HYPE and swap to KEI (WETH).
***
### Unstake kHYPE to UBTC
Unstake `kHYPE` and convert the underlying assets to Wrapped Bitcoin (`UBTC`) on HyperEVM.
[**Try this route →**](https://happypath.enso.build/?chainId=999\&tokenIn=0xfd739d4e423301ce9385c1fb8850539d657c296d\&tokenOut=0x9fdbda0a5e284c32744d2f17ee5c74b284993463)
```javascript theme={null}
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const UBTC = "0x9fdbda0a5e284c32744d2f17ee5c74b284993463" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 kHYPE
tokenIn: [KHYPE],
tokenOut: [UBTC],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "kinetiq-unstake-wbtc",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Unstake kHYPE to HYPE and swap to UBTC.
### Zap PLUME into Mystic myUSDC Vault
Deposit native PLUME and convert it into a myUSDC vault position on Mystic.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x6c92efa3F77760619bb13d395836415ac18C86dc)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x6c92efa3F77760619bb13d395836415ac18C86dc'],
routingStrategy: 'router'
});
// If using 'router' strategy, approval is often required for the input token.
await sendEoa(client.getApprovalData(routeData.route.tokenIn[0]));
await sendEoa(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap PLUME (input token) for USDC.e
* deposit USDC.e into the myUSDC pool, interacting with primary `0xCE192A6E105cD8dd97b8Dedc5B5b263B52bb6AE0`
***
### Deposit native PLUME into Solera aPlunALPHA
Deposit native PLUME and convert it into a Solera aPlunALPHA vault position.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x5d0EC9B10e6759719CeFE14b8c881634678b32f2)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x5d0EC9B10e6759719CeFE14b8c881634678b32f2'],
routingStrategy: 'router'
});
// If using 'router' strategy, approval is often required for the input token.
await sendEoa(client.getApprovalData(routeData.route.tokenIn[0]));
await sendEoa(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap PLUME for PUSD using `enso.swap` action
* deposit `PUSD` into `NALPHA Nucleus` pool, interacting with primary `0xc9f6a492fb1d623690dc065bbced6dfb4a324a35`
* deposit `NALPHA` into the `Solera` pool, interacting with primary `0x5d0ec9b10e6759719cefe14b8c881634678b32f2`
***
### Deposit USDC.e into Nucleus nYIELD Vault
Deposit bridged USDC.e and convert it into an nYIELD vault position on Nucleus.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0x78adD880A697070c1e765Ac44D65323a0DcCE913\&tokenOut=0x892DFf5257B39f7afB7803dd7C81E8ECDB6af3E8)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0x78adD880A697070c1e765Ac44D65323a0DcCE913'],
tokenOut: ['0x892DFf5257B39f7afB7803dd7C81E8ECDB6af3E8'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap `USDC` for `PUSD` using `enso.swap` action
* deposit `PUSD` into `nYIELD Nucleus` pool, interacting with primary `0x92a735f600175fe9ba350a915572a86f68ebbe66` to get `nUSDY`
***
### Deposit USDC.e into Tempest PUSD Vault
Deposit bridged USDC.e and convert it into a Tempest PUSD vault position.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0x78adD880A697070c1e765Ac44D65323a0DcCE913\&tokenOut=0x3C4F9804ce0810821F61289Eb4F92c8E5007c119)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0x78adD880A697070c1e765Ac44D65323a0DcCE913'],
tokenOut: ['0x3C4F9804ce0810821F61289Eb4F92c8E5007c119'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap `USDC.e` for `PUSD` using `enso.swap` action
* deposit `PUSD` into `Tempest pool`, interacting with primary `0x3C4F9804ce0810821F61289Eb4F92c8E5007c119`
***
### Stake PLUME for pETH on Dinero
Deposit native PLUME and convert it into the pETH liquid staking derivative on Dinero.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x39d1F90eF89C52dDA276194E9a832b484ee45574)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x39d1F90eF89C52dDA276194E9a832b484ee45574'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
***
### Deposit PUSD into Rooster (nALPHA/PUSD) LP
Deposit PUSD and convert it into a Rooster (nALPHA/PUSD) LP position.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xdddd73f5df1f0dc31373357beac77545dc5a6f3f\&tokenOut=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xdddd73f5df1f0dc31373357beac77545dc5a6f3f'],
tokenOut: ['0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* split `PUSD` to `NALPHA` and `PUSD` using the `enso.split` action
* deposit `NALPHA` and `PUSD` into the `Rooster pool`, interacting with primary `0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038`
***
### Deposit WETH into the Nest Alpha Vault
Deposit WETH and convert it into a Nest Alpha Vault position.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xca59ca09e5602fae8b629dee83ffa819741f14be\&tokenOut=0x593ccca4c4bf58b7526a4c164ceef4003c6388db)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xca59ca09e5602fae8b629dee83ffa819741f14be'],
tokenOut: ['0x593ccca4c4bf58b7526a4c164ceef4003c6388db'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap `WETH` for `PUSD` using the `enso.swap` action
* deposit `PUSD` into the `Nest Vault`, interacting with primary `0xc9f6a492fb1d623690dc065bbced6dfb4a324a35`
***
### Deposit USDC to get yDAI (Yearn)
Convert USDC to DAI and deposit it into the Yearn DAI v2 Vault.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\&tokenOut=0xda816459f1ab5631232fe5e97a05bbbb94970c95)
```javascript theme={null}
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" as Address;
const yvDAI = "0xda816459f1ab5631232fe5e97a05bbbb94970c95" as Address; // Yearn DAI v2 Vault token
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000"], // 1000 USDC
tokenIn: [USDC],
tokenOut: [yvDAI],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `USDC` to `DAI` via Enso DEX Aggregator
* Deposit `DAI` into Yearn DAI v2 Vault (`0xda816459f1ab5631232fe5e97a05bbbb94970c95`)
***
### HONEY to yHONEY Zap
Deposit HONEY into the Bearn yHONEY vault.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce\&tokenOut=0xc82971bcff09171e16ac08aee9f4ea3fb16c3bdc)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const HONEY = "0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce" as Address;
const yHONEY = "0xc82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1000000000000000000"], // 1 HONEY
tokenIn: [HONEY],
tokenOut: [yHONEY],
routingStrategy: "delegate",
slippage: "50", // 0.5% slippage for stable yield
referralCode: "bearn-deposit",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `HONEY` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn yHONEY vault.
***
### BERA to yHONEY Yield Zap
Convert native BERA into a Bearn yHONEY vault position.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const BERA = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1500000000000000000"], // 1.5 BERA
tokenIn: [BERA],
tokenOut: [yHONEY],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "bera-yhoney",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `BERA` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn yHONEY vault.
***
### USDCe to yHONEY Vault Zap
Convert bridged USDC.e into a Bearn yHONEY vault position.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0x549943e04f40284185054145c6E4e9568C1D3241\&tokenOut=0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const USDCe = "0x549943e04f40284185054145c6E4e9568C1D3241" as Address;
const HONEY = "0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1000000000"], // 1,000 USDCe
tokenIn: [USDCe],
tokenOut: [yHONEY],
routingStrategy: "delegate",
slippage: "200", // 2% slippage for bridge + swap
referralCode: "bridge-yhoney",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `USDCe` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn yHONEY vault.
***
### iBGT to yHONEY Vault Zap
Convert iBGT governance tokens into a Bearn yHONEY vault position.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xac03CABA51e17c86c921E1f6CBFBdC91F8BB2E6b\&tokenOut=0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const iBGT = "0xac03CABA51e17c86c921E1f6CBFBdC91F8BB2E6b" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["500000000000000000"], // 0.5 iBGT
tokenIn: [iBGT],
tokenOut: [yHONEY],
routingStrategy: "delegate",
slippage: "400", // 4% slippage for governance token
referralCode: "ibgt-yield",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `iBGT` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn `yHONEY` vault.
***
### YEET to styHONEY Yield Zap
Convert YEET tokens into a staked yield position (styHONEY).
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0x08A38Caa631DE329FF2DAD1656CE789F31AF3142\&tokenOut=0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const YEET = "0x08A38Caa631DE329FF2DAD1656CE789F31AF3142" as Address;
const styHONEY = "0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["100000000000000000000"], // 100 YEET
tokenIn: [YEET],
tokenOut: [styHONEY],
routingStrategy: "delegate",
slippage: "500", // 5% slippage for volatile meme token
referralCode: "yeet-styhoney",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `YEET` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn `yHONEY` vault.
* Stake `yHONEY` to receive `styHONEY`.
***
### Layer AUSD into Morpho bbqAUSD Vault
Deposit AUSD into a Yearn vault and subsequently into a Morpho Blue bbqAUSD vault.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a\&tokenOut=0xdE6a4F28Acfe431DD1CfA2D9c7A3d8301624a841)
```mermaid theme={null}
flowchart LR
yvUSDC_v3((yvUSDC_v3)) --> A1
A1[yearn-v3.redeem] --> USDC_bridged((USDC_bridged))
A2[vault-bridge.redeem] --> USDC_native((USDC_native))
A3[vault-bridge.deposit] --> USDC_bridged_new((USDC_bridged))
A4[morpho-blue-vaults.deposit] --> morphoUSDC((morphoUSDC))
USDC_bridged --> A2
USDC_native --> A3
USDC_bridged_new --> A4
```
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const KATANA_MAINNET = 747474;
const userAddress = "your-wallet-address" as Address;
const AUSD = "0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a" as Address;
const bbqAUSD = "0xdE6a4F28Acfe431DD1CfA2D9c7A3d8301624a841" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["1000000000"], // 1,000 AUSD
tokenIn: [AUSD],
tokenOut: [bbqAUSD],
routingStrategy: "delegate",
slippage: "150", // 1.5% slippage for multi-step
referralCode: "ausd-morpho",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Deposit AUSD into Yearn AUSD vault to receive yvAUSD.
* Deposit yvAUSD into Morpho Blue bbqAUSD vault for enhanced yield.
***
### USDS to steakUSDC Prime Vault
Convert USDS into a Morpho Steakhouse prime USDC vault position.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x203a662b0bd271a6ed5a60edfbd04bfce608fd36\&tokenOut=0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d)
```javascript theme={null}
const USDC_VB = "0x203a662b0bd271a6ed5a60edfbd04bfce608fd36" as Address; // Assuming USDS input is USDC_VB
const steakUSDC = "0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["1000000000"], // 1,000 USDS
tokenIn: [USDC_VB],
tokenOut: [steakUSDC],
routingStrategy: "delegate",
slippage: "150", // 1.5% slippage for prime vault
referralCode: "usds-prime",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Convert USDC to USDS for stablecoin diversification.
* Deposit USDS into Yearn vault for base yield.
* Deposit vault tokens into Morpho steakUSDC prime vault.
***
### Convert LBTC into Yearn WBTC Vault
Convert Liquid Bitcoin (LBTC) into a Yearn WBTC vault position.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x203a662b0bd271a6ed5a60edfbd04bfce608fd36\&tokenOut=0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d)
```javascript theme={null}
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["100000000"], // 1 LBTC
tokenIn: [LBTC],
tokenOut: [yvvbWBTC],
routingStrategy: "delegate",
slippage: "200", // 2% slippage for BTC yield
referralCode: "lbtc-yield",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Convert LBTC to WBTC through liquidity protocols.
* Deposit WBTC into Yearn vault for Bitcoin yield farming.
***
### Compound KAT Rewards into Yearn USDC Vault
Convert KAT reward tokens into a Yearn USDC vault position.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x7f1f4b4b29f5058fa32cc7a97141b8d7e5abdc2d\&tokenOut=0x80c34bd3a3569e126e7055831036aa7b212cb159)
```javascript theme={null}
const KAT = "0x7f1f4b4b29f5058fa32cc7a97141b8d7e5abdc2d" as Address;
const yvvbUSDC = "0x80c34bd3a3569e126e7055831036aa7b212cb159" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["10000000000000000000000"], // 10,000 KAT
tokenIn: [KAT],
tokenOut: [yvvbUSDC],
routingStrategy: "delegate",
slippage: "500", // 5% slippage for native token
referralCode: "kat-compound",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Convert KAT rewards to USDC through DEX protocols.
* Deposit USDC into Yearn vault for optimized yield.
* Compound rewards automatically through vault strategies.
***
### Zap PUSD into Rooster Stablecoin LP (USDT/pUSD)
Deposit PUSD to create a stablecoin LP position (USDT/pUSD) on Rooster Finance.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xdddd73f5df1f0dc31373357beac77545dc5a6f3f\&tokenOut=0xd5c02efe86ebbc03126281e07b4d43f0b1021065)
```javascript theme={null}
const PLUME_USD = "0xdddd73f5df1f0dc31373357beac77545dc5a6f3f" as Address;
const ROOSTER_YAP_USDT_PUSD = "0xd5c02efe86ebbc03126281e07b4d43f0b1021065" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 PUSD
tokenIn: [PLUME_USD],
tokenOut: [ROOSTER_YAP_USDT_PUSD],
routingStrategy: "delegate",
slippage: "50", // 0.5% slippage
referralCode: "rooster-usdt-pusd",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split Plume USD between USDT and pUSD paths using the `enso.split` action
* Swap portion of PUSD to USDT via internal exchange
* Keep portion as pUSD (direct conversion)
* Deposit USDT and pUSD into Rooster YAP stablecoin liquidity pool
***
### Zap Plume USD into Rooster (nALPHA/pUSD) LP
Deposit Plume USD to create a balanced LP position (nALPHA/pUSD) on Rooster Finance.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xdddd73f5df1f0dc31373357beac77545dc5a6f3f\&tokenOut=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038)
```javascript theme={null}
const PLUME_USD = "0xdddd73f5df1f0dc31373357beac77545dc5a6f3f" as Address;
const ROOSTER_YAP_NALPHA_PUSD = "0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 PUSD
tokenIn: [PLUME_USD],
tokenOut: [ROOSTER_YAP_NALPHA_PUSD],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-nalpha-pusd",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split `Plume USD` between `pUSD` and `nALPHA` paths using the `enso.split` action
* Keep portion as `pUSD` (direct conversion)
* Swap portion of `PUSD` to `nALPHA` via internal exchange
* Deposit `pUSD` and `nALPHA` into Rooster YAP `nALPHA/pUSD` pool
***
### Zap Plume Native into Rooster (USDC.e/XAUM) LP
Deposit native `PLUME` to create a multi-asset LP position (USDC.e/XAUM) on Rooster Finance.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&tokenOut=0xd9822928f894b12e5e4ea1ec2890ac233b9fd871)
```javascript theme={null}
const PLUME = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const ROOSTER_YAP_USDC_XAUM = "0xd9822928f894b12e5e4ea1ec2890ac233b9fd871" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 PLUME
tokenIn: [PLUME],
tokenOut: [ROOSTER_YAP_USDC_XAUM],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-yap-zap",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split native `PLUME` between `USDC.e` and `XAUM` conversion paths using the `enso.split` action
* Swap portion of `PLUME` to `USDC.e` via internal exchange
* Swap portion of `PLUME` to XAUM via internal exchange
* Deposit `USDC.e` and `XAUM` into Rooster `YAP-USDC.e-XAUM` pool
***
### Convert UETH to Staked HYPE (kHYPE)
Convert UETH stablecoin into a staked HYPE position (kHYPE).
[**Try this route →**](https://happypath.enso.build?chainId=999\&tokenIn=0xbe6727b535545c67d5caa73dea54865b92cf7907\&tokenOut=0xfd739d4e423301ce9385c1fb8850539d657c296d)
```javascript theme={null}
const UETH = "0xbe6727b535545c67d5caa73dea54865b92cf7907" as Address;
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 DAI
tokenIn: [UETH],
tokenOut: [KHYPE],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "kinetiq-dai-stake",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `UETH` for `HYPE` and stake to `kHYPE`.
# Zap to Deposit
Source: https://docs.enso.build/pages/use-cases/deposits/zap-to-deposit
Maximize user deposits by accepting any token and zapping it directly into a staking or vault position
## Zap 3Crv LP into Convex Finance
This use case allows a user to stake Curve LP tokens in Convex for boosted rewards.
**Bundle Mechanics:** This is a multi-step bundle
* it redeems the 3Crv from curve-dex to get USDT.
* it deposits the USDT back into curve-dex for a different LP token,
* deposits the resulting token into the convex-lp protocol to get the final cvx3Crv token.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490\&tokenOut=0xa1c3492b71938e144ad8be4c2fb6810b01a43dd8)
```mermaid theme={null}
flowchart LR
3CRV((3CRV)) -->|curve-dex redeem| USDT((USDT))
USDT -->|curve-dex deposit| STECRV((steCRV))
STECRV -->|convex-lp deposit| cvxSTECRV((cvxsteCRV))
```
```ts theme={null}
export async function deposit3crvToConvex(): Promise<{ route: any; tx: any }> {
const ThreeCrv: Address = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490";
const cvx3Crv: Address = "0xa1c3492b71938e144ad8be4c2fb6810b01a43dd8";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 3Crv
tokenIn: [ThreeCrv],
tokenOut: [cvx3Crv],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap into Infrared iETH on Berachain
This use case allows a user to zap into the Infrared liquid restaking token on Berachain.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x9b6761bf2397bb5a6624a856cc84a3a14dcd3fe5)
**Bundle Mechanics:**
The bundle consists of a single action:
* a swap from BERA to iBERA using the ooga-booga protocol
```mermaid theme={null}
flowchart LR
BERA((BERA)) -->|ooga-booga swap| iBERA((iBERA))
```
```ts theme={null}
export async function depositBeraToInfrared(): Promise<{ route: any; tx: any }> {
const BERA: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const iBERA: Address = "0x9b6761bf2397bb5a6624a856cc84a3a14dcd3fe5";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_CHAIN,
amountIn: ["1000000000000000000"], // 1 BERA
tokenIn: [BERA],
tokenOut: [iBERA],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Stake PLUME for pETH on Dinero
This use case deposits native PLUME and converts it into the pETH liquid staking derivative on Dinero.
**Route Mechanics:**
The route consists of a single action, a swap from PLUME to pETH using the rooster protocol.
```mermaid theme={null}
flowchart LR
PLUME((PLUME)) -->|rooster swap| DINERO((DINERO))
```
```ts theme={null}
export async function depositPlumeToDinero(): Promise<{ route: any; tx: any }> {
const PLUME: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const pETH: Address = "0x39d1F90eF89C52dDA276194E9a832b484ee45574";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: PLUME_CHAIN,
amountIn: ["1000000000000000000"], // 1 PLUME
tokenIn: [PLUME],
tokenOut: [pETH],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap ETH into Renzo's ezETH
This use case allows a user to enter the Renzo liquid restaking ecosystem.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0xbf5495Efe5DB9ce00f80364C8B423567e58d2110)
**Bundle Mechanics:** The bundle consists of a single action: a swap from ETH to ezETH using the barter protocol.
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|barter swap| ezETH((ezETH))
```
```ts theme={null}
export async function depositEthToRenzo(): Promise<{ route: any; tx: any }> {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const ezETH: Address = "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [ezETH],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
### Zap ETH into Swell's swETH
This use case allows a user to enter the Swell liquid staking ecosystem.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0xf951E335afb289353dc249e82926178EaC7DEd78)
**Bundle Mechanics:** The bundle consists of a single action: a swap from ETH to swETH using the odos protocol.
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|odos swap| swETH((swETH))
```
```ts theme={null}
export async function depositEthToSwell(): Promise<{ route: any; tx: any }> {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const swETH: Address = "0xf951E335afb289353dc249e82926178EaC7DEd78";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [swETH],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap ETH into Stakestone's STONE
This use case allows a user to enter the StakeStone liquid staking ecosystem.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x094c0e36210634c3cfa25dc11b96b562e0b07624)
**Bundle Mechanics:**
The bundle involves a two-step process:
* a swap from ETH to an intermediate token using barter,
* followed by a deposit into the stakestone-sbtc protocol to get the final STONE token.
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|barter swap| SBTC((SBTC))
SBTC -->|stakestone-sbtc deposit| STONE((STONE))
```
```ts theme={null}
export async function depositEthToStakestone(): Promise<{ route: any; tx: any }> {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const STONE: Address = "0x094c0e36210634c3cfa25dc11b96b562e0b07624";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [STONE],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
### Zap ETH into Bedrock's uniETH
This use case allows a user to enter the Bedrock liquid staking ecosystem.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x2ec37d45fcae65d9787ecf71dc85a444968f6646)
**Bundle Mechanics:** The bundle consists of a single action: a swap from ETH to BRBTC using the barter protocol
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|barter swap| uniBTC((uniBTC))
```
```ts theme={null}
export async function depositEthToBedrock(): Promise<{ route: any; tx: any }> {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const BRBTC: Address = "0x2ec37d45fcae65d9787ecf71dc85a444968f6646";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [BRBTC],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap Balancer LP into Aura Finance
This use case allows a user to stake Balancer LP tokens in Aura for boosted rewards.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0x32296969Ef14EB0c6d29669C550D4a0449130230\&tokenOut=0x08129a472dfb92a1596bbe31f27c53914a990563)
**Route mechanics:**
* Redeem the Balancer v2 LP position to get WETH
* Redeem WETH using wrapped native protocol to get native ETH
* Deposit native ETH back into wrapped native to get WETH
* Deposit WETH into Balancer v2 to create FIXME (0xfd1cf6fd41f229ca86ada0584c63c49c3d66bbc9) LP
* Deposit the LP into Aura protocol to receive the Aura staked position
```mermaid theme={null}
flowchart LR
BAURA((B-AURA)) -->|balancer-v2 redeem| WETH((WETH))
WETH -->|wrapped-native redeem| ETH((ETH))
ETH -->|wrapped-native deposit| WETH_new((WETH))
WETH_new -->|balancer-v2 deposit| WETHUSDC((WETH-USDC))
WETHUSDC -->|aura deposit| auraWETHUSDC((auraWETH-USDC))
```
```ts theme={null}
export async function depositBalancerLpToAura(): Promise<{ route: any; tx: any }> {
const BPT_wstETH_WETH: Address = "0x32296969Ef14EB0c6d29669C550D4a0449130230";
const auraBPT: Address = "0x08129a472dfb92a1596bbe31f27c53914a990563";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 BPT
tokenIn: [BPT_wstETH_WETH],
tokenOut: [auraBPT],
routingStrategy: 'router'
};
happyPathLog(routeParams);
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
## Zap WETH to Balancer stEUR/Eure LP on Gnosis
Zaps WETH into the Balancer stEUR/Eure liquidity pool on Gnosis.
[**Try this route →**](https://happypath.enso.build/?tokenIn=0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1\&outChainId=100\&chainId=100\&tokenOut=0x06135A9Ae830476d3a941baE9010B63732a055F4\&amountIn=1000000000000000000)
```javascript theme={null}
const WETH = "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1" as Address;
const stEurEure = "0x06135A9Ae830476d3a941baE9010B63732a055F4" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: GNOSIS_CHAIN,
amountIn: ["1000000000000000000"],
tokenIn: [WETH],
tokenOut: [stEurEure],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(client.getApprovalData(route));
await sendEoa(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `WETH` to `EURE` via Enso.
* Deposit `EURE` into Balancer v2 to get the LP token.
***
## Provide Liquidity to Yearn Curve mUSD Vault with ETH
Deposit `ETH` and provide liquidity to the Yearn Curve `mUSD` Pool yVault on Ethereum.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&tokenOut=0x8cc94ccd0f3841a468184aca3cc478d2148e1757)
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|enso route| DAI((DAI))
DAI -->|curve deposit| 3CRV((3CRV LP))
3CRV -->|curve deposit| mUSD_LP((mUSD LP))
mUSD_LP -->|yearn-v2 deposit| yvmUSD((yvmUSD))
```
```javascript theme={null}
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const CurveMUSD_yVault = "0x8cc94ccd0f3841a468184aca3cc478d2148e1757" as Address; // Yearn Curve mUSD Pool yVault
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["100000000000000000"], // 0.1 ETH
tokenIn: [ETH],
tokenOut: [CurveMUSD_yVault],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `ETH` to DAI via Enso DEX Aggregator
* Deposit `DAI` into Curve.fi 3pool ( `0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7` ) to receive Curve 3pool LP tokens
* Deposit `Curve 3pool LP tokens` into Curve.fi mUSD Pool ( `0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6` ) to receive Curve mUSD LP tokens
* Deposit `Curve mUSD LP tokens` into Yearn Curve mUSD yVault ( `0x8cc94ccd0f3841a468184aca3cc478d2148e1757` )
***
## ETH to Curve stETH Factory yVault
Deposit `ETH` and provide liquidity to the Yearn Curve `stETH` Factory yVault on Ethereum.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&tokenOut=0x5b8c556b8b2a78696f0b9b830b3d67623122e270)
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|curve deposit| stETH_LP((stETH LP))
stETH_LP -->|yearn-v2 deposit| yvstETH((yvstETH))
```
```javascript theme={null}
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const CurveStETH_yVault = "0x5b8c556b8b2a78696f0b9b830b3d67623122e270" as Address; // Yearn Curve stETH Factory yVault
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["100000000000000000"], // 0.1 ETH
tokenIn: [ETH],
tokenOut: [CurveStETH_yVault],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Deposit `ETH` into Curve.fi stETH Pool ( `0xdc24316b9ae028f1497c275eb9192a3ea0f67022` ) to receive Curve stETH LP tokens
* Deposit `Curve stETH LP tokens` into Yearn Curve stETH Factory yVault ( `0x5b8c556b8b2a78696f0b9b830b3d67623122e270` )
***
## ETH to Balancer cbETH-wstETH Factory yVault
Deposit `ETH` and provide liquidity to the Yearn Balancer (`cbETH`/`wstETH`) yVault on Ethereum.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&tokenOut=0xc325849908d482550b87f96ef60271b95f92c861)
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> SPLIT{enso.split}
SPLIT -->|enso route| wstETH((wstETH))
SPLIT -->|enso route| cbETH((cbETH))
wstETH -->|balancer-v2 deposit| BAL_LP((cbETH/wstETH LP))
cbETH -->|balancer-v2 deposit| BAL_LP
BAL_LP -->|yearn-v2 deposit| yvBAL((yvBAL))
```
```javascript theme={null}
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const BalancerCBETHwstETH_yVault = "0xc325849908d482550b87f96ef60271b95f92c861" as Address; // Yearn Balancer cbETH-wstETH Factory yVault
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["100000000000000000"], // 0.1 ETH
tokenIn: [ETH],
tokenOut: [BalancerCBETHwstETH_yVault],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split `ETH`:
* Swap `ETH` to wstETH via Enso DEX Aggregator
* Swap `ETH` to cbETH via Enso DEX Aggregator
* Deposit `wstETH` and `cbETH` into Balancer V2 pool ( `0xba12222222228d8ba445958a75a0704d566bf2c8` ) to receive Balancer cbETH-wstETH LP tokens
* Deposit `Balancer cbETH-wstETH LP tokens` into Yearn Balancer cbETH-wstETH Factory yVault ( `0xc325849908d482550b87f96ef60271b95f92c861` )
***
## ETH to Curve TriCryptoLLAMA Factory yVault
Deposit `ETH` and provide liquidity to the Yearn Curve `TriCryptoLLAMA` yVault on Ethereum.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&tokenOut=0xe2cad35cfd1a9b5acd557558f44b096ef8340c1b)
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|enso route| tBTC((tBTC))
tBTC -->|curve deposit| TRICRYPTO_LP((TriCrypto LP))
TRICRYPTO_LP -->|yearn-v2 deposit| yvTRICRYPTO((yvTriCrypto))
```
```javascript theme={null}
const ETH = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const CurveTriCryptoLLAMA_yVault = "0xe2cad35cfd1a9b5acd557558f44b096ef8340c1b" as Address; // Yearn Curve TriCryptoLLAMA Factory yVault
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["100000000000000000"], // 0.1 ETH
tokenIn: [ETH],
tokenOut: [CurveTriCryptoLLAMA_yVault],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `ETH` to tBTC via Enso DEX Aggregator
* Deposit `tBTC` into Curve.fi TriCryptoLLAMA Pool ( `0x2889302a794da87fbf1d6db415c1492194663d13` ) to receive Curve TriCryptoLLAMA LP tokens
* Deposit `Curve TriCryptoLLAMA LP tokens` into Yearn Curve TriCryptoLLAMA Factory yVault ( `0xe2cad35cfd1a9b5acd557558f44b096ef8340c1b` )
***
# Curve Convex Yield Farming
Source: https://docs.enso.build/pages/use-cases/dexes-aggregators/convex-yield-farming
Deposit into Curve pools and stake LP tokens in Convex for boosted CRV rewards
export const date_0 = "2025-09-29"
## Deposit ETH into Curve stETH/ETH Pool and Stake in Convex
This use case automates the complete yield farming workflow for Curve's liquid staking pool with Convex rewards.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&tokenOut=0x182B723a58739a9c974cFDB385ceaDb237453c28)
**Route Mechanics:**
* Deposit native ETH into the Curve stETH/ETH liquidity pool
* Receive Curve LP tokens representing your pool share
* Automatically stake the LP tokens in the corresponding Curve Gauge
* Earn both trading fees from the pool and CRV rewards from the gauge
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|curve deposit| LP_TOKEN((stETH/ETH LP))
LP_TOKEN -->|curve-gauge deposit| GAUGE_TOKEN((Gauge Token))
```
```typescript theme={null}
const chainId = 1; // Ethereum mainnet
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token addresses
const tokenInEth = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
const lpTokenStethEth = "0x06325440d014e39736583c165c2963ba99faf14e"; // stETH/ETH Curve LP token
const stEthEthPool = "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022"; // stETH/ETH Curve Pool
const stEthGauge = "0x182B723a58739a9c974cFDB385ceaDb237453c28"; // stETH/ETH Curve Gauge
const amountIn = parseUnits("1000", 6); // 1000 USDC
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
// Step 1: Deposit into Curve stETH/ETH pool using standard "deposit" action
protocol: "curve",
action: "deposit",
args: {
tokenIn: [tokenInEth],
tokenOut: lpTokenStethEth, // stETH/ETH LP token
amountIn: [amountIn.toString()],
primaryAddress: stEthEthPool, // Curve stETH pool address
},
},
{
// Step 2: Stake LP tokens in Curve Gauge for CRV rewards
protocol: "curve-gauge",
action: "deposit",
args: {
tokenIn: lpTokenStethEth, // stETH/ETH LP token
tokenOut: stEthGauge, // stETH/ETH Gauge
amountIn: {
useOutputOfCallAt: 0, // Use LP tokens from Curve deposit
},
primaryAddress: stEthGauge, // Gauge address
},
},
]
);
await sendEoa(bundle.tx, bundle.gas);
```
# Overview
Source: https://docs.enso.build/pages/use-cases/dexes-aggregators/index
Crosschain DeFi automation for LP provisioning, yield optimization, and multi-protocol position management
## Liquidity Provision
Simplify liquidity provision to DeFi pools with a single transaction across multiple DEXs and chains.
Provide concentrated liquidity to Uniswap V3 pools with automated token splitting and position management.
## Position Management
Make it easy for users to migrate positions between different protocols and assets.
Deposit into Curve pools and stake LP tokens in Convex for boosted CRV rewards.
## Crosschain Operations
Provision liquidity across chains using Enso bridge action with seamless cross-chain operations.
# Position Migration
Source: https://docs.enso.build/pages/use-cases/dexes-aggregators/position-migration
Make it easy for users to migrate positions between different protocols and assets.
export const date_0 = "2025-09-29"
## Rebalance Nest Alpha Vault into Rooster LP on Plume
This use case rebalances a Nest Alpha Vault position into a Rooster Finance YAP (nALPHA/pUSD) liquidity pool.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0x593ccca4c4bf58b7526a4c164ceef4003c6388db\&tokenOut=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038)
**Route Mechanics**:
* The bundle first splits the input NestAlphaVault token
* A portion of the original token is paired with an equal value of pUSD obtained through a swap using the rooster protocol
* Both assets are then deposited into a rooster-yap liquidity pool to form the final LP position
```mermaid theme={null}
flowchart LR
NEST((NEST)) --> SPLIT{enso.split}
SPLIT -->|rooster swap| PUSD((PUSD))
SPLIT -->|keep as NALPHA| NALPHA((NALPHA))
PUSD -->|rooster-yap deposit| ROOSTER_LP((ROOSTER_LP))
NALPHA -->|rooster-yap deposit| ROOSTER_LP
```
```ts theme={null}
const BERACHAIN_CHAIN = 80094;
const OPTIMISM_CHAIN = 10;
const ARBITRUM_CHAIN = 42161;
const ETHEREUM_CHAIN = 1;
const PLUME_CHAIN = 98866;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Rebalances a Nest Alpha Vault position into a Rooster Finance YAP (nALPHA/pUSD) liquidity pool on Plume.
* @returns The route and transaction objects.
*/
export async function rebalanceNestToRoosterLp(): {
const NestAlphaVault: Address = "0x593ccca4c4bf58b7526a4c164ceef4003c6388db";
const RoosterYAPLP: Address = "0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: PLUME_CHAIN,
amountIn: ["1000000000"], // 1000 NALPHA tokens
tokenIn: [NestAlphaVault],
tokenOut: [RoosterYAPLP],
routingStrategy: 'router'
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Rebalance yHONEY Vault into Kodiak HONEY/WBERA LP
Redeem yHONEY vault shares and use the underlying assets to create a Kodiak BERA/HONEY LP position.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC\&tokenOut=0x9659dc8c1565E0bd82627267e3b4eEd1a377ebE6)
```mermaid theme={null}
flowchart LR
yHONEY((yHONEY)) -->|bearn redeem| HONEY((HONEY))
HONEY --> SPLIT{enso.split}
SPLIT -->|enso route| WBERA((WBERA))
SPLIT -->|keep as HONEY| HONEY_KEPT((HONEY))
WBERA -->|kodiak-islands deposit| LP((HONEY/WBERA LP))
HONEY_KEPT -->|kodiak-islands deposit| LP
```
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const HONEY_WBERA_POOL = "0x9659dc8c1565E0bd82627267e3b4eEd1a377ebE6" as Address; // HONEY/WBERA LP
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1500000000000000000"], // 1.5 yHONEY
tokenIn: [yHONEY],
tokenOut: [HONEY_WBERA_POOL],
routingStrategy: "delegate",
slippage: "200", // 2% slippage for yield token pairing
referralCode: "yhoney-island",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem `yHONEY` vault shares to receive `HONEY`.
* Split `HONEY` into `HONEY` and `WBERA` through internal routing.
* Deposit balanced tokens into Kodiak Islands `HONEY/WBERA` pool.
***
Updated {date_0}
# Uniswap V3 Concentrated Liquidity
Source: https://docs.enso.build/pages/use-cases/dexes-aggregators/provision-lp
Provide concentrated liquidity to Uniswap V3 pools with automated token splitting and position management
export const date_0 = "2025-09-29"
This use case demonstrates providing concentrated liquidity to a Uniswap V3 pool by automatically splitting a single token input.
**Route Mechanics:**
* Split the input AAVE token into two equal parts using Enso's internal routing
* Convert the first half to WETH to match the pool's token pair requirements
* Deposit both tokens into the Uniswap V3 AAVE/WETH pool with specified tick ranges
* Receive NFT position representing the concentrated liquidity position
```mermaid theme={null}
flowchart LR
AAVE((AAVE)) --> SPLIT{enso.split}
SPLIT -->|uniswap-v3 swap| WETH((WETH))
SPLIT -->|keep as AAVE| AAVE_KEPT((AAVE))
WETH -->|uniswap-v3 depositclmm| LP_POSITION((LP Position))
AAVE_KEPT -->|uniswap-v3 depositclmm| LP_POSITION
```
```typescript theme={null}
const chainId = 42161; // Arbitrum
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const tokenIn_AAVE = "0xba5ddd1f9d7f570dc94a51479a000e3bce967196";
const tokenOut_WETH = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1";
const uniswapManager = "0xc36442b4a4522e871399cd717abdd847ab11fe88";
// Define amount
const amountIn = parseUnits("10", 18); // 10 AAVE
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "router",
},
[
{
// Split AAVE into 2 equal parts
// Converts the first half into WETH
// needed for AAVE/WETH pool
protocol: "enso",
action: "split",
args: {
tokenIn: tokenIn_AAVE,
tokenOut: [tokenOut_WETH, tokenIn_AAVE],
amountIn: amountIn.toString(),
},
},
{
protocol: "uniswap-v3",
action: "depositclmm",
args: {
tokenOut: uniswapManager,
ticks: [25320, 25980],
tokenIn: [tokenOut_WETH, tokenIn_AAVE],
poolFee: "3000",
amountIn: [
// use output from the split call
{ useOutputOfCallAt: 0, index: 0 },
{ useOutputOfCallAt: 0, index: 1 },
],
},
},
]
);
const approvalData = await client.getApprovalData({
amount: amountIn.toString(),
chainId,
fromAddress,
tokenAddress: tokenIn_AAVE,
});
```
**Important Considerations:**
* Tick ranges determine the price range for concentrated liquidity
* Pool fee tier affects trading volume and potential returns
* Position requires active management as price moves outside the range
Updated {date_0}
# Zap to Add Liquidity
Source: https://docs.enso.build/pages/use-cases/dexes-aggregators/zap-to-liquidity
Simplify liquidity provision to DeFi pools with a single transaction.
export const date_0 = "2025-09-29"
## Zap BERA to BEX WBERA/HONEY LP on Berachain
This use case adds liquidity to the primary stable-native pair on the Berachain BEX.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x0277d40b08ac168518c524418f1b3c16adae0f0d)
**Route Mechanics:**
* splits the input BERA token using an internal enso router.
* creates two components: a portion is swapped for HONEY on a DEX, and the other portion is used to provide liquidity directly with WBERA.
* both assets are then deposited into the BEX protocol to form the LP position
```mermaid theme={null}
flowchart LR
BERA((BERA)) --> SPLIT{enso.split}
SPLIT -->|ooga-booga swap| HONEY((HONEY))
SPLIT -->|infrared-ibera deposit| iBERA((iBERA))
SPLIT -->|openocean swap| USDC((USDC))
HONEY -->|bex deposit| BEX_LP((BEX_LP))
iBERA -->|bex deposit| BEX_LP
USDC -->|bex deposit| BEX_LP
```
```ts theme={null}
const BERACHAIN_CHAIN = 80094;
const OPTIMISM_CHAIN = 10;
const ARBITRUM_CHAIN = 42161;
const ETHEREUM_CHAIN = 1;
const PLUME_CHAIN = 98866;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Zaps native BERA into the BEX WBERA/HONEY liquidity pool on Berachain.
* @returns The route and transaction objects.
*/
export async function zapBeraToBexLp(): {
const BERA: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const BEX_WBERA_HONEY_LP: Address = "0x0277d40b08ac168518c524418f1b3c16adae0f0d";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_CHAIN,
amountIn: ["1000000000000000000"], // 1 BERA
tokenIn: [BERA],
tokenOut: [BEX_WBERA_HONEY_LP],
routingStrategy: 'router'
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap ETH into a Velodrome LP on Optimism
This use case demonstrates a single transaction to provide liquidity to a Velodrome v2 pool.
[**Try this route →**](https://happypath.enso.build?chainId=10\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0xa3031D9FD5010496a2bAF8AFCE27Ef6f3849FB10)
**Route Mechanics:**
* splits the input ETH token. One portion is wrapped into WETH using wrapped-native, while the other is swapped for wstETH using the openocean protocol.
* both assets are deposited into a velodrome-v2 liquidity pool
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> SPLIT{enso.split}
SPLIT -->|wrapped-native deposit| WETH((WETH))
SPLIT -->|openocean swap| OP((OP))
WETH -->|velodrome-v2 deposit| VELO_LP((VELO_LP))
OP -->|velodrome-v2 deposit| VELO_LP
```
```ts theme={null}
const BERACHAIN_CHAIN = 80094;
const OPTIMISM_CHAIN = 10;
const ARBITRUM_CHAIN = 42161;
const ETHEREUM_CHAIN = 1;
const PLUME_CHAIN = 98866;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Zaps ETH into a Velodrome wstETH/WETH liquidity pool on Optimism.
* @returns The route and transaction objects.
*/
export async function zapEthToVelodromeLp(): {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const veloWstethWethLp: Address = "0xa3031D9FD5010496a2bAF8AFCE27Ef6f3849FB10";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: OPTIMISM_CHAIN,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [veloWstethWethLp],
routingStrategy: 'router'
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap ETH to SushiSwap ARB/WETH LP on Arbitrum
This use case provides liquidity to a popular v3 pool on Sushiswap.
[**Try this route →**](https://happypath.enso.build?chainId=42161\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x905dfcd5649217c42684f23958568e533c711aa3)
**Route Mechanics:**
* Split ETH into two portions using enso internal routing:
* First portion: swap ETH to USDC.e using 1inch protocol
* Second portion: deposit ETH into wrapped native to get WETH
* Deposit both USDC.e and WETH into SushiSwap v2 to create the LP position
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> SPLIT{enso.split}
SPLIT -->|1inch swap| USDC_e((USDC.e))
SPLIT -->|wrapped-native deposit| WETH((WETH))
USDC_e -->|sushiswap-v2 deposit| SUSHI_LP((SUSHI_LP))
WETH -->|sushiswap-v2 deposit| SUSHI_LP
```
```ts theme={null}
const BERACHAIN_CHAIN = 80094;
const OPTIMISM_CHAIN = 10;
const ARBITRUM_CHAIN = 42161;
const ETHEREUM_CHAIN = 1;
const PLUME_CHAIN = 98866;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Zaps ETH to a SushiSwap ARB/WETH liquidity pool on Arbitrum.
* @returns The route and transaction objects.
*/
export async function zapEthToSushiswapLp(): {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const SLP_ARB_WETH: Address = "0x905dfcd5649217c42684f23958568e533c711aa3";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ARBITRUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [SLP_ARB_WETH],
routingStrategy: 'router'
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap ETH to Balancer WETH/BAL LP on Mainnet
This use case provides liquidity to a classic Balancer weighted pool.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56)
**Route Mechanics:**
* Deposit ETH into wrapped native protocol to get WETH
* Deposit WETH into Balancer v2 pool to create the WETH/BAL LP position
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> SPLIT{enso.split}
SPLIT -->|1inch swap| USDC_e((USDC.e))
SPLIT -->|wrapped-native deposit| WETH((WETH))
USDC_e -->|sushiswap-v2 deposit| SUSHI_LP((SUSHI_LP))
WETH -->|sushiswap-v2 deposit| SUSHI_LP
```
```ts theme={null}
const BERACHAIN_CHAIN = 80094;
const OPTIMISM_CHAIN = 10;
const ARBITRUM_CHAIN = 42161;
const ETHEREUM_CHAIN = 1;
const PLUME_CHAIN = 98866;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Zaps ETH to a Balancer WETH/BAL weighted pool on Ethereum Mainnet.
* @returns The route and transaction objects.
*/
export async function zapEthToBalancerLp(): {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const BPT_WETH_BAL: Address = "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [BPT_WETH_BAL],
routingStrategy: 'router'
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap ETH to Camelot GRAIL/WETH LP on Arbitrum
This use case provides liquidity to a core pool on Camelot DEX.
[**Try this route →**](https://happypath.enso.build?chainId=42161\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0xbfca4230115de8341f3a3d5e8845ffb3337b2be3)
Route Mechanics:
* the bundle first splits the input ETH token.
* tne portion is swapped for GRAIL using the odos protocol
* the other is wrapped into WETH using the wrapped-native protocol.
* the two assets are then deposited into the camelot-v2 protocol to form the LP position
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> SPLIT{enso.split}
SPLIT -->|odos swap| PENDLE((PENDLE))
SPLIT -->|wrapped-native deposit| WETH((WETH))
PENDLE -->|camelot-v2 deposit| CAMELOT_LP((CAMELOT_LP))
WETH -->|camelot-v2 deposit| CAMELOT_LP
```
```ts theme={null}
import { EnsoClient, RouteParams, Address } from "@ensofinance/sdk";
import * as dotenv from "dotenv";
import { happyPathLog } from "../../tools";
import { sendEoa } from "../utils";
dotenv.config();
// Initialize EnsoClient with your API key
const client = new EnsoClient({
apiKey: process.env.ENSO_API_KEY!,
});
// Define common constants
const BERACHAIN_CHAIN = 80094;
const OPTIMISM_CHAIN = 10;
const ARBITRUM_CHAIN = 42161;
const ETHEREUM_CHAIN = 1;
const PLUME_CHAIN = 98866;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Zaps ETH to a Camelot GRAIL/WETH liquidity pool on Arbitrum.
* @returns The route and transaction objects.
*/
export async function zapEthToCamelotLp(): {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const spLP_GRAIL_WETH: Address = "0xbfca4230115de8341f3a3d5e8845ffb3337b2be3";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ARBITRUM_CHAIN,
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [spLP_GRAIL_WETH],
routingStrategy: 'router'
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
Updated {date_0}
# Overview
Source: https://docs.enso.build/pages/use-cases/index
Find Enso routes and bundles for your use case and the strategies you need
Find Enso routes and bundles for different DeFi use cases and the run strategies you need.
Simplify deposits, repayments, and collateral management. Enable complex vault strategies and ensure protocol solvency with efficient liquidations.
Offer seamless swaps, cross-chain bridging, and direct-to-DeFi earning opportunities to keep your users' assets active
Remove friction from liquidity provision with simple zaps. Make it easy for users to migrate positions and optimize backend operations.
Use single-origin minting with secure cross-chain bridging.
Launch yield tokens across multiple chains without deploying contracts everywhere.
Automate DEX market making, CEX-DEX arbitrage, and liquidity pool rebalancing. Respond to market conditions programmatically to improve capital efficiency.
Maximize user deposits by accepting any token. Simplify position migration between vaults to keep capital within your ecosystem.
Execute complex leveraged yield strategies with Enso's automated routing
Build single-transaction multi-step yield strategies, including auto-compounding
# Borrow from Lending Protocols
Source: https://docs.enso.build/pages/use-cases/lending-markets/borrowing
Borrow on lending protocols and combine with Enso's routing
## Provide collateral and borrow in a single transaction
**Route mechanics**
* Provide USDC collateral either using [`deposit`](/pages/build/reference/actions#deposit) or simpler with Enso's [`route` action](/pages/build/reference/actions#route)
* Borrow WETH using the deposited USDC
```mermaid theme={null}
flowchart LR
USDC((USDC)) -->|enso route| aUSDC((aUSDC))
aUSDC -->|aave-v3 borrow| WETH((WETH))
```
```ts lines theme={null}
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const USDC_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const AUSDC_ADDRESS = "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c";
const WETH_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
const AAVE_V3 = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
const usdcAmountIn = parseUnits("10000", 6).toString();
const wethAmountOut = parseUnits("0.025", 18).toString();
const chainId = 1;
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
receiver: fromAddress,
},
[
{
protocol: "enso",
action: "route",
args: {
amountIn: usdcAmountIn,
tokenIn: USDC_ADDRESS,
tokenOut: AUSDC_ADDRESS,
},
},
{
protocol: "aave-v3",
action: "borrow",
args: {
primaryAddress: AAVE_V3,
collateral: USDC_ADDRESS,
tokenOut: WETH_ADDRESS,
amountOut: wethAmountOut,
},
},
]
);
console.log(JSON.stringify(bundle.bundle, null, 2));
await sendEoa(approvalData.tx, approvalData.gas);
// sending the actual transaction
await sendEoa(bundle.tx, bundle.gas);
```
# Collateral Swap
Source: https://docs.enso.build/pages/use-cases/lending-markets/collateral-swap
Switch the collateral backing your debt without closing the debt position
**Note on Approvals**: When using `routingStrategy`: `router`, you must first approve the Enso contract to spend your tokens.
The code samples below include the necessary `client.getApprovalData()` step, which generates the required approval transaction
to be signed before the main routing transaction.
To swap the collateral, we need three actions:
* `redeem` a part of exising `WETH` collateral for the `aWETH` position
* `route` to swap the redeemed collateral (WETH) to a different position (WBTC)
* `deposit` the swapped position (WBTC) as collateral for the existing debt
```mermaid theme={null}
flowchart LR
aWETH((aWETH)) -->|aave-v3 redeem| WETH((WETH))
WETH -->|enso route| WBTC((WBTC))
WBTC -->|aave-v3 deposit| aWBTC((aWBTC))
```
```ts theme={null}
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
const aWETH = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
const WBTC = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599";
const aWBTC = "0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8";
// aave v3 position manager
const AAVE_V3 = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "redeem",
args: {
primaryAddress: AAVE_V3,
tokenIn: aWETH,
tokenOut: WETH,
amountIn: "1000000000000000000",
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: WETH,
tokenOut: WBTC,
amountIn: { useOutputOfCallAt: 0 },
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
primaryAddress: AAVE_V3,
tokenIn: WBTC,
tokenOut: aWBTC,
amountIn: { useOutputOfCallAt: 1 },
},
},
]
);
console.log(JSON.stringify(bundle, null, 2));
```
# Deposit with Leverage
Source: https://docs.enso.build/pages/use-cases/lending-markets/deposit-with-leverage
Depositing with leverage amplifies exposure by redepositing the same collateral:
* deposits initial collateral (WETH),
* borrows against it (USDC),
* swaps the borrowed funds for more collateral (USDC → WETH),
* and repeats this process.
```mermaid theme={null}
flowchart LR
WETH((WETH)) -->|aave-v3 deposit| aWETH((aWETH))
aWETH -->|aave-v3 borrow| USDC((USDC))
USDC -->|enso route| WETH_2((WETH))
WETH_2 -->|aave-v3 deposit| aWETH_2((aWETH))
```
```ts lines highlight={32-33, 42-43, 52-53} theme={null}
const chainId = 1;
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
// Token and Protocol Addresses
const WETH: Address = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
const aWETH: Address = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
const USDC: Address = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const aaveV3Pool: Address = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
// Define amounts
const initialDeposit = parseUnits("1", 18);
const borrowAmount = parseUnits("1000", 6);
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
[
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: WETH,
tokenOut: aWETH,
amountIn: initialDeposit.toString(),
primaryAddress: aaveV3Pool,
},
},
{
protocol: "aave-v3",
action: "borrow",
args: {
collateral: aWETH,
tokenOut: USDC,
amountOut: borrowAmount.toString(),
primaryAddress: aaveV3Pool,
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDC,
tokenOut: WETH,
amountIn: borrowAmount.toString(),
slippage: "100",
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: WETH,
tokenOut: aWETH,
amountIn: { useOutputOfCallAt: 2 },
primaryAddress: aaveV3Pool,
},
},
]
);
console.log(JSON.stringify(bundle.bundle, null, 2));
await sendSmartWallet(bundle.tx, bundle.gas);
```
# Overview
Source: https://docs.enso.build/pages/use-cases/lending-markets/index
Shortcuts for Lending Markets Operations
Redeem asssets and swap them directly to an arbitrary token in a single transaction
Borrow from Lending Protocols
Migrate positions between protocols
Automatically zap any input token as collateral to arbitrary vault tokens
Switch the collateral backing your debt without closing the debt position
Deposit using leveraged position
Zap to repay debt from any position
TBD
TBD
TBD
# Migration
Source: https://docs.enso.build/pages/use-cases/lending-markets/migration
Migrate positions between protocols
## Migrating with same base token
Move your USDC lending position from Aave to Compound while keeping the same underlying asset.
**Route mechanics**
* `redeem` existing USDC collateral on AAVE
* `deposit` retreived USDC to Compound `CUSDC` position
```mermaid theme={null}
flowchart LR
aUSDC((aUSDC)) -->|aave-v3 redeem| USDC((USDC))
USDC -->|compound-v3 deposit| cUSDC((cUSDC))
```
```ts lines theme={null}
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const USDC_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const AUSDC_ADDRESS = "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c";
const CUSDC_ADDRESS = "0xc3d688B66703497DAA19211EEdff47f25384cdc3";
const AAVE_V3 = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
const aUsdcAmountIn = parseUnits("5000", 6).toString(); // 5,000 aUSDC to withdraw
const chainId = 1;
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
// Migrate USDC lending position from Aave to Compound
[
{
protocol: "aave-v3",
action: "redeem",
args: {
tokenIn: AUSDC_ADDRESS,
tokenOut: USDC_ADDRESS,
amountIn: aUsdcAmountIn,
primaryAddress: AAVE_V3,
},
},
{
protocol: "compound-v3",
action: "deposit",
args: {
tokenIn: USDC_ADDRESS,
tokenOut: CUSDC_ADDRESS,
amountIn: aUsdcAmountIn,
primaryAddress: CUSDC_ADDRESS,
},
},
]
);
console.log(JSON.stringify(bundle.bundle, null, 2));
await sendSmartWallet(bundle.tx, bundle.tx);
```
## Migrating to different base position
Switch Aave lending position from USDC collateral to WETH collateral in a single transaction.
Bundle design:
* `redeem` existing USDC collateral on AAVE
* swap USDC to WETH using `route` action
* `deposit` resulting WETH to AAVE (using the `{useOutputOfCallAt: 1}` to reference the swap)
```mermaid theme={null}
flowchart LR
aUSDC((aUSDC)) -->|aave-v3 redeem| USDC((USDC))
USDC -->|enso route| WETH((WETH))
WETH -->|aave-v3 deposit| aWETH((aWETH))
```
```ts lines theme={null}
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const USDC_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const AUSDC_ADDRESS = "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c";
const WETH_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
const AWETH_ADDRESS = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
const AAVE_V3 = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
const aUsdcAmountIn = parseUnits("3000", 6).toString();
const chainId = 1;
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
// Switch collateral within Aave from USDC to WETH
[
{
protocol: "aave-v3",
action: "redeem",
args: {
tokenIn: AUSDC_ADDRESS,
tokenOut: USDC_ADDRESS,
amountIn: aUsdcAmountIn,
primaryAddress: AAVE_V3,
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDC_ADDRESS,
tokenOut: WETH_ADDRESS,
amountIn: aUsdcAmountIn,
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: WETH_ADDRESS,
tokenOut: AWETH_ADDRESS,
amountIn: {useOutputOfCallAt: 1},
primaryAddress: AAVE_V3,
},
},
]
);
console.log(JSON.stringify(bundle.bundle, null, 2));
await sendSmartWallet(bundle.tx, bundle.tx);
```
# Withdraw & Swap
Source: https://docs.enso.build/pages/use-cases/lending-markets/withdraw-and-swap
Redeem asssets and swap them directly to an arbitrary token in a single transaction
Enso [GET `route`](/pages/build/get-started/route) API allows withdrawing (redeeming) from a curated vault position to an arbitrary DeFi or base asset.
## Withdraw PT and swap to USDC
This route redeems ezETH PT into USDC, performing any necessary withdrawals and swaps.
[Try this route →](https://happypath.enso.build/?tokenIn=0xeEE8aED1957ca1545a0508AfB51b53cCA7e3c0d1\&outChainId=1\&chainId=1\&tokenOut=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\&amountIn=10000000000000000000)
**Route mechanics:**
* Redeem from `PT_ezETH` to get `SY_ezETH`
* Redeem from `SY_ezETH` to obtain the deposited `ezETH`
* Swap `ezETH` to desired `USDC`
```mermaid theme={null}
flowchart LR
PT((PT_Token)) -->|pendle-pt redeem| SY((SY_Token))
SY -->|pendle-sy redeem| ezETH((ezETH))
ezETH -->|barter swap| USDC((USDC))
```
```ts lines theme={null}
const PT_ezETH_25APR2024 = "0xeEE8aED1957ca1545a0508AfB51b53cCA7e3c0d1";
const USDC: Address = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const amountIn = parseUnits("10", 18).toString();
const chainId = 1;
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const routeParams: RouteParams = {
chainId,
amountIn: [amountIn],
fromAddress,
tokenIn: [PT_ezETH_25APR2024],
tokenOut: [USDC],
routingStrategy: "router",
receiver: fromAddress,
slippage: "500",
};
const route = await client.getRouteData(routeParams);
console.log(JSON.stringify(route, null, 2));
const approvalData = await client.getApprovalData({
chainId,
fromAddress,
amount: amountIn,
tokenAddress: PT_ezETH_25APR2024,
});
await sendEoa(approvalData.tx, approvalData.gas);
// sending the actual transaction
await sendEoa(route.tx, route.gas);
```
## Withdraw ADAI to USDC
This sample withdraws `ADAI` and swaps it to USDC in a single transaction.
[Try this route →](https://happypath.enso.build/?tokenIn=0xeEE8aED1957ca1545a0508AfB51b53cCA7e3c0d1\&outChainId=1\&chainId=1\&tokenOut=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\&amountIn=10000000000000000000)
**Route mechanics:**
* Withdraw deposited `ADAI` to the underlying `DAI`
* Swaps `DAI` to `USDC`
* The `receiver` gets the resulting funds
```mermaid theme={null}
flowchart LR
aDAI((aDAI)) -->|aave-v3 redeem| DAI((DAI))
DAI -->|odos swap| USDC((USDC))
```
```ts lines theme={null}
const ADAI_ADDRESS = "0x018008bfb33d285247A21d44E50697654f754e63";
const USDC: Address = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const amountIn = parseUnits("100", 18).toString();
const chainId = 1;
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const routeParams: RouteParams = {
chainId,
destinationChainId: chainId,
amountIn: [amountIn],
fromAddress,
tokenIn: [ADAI_ADDRESS],
tokenOut: [USDC],
routingStrategy: "router",
receiver: fromAddress,
slippage: "500",
};
const route = await client.getRouteData(routeParams);
console.log(JSON.stringify(route, null, 2));
const approvalData = await client.getApprovalData({
chainId,
fromAddress,
amount: amountIn,
tokenAddress: ADAI_ADDRESS,
});
await sendEoa(approvalData.tx, approvalData.gas);
// sending the actual transaction
await sendEoa(route.tx, route.gas);
```
# Zap Repay Debt
Source: https://docs.enso.build/pages/use-cases/lending-markets/zap-repay-behalf-of
Zap to repay debt from any position
Note on Approvals: When using `routingStrategy`: `router`, you must first approve the Enso contract to spend your tokens.
The code samples below include the necessary `client.getApprovalData()` step, which generates the required approval transaction
to be signed before the main routing transaction.
When using `repay` with `router` routing strategy, you must specify the debt holder via `onBehalfOf` argument.
Enabling zap to repay debt requires two steps:
* Suppose there's USDC debt
* `route` from arbitrary token (WETH) to the debt token (USDC)
* `repay` debt using the swap output by using the dynamic amount reference (`useOutputOfCallAt`)
```mermaid theme={null}
flowchart LR
WETH((WETH)) --> SG1
subgraph SG1["On-Behalf Repayment"]
direction LR
A1[enso.route] --> USDC((USDC))
A2[aave-v3.repay onBehalfOf]
USDC --> A2
end
```
```ts lines highlight={16-17, 26-27, 31, 32, 46} theme={null}
const AAVE_v3 = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
const fromAddress = "0x93621dca56fe26cdee86e4f6b18e116e9758ff11";
const USDC_ADDRESS = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const WETH_ADDRESS: Address = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
const WETH_AMOUNT_IN = parseUnits("0.001", 18).toString();
const bundle = await client.getBundleData(
{
chainId: 1,
fromAddress,
routingStrategy: "router",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: WETH_ADDRESS,
tokenOut: USDC_ADDRESS,
amountIn: WETH_AMOUNT_IN,
},
},
{
// FIX: could not simulate TX
protocol: "aave-v3",
action: "repay",
args: {
primaryAddress: AAVE_v3,
tokenIn: USDC_ADDRESS,
amountIn: { useOutputOfCallAt: 0 },
onBehalfOf: fromAddress,
},
},
]
);
const approval = await client.getApprovalData({
tokenAddress: WETH_ADDRESS,
amount: WETH_AMOUNT_IN,
chainId: 1,
fromAddress,
});
console.log(JSON.stringify(bundle.bundle));
await sendEoa(approval.tx, approval.gas);
await sendEoa(bundle.tx, bundle.gas);
```
# Zap to Collateral
Source: https://docs.enso.build/pages/use-cases/lending-markets/zap-to-collateral
Automatically zap any input token as collateral to arbitrary vault tokens
Automatically convert any token into the required vault token and deposit as collateral in a single transaction.
In this example, we're zapping WETH to an AAVE `aUSDT` position.
```mermaid theme={null}
flowchart LR
WETH((WETH)) -->|barter swap| USDT((USDT))
USDT -->|aave-v3 deposit| aUSDT((aUSDT))
```
```typescript lines theme={null}
const WETH: Address = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; // WETH
const aUSDT: Address = "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a";
const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
const routeParams: RouteParams = {
tokenIn: [WETH],
tokenOut: [aUSDT],
amountIn: ["1000000000000000000"],
chainId: 1,
routingStrategy: "router",
fromAddress,
};
const approvalData = await client.getApprovalData({
amount: routeParams.amountIn[0],
chainId: 1,
tokenAddress: WETH,
fromAddress,
});
const route = await client.getRouteData(routeParams);
await sendEoa(approvalData.tx, approvalData.gas);
await sendEoa(route.tx, route.gas);
```
## Zap Deposits
### **Zap ETH to lend on Aave V3 on Arbitrum**
Deposit WETH into Aave on Arbitrum.
[Try this route →](https://happypath.enso.build/?tokenIn=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\&outChainId=42161\&chainId=42161\&tokenOut=0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8\&amountIn=1000000000000000000)
**Route Mechanics:**
* **Deposit into Aave V3**: The input `WETH` is deposited into the Aave V3 protocol, and in return, you receive `aWETH`, representing your lending position.
```mermaid theme={null}
flowchart LR
WETH((WETH)) -->|aave-v3 deposit| aWETH((aWETH))
```
```javascript lines theme={null}
const WETH = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
const aWETH = "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8";
const routeParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: 42161, // Arbitrum
amountIn: ["1000000000000000000"], // 1 WETH
tokenIn: [WETH],
tokenOut: [aWETH],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
const approval = await client.getApprovalData({
chainId: 42161,
fromAddress: userAddress,
amount: "1000000000000000000",
tokenAddress: WETH,
});
// Approval transaction for `router` strategy
await sendEoa(approval.tx, approval.gas);
// Sending the actual transaction
await sendEoa(route.tx, route.gas);
```
***
### **Zap ETH to lend on Euler V2 on Mainnet**
Supply ETH to the Euler V2 lending market on the Ethereum Mainnet. This route provides a seamless way to start earning interest on your ETH.
[Try this route →](https://happypath.enso.build/?tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&outChainId=1\&chainId=1\&tokenOut=0xb3b36220fA7d12f7055dab5c9FD18E860e9a6bF8\&amountIn=1000000000000000000)
**Route Mechanics:**
* **Wrap**: The input `ETH` is first wrapped into `WETH`.
* **Deposit**: The `WETH` is then deposited into the Euler V2 protocol, and you receive `eWETH` in return.
```mermaid theme={null}
flowchart LR
ETH((ETH)) -->|wrapped-native deposit| WETH((WETH))
WETH -->|euler-v2 deposit| eWETH((eWETH))
```
```javascript lines theme={null}
const ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const eWETH = "0xb3b36220fA7d12f7055dab5c9FD18E860e9a6bF8";
const routeParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: 1, // Ethereum
amountIn: ["1000000000000000000"], // 1 ETH
tokenIn: [ETH],
tokenOut: [eWETH],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
// Approval transaction for `router` strategy
const approval = await client.getApprovalData({
chainId: 1,
fromAddress: userAddress,
amount: "1000000000000000000",
tokenAddress: ETH,
});
// Approval transaction for `router` strategy
await sendEoa(approval.tx, approval.gas);
// Sending the actual transaction
await sendEoa(route.tx, route.gas);
```
***
### **Lend USDC on Spark on Gnosis**
Supply USDC to Spark's money market on the Gnosis chain. This route provides a direct way to enter a lending position.
[Try this route →](https://happypath.enso.build/?tokenIn=0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83\&outChainId=100\&chainId=100\&tokenOut=0x5850d127a04ed0b4f1fcdfb051b3409fb9fe6b90\&amountIn=100000000)
**Route Mechanics:**
* **Deposit into Spark**: Your `USDC` is deposited into the Spark-lend protocol, and you receive `spUSDC` in return, which represents your share in the lending pool.
```mermaid theme={null}
flowchart LR
USDC((USDC)) -->|spark-lend 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 deposit| WBERA((WBERA))
SPLIT -->|openocean swap| STGUSDC((STGUSDC))
WBERA -->|kodiak-islands deposit| KODIAK_LP((KODIAK_LP))
STGUSDC -->|kodiak-islands 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
Automate DEX market making, responding to market conditions programmatically to improve capital efficiency
Dynamically shift capital from one protocol to another to optimize yield
# 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;
}
```
# 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
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 check| USDC_ETH((USDC))
subgraph ethereum ["🌐 Ethereum"]
USDC_ETH((USDC)) -->|reservoir deposit| rUSD_ETH((rUSD))
end
rUSD_ETH -.-> |balance check|rUSD_BERA((rUSD))
subgraph berachain ["🐻 Berachain"]
rUSD_BERA((rUSD)) -->|dolomite 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
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.
```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
Updated {date_0}
# 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
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 check| USDC_ETH((USDCe))
subgraph ethereum ["🌐 Ethereum"]
USDC_ETH((USDC)) -->|reservoir deposit| rUSD_ETH((rUSD))
end
rUSD_ETH -.-> |balance check|rUSD_BERA((rUSD))
subgraph berachain ["🐻 Berachain"]
rUSD_BERA((rUSD)) -->|euler-v2 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 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
Updated {date_0}
# Katana: Mint rUSD and deposit to Morpho
Source: https://docs.enso.build/pages/use-cases/stablecoins/crosschain-deposit-rusd-katana-morpho
Crosschain wsrUSD minting and automated routing to Morpho lending positions on Katana
export const date_0 = "2025-09-25"
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.
```mermaid theme={null}
flowchart LR
subgraph ethereum ["🌐 Ethereum"]
USDC_ETH((USDC))
USDC_ETH -->|enso route| wsrUSD_ETH((wsrUSD))
end
wsrUSD_ETH -.->|stargate bridge| wsrUSD_KATANA((wsrUSD))
subgraph katana ["⚔️ Katana"]
wsrUSD_KATANA -->|morpho-markets-v1 deposit| MORPHO_SHARES((Morpho wsrUSD/vbUSD))
end
style MORPHO_SHARES stroke-dasharray: 5 5
```
\*\*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](https://app.morpho.org/katana/market/0xd8a93a4cd16f843c385391e208a9a9f2fd75aedfcca05e4810e5fbfcaa6baec6/wsrusd-vbusdc)
The strategy enables users to access Katana's DeFi ecosystem while starting with familiar USDC on Ethereum and relying on Reservoir Stablecoin.
```typescript lines highlight={} theme={null}
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:
* [Bridge Action Reference](/pages/build/reference/actions#bridge) - Technical details on crosschain bridging
* [Route Action Reference](/pages/build/reference/actions#route) - Using Enso's routing aggregation
* [Deposit Action Reference](/pages/build/reference/actions#deposit) - Using Enso's deposit action
* [getLayerZeroPool SDK Method](https://github.com/EnsoBuild/sdk-ts?tab=readme-ov-file#bridging-pool-address) - Finding available bridge pools programmatically
* [Crosschain Bridging Guide](/pages/build/examples/bridging) - Getting started with multi-chain workflows
Updated {date_0}
# Crosschain Minting: Round-Trip to Berachain
Source: https://docs.enso.build/pages/use-cases/stablecoins/crosschain-mint-rusd-bera
Crosschain stablecoin minting workflow: bridge USDCefrom Berachain to Ethereum, mint rUSD, and return minted tokens to origin chain
export const date_0 = "2025-09-29"
The workflow shows how to access Reservoir minting infrastructure from remote chains through automated bridging sequences.
```mermaid theme={null}
flowchart LR
subgraph berachain ["🐻 Berachain"]
USDCE_BERA((USDCE)) --> A1(( ))
end
A1 -.->|stargate bridge| B1
subgraph ethereum ["🌐 Ethereum"]
B1(( )) -->|balance check| USDC_ETH((USDC))
USDC_ETH -->|reservoir deposit| A2(( )) --> rUSD_ETH((rUSD))
rUSD_ETH -.->|stargate bridge| C1
end
subgraph berachain ["🐻 Berachain"]
C1(( )) -->|balance check| rUSD_BERA((rUSD))
end
```
**Route Mechanics:**
This bundle orchestrates a complete crosschain yield strategy through multiple atomic operations:
* Bridge USDCe from Berachain to Ethereum using Stargate protocol
* Check USDCebalance on Ethereum after successful bridge completion
* Mint rUSD using the bridged USDCethrough Reservoir's minting contract
* Bridge newly minted rUSD back to Berachain via Stargate bridge
* Check rUSD balance on Berachain after the bridge returns
```typescript mintOnBeraFromMainnet.ts highlight={21, 27, 47, 54, 63, 75} lines theme={null}
// Chain IDs
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";
// Protocol addresses
const RESERVOIR_MINTING_CONTRACT =
"0x4809010926aec940b550D34a46A52739f996D75D";
const client = new EnsoClient({
apiKey: process.env.ENSO_API_KEY || "your-api-key-here",
});
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 USDCebalance on Ethereum after bridge
{
protocol: "enso",
action: "balance",
args: {
token: USDC_ETHEREUM,
},
},
// Step 2: Mint rUSD using bridged USDC
{
protocol: "reservoir",
action: "deposit",
args: {
primaryAddress: RESERVOIR_MINTING_CONTRACT,
tokenIn: USDC_ETHEREUM,
tokenOut: RUSD_ETHEREUM,
amountIn: { useOutputOfCallAt: 0 }, // Use USDCefrom 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 e-rUSD from minting
receiver: WALLET_ADDRESS,
},
},
],
},
},
]
);
return bundle;
```
**Important considerations**
* This bundle executes multiple crosschain operations atomically - if any step fails, the entire transaction reverts
* LayerZero bridge fees apply for both USDCe and rUSD transfers between chains
* Gas costs for Ethereum minting and Berachain vault deposit are calculated upfront
* Bridge timing may vary based on network congestion on both chains
## Resources:
* [Bridge Action Reference](/pages/build/reference/actions#bridge) - Technical details on crosschain bridging
* [Crosschain Routing Guide](/pages/build/get-started/crosschain-routing) - 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
* [Bundle Actions Guide](/pages/build/get-started/bundling-actions) - Creating complex multi-step transactions
Updated {date_0}
# Crosschain Minting: Round-Trip to Katana
Source: https://docs.enso.build/pages/use-cases/stablecoins/crosschain-mint-rusd-katana
Mint rUSD stablecoin on Ethereum mainnet and bridge to Katana chain for DeFi yield and stablecoin diversification
export const date_0 = "2025-09-22"
This example shows single-contract minting on Ethereum followed by automated token distribution to Katana through bridging.
The pattern shows multi-chain token access without requiring separate minting deployments on each destination chain.
```mermaid theme={null}
flowchart LR
subgraph ethereum ["🌐 Ethereum"]
USDC_ETH((USDC))
USDC_ETH -->|enso route| rUSD_ETH((rUSD))
end
rUSD_ETH -.->|stargate bridge| rUSD_KAT((rUSD))
subgraph katana ["⚔️ Katana"]
rUSD_KAT -->|enso route| VBUSDC((vbUSDC))
end
```
\*\*Route Mechanics:
\*\*
This bundle facilitates stablecoin diversification across chains through a the following process:
* Convert USDC to rUSD on Ethereum using Enso's routing aggregation
* Bridge the newly minted rUSD from Ethereum to Katana chain via Stargate
* Check rUSD balance on Katana after bridge completion
* Swap rUSD for vault-bridged USDC (vbUSDC) on Katana
The strategy enables users to access Katana's DeFi ecosystem while starting with familiar USDC on Ethereum and relying on Reservoir Stablecoin.
```typescript lines highlight={} theme={null}
const KATANA_ID = 747474;
const ETHEREUM_ID = 1;
// Common addresses
const WALLET_ADDRESS = "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11"; // User wallet
// Token addresses
const rUSD_ETHEREUM = "0x09D4214C03D01F49544C0448DBE3A27f768F2b34";
const rUSD_KATANA = "0x09D4214C03D01F49544C0448DBE3A27f768F2b34";
const USDC_ETHEREUM = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const VBUSDC_KATANA = "0x203A662b0BD271A6ed5a60EdFbd04bFce608FD36";
const client = new EnsoClient({
apiKey: process.env.ENSO_API_KEY!,
});
// LayerZero pool addresses
const wsrEthToKatanaPools = await client.getLayerZeroPool({
chainId: ETHEREUM_ID,
token: rUSD_ETHEREUM,
destinationChainId: KATANA_ID,
destinationToken: rUSD_KATANA,
});
// LayerZero pool addresses
const rUsdKatanaToEthRUsd = await client.getLayerZeroPool({
chainId: ETHEREUM_ID,
token: rUSD_ETHEREUM,
destinationChainId: KATANA_ID,
destinationToken: rUSD_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: rUSD_ETHEREUM,
},
},
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: wsrEthToKatanaPools[0].pool as Address,
destinationChainId: KATANA_ID,
tokenIn: rUSD_ETHEREUM,
amountIn: { useOutputOfCallAt: 0 },
receiver: WALLET_ADDRESS,
callback: [
// Step 1: Check wsrUSD balance on Katana after bridge
{
protocol: "enso",
action: "balance",
args: {
token: rUSD_KATANA,
},
},
// Step 2: Swap wsrUSD to vbUSDC
{
protocol: "enso",
action: "route",
args: {
tokenIn: rUSD_KATANA,
tokenOut: VBUSDC_KATANA,
amountIn: { useOutputOfCallAt: 0 }, // Use wsrUSD_KATANA from balance check
receiver: WALLET_ADDRESS,
},
},
],
},
},
]
);
```
**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:
* [Bridge Action Reference](/pages/build/reference/actions#bridge) - Technical details on crosschain bridging
* [Route Action Reference](/pages/build/reference/actions#route) - Using Enso's routing aggregation
* [getLayerZeroPool SDK Method](https://github.com/EnsoBuild/sdk-ts?tab=readme-ov-file#bridging-pool-address) - Finding available bridge pools programmatically
* [Crosschain Bridging Guide](/pages/build/examples/bridging) - Getting started with multi-chain workflows
Updated {date_0}
# Overview
Source: https://docs.enso.build/pages/use-cases/stablecoins/index
Streamlined crosschain stablecoin workflows for minting, yield farming, and liquidity provision from a single origin chain
## Crosschain Stablecoin Minting
Use Enso's crosschain routing to mint stablecoins on their origin chain and access assets on the target chain.
Bridge assets across chains to mint stablecoins where protocols exist, then return with newly minted tokens for yield farming
Mint rUSD stablecoin on Ethereum and bridge to Katana for yield and diversification
## Crosschain Stablecoin Yield Roundtrip
Build crosschain workflows to enter yield bearing positions with single-chain stablecoins.
Crosschain minting strategy with USDCe bridging, rUSD minting, and Dolomite vault deposits for yield generation on Berachain
Crosschain minting roundtrip with USDCe bridging, rUSD creation, and Euler vault deposits for yield generation on Berachain
Crosschain wsrUSD minting and automated routing to Morpho lending positions on Katana
Mint wsrUSD on Ethereum and automatically bridge to Katana for Yearn vault deposits
# Auto-Compounding & Complete Yield Flows
Source: https://docs.enso.build/pages/use-cases/strategies/auto-compounding
Build single-transaction multi-step yield strategies, including auto-compounding
Use these routes to deposit assets into auto-compounding vaults in a single step, which automatically reinvests your yield to maximize returns without requiring manual intervention.
**Note on Route Mechanics:** The steps listed below are illustrative of a possible path. Enso's API dynamically calculates the most efficient route at the moment of execution, so the exact swaps and bridges may vary based on real-time market conditions.
**Table of Contents**
* [HONEY to Bault Auto-Compound Zap](#honey-to-bault-auto-compound-zap)
* [BERA to styHONEY Vault Zap](#bera-to-styhoney-vault-zap)
* [BERA to Bault Auto-Compound Zap](#bera-to-bault-auto-compound-zap)
## HONEY to Bault Auto-Compound Zap
Convert `HONEY` into an auto-compounding Kodiak Bault (`WBERA`/`HONEY`) position on Berachain.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590\&tokenOut=0x056319DE9c9DF9eD7eE35221795F8C9F9E160cd1)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const HONEY = "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590" as Address;
const BAULT_KODI_WBERA_HONEY = "0x056319DE9c9DF9eD7eE35221795F8C9F9E160cd1" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["2000000000000000000"], // 2 HONEY
tokenIn: [HONEY],
tokenOut: [BAULT_KODI_WBERA_HONEY],
routingStrategy: "delegate",
slippage: "150", // 1.5% slippage for yield strategy
referralCode: "honey-bault",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split `HONEY` into `WBERA` and `HONEY` through internal routing.
* Deposit balanced tokens into Kodiak Islands liquidity pool.
* Deposit LP tokens into Kodiak Bault auto-compounding vault.
***
## BERA to styHONEY Vault Zap
Convert native `BERA` into a staked yield position (`styHONEY`) on Berachain.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const BERA = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address;
const styHONEY = "0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["2000000000000000000"], // 2 BERA
tokenIn: [BERA],
tokenOut: [styHONEY],
routingStrategy: "delegate",
slippage: "150", // 1.5% slippage for multi-step
referralCode: "bera-styhoney",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `BERA` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn `yHONEY` vault.
* Stake `yHONEY` to receive `styHONEY`.
***
## BERA to Bault Auto-Compound Zap
Convert native `BERA` into an auto-compounding Kodiak Bault (`WBERA`/`HONEY`) position on Berachain.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x056319DE9c9DF9eD7eE35221795F8C9F9E160cd1)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const BERA = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address;
const BAULT_KODI_WBERA_HONEY = "0x056319DE9c9DF9eD7eE35221795F8C9F9E160cd1" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["3000000000000000000"], // 3 BERA
tokenIn: [BERA],
tokenOut: [BAULT_KODI_WBERA_HONEY],
routingStrategy: "delegate",
slippage: "250", // 2.5% slippage for advanced strategy
referralCode: "bera-compound",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split `BERA` into `WBERA` and `USDCe` through internal routing.
* Deposit `USDCe` into Berachain Honey minting to receive `HONEY`.
* Deposit `WBERA` and `HONEY` into Kodiak Islands pool.
* Deposit LP tokens into Kodiak Bault auto-compounding vault.
# Overview
Source: https://docs.enso.build/pages/use-cases/strategies/index
Offer seamless swaps, cross-chain bridging, and direct-to-DeFi earning opportunities to keep your users engaged and their assets active.
Atomic multi-step yield strategies, including auto-compounding
Execute complex leveraged yield strategies
Optimize DeFi portfolio by rebalancing positions efficiently
Single-click deposits into yield-generating vaults and liquidity pools.
# Leverage Loops
Source: https://docs.enso.build/pages/use-cases/strategies/leverage-loops
Execute complex leveraged yield strategies
These routes automate complex leverage strategies, where an asset is used as collateral to borrow another asset, which is then re-deposited to amplify yield, all within a single transaction.
**Note on Route Mechanics:** The steps listed below are illustrative of a possible path. Enso's API dynamically calculates the most efficient route at the moment of execution, so the exact swaps and bridges may vary based on real-time market conditions.
## WBETH to USDT Vault Leverage Loop
Execute a leverage loop on Katana by supplying `WBETH` as collateral to borrow and deposit stablecoins into a Yearn `USDT` vault.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0xee7d8bcfb72bc1880d0cf19822eb0a2e6577ab62\&tokenOut=0x9a6bd7b6fd5c4f87eb66356441502fc7dcdd185b)
```javascript theme={null}
const WBETH = "0xee7d8bcfb72bc1880d0cf19822eb0a2e6577ab62" as Address;
const yvvbUSDT = "0x9a6bd7b6fd5c4f87eb66356441502fc7dcdd185b" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["1000000000000000000"], // 1 WBTC
tokenIn: [WBETH],
tokenOut: [yvvbUSDT],
routingStrategy: "delegate",
slippage: "400", // 4% slippage for complex loop
referralCode: "wbtc-loop",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
```
**Route Mechanics:**
* Use WBETH as collateral in lending protocols.
* Borrow stablecoins against WBETH collateral.
* Deposit borrowed assets into Yearn USDT vault.
* Create leveraged yield farming position.
***
## Create steakAUSD Leverage Loop
Execute a leverage loop on Katana by supplying `steakAUSD` as collateral to borrow and deposit `ETH` into a Yearn `ETH` vault.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x82c4c641ccc38719ae1f0fbd16a64808d838fdfd\&tokenOut=0xe007ca01894c863d7898045ed5a3b4abf0b18f37)
```mermaid theme={null}
flowchart LR
MorphoVault((MorphoVault)) --> SG1
subgraph SG1["Vault Migration"]
direction LR
A1[morpho-blue-vaults.redeem] --> AUSD((AUSD))
A2[sushiswap-router.swap] --> STEAK((STEAK))
A3[yearn-v3.deposit] --> ySTEAK((ySTEAK))
AUSD --> A2
STEAK --> A3
end
```
```javascript theme={null}
const steakAUSD = "0x82c4c641ccc38719ae1f0fbd16a64808d838fdfd" as Address;
const yvvbETH = "0xe007ca01894c863d7898045ed5a3b4abf0b18f37" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["2000000000000000000000"], // 2,000 steakAUSD
tokenIn: [steakAUSD],
tokenOut: [yvvbETH],
routingStrategy: "delegate",
slippage: "350", // 3.5%
referralCode: "steak-loop",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
```
**Route Mechanics:**
* Use steakAUSD as collateral in lending protocols.
* Borrow ETH against steakAUSD collateral.
* Deposit borrowed ETH into Yearn ETH vault.
* Create leveraged yield position with amplified returns.
## Leverage WETH on Aave on Arbitrum
Creates a leveraged position by depositing WETH into Aave on Arbitrum.
[**Try this route →**](https://happypath.enso.build/?tokenIn=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\&outChainId=42161\&chainId=42161\&tokenOut=0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8\&amountIn=100000000000000000000)
```javascript theme={null}
const WETH = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" as Address;
const aWETH = "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ARBITRUM_CHAIN,
amountIn: ["100000000000000000000"],
tokenIn: [WETH],
tokenOut: [aWETH],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
```
**Route Mechanics:**
* Deposit `WETH` into the Aave v3 protocol to receive `aWETH`.
***
## Leverage USDC to sAVAX on Avalanche
Creates a leveraged sAVAX position by supplying USDC as collateral on Avalanche.
[**Try this route →**](https://happypath.enso.build/?tokenIn=0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\&outChainId=43114\&chainId=43114\&tokenOut=0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE\&amountIn=100000000)
```javascript theme={null}
const USDC = "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" as Address;
const sAVAX = "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: AVALANCHE_CHAIN,
amountIn: ["100000000"],
tokenIn: [USDC],
tokenOut: [sAVAX],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `USDC` to `sAVAX` via Enso.
***
## Leverage cbETH to Yearn Aerodrome LP on Base
Uses cbETH to enter a leveraged Yearn Aerodrome WETH/cbETH LP position on Base.
[**Try this route →**](https://happypath.enso.build/?tokenIn=0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22\&outChainId=8453\&chainId=8453\&tokenOut=0x44Ecc644449fC3a9858d2007CaA8CFAa4C561f91\&amountIn=100000000000000000000)
```javascript theme={null}
const cbETH = "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22" as Address;
const yvAeroEthCbEthLp =
"0x44Ecc644449fC3a9858d2007CaA8CFAa4C561f91" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BASE_CHAIN,
amountIn: ["100000000000000000000"],
tokenIn: [cbETH],
tokenOut: [yvAeroEthCbEthLp],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
```
**Route Mechanics:**
* The initial `cbETH` is split into `WETH` and `cbETH`.
* A portion of `cbETH` is swapped to native `ETH`, which is then deposited to become `WETH`.
* The `WETH` and `cbETH` are deposited into the Aerodrome protocol to get the LP token.
***
## Leverage wstETH to Velodrome LP on Optimism
Creates a leveraged Velodrome wstETH/WETH LP position from wstETH on Optimism.
[**Try this route →**](https://happypath.enso.build/?tokenIn=0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb\&outChainId=10\&chainId=10\&tokenOut=0xa3031D9FD5010496a2bAF8AFCE27Ef6f3849FB10\&amountIn=100000000000000000000)
```javascript theme={null}
const wstETH = "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb" as Address;
const veloWstethWethLp =
"0xa3031D9FD5010496a2bAF8AFCE27Ef6f3849FB10" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: OPTIMISM_CHAIN,
amountIn: ["100000000000000000000"],
tokenIn: [wstETH],
tokenOut: [veloWstethWethLp],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
```
**Route Mechanics:**
* The initial `wstETH` is split into `WETH` and `wstETH`.
* **Internal Route**: A portion of `wstETH` is swapped for `WETH` via Enso.
* The `WETH` and `wstETH` are deposited into the Velodrome v2 protocol to get the LP token.
***
## Leverage WETH on Aave on Base
Creates a leveraged WETH position on Base using Aave v3.
[**Try this route →**](https://happypath.enso.build/?tokenIn=0x4200000000000000000000000000000000000006\&outChainId=8453\&chainId=8453\&tokenOut=0x16a004065dfb11276dcb29dc03fb8a85f9a43c6e\&amountIn=10000000000000000000)
```javascript theme={null}
const WETH = "0x4200000000000000000000000000000000000006" as Address;
const stataBascbETH = "0x16a004065dfb11276dcb29dc03fb8a85f9a43c6e" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BASE_CHAIN,
amountIn: ["10000000000000000000"], // 100 WETH
tokenIn: [WETH],
tokenOut: [stataBascbETH],
routingStrategy: "delegate",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
return route;
```
**Route Mechanics:**
* Redeem `WETH` for native `ETH`.
* Swap native `ETH` to `cbETH`.
* Deposit `cbETH` into Aave to get `stataBascbETH`.
# Position Rebalancing
Source: https://docs.enso.build/pages/use-cases/strategies/position-rebalancing
Optimize DeFi portfolio by rebalancing positions efficiently
## Rebalance from Beramo LP to HONEY/WBERA LP
Rebalance a position from a Bearn BEX LP vault into a Kodiak Islands HONEY/WBERA liquidity pool.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xefC923B5F2162b83F0e05dC36148aD56615Bff70\&tokenOut=0x9659dc8c1565E0bd82627267e3b4eEd1a377ebE6)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const byAB_KODIAK_WBERA_BERAMO = "0xefC923B5F2162b83F0e05dC36148aD56615Bff70" as Address; // byAB KODIAK WBERA BERAMO
const HONEY_WBERA_POOL = "0x9659dc8c1565E0bd82627267e3b4eEd1a377ebE6" as Address; // HONEY/WBERA LP
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1000000000000000000"], // 1 LP token
tokenIn: [byAB_KODIAK_WBERA_BERAMO],
tokenOut: [HONEY_WBERA_POOL],
routingStrategy: "delegate",
slippage: "400", // 4% slippage for volatile rebalance
referralCode: "rebal-island",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem `byAB KODIAK WBERA BERAMO LP tokens` from Bearn vault.
* Redeem underlying BEX LP tokens to receive `HONEY`.
* Split `HONEY` into `HONEY` and `WBERA` through internal routing.
* Deposit balanced tokens into Kodiak Islands `HONEY/WBERA` liquidity pool.
### Rebalance Rooster YAP LP into Nest Alpha Vault
Convert Rooster YAP liquidity pool tokens back to Nest Alpha Vault for vault-specific strategies. This route reduces 4 manual transactions to 1
[**Try this route →**](https://happypath.enso.build/?chainId=98866\&tokenIn=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038\&tokenOut=0x593ccca4c4bf58b7526a4c164ceef4003c6388db)
```javascript theme={null}
const ROOSTER_YAP_NALPHA_PUSD = "0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038" as Address;
const NEST_ALPHA_VAULT = "0x593ccca4c4bf58b7526a4c164ceef4003c6388db" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 Rooster YAP tokens
tokenIn: [ROOSTER_YAP_NALPHA_PUSD],
tokenOut: [NEST_ALPHA_VAULT],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-vault-redeem",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem Rooster YAP pool tokens to underlying PUSD and nALPHA
* Swap PUSD to nALPHA via internal exchange
* Merge tokens using the enso.merge action
* Deposit consolidated nALPHA into Nest Alpha Vault
***
## Rebalance Nest Alpha Vault into Rooster LP
Rebalance a Nest Alpha Vault position into a Rooster Finance YAP (nALPHA/pUSD) liquidity pool.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0x593ccca4c4bf58b7526a4c164ceef4003c6388db\&tokenOut=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038)
```mermaid theme={null}
flowchart LR
NEST((NEST)) --> SG1
subgraph SG1["enso.split"]
A1[rooster.swap] --> PUSD((PUSD))
end
SG1 --> A2[rooster-yap.deposit] --> ROOSTER_LP((ROOSTER_LP))
```
```javascript theme={null}
const NEST_ALPHA_VAULT = "0x593ccca4c4bf58b7526a4c164ceef4003c6388db" as Address;
const ROOSTER_YAP_NALPHA_PUSD = "0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 Nest Alpha Vault tokens
tokenIn: [NEST_ALPHA_VAULT],
tokenOut: [ROOSTER_YAP_NALPHA_PUSD],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-vault-migration",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split Nest Alpha Vault tokens between PUSD and nALPHA paths using the enso.split action
* Swap portion of vault tokens to PUSD via internal exchange
* Keep portion as nALPHA (direct vault token)
* Deposit PUSD and nALPHA into Rooster YAP liquidity pool
***
## Rebalance Nest Elixir Vault into Rooster (USDC.e/pUSD) LP
Convert Nest Elixir Vault tokens into a Rooster Finance YAP liquidity pool for diversified yield farming. This route reduces 5 manual transactions to 1
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0x9fbc367b9bb966a2a537989817a088afcaffdc4c\&tokenOut=0x5649009d65ebc80efee715c95768607b8fbacd55)
```javascript theme={null}
const NEST_ELIXIR_VAULT = "0x9fbc367b9bb966a2a537989817a088afcaffdc4c" as Address;
const ROOSTER_YAP_USDC_PUSD = "0x5649009d65ebc80efee715c95768607b8fbacd55" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 Nest Elixir Vault tokens
tokenIn: [NEST_ELIXIR_VAULT],
tokenOut: [ROOSTER_YAP_USDC_PUSD],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-elixir-zap",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split Nest Elixir Vault tokens between USDC.e and PUSD paths using the `enso.split` action
* Swap portion of vault tokens to USDC.e via internal exchange
* Swap portion of vault tokens to PUSD via internal exchange
* Deposit USDC.e and PUSD into Rooster YAP liquidity pool
# Yield Farming Deposits
Source: https://docs.enso.build/pages/use-cases/strategies/yield-farming-deposits
Single-click deposits into yield-generating vaults and liquidity pools.
### Unstake styHONEY to BERA
Unstake a `styHONEY` position and convert it back to the native gas token, `BERA`, on Berachain.
[**Try this route →**](https://happypath.enso.build/?chainId=80094\&tokenIn=0x99d6a0fb9420f3995fd07dcc36ac827a8e146cf9\&tokenOut=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&outChainId=80094)
**Route Mechanics:**
* Redeem `styHONEY` to receive `yHONEY`.
* Redeem `yHONEY` to receive `HONEY`.
* Swap `HONEY` to `BERA` through Enso's routing.
```mermaid theme={null}
flowchart LR
styHONEY((styHONEY)) --> A1
A1[bearn.redeem] --> HONEY_intermediate((HONEY))
A2[bearn.redeem] --> HONEY_final((HONEY))
A3[openocean.swap] --> BERA((BERA))
HONEY_intermediate --> A2
HONEY_final --> A3
```
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const styHONEY = "0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const HONEY = "0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce" as Address;
const BERA = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1000000000000000000"], // 1 styHONEY
tokenIn: [styHONEY],
tokenOut: [BERA],
routingStrategy: "delegate",
slippage: "300", // 3% slippage for redemption
referralCode: "styhoney-bera",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
***
### Withdraw Yearn Curve mUSD Vault to USDC
Unwind a Yearn Curve `mUSD` vault position back to the base asset, `USDC`, on Ethereum.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0x8cc94ccd0f3841a468184aca3cc478d2148e1757\&tokenOut=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
```javascript theme={null}
const CurveMUSD_yVault = "0x8cc94ccd0f3841a468184aca3cc478d2148e1757" as Address; // Yearn Curve mUSD Pool yVault
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // Example amount for yVault token
tokenIn: [CurveMUSD_yVault],
tokenOut: [USDC],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem from Yearn Curve mUSD Pool yVault ( `0x8cc94ccd0f3841a468184aca3cc478d2148e1757` ) to receive Curve mUSD LP tokens
* Redeem from Curve.fi mUSD Pool ( `0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6` ) to receive Curve 3pool LP tokens
* Redeem from Curve.fi 3pool ( `0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7` ) to receive USDC
***
### Withdraw Yearn Curve alUSD Vault to USDC
Unwind a Yearn Curve `alUSD` vault position back to the base asset, `USDC`, on Ethereum.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xa74d4b67b3368e83797a35382afb776baae4f5c8\&tokenOut=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
```javascript theme={null}
const CurveAlUSD_yVault = "0xa74d4b67b3368e83797a35382afb776baae4f5c8" as Address; // Yearn Curve alUSD Pool yVault
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000000000000"], // Example amount for yVault token
tokenIn: [CurveAlUSD_yVault],
tokenOut: [USDC],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem from Yearn Curve alUSD Pool yVault ( `0xa74d4b67b3368e83797a35382afb776baae4f5c8` ) to receive Curve alUSD LP tokens
* Redeem from Curve.fi alUSD Pool ( `0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c` ) to receive Curve 3pool LP tokens
* Redeem from Curve.fi 3pool ( `0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7` ) to receive USDC
***
### Withdraw Rooster LP (nALPHA/pUSD) to Native Plume
Completely unwind a Rooster YAP LP (`nALPHA`/`pUSD`) position back to the native `Plume` token on Plume.
[**Try this route →**](https://happypath.enso.build/?chainId=98866\&tokenIn=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038\&tokenOut=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)
```javascript theme={null}
const ROOSTER_YAP_NALPHA_PUSD = "0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038" as Address;
const PLUME = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 Rooster YAP tokens
tokenIn: [ROOSTER_YAP_NALPHA_PUSD],
tokenOut: [PLUME],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-exit-native",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Redeem Rooster YAP pool tokens to underlying PUSD and nALPHA
* Merge tokens using the enso.merge action
* Swap PUSD to native Plume via internal exchange
* Swap nALPHA to native Plume via internal exchange
* Consolidate native Plume tokens in user wallet
***
### Unstake kHYPE to USDT0
Unstake `kHYPE` and convert the underlying assets to the `USDT0` stablecoin on HyperEVM.
[**Try this route →**](https://happypath.enso.build/?chainId=999\&tokenIn=0xfd739d4e423301ce9385c1fb8850539d657c296d\&tokenOut=0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb)
```javascript theme={null}
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const USDT0 = "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 kHYPE
tokenIn: [KHYPE],
tokenOut: [USDT0],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "kinetiq-withdraw",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Unstake kHYPE to HYPE via Kinetiq Protocol
* Swap HYPE to USDT0 via internal exchange
* Transfer USDT0 to user wallet
***
### Unstake kHYPE to Native HYPE
Unstake `kHYPE` back to the native `HYPE` token on HyperEVM.
[**Try this route →**](https://happypath.enso.build/?chainId=999\&tokenIn=0xfd739d4e423301ce9385c1fb8850539d657c296d\&tokenOut=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)
```javascript theme={null}
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const HYPE = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 kHYPE
tokenIn: [KHYPE],
tokenOut: [HYPE],
routingStrategy: "delegate",
slippage: "50", // 0.5% slippage
referralCode: "kinetiq-unstake-native",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Unstake kHYPE to native HYPE.
***
### Unstake kHYPE to KEI
Unstake `kHYPE` and convert the underlying assets to Wrapped Ethereum (`KEI`) on HyperEVM.
[**Try this route →**](https://happypath.enso.build/?chainId=999\&tokenIn=0xfd739d4e423301ce9385c1fb8850539d657c296d\&tokenOut=0xb5fe77d323d69eb352a02006ea8ecc38d882620c)
```javascript theme={null}
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const KEI = "0xb5fe77d323d69eb352a02006ea8ecc38d882620c" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 kHYPE
tokenIn: [KHYPE],
tokenOut: [KEI],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "kinetiq-unstake-weth",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Unstake kHYPE to HYPE and swap to KEI (WETH).
***
### Unstake kHYPE to UBTC
Unstake `kHYPE` and convert the underlying assets to Wrapped Bitcoin (`UBTC`) on HyperEVM.
[**Try this route →**](https://happypath.enso.build/?chainId=999\&tokenIn=0xfd739d4e423301ce9385c1fb8850539d657c296d\&tokenOut=0x9fdbda0a5e284c32744d2f17ee5c74b284993463)
```javascript theme={null}
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const UBTC = "0x9fdbda0a5e284c32744d2f17ee5c74b284993463" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 kHYPE
tokenIn: [KHYPE],
tokenOut: [UBTC],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "kinetiq-unstake-wbtc",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Unstake kHYPE to HYPE and swap to UBTC.
### Zap PLUME into Mystic myUSDC Vault
Deposit native PLUME and convert it into a myUSDC vault position on Mystic.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x6c92efa3F77760619bb13d395836415ac18C86dc)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x6c92efa3F77760619bb13d395836415ac18C86dc'],
routingStrategy: 'router'
});
// If using 'router' strategy, approval is often required for the input token.
await sendEoa(client.getApprovalData(routeData.route.tokenIn[0]));
await sendEoa(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap PLUME (input token) for USDC.e
* deposit USDC.e into the myUSDC pool, interacting with primary `0xCE192A6E105cD8dd97b8Dedc5B5b263B52bb6AE0`
***
### Deposit native PLUME into Solera aPlunALPHA
Deposit native PLUME and convert it into a Solera aPlunALPHA vault position.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x5d0EC9B10e6759719CeFE14b8c881634678b32f2)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x5d0EC9B10e6759719CeFE14b8c881634678b32f2'],
routingStrategy: 'router'
});
// If using 'router' strategy, approval is often required for the input token.
await sendEoa(client.getApprovalData(routeData.route.tokenIn[0]));
await sendEoa(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap PLUME for PUSD using `enso.swap` action
* deposit `PUSD` into `NALPHA Nucleus` pool, interacting with primary `0xc9f6a492fb1d623690dc065bbced6dfb4a324a35`
* deposit `NALPHA` into the `Solera` pool, interacting with primary `0x5d0ec9b10e6759719cefe14b8c881634678b32f2`
***
### Deposit USDC.e into Nucleus nYIELD Vault
Deposit bridged USDC.e and convert it into an nYIELD vault position on Nucleus.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0x78adD880A697070c1e765Ac44D65323a0DcCE913\&tokenOut=0x892DFf5257B39f7afB7803dd7C81E8ECDB6af3E8)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0x78adD880A697070c1e765Ac44D65323a0DcCE913'],
tokenOut: ['0x892DFf5257B39f7afB7803dd7C81E8ECDB6af3E8'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap `USDC` for `PUSD` using `enso.swap` action
* deposit `PUSD` into `nYIELD Nucleus` pool, interacting with primary `0x92a735f600175fe9ba350a915572a86f68ebbe66` to get `nUSDY`
***
### Deposit USDC.e into Tempest PUSD Vault
Deposit bridged USDC.e and convert it into a Tempest PUSD vault position.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0x78adD880A697070c1e765Ac44D65323a0DcCE913\&tokenOut=0x3C4F9804ce0810821F61289Eb4F92c8E5007c119)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0x78adD880A697070c1e765Ac44D65323a0DcCE913'],
tokenOut: ['0x3C4F9804ce0810821F61289Eb4F92c8E5007c119'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap `USDC.e` for `PUSD` using `enso.swap` action
* deposit `PUSD` into `Tempest pool`, interacting with primary `0x3C4F9804ce0810821F61289Eb4F92c8E5007c119`
***
### Stake PLUME for pETH on Dinero
Deposit native PLUME and convert it into the pETH liquid staking derivative on Dinero.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x39d1F90eF89C52dDA276194E9a832b484ee45574)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x39d1F90eF89C52dDA276194E9a832b484ee45574'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
***
### Deposit PUSD into Rooster (nALPHA/PUSD) LP
Deposit PUSD and convert it into a Rooster (nALPHA/PUSD) LP position.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xdddd73f5df1f0dc31373357beac77545dc5a6f3f\&tokenOut=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xdddd73f5df1f0dc31373357beac77545dc5a6f3f'],
tokenOut: ['0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* split `PUSD` to `NALPHA` and `PUSD` using the `enso.split` action
* deposit `NALPHA` and `PUSD` into the `Rooster pool`, interacting with primary `0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038`
***
### Deposit WETH into the Nest Alpha Vault
Deposit WETH and convert it into a Nest Alpha Vault position.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xca59ca09e5602fae8b629dee83ffa819741f14be\&tokenOut=0x593ccca4c4bf58b7526a4c164ceef4003c6388db)
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xca59ca09e5602fae8b629dee83ffa819741f14be'],
tokenOut: ['0x593ccca4c4bf58b7526a4c164ceef4003c6388db'],
routingStrategy: 'delegate'
});
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* swap `WETH` for `PUSD` using the `enso.swap` action
* deposit `PUSD` into the `Nest Vault`, interacting with primary `0xc9f6a492fb1d623690dc065bbced6dfb4a324a35`
***
### Deposit USDC to get yDAI (Yearn)
Convert USDC to DAI and deposit it into the Yearn DAI v2 Vault.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\&tokenOut=0xda816459f1ab5631232fe5e97a05bbbb94970c95)
```javascript theme={null}
const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" as Address;
const yvDAI = "0xda816459f1ab5631232fe5e97a05bbbb94970c95" as Address; // Yearn DAI v2 Vault token
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: ["1000000000"], // 1000 USDC
tokenIn: [USDC],
tokenOut: [yvDAI],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `USDC` to `DAI` via Enso DEX Aggregator
* Deposit `DAI` into Yearn DAI v2 Vault (`0xda816459f1ab5631232fe5e97a05bbbb94970c95`)
***
### HONEY to yHONEY Zap
Deposit HONEY into the Bearn yHONEY vault.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce\&tokenOut=0xc82971bcff09171e16ac08aee9f4ea3fb16c3bdc)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const HONEY = "0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce" as Address;
const yHONEY = "0xc82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1000000000000000000"], // 1 HONEY
tokenIn: [HONEY],
tokenOut: [yHONEY],
routingStrategy: "delegate",
slippage: "50", // 0.5% slippage for stable yield
referralCode: "bearn-deposit",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `HONEY` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn yHONEY vault.
***
### BERA to yHONEY Yield Zap
Convert native BERA into a Bearn yHONEY vault position.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const BERA = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1500000000000000000"], // 1.5 BERA
tokenIn: [BERA],
tokenOut: [yHONEY],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "bera-yhoney",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `BERA` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn yHONEY vault.
***
### USDCe to yHONEY Vault Zap
Convert bridged USDC.e into a Bearn yHONEY vault position.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0x549943e04f40284185054145c6E4e9568C1D3241\&tokenOut=0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const USDCe = "0x549943e04f40284185054145c6E4e9568C1D3241" as Address;
const HONEY = "0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["1000000000"], // 1,000 USDCe
tokenIn: [USDCe],
tokenOut: [yHONEY],
routingStrategy: "delegate",
slippage: "200", // 2% slippage for bridge + swap
referralCode: "bridge-yhoney",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `USDCe` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn yHONEY vault.
***
### iBGT to yHONEY Vault Zap
Convert iBGT governance tokens into a Bearn yHONEY vault position.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xac03CABA51e17c86c921E1f6CBFBdC91F8BB2E6b\&tokenOut=0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const iBGT = "0xac03CABA51e17c86c921E1f6CBFBdC91F8BB2E6b" as Address;
const yHONEY = "0xC82971BcFF09171e16Ac08AEE9f4EA3fB16C3BDC" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["500000000000000000"], // 0.5 iBGT
tokenIn: [iBGT],
tokenOut: [yHONEY],
routingStrategy: "delegate",
slippage: "400", // 4% slippage for governance token
referralCode: "ibgt-yield",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `iBGT` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn `yHONEY` vault.
***
### YEET to styHONEY Yield Zap
Convert YEET tokens into a staked yield position (styHONEY).
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0x08A38Caa631DE329FF2DAD1656CE789F31AF3142\&tokenOut=0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const YEET = "0x08A38Caa631DE329FF2DAD1656CE789F31AF3142" as Address;
const styHONEY = "0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_MAINNET,
amountIn: ["100000000000000000000"], // 100 YEET
tokenIn: [YEET],
tokenOut: [styHONEY],
routingStrategy: "delegate",
slippage: "500", // 5% slippage for volatile meme token
referralCode: "yeet-styhoney",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `YEET` to `HONEY` through Enso's routing.
* Deposit `HONEY` into Bearn `yHONEY` vault.
* Stake `yHONEY` to receive `styHONEY`.
***
### Layer AUSD into Morpho bbqAUSD Vault
Deposit AUSD into a Yearn vault and subsequently into a Morpho Blue bbqAUSD vault.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a\&tokenOut=0xdE6a4F28Acfe431DD1CfA2D9c7A3d8301624a841)
```mermaid theme={null}
flowchart LR
yvUSDC_v3((yvUSDC_v3)) --> A1
A1[yearn-v3.redeem] --> USDC_bridged((USDC_bridged))
A2[vault-bridge.redeem] --> USDC_native((USDC_native))
A3[vault-bridge.deposit] --> USDC_bridged_new((USDC_bridged))
A4[morpho-blue-vaults.deposit] --> morphoUSDC((morphoUSDC))
USDC_bridged --> A2
USDC_native --> A3
USDC_bridged_new --> A4
```
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const KATANA_MAINNET = 747474;
const userAddress = "your-wallet-address" as Address;
const AUSD = "0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a" as Address;
const bbqAUSD = "0xdE6a4F28Acfe431DD1CfA2D9c7A3d8301624a841" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["1000000000"], // 1,000 AUSD
tokenIn: [AUSD],
tokenOut: [bbqAUSD],
routingStrategy: "delegate",
slippage: "150", // 1.5% slippage for multi-step
referralCode: "ausd-morpho",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Deposit AUSD into Yearn AUSD vault to receive yvAUSD.
* Deposit yvAUSD into Morpho Blue bbqAUSD vault for enhanced yield.
***
### USDS to steakUSDC Prime Vault
Convert USDS into a Morpho Steakhouse prime USDC vault position.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x203a662b0bd271a6ed5a60edfbd04bfce608fd36\&tokenOut=0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d)
```javascript theme={null}
const USDC_VB = "0x203a662b0bd271a6ed5a60edfbd04bfce608fd36" as Address; // Assuming USDS input is USDC_VB
const steakUSDC = "0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["1000000000"], // 1,000 USDS
tokenIn: [USDC_VB],
tokenOut: [steakUSDC],
routingStrategy: "delegate",
slippage: "150", // 1.5% slippage for prime vault
referralCode: "usds-prime",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Convert USDC to USDS for stablecoin diversification.
* Deposit USDS into Yearn vault for base yield.
* Deposit vault tokens into Morpho steakUSDC prime vault.
***
### Convert LBTC into Yearn WBTC Vault
Convert Liquid Bitcoin (LBTC) into a Yearn WBTC vault position.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x203a662b0bd271a6ed5a60edfbd04bfce608fd36\&tokenOut=0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d)
```javascript theme={null}
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["100000000"], // 1 LBTC
tokenIn: [LBTC],
tokenOut: [yvvbWBTC],
routingStrategy: "delegate",
slippage: "200", // 2% slippage for BTC yield
referralCode: "lbtc-yield",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Convert LBTC to WBTC through liquidity protocols.
* Deposit WBTC into Yearn vault for Bitcoin yield farming.
***
### Compound KAT Rewards into Yearn USDC Vault
Convert KAT reward tokens into a Yearn USDC vault position.
[**Try this route →**](https://happypath.enso.build?chainId=747474\&tokenIn=0x7f1f4b4b29f5058fa32cc7a97141b8d7e5abdc2d\&tokenOut=0x80c34bd3a3569e126e7055831036aa7b212cb159)
```javascript theme={null}
const KAT = "0x7f1f4b4b29f5058fa32cc7a97141b8d7e5abdc2d" as Address;
const yvvbUSDC = "0x80c34bd3a3569e126e7055831036aa7b212cb159" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: KATANA_MAINNET,
amountIn: ["10000000000000000000000"], // 10,000 KAT
tokenIn: [KAT],
tokenOut: [yvvbUSDC],
routingStrategy: "delegate",
slippage: "500", // 5% slippage for native token
referralCode: "kat-compound",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Convert KAT rewards to USDC through DEX protocols.
* Deposit USDC into Yearn vault for optimized yield.
* Compound rewards automatically through vault strategies.
***
### Zap PUSD into Rooster Stablecoin LP (USDT/pUSD)
Deposit PUSD to create a stablecoin LP position (USDT/pUSD) on Rooster Finance.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xdddd73f5df1f0dc31373357beac77545dc5a6f3f\&tokenOut=0xd5c02efe86ebbc03126281e07b4d43f0b1021065)
```javascript theme={null}
const PLUME_USD = "0xdddd73f5df1f0dc31373357beac77545dc5a6f3f" as Address;
const ROOSTER_YAP_USDT_PUSD = "0xd5c02efe86ebbc03126281e07b4d43f0b1021065" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 PUSD
tokenIn: [PLUME_USD],
tokenOut: [ROOSTER_YAP_USDT_PUSD],
routingStrategy: "delegate",
slippage: "50", // 0.5% slippage
referralCode: "rooster-usdt-pusd",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split Plume USD between USDT and pUSD paths using the `enso.split` action
* Swap portion of PUSD to USDT via internal exchange
* Keep portion as pUSD (direct conversion)
* Deposit USDT and pUSD into Rooster YAP stablecoin liquidity pool
***
### Zap Plume USD into Rooster (nALPHA/pUSD) LP
Deposit Plume USD to create a balanced LP position (nALPHA/pUSD) on Rooster Finance.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xdddd73f5df1f0dc31373357beac77545dc5a6f3f\&tokenOut=0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038)
```javascript theme={null}
const PLUME_USD = "0xdddd73f5df1f0dc31373357beac77545dc5a6f3f" as Address;
const ROOSTER_YAP_NALPHA_PUSD = "0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 PUSD
tokenIn: [PLUME_USD],
tokenOut: [ROOSTER_YAP_NALPHA_PUSD],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-nalpha-pusd",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split `Plume USD` between `pUSD` and `nALPHA` paths using the `enso.split` action
* Keep portion as `pUSD` (direct conversion)
* Swap portion of `PUSD` to `nALPHA` via internal exchange
* Deposit `pUSD` and `nALPHA` into Rooster YAP `nALPHA/pUSD` pool
***
### Zap Plume Native into Rooster (USDC.e/XAUM) LP
Deposit native `PLUME` to create a multi-asset LP position (USDC.e/XAUM) on Rooster Finance.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&tokenOut=0xd9822928f894b12e5e4ea1ec2890ac233b9fd871)
```javascript theme={null}
const PLUME = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const ROOSTER_YAP_USDC_XAUM = "0xd9822928f894b12e5e4ea1ec2890ac233b9fd871" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ROOSTER_CHAIN,
amountIn: ["100000000000000000000"], // 100 PLUME
tokenIn: [PLUME],
tokenOut: [ROOSTER_YAP_USDC_XAUM],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "rooster-yap-zap",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Split native `PLUME` between `USDC.e` and `XAUM` conversion paths using the `enso.split` action
* Swap portion of `PLUME` to `USDC.e` via internal exchange
* Swap portion of `PLUME` to XAUM via internal exchange
* Deposit `USDC.e` and `XAUM` into Rooster `YAP-USDC.e-XAUM` pool
***
### Convert UETH to Staked HYPE (kHYPE)
Convert UETH stablecoin into a staked HYPE position (kHYPE).
[**Try this route →**](https://happypath.enso.build?chainId=999\&tokenIn=0xbe6727b535545c67d5caa73dea54865b92cf7907\&tokenOut=0xfd739d4e423301ce9385c1fb8850539d657c296d)
```javascript theme={null}
const UETH = "0xbe6727b535545c67d5caa73dea54865b92cf7907" as Address;
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 DAI
tokenIn: [UETH],
tokenOut: [KHYPE],
routingStrategy: "delegate",
slippage: "100", // 1% slippage
referralCode: "kinetiq-dai-stake",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `UETH` for `HYPE` and stake to `kHYPE`.
# Bridging
Source: https://docs.enso.build/pages/use-cases/wallets/bridging
## Bridge ETH to BERA Cross-Chain Swap
This use case bridges ETH from Ethereum to its native gas token equivalent, BERA, on Berachain.
[**Try this route →**](https://happypath.enso.build?chainId=1\&outChainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
**Route mechanics**:
* Swap native ETH to USDC using 0x protocol on Ethereum mainnet
* Bridge USDC from Ethereum (chain 1) to FIXME (0x549943e04f40284185054145c6e4e9568c1d3241) on Berachain (chain 80094) using Stargate protocol
* Swap the bridged token to native BERA using ooga-booga protocol on Berachain
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> A1
A1[0x.swap] --> USDC((USDC))
A2[stargate.bridge] --> USDC_Bera((USDC_Bera))
A3[ooga-booga.swap] --> BERA((BERA))
USDC --> A2
USDC_Bera --> A3
```
```ts theme={null}
const ETHEREUM_CHAIN = 1;
const BERACHAIN_CHAIN = 80094;
const PLUME_CHAIN = 98866;
const ARBITRUM_CHAIN = 42161;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
export async function bridgeEthToBera() {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const BERA: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const amountIn = "1000000000000000000";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
destinationChainId: BERACHAIN_CHAIN,
amountIn: [amountIn],
tokenIn: [ETH],
tokenOut: [BERA],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Zap ETH from Ethereum to get sUSDe on Ethena
This use case gets exposure to delta-neutral yield from Ethena in a single transaction.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x9D39A5DE30e57443BfF2A8307A4256c8797A3497)
**Route mechanics**
* Swap native ETH to sUSDe using KyberSwap protocol in a single transaction
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> A1[kyberswap.swap] --> sUSDe((sUSDe))
```
```ts theme={null}
const ETHEREUM_CHAIN = 1;
const BERACHAIN_CHAIN = 80094;
const PLUME_CHAIN = 98866;
const ARBITRUM_CHAIN = 42161;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Zaps ETH into Ethena's sUSDe to get exposure to delta-neutral yield.
* @returns The route and transaction objects.
*/
export async function earnEthToSusde() {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const sUSDe: Address = "0x9D39A5DE30e57443BfF2A8307A4256c8797A3497";
const amountIn = "1000000000000000000";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
amountIn: [amountIn], // 1 ETH
tokenIn: [ETH],
tokenOut: [sUSDe],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Bridge ETH for styHoney
Convert `ETH` on Ethereum into a staked yield position (`styHONEY`) on Berachain.
[**Try this route →**](https://happypath.enso.build?chainId=1\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&outChainId=80094\&tokenOut=0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9)
```javascript theme={null}
import { Address, EnsoClient, RouteParams } from "@ensofinance/sdk";
const ETHEREUM_MAINNET = 1; // Ethereum Mainnet
const BERACHAIN_MAINNET = 80094;
const userAddress = "your-wallet-address" as Address;
const ETH_Ethereum = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address; // ETH on Ethereum
const styHONEY = "0x99d6A0FB9420F3995fD07dCc36AC827a8E146cf9" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_MAINNET, // Start from Ethereum
destinationChainId: BERACHAIN_MAINNET,
amountIn: ["200000000000000000"], // 0.2 ETH
tokenIn: [ETH_Ethereum],
tokenOut: [styHONEY],
routingStrategy: "delegate",
slippage: "400", // 4% slippage for complex cross-chain
referralCode: "eth-styhoney",
};
const route = await client.getRouteData(routeParams);
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap `ETH` to `USDC` on Ethereum Mainnet.
* Bridge `USDC` to `USDCe` on Berachain via Stargate.
* Swap `USDCe` to `HONEY` on Berachain.
* Deposit `HONEY` into Bearn `yHONEY` vault.
* Stake `yHONEY` to receive `styHONEY`.
***
# Overview
Source: https://docs.enso.build/pages/use-cases/wallets/index
Offer seamless swaps, cross-chain bridging, and direct-to-DeFi earning opportunities to keep your users engaged and their assets active.
Offer swaps into the latest, most popular tokens, as soon as they are available to trade.
Provide seamless movement of tokens across all the chains that your wallet supports, with minimal price impact
Mint stablecoins and use it to mint native assets on another chain
Deposit wallet assets in the latest DeFi protocols to earn yield.
Add DEX liquidity, stake, lend collateral, deposit into automated strategy vaults and more
# Minting
Source: https://docs.enso.build/pages/use-cases/wallets/mint
Mint stablecoins and use it to mint native assets on another chain
## Mint HONEY on Berachain from USDC
This use case demonstrates bridging a stablecoin and using it to mint a native asset on another chain.
[**Try this route →**](https://happypath.enso.build?chainId=1\&outChainId=80094\&tokenIn=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\&tokenOut=0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590)
**Route mechanics**
* Swap USDC to native ETH using 1inch protocol on Ethereum mainnet
* Bridge native ETH from Ethereum (chain 1) to HONEY on Berachain (chain 80094) using Stargate protocol
```mermaid theme={null}
flowchart LR
USDC((USDC)) -->A1
A1[1inch.swap] --> ETH((ETH))
A2[stargate.bridge] --> HONEY((HONEY))
ETH --> A2
```
```ts theme={null}
const ETHEREUM_CHAIN = 1;
const BERACHAIN_CHAIN = 80094;
const PLUME_CHAIN = 98866;
const ARBITRUM_CHAIN = 42161;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Bridges USDC from Ethereum via Stargate and mints HONEY on Berachain.
* @returns The route and transaction objects.
*/
export async function mintHoneyFromUsdc() {
const USDC: Address = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
const HONEY: Address = "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590";
const amountIn = "100000000";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ETHEREUM_CHAIN,
destinationChainId: BERACHAIN_CHAIN,
amountIn: [amountIn],
tokenIn: [USDC],
tokenOut: [HONEY],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
# Swaps
Source: https://docs.enso.build/pages/use-cases/wallets/swaps
Offer swaps into the latest, most popular tokens, as soon as they are available to trade.
## Swap BERA to HONEY on Berachain
This use case demonstrates a basic swap of the native gas token for the native stablecoin on Berachain.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590)
**Route mechanics**
A simple swap from BERA to HONEY using the openocean protocol on Berachain.
```mermaid theme={null}
flowchart LR
BERA((BERA)) --> A1[openocean.swap] --> HONEY((HONEY))
```
```ts theme={null}
const ETHEREUM_CHAIN = 1;
const BERACHAIN_CHAIN = 80094;
const PLUME_CHAIN = 98866;
const ARBITRUM_CHAIN = 42161;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Swaps the native gas token BERA for the native stablecoin HONEY on Berachain.
* @returns The route and transaction objects.
*/
export async function swapBeraToHoney() {
const BERA: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const HONEY: Address = "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590";
const amountIn = "1000000000000000000";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: BERACHAIN_CHAIN,
amountIn: [amountIn], // 1 BERA
tokenIn: [BERA],
tokenOut: [HONEY],
routingStrategy: "router",
};
const approval = await client.getApprovalData({
amount: "1000000000000000000",
tokenAddress: BERA,
chainId: BERACHAIN_CHAIN,
fromAddress: userAddress,
});
const route = await client.getRouteData(routeParams);
await sendEoa(approval.tx, approval.gas);
await sendEoa(route.tx, route.gas);
return route;
}
```
***
## Swap USDC.e to get superOETH on Origin
This use case swaps bridged USDC.e and converts it into a superOETH position on Origin.
[**Try this route →**](https://happypath.enso.build?chainId=98866\&tokenIn=0x78adD880A697070c1e765Ac44D65323a0DcCE913\&tokenOut=0xFCbe50DbE43bF7E5C88C6F6Fb9ef432D4165406E)
**Route mechanics** A direct swap from USDC.e to superOETH using the rooster protocol on Plume.
```mermaid theme={null}
flowchart LR
USDC_e((USDC.e)) --> A1[rooster.swap] --> superOETH((superOETH))
```
```ts theme={null}
const ETHEREUM_CHAIN = 1;
const BERACHAIN_CHAIN = 80094;
const PLUME_CHAIN = 98866;
const ARBITRUM_CHAIN = 42161;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Swaps bridged USDC.e for superOETH on the Origin protocol on Plume.
* @returns The route and transaction objects.
*/
export async function swapUsdceToSuperOeth() {
const USDCe: Address = "0x78adD880A697070c1e765Ac44D65323a0DcCE913";
const superOETH: Address = "0xFCbe50DbE43bF7E5C88C6F6Fb9ef432D4165406E";
const amountIn = "100000000";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: PLUME_CHAIN,
amountIn: [amountIn], // 100 USDC.e
tokenIn: [USDCe],
tokenOut: [superOETH],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```
## Convert HYPE to Staked HYPE (kHYPE)
Stake the native HYPE token to receive its yield-bearing equivalent, kHYPE.
[**Try this route →**](https://happypath.enso.build?chainId=999\&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\&tokenOut=0xfd739d4e423301ce9385c1fb8850539d657c296d)
```javascript theme={null}
const HYPE = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" as Address;
const KHYPE = "0xfd739d4e423301ce9385c1fb8850539d657c296d" as Address;
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: HYPEREVM_CHAIN,
amountIn: ["1000000000000000000"], // 1 HYPE
tokenIn: [HYPE],
tokenOut: [KHYPE],
routingStrategy: "router",
slippage: "50", // 0.5% slippage
referralCode: "kinetiq-native",
};
const route = await client.getRouteData(routeParams);
// If using 'router' strategy, approval is often required for the input token.
await sendSmartWallet(client.getApprovalData(route.route.tokenIn[0]));
// sign with an EOA with `router` routing strategy
await sendSmartWallet(route.tx, route.gas);
```
**Route Mechanics:**
* Swap native HYPE to kHYPE.
## Swap USDC.e to PUSD on Plume
Swap bridged USDC.e for the PUSD stablecoin on Plume.
[**Try this route →**](https://happypath.enso.build?chainId=80094\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590)
```mermaid theme={null}
flowchart LR
USDC_e((USDC.e)) --> A1[rooster.swap] --> PUSD((PUSD))
```
```javascript theme={null}
// SDK Example
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000000000000'],
slippage: '300',
tokenIn: ['0x54FD4da2Fa19Cf0f63d8f93A6EA5BEd3F9C042C6'],
tokenOut: ['0xdddD73F5Df1F0DC31373357beAC77545dC5A6f3F'],
routingStrategy: 'router'
});
// If using 'router' strategy, approval is often required for the input token.
await sendSmartWallet(client.getApprovalData(routeData.route.tokenIn[0]));
await sendSmartWallet(routeData.tx, routeData.gas);
```
**Route Mechanics:**
* Swap bridged USDC.e to PUSD.
***
# Zap & Earn
Source: https://docs.enso.build/pages/use-cases/wallets/zap-earn
Deposit wallet assets in the latest DeFi protocols to earn yield
## Zap into a Pendle Yield Token pool with ETH on Arbitrum
This use case allows a user to enter a Pendle pool to speculate on or hedge against yield from a liquid restaking token.
[**Try this route →**](https://happypath.enso.build?chainId=42161\&tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\&tokenOut=0xa6C895EB332E91c5b3D00B7baeEAae478cc502DA)
**Route mechanics**
This is a two-step bundle that:
* Swap native `ETH` to `weETH` using odos protocol on Arbitrum
* Deposit `weETH` into Pendle SY protocol to receive the Pendle Yield Token position
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> A1[odos.swap] --> weETH((weETH))
weETH --> A2[pendle-sy.deposit] --> YT_weETH((YT_weETH))
```
```ts theme={null}
const ETHEREUM_CHAIN = 1;
const BERACHAIN_CHAIN = 80094;
const PLUME_CHAIN = 98866;
const ARBITRUM_CHAIN = 42161;
const userAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" as Address;
/**
* Zaps ETH into a Pendle Yield Token pool for weETH on Arbitrum.
* @returns The route and transaction objects.
*/
export async function earnEthToPendleYt() {
const ETH: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const SY_weETH: Address = "0xa6C895EB332E91c5b3D00B7baeEAae478cc502DA";
const amountIn = "1000000000000000000";
const routeParams: RouteParams = {
fromAddress: userAddress,
receiver: userAddress,
chainId: ARBITRUM_CHAIN,
amountIn: [amountIn], // 1 ETH
tokenIn: [ETH],
tokenOut: [SY_weETH],
routingStrategy: "router",
};
const route = await client.getRouteData(routeParams);
await sendEoa(route.tx, route.gas);
return route;
}
```