# Table of Contents - [Integrating Kamino with Privy - Privy Docs](#integrating-kamino-with-privy-privy-docs) - [Integrating Deframe with Privy - Privy Docs](#integrating-deframe-with-privy-privy-docs) - [Overview - Privy Docs](#overview-privy-docs) - [Integrating Sky Savings with Privy - Privy Docs](#integrating-sky-savings-with-privy-privy-docs) - [Integrating Ethena with Privy - Privy Docs](#integrating-ethena-with-privy-privy-docs) - [Integrating Aave with Privy - Privy Docs](#integrating-aave-with-privy-privy-docs) - [Overview - Privy Docs](#overview-privy-docs) --- # Integrating Kamino with Privy - Privy Docs [Skip to main content](https://docs.privy.io/recipes/yield/kamino-guide#content-area) [Privy Docs home page![light logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-light.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=bd297b680ace8a13db4d9ce977f93180)![dark logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-dark.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=24d83970695ab19a1803a2eb00dbea4e)](https://docs.privy.io/) Search... Ctrl KAsk AI Search... Navigation Yield Integrating Kamino with Privy [Welcome](https://docs.privy.io/welcome) [Basics](https://docs.privy.io/basics/get-started/about) [Authentication](https://docs.privy.io/authentication/overview) [Wallets](https://docs.privy.io/wallets/overview) [Policies & controls](https://docs.privy.io/controls/overview) [Transaction management](https://docs.privy.io/transaction-management/overview) [User management](https://docs.privy.io/user-management/overview) [Security](https://docs.privy.io/security/overview) [Recipes](https://docs.privy.io/recipes/overview) [API reference](https://docs.privy.io/api-reference/introduction) On this page * [Deposit flow](https://docs.privy.io/recipes/yield/kamino-guide#deposit-flow) * [Additional resources](https://docs.privy.io/recipes/yield/kamino-guide#additional-resources) Kamino Earn vaults enable users to generate yield on their Solana assets. This guide walks through setting up backend developer-owned wallets using [NodeJS](https://docs.privy.io/basics/nodeJS/quickstart) and building and sending a Solana transaction that deposits funds into a Kamino Earn vault. [​](https://docs.privy.io/recipes/yield/kamino-guide#deposit-flow) Deposit flow ---------------------------------------------------------------------------------- 1 [](https://docs.privy.io/recipes/yield/kamino-guide#) 1\. Import dependencies, configure Privy, and initialize clients Import the required packages for Privy client, Solana RPC communication, and Kamino SDK operations. Set up your Privy credentials and initialize the Privy client and RPC connection. Report incorrect code Copy Ask AI import {PrivyClient} from '@privy-io/node'; import { createSolanaRpc, address, pipe, createTransactionMessage, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstructions, createNoopSigner, getBase64EncodedWireTransaction, compileTransaction } from '@solana/kit'; import {KaminoVault} from '@kamino-finance/klend-sdk'; import {Decimal} from 'decimal.js'; const PRIVY_APP_ID = 'put-your-privy-app-id-here'; const PRIVY_APP_SECRET = 'put-your-privy-app-secret-here'; const RPC_ENDPOINT = 'https://api.mainnet-beta.solana.com'; const VAULT_ADDRESS = 'put-your-vault-address-here'; const AUTH_KEY_ID = 'put-your-auth-key-id-here'; const AUTH_KEY_PRIVATE = 'put-your-auth-key-private-here'; const USER_EMAIL = 'put-your-email-here'; const privy = new PrivyClient({ appId: PRIVY_APP_ID, appSecret: PRIVY_APP_SECRET }); const rpc = createSolanaRpc(RPC_ENDPOINT); 2 [](https://docs.privy.io/recipes/yield/kamino-guide#) 2\. Create a Privy user and Solana wallet Create a Privy user, generate a Solana wallet linked to the user, and set your authorization key as the wallet owner. We recommend funding the wallet with SOL and the tokens you will lend (likely USDC) so that your wallet can submit transactions successfully. Report incorrect code Copy Ask AI await privy.users().create({ linked_accounts: [{type: 'email', address: USER_EMAIL}] }); const {id: walletId, address: walletAddress} = await privy.wallets().create({ chain_type: 'solana', owner_id: AUTH_KEY_ID }); 3 [](https://docs.privy.io/recipes/yield/kamino-guide#) 3\. Build Kamino Earn deposit instructions and transaction message Initialize the vault and generate deposit instructions using a noop signer. A noop signer is used to build instructions without requiring the actual private key. Privy will handle signing later. Additionally fetch the latest blockhash and construct the transaction message. Report incorrect code Copy Ask AI const vault = new KaminoVault(rpc, address(VAULT_ADDRESS)); await vault.getState(); const noopSigner = createNoopSigner(address(walletAddress)); const bundle = await vault.depositIxs(noopSigner, new Decimal(1.0)); const instructions = [...(bundle.depositIxs || [])]; if (!instructions.length) throw new Error('No instructions returned'); const {value: latestBlockhash} = await rpc.getLatestBlockhash().send(); const depositTransactionMessage = pipe( createTransactionMessage({version: 0}), (tx) => setTransactionMessageFeePayerSigner(noopSigner, tx), (tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx), (tx) => appendTransactionMessageInstructions(instructions, tx) ); 4 [](https://docs.privy.io/recipes/yield/kamino-guide#) 4\. Sign the transaction with Privy Compile the transaction, serialize it, and sign using Privy’s wallet API. Privy handles the signing securely using the embedded wallet. The private key never leaves Privy’s infrastructure. Report incorrect code Copy Ask AI const compiledTransaction = compileTransaction(depositTransactionMessage); const serializedTx = getBase64EncodedWireTransaction(compiledTransaction); const signResponse = await privy .wallets() .solana() .signTransaction(walletId, { transaction: serializedTx, authorization_context: { authorization_private_keys: [AUTH_KEY_PRIVATE] } }); 5 [](https://docs.privy.io/recipes/yield/kamino-guide#) 5\. Send the transaction Submit the signed transaction to the Solana network. Report incorrect code Copy Ask AI const signature = await rpc .sendTransaction(signResponse.signed_transaction as any, { encoding: 'base64', skipPreflight: true }) .send(); console.log('Deposit successful! Signature:', signature); Your deposit is complete! The user’s funds are now deposited in the Kamino Earn vault using their Privy embedded wallet. [​](https://docs.privy.io/recipes/yield/kamino-guide#additional-resources) Additional resources -------------------------------------------------------------------------------------------------- [Kamino Developer Docs\ ---------------------\ \ Official documentation for Kamino protocol.](https://docs.kamino.finance/) [Privy Solana wallets\ --------------------\ \ Configure embedded Solana wallets for users.](https://docs.privy.io/wallets/wallets/create/create-a-wallet#solana) Was this page helpful? YesNo [Sky Savings](https://docs.privy.io/recipes/yield/sky-savings-guide) [Deframe](https://docs.privy.io/recipes/yield/deframe-guide) Ctrl+I Assistant Responses are generated using AI and may contain mistakes. --- # Integrating Deframe with Privy - Privy Docs [Skip to main content](https://docs.privy.io/recipes/yield/deframe-guide#content-area) [Privy Docs home page![light logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-light.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=bd297b680ace8a13db4d9ce977f93180)![dark logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-dark.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=24d83970695ab19a1803a2eb00dbea4e)](https://docs.privy.io/) Search... Ctrl KAsk AI Search... Navigation Yield Integrating Deframe with Privy [Welcome](https://docs.privy.io/welcome) [Basics](https://docs.privy.io/basics/get-started/about) [Authentication](https://docs.privy.io/authentication/overview) [Wallets](https://docs.privy.io/wallets/overview) [Policies & controls](https://docs.privy.io/controls/overview) [Transaction management](https://docs.privy.io/transaction-management/overview) [User management](https://docs.privy.io/user-management/overview) [Security](https://docs.privy.io/security/overview) [Recipes](https://docs.privy.io/recipes/overview) [API reference](https://docs.privy.io/api-reference/introduction) On this page * [Resources](https://docs.privy.io/recipes/yield/deframe-guide#resources) * [Using Deframe with Privy](https://docs.privy.io/recipes/yield/deframe-guide#using-deframe-with-privy) * [Setup](https://docs.privy.io/recipes/yield/deframe-guide#setup) * [Configure Deframe API access](https://docs.privy.io/recipes/yield/deframe-guide#configure-deframe-api-access) * [List available strategies](https://docs.privy.io/recipes/yield/deframe-guide#list-available-strategies) * [Deposit into a yield strategy](https://docs.privy.io/recipes/yield/deframe-guide#deposit-into-a-yield-strategy) * [Check strategy position](https://docs.privy.io/recipes/yield/deframe-guide#check-strategy-position) * [Withdraw from a strategy](https://docs.privy.io/recipes/yield/deframe-guide#withdraw-from-a-strategy) * [Deframe EarnWidget](https://docs.privy.io/recipes/yield/deframe-guide#deframe-earnwidget) * [Install the Deframe SDK](https://docs.privy.io/recipes/yield/deframe-guide#install-the-deframe-sdk) * [Configure the widget](https://docs.privy.io/recipes/yield/deframe-guide#configure-the-widget) * [Implement the bytecode processor](https://docs.privy.io/recipes/yield/deframe-guide#implement-the-bytecode-processor) * [Render the widget](https://docs.privy.io/recipes/yield/deframe-guide#render-the-widget) * [Key integration tips](https://docs.privy.io/recipes/yield/deframe-guide#key-integration-tips) Deframe allows apps to access diversified DeFi yield strategies across multiple protocols through a single API. Apps fetch strategies from Deframe and execute the returned transaction bytecodes using Privy wallets. This enables deposits into lending, staking, and protocol-native yield strategies without managing complex transaction flows. [​](https://docs.privy.io/recipes/yield/deframe-guide#resources) Resources ----------------------------------------------------------------------------- [Deframe Docs\ ------------\ \ Official documentation for Deframe strategies and API.](https://docs.deframe.io/) [Starter repo\ ------------\ \ Full working example of Deframe + Privy integration.](https://github.com/pods-finance/deframe-privy-integration) * * * [​](https://docs.privy.io/recipes/yield/deframe-guide#using-deframe-with-privy) Using Deframe with Privy ----------------------------------------------------------------------------------------------------------- For this walkthrough, the examples use the Aave USDT strategy on Polygon. The same patterns work across all Deframe-supported strategies and networks—explore the complete list via the [Deframe API](https://docs.deframe.io/) . ### [​](https://docs.privy.io/recipes/yield/deframe-guide#setup) Setup Below is a minimal setup for the Privy provider. To customize the provider, follow the [Privy Quickstart](https://docs.privy.io/basics/get-started/dashboard/create-new-app) . Report incorrect code Copy Ask AI import {PrivyProvider} from '@privy-io/react-auth'; export function App() { return ( {/* Your application components */} ); } ### [​](https://docs.privy.io/recipes/yield/deframe-guide#configure-deframe-api-access) Configure Deframe API access Obtain your API credentials from the Deframe Dashboard: Report incorrect code Copy Ask AI const DEFRAME_API_URL = 'https://api.deframe.io'; const DEFRAME_API_KEY = 'your-deframe-api-key'; ### [​](https://docs.privy.io/recipes/yield/deframe-guide#list-available-strategies) List available strategies Fetch the yield strategies available for users: Report incorrect code Copy Ask AI const fetchStrategies = async () => { const response = await fetch(`${DEFRAME_API_URL}/strategies?limit=100`, { method: 'GET', headers: { 'x-api-key': DEFRAME_API_KEY } }); const {data: strategies} = await response.json(); return strategies; }; Each strategy includes fields like `id`, `protocol`, `assetName`, `network`, and `availableActions`. * * * ### [​](https://docs.privy.io/recipes/yield/deframe-guide#deposit-into-a-yield-strategy) Deposit into a yield strategy 1 [](https://docs.privy.io/recipes/yield/deframe-guide#) 1\. Get the user's wallet address Report incorrect code Copy Ask AI import {useWallets} from '@privy-io/react-auth'; const {wallets} = useWallets(); const walletAddress = wallets[0]?.address; 2 [](https://docs.privy.io/recipes/yield/deframe-guide#) 2\. Generate transaction bytecodes from Deframe Request the bytecodes needed to execute a deposit action: Report incorrect code Copy Ask AI const strategyId = 'Aave-USDT-polygon'; const action = 'lend'; const amount = '1500000'; // 1.5 USDT (6 decimals) const response = await fetch( `${DEFRAME_API_URL}/strategies/${strategyId}/bytecode?action=${action}&wallet=${walletAddress}&amount=${amount}`, { method: 'GET', headers: { 'x-api-key': DEFRAME_API_KEY } } ); const bytecodeResponse = await response.json(); The response contains an array of transactions to execute: Report incorrect code Copy Ask AI type DeframeBytecodeResponse = { feeCharged: string; metadata: { isCrossChain: boolean; isSameChainSwap: boolean; crossChainQuoteId: string; }; bytecode: { to: string; value: string; data: string; chainId: string; }[]; }; 3 [](https://docs.privy.io/recipes/yield/deframe-guide#) 3\. Execute the transactions with Privy Use Privy’s `useSendTransaction` to execute each bytecode: Report incorrect code Copy Ask AI import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const executeDeframeStrategy = async (bytecodeResponse: DeframeBytecodeResponse) => { for (const tx of bytecodeResponse.bytecode) { await sendTransaction({ to: tx.to as `0x${string}`, data: tx.data as `0x${string}`, value: BigInt(tx.value), chainId: Number(tx.chainId) }); } }; * * * ### [​](https://docs.privy.io/recipes/yield/deframe-guide#check-strategy-position) Check strategy position Fetch the user’s current position and APY for a strategy: Report incorrect code Copy Ask AI const fetchPosition = async (strategyId: string, walletAddress: string) => { const response = await fetch( `${DEFRAME_API_URL}/strategies/${strategyId}?wallet=${walletAddress}`, { method: 'GET', headers: { 'x-api-key': DEFRAME_API_KEY } } ); const strategy = await response.json(); return { apy: strategy.apy, avgApy: strategy.avgApy, position: strategy.position }; }; * * * ### [​](https://docs.privy.io/recipes/yield/deframe-guide#withdraw-from-a-strategy) Withdraw from a strategy To withdraw, use the `withdraw` action and execute the returned bytecodes: Report incorrect code Copy Ask AI import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const withdrawFromStrategy = async (strategyId: string, walletAddress: string, amount: string) => { const response = await fetch( `${DEFRAME_API_URL}/strategies/${strategyId}/bytecode?action=withdraw&wallet=${walletAddress}&amount=${amount}`, { method: 'GET', headers: { 'x-api-key': DEFRAME_API_KEY } } ); const bytecodeResponse = await response.json(); for (const tx of bytecodeResponse.bytecode) { await sendTransaction({ to: tx.to as `0x${string}`, data: tx.data as `0x${string}`, value: BigInt(tx.value), chainId: Number(tx.chainId) }); } }; * * * [​](https://docs.privy.io/recipes/yield/deframe-guide#deframe-earnwidget) Deframe EarnWidget ----------------------------------------------------------------------------------------------- For a faster integration, Deframe provides a pre-built `EarnWidget` component that handles strategy selection, deposits, and withdrawals with a built-in UI. ### [​](https://docs.privy.io/recipes/yield/deframe-guide#install-the-deframe-sdk) Install the Deframe SDK Report incorrect code Copy Ask AI npm install deframe-sdk @deframe-sdk/components @reduxjs/toolkit react-redux redux permissionless If your app uses Vite, install the Node polyfills plugin and add it to `vite.config.ts`: Report incorrect code Copy Ask AI npm install --save-dev vite-plugin-node-polyfills Report incorrect code Copy Ask AI import {defineConfig} from 'vite'; import {nodePolyfills} from 'vite-plugin-node-polyfills'; export default defineConfig({ plugins: [nodePolyfills()] }); ### [​](https://docs.privy.io/recipes/yield/deframe-guide#configure-the-widget) Configure the widget Report incorrect code Copy Ask AI import {DeframeProvider, EarnWidget} from 'deframe-sdk'; import {useSmartWallets} from '@privy-io/react-auth/smart-wallets'; import {usePrivy} from '@privy-io/react-auth'; const {user} = usePrivy(); const {client: smartWalletClient, getClientForChain} = useSmartWallets(); const config = { DEFRAME_API_URL: 'https://api.deframe.io', DEFRAME_API_KEY: 'your-deframe-api-key', walletAddress: smartWalletClient?.account.address, userId: user?.id, globalCurrency: 'USD', globalCurrencyExchangeRate: 1, theme: {mode: 'dark', preset: 'default'} }; ### [​](https://docs.privy.io/recipes/yield/deframe-guide#implement-the-bytecode-processor) Implement the bytecode processor The widget returns bytecode for the app to execute using Privy smart wallets: Report incorrect code Copy Ask AI import type {BytecodeTransaction, UpdateTxStatus} from 'deframe-sdk'; const processBytecode = async ( payload: {clientTxId: string; bytecodes: BytecodeTransaction[]; simulateError?: boolean}, ctx: {updateTxStatus: UpdateTxStatus} ) => { ctx.updateTxStatus({type: 'HOST_ACK', clientTxId: payload.clientTxId}); const chainId = Number(payload.bytecodes[0].chainId); const chainClient = await getClientForChain({id: chainId}); const calls = payload.bytecodes.map((b) => ({ to: b.to as `0x${string}`, data: b.data as `0x${string}`, value: BigInt(b.value) })); ctx.updateTxStatus({type: 'SIGNATURE_PROMPTED', clientTxId: payload.clientTxId}); const txHash = await chainClient.sendTransaction({calls}); ctx.updateTxStatus({type: 'TX_SUBMITTED', clientTxId: payload.clientTxId, txHash}); }; ### [​](https://docs.privy.io/recipes/yield/deframe-guide#render-the-widget) Render the widget Report incorrect code Copy Ask AI The EarnWidget requires [Smart Wallets](https://docs.privy.io/wallets/using-wallets/evm-smart-wallets/overview) for transaction execution. Enable Smart Wallets in the [Privy Dashboard](https://dashboard.privy.io/) under Wallet infrastructure. * * * [​](https://docs.privy.io/recipes/yield/deframe-guide#key-integration-tips) Key integration tips --------------------------------------------------------------------------------------------------- 1. **Handle token decimals**: The `amount` parameter must respect the token’s decimal places. USDT and USDC use 6 decimals; most other tokens use 18. 2. **Execute transactions in order**: Deframe may return multiple bytecodes for a single action. Execute them sequentially. 3. **Verify available actions**: Each strategy has an `availableActions` array. Check that the action exists before requesting bytecodes. 4. **Handle errors gracefully**: Wrap transaction execution in try/catch blocks to handle user rejection, insufficient funds, and network issues. For advanced use cases, refer to the [Deframe Docs](https://docs.deframe.io/) , or reach out in [Slack](https://privy.io/slack) . Was this page helpful? YesNo [Kamino](https://docs.privy.io/recipes/yield/kamino-guide) [Exporting wallet keys from mobile apps](https://docs.privy.io/recipes/mobile-key-export) Ctrl+I Assistant Responses are generated using AI and may contain mistakes. --- # Overview - Privy Docs [Skip to main content](https://docs.privy.io/recipes/yield/overview#content-area) [Privy Docs home page![light logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-light.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=bd297b680ace8a13db4d9ce977f93180)![dark logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-dark.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=24d83970695ab19a1803a2eb00dbea4e)](https://docs.privy.io/) Search... Ctrl KAsk AI Search... Navigation Yield Overview [Welcome](https://docs.privy.io/welcome) [Basics](https://docs.privy.io/basics/get-started/about) [Authentication](https://docs.privy.io/authentication/overview) [Wallets](https://docs.privy.io/wallets/overview) [Policies & controls](https://docs.privy.io/controls/overview) [Transaction management](https://docs.privy.io/transaction-management/overview) [User management](https://docs.privy.io/user-management/overview) [Security](https://docs.privy.io/security/overview) [Recipes](https://docs.privy.io/recipes/overview) [API reference](https://docs.privy.io/api-reference/introduction) Create a seamless DeFi lending experience by combining Privy embedded wallets with protocol integrations across Ethereum and Solana. Looking for a simple DeFi solution? [Earn](https://docs.privy.io/transaction-management/earn/overview) provides direct access to leading yield-generating protocols, revenue sharing, and position tracking out of the box, with a single API. [Aave\ ----\ \ Build lending and vault flows on Aave.](https://docs.privy.io/recipes/yield/aave-guide) [Ethena\ ------\ \ Earn yield by staking USDe in sUSDe vaults.](https://docs.privy.io/recipes/yield/ethena-guide) [Morpho\ ------\ \ Deposit into Morpho vaults, collect fees, and track positions with Privy’s earn feature.](https://docs.privy.io/transaction-management/earn/overview) [Sky Savings\ -----------\ \ Earn the Sky Savings Rate by depositing USDS into sUSDS vaults.](https://docs.privy.io/recipes/yield/sky-savings-guide) [Kamino\ ------\ \ Build a Solana-based yield flow with Kamino Earn.](https://docs.privy.io/recipes/yield/kamino-guide) [Deframe\ -------\ \ Access diversified yield strategies across multiple DeFi protocols.](https://docs.privy.io/recipes/yield/deframe-guide) Was this page helpful? YesNo [Builder Codes](https://docs.privy.io/recipes/hyperliquid/builder-codes) [Aave](https://docs.privy.io/recipes/yield/aave-guide) Ctrl+I Assistant Responses are generated using AI and may contain mistakes. --- # Integrating Sky Savings with Privy - Privy Docs [Skip to main content](https://docs.privy.io/recipes/yield/sky-savings-guide#content-area) [Privy Docs home page![light logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-light.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=bd297b680ace8a13db4d9ce977f93180)![dark logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-dark.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=24d83970695ab19a1803a2eb00dbea4e)](https://docs.privy.io/) Search... Ctrl KAsk AI Search... Navigation Yield Integrating Sky Savings with Privy [Welcome](https://docs.privy.io/welcome) [Basics](https://docs.privy.io/basics/get-started/about) [Authentication](https://docs.privy.io/authentication/overview) [Wallets](https://docs.privy.io/wallets/overview) [Policies & controls](https://docs.privy.io/controls/overview) [Transaction management](https://docs.privy.io/transaction-management/overview) [User management](https://docs.privy.io/user-management/overview) [Security](https://docs.privy.io/security/overview) [Recipes](https://docs.privy.io/recipes/overview) [API reference](https://docs.privy.io/api-reference/introduction) On this page * [Resources](https://docs.privy.io/recipes/yield/sky-savings-guide#resources) * [Getting USDS](https://docs.privy.io/recipes/yield/sky-savings-guide#getting-usds) * [Swap on a DEX](https://docs.privy.io/recipes/yield/sky-savings-guide#swap-on-a-dex) * [Convert DAI to USDS](https://docs.privy.io/recipes/yield/sky-savings-guide#convert-dai-to-usds) * [Using Sky Savings with Privy](https://docs.privy.io/recipes/yield/sky-savings-guide#using-sky-savings-with-privy) * [Deposit USDS into Sky Savings](https://docs.privy.io/recipes/yield/sky-savings-guide#deposit-usds-into-sky-savings) * [Check balance](https://docs.privy.io/recipes/yield/sky-savings-guide#check-balance) * [Withdraw from the vault](https://docs.privy.io/recipes/yield/sky-savings-guide#withdraw-from-the-vault) * [Key integration tips](https://docs.privy.io/recipes/yield/sky-savings-guide#key-integration-tips) * [Conclusion](https://docs.privy.io/recipes/yield/sky-savings-guide#conclusion) Sky Savings allows apps to earn the Sky Savings Rate by depositing USDS into the sUSDS vault. The sUSDS vault follows the ERC-4626 standard — your app deposits USDS and receives sUSDS shares that automatically accrue yield. [​](https://docs.privy.io/recipes/yield/sky-savings-guide#resources) Resources --------------------------------------------------------------------------------- [Sky Developer Docs\ ------------------\ \ Official documentation for the Sky protocol and smart contracts.](https://developers.skyeco.com/) [Privy Wallets\ -------------\ \ Privy Wallets are a powerful tool for helping users interact with DeFi.](https://docs.privy.io/wallets/overview) * * * [​](https://docs.privy.io/recipes/yield/sky-savings-guide#getting-usds) Getting USDS --------------------------------------------------------------------------------------- ### [​](https://docs.privy.io/recipes/yield/sky-savings-guide#swap-on-a-dex) Swap on a DEX Your app can swap any supported token for USDS on any major decentralized exchange using a DEX aggregator or router. ### [​](https://docs.privy.io/recipes/yield/sky-savings-guide#convert-dai-to-usds) Convert DAI to USDS On Ethereum, your app can convert DAI to USDS at a 1:1 rate through the [DaiUsds converter contract](https://etherscan.io/address/0x3225737a9bbb6473cb4a45b7244aca2befdb276a#writeContract) . First, approve the converter to spend DAI, then call `daiToUsds`. Report incorrect code Copy Ask AI import {encodeFunctionData, maxUint256, erc20Abi, parseUnits} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const DAI_ADDRESS = '0x6B175474E89094C44Da98b954EedeAC495271d0F'; const DAI_USDS_CONVERTER = '0x3225737a9Bbb6473CB4a45b7244ACa2BEFdB276A'; const CHAIN_ID = 1; // Ethereum Mainnet // Step 1: Approve the converter to spend DAI const approveData = encodeFunctionData({ abi: erc20Abi, functionName: 'approve', args: [DAI_USDS_CONVERTER as `0x${string}`, maxUint256] }); await sendTransaction({ to: DAI_ADDRESS as `0x${string}`, data: approveData, chainId: CHAIN_ID }); // Step 2: Convert DAI to USDS const converterAbi = [\ {\ type: 'function',\ name: 'daiToUsds',\ inputs: [\ {name: 'usr', type: 'address'},\ {name: 'wad', type: 'uint256'}\ ],\ outputs: [],\ stateMutability: 'nonpayable'\ }\ ] as const; const amount = parseUnits('100', 18); // 100 DAI const convertData = encodeFunctionData({ abi: converterAbi, functionName: 'daiToUsds', args: [address, amount] }); await sendTransaction({ to: DAI_USDS_CONVERTER as `0x${string}`, data: convertData, chainId: CHAIN_ID }); * * * [​](https://docs.privy.io/recipes/yield/sky-savings-guide#using-sky-savings-with-privy) Using Sky Savings with Privy ----------------------------------------------------------------------------------------------------------------------- ### [​](https://docs.privy.io/recipes/yield/sky-savings-guide#deposit-usds-into-sky-savings) Deposit USDS into Sky Savings 1 [](https://docs.privy.io/recipes/yield/sky-savings-guide#) 1\. Configure addresses Set up the sUSDS vault and USDS token addresses. The example below uses Ethereum Mainnet: Report incorrect code Copy Ask AI const SUSDS_VAULT_ADDRESS = '0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD'; const USDS_ADDRESS = '0xdC035D45d973E3EC169d2276DDab16f1e407384F'; const CHAIN_ID = 1; // Ethereum Mainnet 2 [](https://docs.privy.io/recipes/yield/sky-savings-guide#) 2\. Approve the sUSDS vault to spend USDS Use viem’s `encodeFunctionData` to encode the approval, and Privy’s `useSendTransaction` to send it: Report incorrect code Copy Ask AI import {encodeFunctionData, maxUint256, erc20Abi} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const data = encodeFunctionData({ abi: erc20Abi, functionName: 'approve', args: [SUSDS_VAULT_ADDRESS as `0x${string}`, maxUint256] }); const tx = await sendTransaction({ to: USDS_ADDRESS as `0x${string}`, data, chainId: CHAIN_ID }); 3 [](https://docs.privy.io/recipes/yield/sky-savings-guide#) 3\. Deposit USDS into the vault Use viem to encode the deposit and Privy’s `useSendTransaction` to fund the vault: Report incorrect code Copy Ask AI import {encodeFunctionData, parseUnits} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const erc4626Abi = [\ {\ type: 'function',\ name: 'deposit',\ inputs: [\ {name: 'assets', type: 'uint256'},\ {name: 'receiver', type: 'address'}\ ],\ outputs: [{name: 'shares', type: 'uint256'}],\ stateMutability: 'nonpayable'\ }\ ] as const; const depositAmount = parseUnits('100', 18); // 100 USDS (18 decimals) const data = encodeFunctionData({ abi: erc4626Abi, functionName: 'deposit', args: [depositAmount, address] }); const tx = await sendTransaction({ to: SUSDS_VAULT_ADDRESS as `0x${string}`, data, chainId: CHAIN_ID }); * * * ### [​](https://docs.privy.io/recipes/yield/sky-savings-guide#check-balance) Check balance Call the vault’s `balanceOf` function to get the user’s sUSDS shares, then call `convertToAssets` to see the current USDS value including accrued yield. Report incorrect code Copy Ask AI import {publicClient} from './viem'; const erc4626Abi = [\ {\ type: 'function',\ name: 'balanceOf',\ inputs: [{name: 'account', type: 'address'}],\ outputs: [{name: '', type: 'uint256'}],\ stateMutability: 'view'\ },\ {\ type: 'function',\ name: 'convertToAssets',\ inputs: [{name: 'shares', type: 'uint256'}],\ outputs: [{name: '', type: 'uint256'}],\ stateMutability: 'view'\ }\ ] as const; const userShares = await publicClient.readContract({ address: SUSDS_VAULT_ADDRESS as `0x${string}`, abi: erc4626Abi, functionName: 'balanceOf', args: [address] }); const usdsValue = await publicClient.readContract({ address: SUSDS_VAULT_ADDRESS as `0x${string}`, abi: erc4626Abi, functionName: 'convertToAssets', args: [userShares] }); * * * ### [​](https://docs.privy.io/recipes/yield/sky-savings-guide#withdraw-from-the-vault) Withdraw from the vault Your app can withdraw a specific amount of USDS or redeem all shares for a full exit. * Withdraw a specific USDS amount * Redeem all shares (full exit) Report incorrect code Copy Ask AI import {encodeFunctionData, parseUnits} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const withdrawAbi = [\ {\ type: 'function',\ name: 'withdraw',\ inputs: [\ {name: 'assets', type: 'uint256'},\ {name: 'receiver', type: 'address'},\ {name: 'owner', type: 'address'}\ ],\ outputs: [{name: 'shares', type: 'uint256'}],\ stateMutability: 'nonpayable'\ }\ ] as const; const withdrawAmount = parseUnits('50', 18); // 50 USDS const data = encodeFunctionData({ abi: withdrawAbi, functionName: 'withdraw', args: [withdrawAmount, address, address] }); const tx = await sendTransaction({ to: SUSDS_VAULT_ADDRESS as `0x${string}`, data, chainId: CHAIN_ID }); Report incorrect code Copy Ask AI import {encodeFunctionData} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const redeemAbi = [\ {\ type: 'function',\ name: 'redeem',\ inputs: [\ {name: 'shares', type: 'uint256'},\ {name: 'receiver', type: 'address'},\ {name: 'owner', type: 'address'}\ ],\ outputs: [{name: 'assets', type: 'uint256'}],\ stateMutability: 'nonpayable'\ }\ ] as const; const data = encodeFunctionData({ abi: redeemAbi, functionName: 'redeem', args: [userShares, address, address] }); const tx = await sendTransaction({ to: SUSDS_VAULT_ADDRESS as `0x${string}`, data, chainId: CHAIN_ID }); * * * [​](https://docs.privy.io/recipes/yield/sky-savings-guide#key-integration-tips) Key integration tips ------------------------------------------------------------------------------------------------------- 1. **Always approve first**: Your app must grant ERC-20 approval to the sUSDS vault before any deposit. 2. **USDS uses 18 decimals**: Unlike USDC (6 decimals), USDS uses 18 decimals — use `parseUnits('100', 18)` for amounts. 3. **Use `convertToAssets` for real-time balances**: This ERC-4626 method converts sUSDS shares to their current USDS value, including accrued yield. 4. **Supported chains**: Sky Savings supports Ethereum, Base, Arbitrum, OP Mainnet, and Unichain. * * * [​](https://docs.privy.io/recipes/yield/sky-savings-guide#conclusion) Conclusion ----------------------------------------------------------------------------------- Privy makes it straightforward to build secure, user-friendly access to Sky Savings. For advanced use cases, refer to the [Sky Developer Docs](https://developers.skyeco.com/) , or reach out in [Slack](https://privy.io/slack) . Your app is now ready to interact with Sky Savings using Privy embedded wallets! Was this page helpful? YesNo [Morpho guide](https://docs.privy.io/recipes/yield/morpho-guide) [Kamino](https://docs.privy.io/recipes/yield/kamino-guide) Ctrl+I Assistant Responses are generated using AI and may contain mistakes. --- # Integrating Ethena with Privy - Privy Docs [Skip to main content](https://docs.privy.io/recipes/yield/ethena-guide#content-area) [Privy Docs home page![light logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-light.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=bd297b680ace8a13db4d9ce977f93180)![dark logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-dark.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=24d83970695ab19a1803a2eb00dbea4e)](https://docs.privy.io/) Search... Ctrl KAsk AI Search... Navigation Yield Integrating Ethena with Privy [Welcome](https://docs.privy.io/welcome) [Basics](https://docs.privy.io/basics/get-started/about) [Authentication](https://docs.privy.io/authentication/overview) [Wallets](https://docs.privy.io/wallets/overview) [Policies & controls](https://docs.privy.io/controls/overview) [Transaction management](https://docs.privy.io/transaction-management/overview) [User management](https://docs.privy.io/user-management/overview) [Security](https://docs.privy.io/security/overview) [Recipes](https://docs.privy.io/recipes/overview) [API reference](https://docs.privy.io/api-reference/introduction) On this page * [Resources](https://docs.privy.io/recipes/yield/ethena-guide#resources) * [Getting USDe](https://docs.privy.io/recipes/yield/ethena-guide#getting-usde) * [Stake USDe into the sUSDe vault](https://docs.privy.io/recipes/yield/ethena-guide#stake-usde-into-the-susde-vault) * [Check balance](https://docs.privy.io/recipes/yield/ethena-guide#check-balance) * [Unstake from the vault](https://docs.privy.io/recipes/yield/ethena-guide#unstake-from-the-vault) * [Key integration tips](https://docs.privy.io/recipes/yield/ethena-guide#key-integration-tips) * [Conclusion](https://docs.privy.io/recipes/yield/ethena-guide#conclusion) Ethena allows apps to earn yield by staking USDe into the sUSDe vault. The sUSDe vault follows the ERC-4626 standard — your app deposits USDe and receives sUSDe shares that automatically accrue yield over time. There is no minimum staking period, and rewards are distributed every 8 hours. [​](https://docs.privy.io/recipes/yield/ethena-guide#resources) Resources ---------------------------------------------------------------------------- [Ethena Staking Docs\ -------------------\ \ Official documentation for staking USDe and the sUSDe contract.](https://docs.ethena.fi/solution-design/staking-usde) [Get started with Privy\ ----------------------\ \ Set up Privy and create embedded wallets for your app.](https://docs.privy.io/basics/react/quickstart) [​](https://docs.privy.io/recipes/yield/ethena-guide#getting-usde) Getting USDe ---------------------------------------------------------------------------------- Your app can swap any supported token for USDe on any major decentralized exchange using a DEX aggregator or router. [​](https://docs.privy.io/recipes/yield/ethena-guide#stake-usde-into-the-susde-vault) Stake USDe into the sUSDe vault ------------------------------------------------------------------------------------------------------------------------ 1 [](https://docs.privy.io/recipes/yield/ethena-guide#) 1\. Configure addresses Set up the sUSDe vault and USDe token addresses. The example below uses Ethereum Mainnet: Report incorrect code Copy Ask AI const SUSDE_VAULT_ADDRESS = '0x9D39A5DE30e57443BfF2A8307A4256c8797A3497'; const USDE_ADDRESS = '0x4c9EDD5852cd905f086C759E8383e09bff1E68B3'; const CHAIN_ID = 1; // Ethereum Mainnet 2 [](https://docs.privy.io/recipes/yield/ethena-guide#) 2\. Approve the sUSDe vault to spend USDe Use viem’s `encodeFunctionData` to encode the approval, and Privy’s `useSendTransaction` to send it: Report incorrect code Copy Ask AI import {encodeFunctionData, maxUint256, erc20Abi} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const data = encodeFunctionData({ abi: erc20Abi, functionName: 'approve', args: [SUSDE_VAULT_ADDRESS as `0x${string}`, maxUint256] }); const tx = await sendTransaction({ to: USDE_ADDRESS as `0x${string}`, data, chainId: CHAIN_ID }); 3 [](https://docs.privy.io/recipes/yield/ethena-guide#) 3\. Deposit USDe into the vault Use viem to encode the deposit and Privy’s `useSendTransaction` to stake USDe: Report incorrect code Copy Ask AI import {encodeFunctionData, parseUnits} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const erc4626Abi = [\ {\ type: 'function',\ name: 'deposit',\ inputs: [\ {name: 'assets', type: 'uint256'},\ {name: 'receiver', type: 'address'}\ ],\ outputs: [{name: 'shares', type: 'uint256'}],\ stateMutability: 'nonpayable'\ }\ ] as const; const depositAmount = parseUnits('100', 18); // 100 USDe (18 decimals) const data = encodeFunctionData({ abi: erc4626Abi, functionName: 'deposit', args: [depositAmount, address] }); const tx = await sendTransaction({ to: SUSDE_VAULT_ADDRESS as `0x${string}`, data, chainId: CHAIN_ID }); ### [​](https://docs.privy.io/recipes/yield/ethena-guide#check-balance) Check balance Call the vault’s `balanceOf` function to get the user’s sUSDe shares, then call `convertToAssets` to see the current USDe value including accrued yield. Report incorrect code Copy Ask AI import {publicClient} from './viem'; const erc4626Abi = [\ {\ type: 'function',\ name: 'balanceOf',\ inputs: [{name: 'account', type: 'address'}],\ outputs: [{name: '', type: 'uint256'}],\ stateMutability: 'view'\ },\ {\ type: 'function',\ name: 'convertToAssets',\ inputs: [{name: 'shares', type: 'uint256'}],\ outputs: [{name: '', type: 'uint256'}],\ stateMutability: 'view'\ }\ ] as const; const userShares = await publicClient.readContract({ address: SUSDE_VAULT_ADDRESS as `0x${string}`, abi: erc4626Abi, functionName: 'balanceOf', args: [address] }); const usdeValue = await publicClient.readContract({ address: SUSDE_VAULT_ADDRESS as `0x${string}`, abi: erc4626Abi, functionName: 'convertToAssets', args: [userShares] }); ### [​](https://docs.privy.io/recipes/yield/ethena-guide#unstake-from-the-vault) Unstake from the vault Ethena has a **7-day cooldown period** for unstaking. Your app must first request an unstake, which places the USDe in the USDeSilo contract. After the cooldown completes, your app can withdraw the USDe. Unlike instant withdrawal vaults, Ethena requires a 7-day cooldown period after requesting an unstake before USDe can be withdrawn. * Request unstake (start cooldown) * Withdraw after cooldown Call `cooldownShares` on the sUSDe vault to initiate the unstaking process. The USDe is placed in the USDeSilo contract during the cooldown period. Report incorrect code Copy Ask AI import {encodeFunctionData} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const cooldownAbi = [\ {\ type: 'function',\ name: 'cooldownShares',\ inputs: [{name: 'shares', type: 'uint256'}],\ outputs: [{name: 'assets', type: 'uint256'}],\ stateMutability: 'nonpayable'\ }\ ] as const; const data = encodeFunctionData({ abi: cooldownAbi, functionName: 'cooldownShares', args: [userShares] }); const tx = await sendTransaction({ to: SUSDE_VAULT_ADDRESS as `0x${string}`, data, chainId: CHAIN_ID }); After the 7-day cooldown period has passed, call `unstake` on the sUSDe vault to withdraw USDe from the USDeSilo contract: Report incorrect code Copy Ask AI import {encodeFunctionData} from 'viem'; import {useSendTransaction} from '@privy-io/react-auth'; const {sendTransaction} = useSendTransaction(); const unstakeAbi = [\ {\ type: 'function',\ name: 'unstake',\ inputs: [{name: 'receiver', type: 'address'}],\ outputs: [],\ stateMutability: 'nonpayable'\ }\ ] as const; const data = encodeFunctionData({ abi: unstakeAbi, functionName: 'unstake', args: [address] }); const tx = await sendTransaction({ to: SUSDE_VAULT_ADDRESS as `0x${string}`, data, chainId: CHAIN_ID }); [​](https://docs.privy.io/recipes/yield/ethena-guide#key-integration-tips) Key integration tips -------------------------------------------------------------------------------------------------- 1. **Always approve first**: Your app must grant ERC-20 approval to the sUSDe vault before any deposit. 2. **USDe uses 18 decimals**: Use `parseUnits('100', 18)` for amounts. 3. **Use `convertToAssets` for real-time balances**: This ERC-4626 method converts sUSDe shares to their current USDe value, including accrued yield. 4. **Plan for the 7-day cooldown**: Unlike other yield protocols, Ethena requires a cooldown period before withdrawing staked USDe. During this period, the USDe is held in the USDeSilo contract. 5. **No minimum staking period**: Your app can stake and unstake in consecutive blocks, though the 7-day cooldown still applies for withdrawals. 6. **sUSDe value only increases**: Rewards can only be positive or zero — stakers cannot lose USDe by staking. 7. **Supported chains**: Ethena sUSDe staking is available on Ethereum Mainnet. * * * [​](https://docs.privy.io/recipes/yield/ethena-guide#conclusion) Conclusion ------------------------------------------------------------------------------ Privy makes it straightforward to build secure, user-friendly access to Ethena yield. For advanced use cases, refer to the [Ethena Staking Docs](https://docs.ethena.fi/solution-design/staking-usde) , or reach out in [Slack](https://privy.io/slack) . Your app is now ready to interact with Ethena using Privy embedded wallets! Was this page helpful? YesNo [Aave](https://docs.privy.io/recipes/yield/aave-guide) [Morpho guide](https://docs.privy.io/recipes/yield/morpho-guide) Ctrl+I Assistant Responses are generated using AI and may contain mistakes. --- # Integrating Aave with Privy - Privy Docs [Skip to main content](https://docs.privy.io/recipes/yield/aave-guide#content-area) [Privy Docs home page![light logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-light.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=bd297b680ace8a13db4d9ce977f93180)![dark logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-dark.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=24d83970695ab19a1803a2eb00dbea4e)](https://docs.privy.io/) Search... Ctrl KAsk AI Search... Navigation Yield Integrating Aave with Privy [Welcome](https://docs.privy.io/welcome) [Basics](https://docs.privy.io/basics/get-started/about) [Authentication](https://docs.privy.io/authentication/overview) [Wallets](https://docs.privy.io/wallets/overview) [Policies & controls](https://docs.privy.io/controls/overview) [Transaction management](https://docs.privy.io/transaction-management/overview) [User management](https://docs.privy.io/user-management/overview) [Security](https://docs.privy.io/security/overview) [Recipes](https://docs.privy.io/recipes/overview) [API reference](https://docs.privy.io/api-reference/introduction) React On this page * [Resources](https://docs.privy.io/recipes/yield/aave-guide#resources) * [Integrate with Aave protocol](https://docs.privy.io/recipes/yield/aave-guide#integrate-with-aave-protocol) * [Install and configure the Aave SDK](https://docs.privy.io/recipes/yield/aave-guide#install-and-configure-the-aave-sdk) * [Installation](https://docs.privy.io/recipes/yield/aave-guide#installation) * [Setup](https://docs.privy.io/recipes/yield/aave-guide#setup) * [Supply directly to Aave protocol](https://docs.privy.io/recipes/yield/aave-guide#supply-directly-to-aave-protocol) * [Create a managed Aave vault](https://docs.privy.io/recipes/yield/aave-guide#create-a-managed-aave-vault) * [Key integration tips](https://docs.privy.io/recipes/yield/aave-guide#key-integration-tips) * [Conclusion](https://docs.privy.io/recipes/yield/aave-guide#conclusion) React Create a seamless DeFi lending experience with Privy’s embedded wallets and Aave protocol. This guide shows you how to build an app where users can supply tokens directly to Aave, deploy yield-bearing vaults, and manage deposits—all without external wallets or complex onboarding. [​](https://docs.privy.io/recipes/yield/aave-guide#resources) Resources -------------------------------------------------------------------------- [Aave Docs\ ---------\ \ Official documentation for Aave protocol and smart contracts.](https://docs.aave.com/) [Privy Wallets\ -------------\ \ Privy Wallets are a powerful tool for helping users interact with DeFi.](https://docs.privy.io/wallets/overview) * * * [​](https://docs.privy.io/recipes/yield/aave-guide#integrate-with-aave-protocol) Integrate with Aave protocol ---------------------------------------------------------------------------------------------------------------- There are two ways to integrate Aave into your application: * **Supply directly to Aave**: Directly supply tokens into Aave’s liquidity pools to earn interest. Your tokens become available for borrowers and you earn yield from interest payments. * **Create a managed Aave vault**: Create ERC-4626 compliant vaults that hold aTokens (Aave’s interest-bearing tokens). Vaults allow applications to manage supplied tokens on behalf of users and earn a percentage of the yield generated. For this walkthrough, we’ll demonstrate using **Base Sepolia** and the **WETH lending pool**. The same patterns work across all Aave-supported networks and assets—explore the complete list of available pools and addresses in the [BGD Labs Address Book](https://github.com/bgd-labs/aave-address-book) . ### [​](https://docs.privy.io/recipes/yield/aave-guide#install-and-configure-the-aave-sdk) Install and configure the Aave SDK ### [​](https://docs.privy.io/recipes/yield/aave-guide#installation) Installation Report incorrect code Copy Ask AI npm install @aave/react@latest @privy-io/react-auth@latest ### [​](https://docs.privy.io/recipes/yield/aave-guide#setup) Setup Below is a minimal setup for Privy provider with Aave provider setup. To customize your Privy provider, follow the instructions in the [Privy Quickstart](https://docs.privy.io/basics/get-started/dashboard/create-new-app) to get your app set up with Privy. Report incorrect code Copy Ask AI // App.tsx import {PrivyProvider} from '@privy-io/react-auth'; import {AaveProvider, AaveClient} from '@aave/react'; const client = AaveClient.create(); export function App() { return ( {/* Your application components */} ); } ### [​](https://docs.privy.io/recipes/yield/aave-guide#supply-directly-to-aave-protocol) Supply directly to Aave protocol This approach lets users deposit tokens directly into Aave’s lending pools to earn interest. When you supply tokens, they become available for other users to borrow, and you earn yield from the borrowing fees. This is the simplest way to start earning on idle assets. 1 [](https://docs.privy.io/recipes/yield/aave-guide#) 1\. Execute the supply transaction The Aave SDK returns transaction objects that you execute with Privy’s `sendTransaction`: Report incorrect code Copy Ask AI import {useSupply, bigDecimal} from '@aave/react'; import {useSendTransaction, useWallets} from '@privy-io/react-auth'; const {wallets} = useWallets(); const {sendTransaction} = useSendTransaction(); const [supply] = useSupply(); const supplyToken = async () => { const result = await supply({ market: '0x8bAB6d1b75f19e9eD9fCe8b9BD338844fF79aE27', amount: {native: bigDecimal(0.1)}, // Supply 0.1 ETH sender: wallets[0].address, chainId: 84532 }); if (result.isErr()) { throw new Error(`Supply failed: ${result.error}`); } const plan = result.value; // Handle approval if required if (plan.__typename === 'ApprovalRequired') { await sendTransaction( { to: plan.approval.to, value: BigInt(plan.approval.value), data: plan.approval.data, chainId: plan.approval.chainId }, {address: wallets[0].address} ); // Execute supply transaction return await sendTransaction( { to: plan.originalTransaction.to, value: BigInt(plan.originalTransaction.value), data: plan.originalTransaction.data, chainId: plan.originalTransaction.chainId }, {address: wallets[0].address} ); } // Direct supply transaction if (plan.__typename === 'TransactionRequest') { return await sendTransaction( { to: plan.to, value: BigInt(plan.value), data: plan.data, chainId: plan.chainId }, {address: wallets[0].address} ); } throw new Error(`Unhandled plan type: ${plan.__typename}`); }; * * * ### [​](https://docs.privy.io/recipes/yield/aave-guide#create-a-managed-aave-vault) Create a managed Aave vault Aave Vaults are ERC-4626 compliant yield-bearing vaults that allow users to supply and withdraw ERC-20 tokens supported by Aave V3. Vaults enable applications to manage supplied tokens on behalf of users and earn a percentage of revenue. 1 [](https://docs.privy.io/recipes/yield/aave-guide#) 1\. Get reserve information for vault deployment Report incorrect code Copy Ask AI import {useAaveReserve, useVaultDeploy, bigDecimal} from '@aave/react'; import {useSendTransaction, useWallets} from '@privy-io/react-auth'; const {wallets} = useWallets(); const {sendTransaction} = useSendTransaction(); const [deployVault] = useVaultDeploy(); // Get reserve data for WETH on Base Sepolia (needed for vault deployment) const {data: reserve} = useAaveReserve({ market: '0x8bAB6d1b75f19e9eD9fCe8b9BD338844fF79aE27', // Base Sepolia Pool underlyingToken: '0x4200000000000000000000000000000000000006', // WETH chainId: 84532, suspense: true }); 2 [](https://docs.privy.io/recipes/yield/aave-guide#) 2\. Deploy a new vault Report incorrect code Copy Ask AI const deploy = async () => { const result = await deployVault({ market: reserve.market.address, chainId: 84532, underlyingToken: reserve.underlyingToken.address, deployer: wallets[0].address, initialFee: bigDecimal(3), // 3% performance fee shareName: 'Aave WETH Vault Shares', shareSymbol: 'avWETH', initialLockDeposit: bigDecimal(1) // 1 WETH initial deposit }); if (result.isErr()) { throw new Error(`Deployment failed: ${result.error}`); } const plan = result.value; // Handle approval if required if (plan.__typename === 'ApprovalRequired') { await sendTransaction( { to: plan.approval.to, value: BigInt(plan.approval.value), data: plan.approval.data, chainId: plan.approval.chainId }, {address: wallets[0].address} ); return await sendTransaction( { to: plan.originalTransaction.to, value: BigInt(plan.originalTransaction.value), data: plan.originalTransaction.data, chainId: plan.originalTransaction.chainId }, {address: wallets[0].address} ); } if (plan.__typename === 'TransactionRequest') { return await sendTransaction( { to: plan.to, value: BigInt(plan.value), data: plan.data, chainId: plan.chainId }, {address: wallets[0].address} ); } throw new Error(`Unhandled plan type: ${plan.__typename}`); }; 3 [](https://docs.privy.io/recipes/yield/aave-guide#) 3\. Deposit into a vault Report incorrect code Copy Ask AI import {useVault, useVaultDeposit} from '@aave/react'; const {data: vault} = useVault({ by: {address: '0x36b22e03bc9f8d08109ca4bb36241e3bfb7077fa'}, // vault address to deposit tokens chainId: 84532 }); const [deposit] = useVaultDeposit(); const depositTokens = async () => { const result = await deposit({ chainId: vault.chainId, vault: vault.address, amount: { currency: vault.usedReserve.underlyingToken.address, value: bigDecimal(100) // 100 tokens }, depositor: wallets[0].address }); if (result.isErr()) { throw new Error(`Deposit failed: ${result.error}`); } const plan = result.value; // Handle approval if required if (plan.__typename === 'ApprovalRequired') { await sendTransaction( { to: plan.approval.to, value: BigInt(plan.approval.value), data: plan.approval.data, chainId: plan.approval.chainId }, {address: wallets[0].address} ); return await sendTransaction( { to: plan.originalTransaction.to, value: BigInt(plan.originalTransaction.value), data: plan.originalTransaction.data, chainId: plan.originalTransaction.chainId }, {address: wallets[0].address} ); } if (plan.__typename === 'TransactionRequest') { return await sendTransaction( { to: plan.to, value: BigInt(plan.value), data: plan.data, chainId: plan.chainId }, {address: wallets[0].address} ); } throw new Error(`Unhandled plan type: ${plan.__typename}`); }; [​](https://docs.privy.io/recipes/yield/aave-guide#key-integration-tips) Key integration tips ------------------------------------------------------------------------------------------------ 1. **In NodeJS**: the `sendWith` method from the Aave SDK is feature-rich and streamlines complex transaction flows. It automatically handles token approvals when required and then sends the main Aave transaction, making the overall process more seamless. 2. **Handle transaction plans**: The Aave SDK returns various plan types (actions) like `TransactionRequest` and `ApprovalRequired` which can be used to handle different transaction scenarios accordingly. This allows for flexible handling of different approval and execution patterns. 3. **Add error handling**: Production applications should wrap all async functions in try/catch blocks to handle common blockchain errors like user rejection, insufficient funds, network issues, and contract failures. Consider implementing user-friendly error messages and retry mechanisms for failed transactions. * * * [​](https://docs.privy.io/recipes/yield/aave-guide#conclusion) Conclusion ---------------------------------------------------------------------------- With Privy and the Aave, building powerful DeFi lending experiences becomes seamless and secure. Users can interact with Aave protocol seamlessly through embedded wallets without needing external wallet management. Was this page helpful? YesNo [Overview](https://docs.privy.io/recipes/yield/overview) [Ethena](https://docs.privy.io/recipes/yield/ethena-guide) Ctrl+I Assistant Responses are generated using AI and may contain mistakes. --- # Overview - Privy Docs [Skip to main content](https://docs.privy.io/recipes/yield/morpho-guide#content-area) [Privy Docs home page![light logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-light.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=bd297b680ace8a13db4d9ce977f93180)![dark logo](https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-dark.png?fit=max&auto=format&n=Ih_Fo3QYM486gzWq&q=85&s=24d83970695ab19a1803a2eb00dbea4e)](https://docs.privy.io/) Search... Ctrl KAsk AI Search... Navigation Earn Overview [Welcome](https://docs.privy.io/welcome) [Basics](https://docs.privy.io/basics/get-started/about) [Authentication](https://docs.privy.io/authentication/overview) [Wallets](https://docs.privy.io/wallets/overview) [Policies & controls](https://docs.privy.io/controls/overview) [Transaction management](https://docs.privy.io/transaction-management/overview) [User management](https://docs.privy.io/user-management/overview) [Security](https://docs.privy.io/security/overview) [Recipes](https://docs.privy.io/recipes/overview) [API reference](https://docs.privy.io/api-reference/introduction) On this page * [Capabilities](https://docs.privy.io/recipes/yield/morpho-guide#capabilities) * [How DeFi yield is generated](https://docs.privy.io/recipes/yield/morpho-guide#how-defi-yield-is-generated) * [Supported vaults](https://docs.privy.io/recipes/yield/morpho-guide#supported-vaults) * [Revenue sharing](https://docs.privy.io/recipes/yield/morpho-guide#revenue-sharing) * [Next steps](https://docs.privy.io/recipes/yield/morpho-guide#next-steps) Earn is a new capability that enables apps to generate yield on wallet balances via DeFi lending protocols. Deposit into vaults, withdraw at any time, and track positions in real time, all with a few API calls. Privy simplifies vault deployment, smart contract interactions, and onchain execution. Earn is an Enterprise feature. Reach out to [sales@privy.io](mailto:sales@privy.io) to request access for your app. [​](https://docs.privy.io/recipes/yield/morpho-guide#capabilities) Capabilities ---------------------------------------------------------------------------------- * **Deposit and withdraw** assets into yield vaults with a single API call per operation * **Query positions** to display real-time holdings, accrued yield, and vault shares * **Collect fees** from a configurable share of the yield generated through your app [​](https://docs.privy.io/recipes/yield/morpho-guide#how-defi-yield-is-generated) How DeFi yield is generated ---------------------------------------------------------------------------------------------------------------- DeFi vaults allocate deposited assets into onchain lending markets where borrowers pay interest to access liquidity. That interest flows back to the vault, increasing the value of deposited shares over time. Vault strategies are managed by curators who determine how capital is allocated across markets to balance risk and return. APY fluctuates based on borrower demand, market utilization, and the curator’s allocation strategy. Some vaults also distribute additional token incentives on top of the base lending yield. All lending and borrowing happens onchain through non-custodial smart contracts. Your app should make clear to end users that yield is generated via a DeFi protocol independent from the wallet provider. Users keep full control of their assets and should explicitly direct the deposit action. [​](https://docs.privy.io/recipes/yield/morpho-guide#supported-vaults) Supported vaults ------------------------------------------------------------------------------------------ Earn is built on the [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) tokenized vault standard and supports multiple protocols through a single API. [Morpho](https://morpho.org/) vaults curated by [Gauntlet](https://www.gauntlet.xyz/) and [Steakhouse](https://www.steakhouse.financial/) are available today in the Privy Dashboard. Morpho, Aave, and Kamino vaults across all supported chains are available on request. Contact [sales@privy.io](mailto:sales@privy.io) to enable your preferred vault. Do your own research when selecting a vault. You can find more information on the vaults supported in the Dashboard, including details on the liquidity and allocation below: * [Gauntlet USDC Prime (USDC on Base)](https://app.morpho.org/base/vault/0x050cE30b927Da55177A4914EC73480238BAD56f0/gauntlet-usdc-prime) * [Steakhouse Prime Instant (USDC on Base)](https://app.morpho.org/base/vault/0xbeef0e0834849aCC03f0089F01f4F1Eeb06873C9/steakhouse-prime-instant) [​](https://docs.privy.io/recipes/yield/morpho-guide#revenue-sharing) Revenue sharing ---------------------------------------------------------------------------------------- Privy helps deploy a fee wrapper that wraps the underlying Morpho vault. Through your app, users direct deposits into this fee wrapper, and the fee wrapper captures a configurable portion (up to 50%) of the accrued yield as shares in a designated admin wallet. Your app can withdraw those shares at any time to collect fees. [​](https://docs.privy.io/recipes/yield/morpho-guide#next-steps) Next steps ------------------------------------------------------------------------------ [Setup\ -----\ \ Deploy a vault, deposit funds, and withdraw with accrued yield.](https://docs.privy.io/transaction-management/earn/setup) [Starter template\ ----------------\ \ A working Next.js app with end-to-end deposit and withdraw flows.](https://github.com/privy-io/examples/tree/main/examples/privy-next-yield-demo) Looking for the legacy Morpho integration guide? It’s still available [here](https://docs.privy.io/recipes/legacy/morpho-guide) . Privy does not control DeFi vaults or underlying protocols. Vault information is provided for reference only and may change or be inaccurate. Earnings are generated from third-party vaults and are not guaranteed. Using vaults involves risk, including loss of funds. These materials are for general information purposes only and are not investment advice or a recommendation or solicitation to engage in any specific transaction. You are responsible for evaluating vaults at your own discretion. Privy does not provide investment, financial, legal, or tax advice. Was this page helpful? YesNo [Sponsoring transactions on Solana](https://docs.privy.io/wallets/gas-and-asset-management/gas/solana) [Setup](https://docs.privy.io/transaction-management/earn/setup) Ctrl+I Assistant Responses are generated using AI and may contain mistakes. ---