UseDocumentation Index
Fetch the complete documentation index at: https://docs.enso.build/llms.txt
Use this file to discover all available pages before exploring further.
bundle with bridge action to provide liquidity crosschain.
This example demonstrates bridging from Ethereum to Base and depositing into an Uniswap V4 pool.
// Chain IDs
const ETHEREUM_CHAIN_ID = 1;
const BASE_CHAIN_ID = 8453;
// Common addresses
const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; // Native ETH representation
const WALLET_ADDRESS = "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11"; // User wallet/fee receiver
// Ethereum Mainnet Token Addresses
const USDC_ETHEREUM = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; // USDC on Ethereum
// Stargate Addresses
const STARGATE_POOL_NATIVE_ETHEREUM =
"0x77b2043768d28e9c9ab44e1abfc95944bce57931"; // StargatePoolNative on Ethereum
// Base Chain Token Addresses
const DAI_BASE = "0x50c5725949a6f0c72e6c4a641f24049a917db0cb"; // L2 Standard Bridged DAI on Base
const USDC_BASE = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"; // USDC on Base
// Uniswap V4 Addresses
const UNISWAP_V4_POSITION_MANAGER_BASE =
"0x7c5f5a4bbd8fd63184577525326123b519429bdc"; // Uniswap V4 PositionManager on Base
const bundle = await client.getBundleData(
{
chainId: ETHEREUM_CHAIN_ID,
fromAddress: WALLET_ADDRESS,
spender: WALLET_ADDRESS,
routingStrategy: "router",
},
[
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDC_ETHEREUM,
amountIn: parseUnits("1000", 6).toString(), // 1000 USDC
tokenOut: ETH_ADDRESS,
},
},
{
protocol: "enso",
action: "fee",
args: {
token: ETH_ADDRESS,
amount: { useOutputOfCallAt: 0 },
bps: 25, // 0.25% fee
receiver: WALLET_ADDRESS,
},
},
{
protocol: "stargate",
action: "bridge",
args: {
primaryAddress: STARGATE_POOL_NATIVE_ETHEREUM,
destinationChainId: BASE_CHAIN_ID,
tokenIn: ETH_ADDRESS,
amountIn: { useOutputOfCallAt: 1 },
receiver: WALLET_ADDRESS,
callback: [
{
protocol: "enso",
action: "balance",
args: {
token: ETH_ADDRESS,
},
},
{
protocol: "enso",
action: "split",
args: {
tokenIn: ETH_ADDRESS,
tokenOut: [DAI_BASE, USDC_BASE],
amountIn: { useOutputOfCallAt: 0 },
},
},
{
protocol: "enso",
action: "slippage",
args: {
amountOut: { useOutputOfCallAt: 1, index: 0 },
bps: 50, // 0.5% slippage
},
},
{
protocol: "enso",
action: "slippage",
args: {
amountOut: { useOutputOfCallAt: 1, index: 1 },
bps: 50, // 0.5% slippage
},
},
{
protocol: "uniswap-v4",
action: "depositclmm",
args: {
tokenOut: UNISWAP_V4_POSITION_MANAGER_BASE,
ticks: [-276842, -275842],
tokenIn: [DAI_BASE, USDC_BASE],
poolFee: "100", // 0.01% fee tier
amountIn: [
{ useOutputOfCallAt: 1, index: 0 },
{ useOutputOfCallAt: 1, index: 1 },
],
},
},
{
protocol: "enso",
action: "slippage",
args: {
amountOut: { useOutputOfCallAt: 4 },
bps: 200, // 2% slippage
},
},
],
},
},
]
);
Updated
