n 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` on Arbitrum
* Deposit `weETH` into Pendle SY protocol to receive the Pendle Yield Token position
```mermaid theme={null}
flowchart LR
ETH((ETH)) --> A1[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;
}
```프로젝트로 돌아가기