Vault Management
Manage your deployed vaults with fee configuration and revenue collection.
Set Vault Fee
The fee for a vault has to be at least 10%.
Update the performance fee for your vault (vault owner only).
First, identify the vault you want to update the fee for.
Let's say we have identified a vault that we own with the following details:
Owned Vault
const vault: Vault = { __typename: "Vault", address: "0x1234567890abcdef1234567890abcdef12345678", owner: "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234", // Your address shareName: "Aave USDC Vault Shares", shareSymbol: "avUSDC", chainId: 1, usedReserve: { __typename: "Reserve", underlyingToken: { __typename: "Currency", symbol: "USDC", name: "USD Coin", address: "0xA0b86a33E6441c8c5f0bb9b7e5e1f8bbf5b78b5c", // … }, // … }, fee: { __typename: "PercentValue", raw: "50000000000000000000000000", decimals: 27, value: "0.11", formatted: "11", // 11% performance fee }, totalFeeRevenue: { __typename: "TokenAmount", amount: { __typename: "DecimalValue", value: "1250.75", // Total fees collected // … }, // … }, // …};
You must be the vault owner to update the fee.
Next, create the transaction request for updating the vault fee.
- React
- TypeScript
- GraphQL
Use the useVaultSetFee hook to create the transaction request for updating the vault fee.
Set Fee
import { useWalletClient } from "wagmi";import { useVaultSetFee, bigDecimal } from "@aave/react";
// …
const { data: walletClient } = useWalletClient();
const [setFee, settingFee] = useVaultSetFee();
const result = await setFee({ chainId: vault.chainId, vault: vault.address, newFee: bigDecimal(15), // 15% performance fee});
// …
Finally, send the transaction.
- React
- TypeScript
- GraphQL
Use the useSendTransaction hook for the wallet library of your choice to send the transaction.
Viem
import { useWalletClient } from "wagmi";import { useVaultSetFee } from "@aave/react";import { useSendTransaction } from "@aave/react/viem";
// …
const { data: walletClient } = useWalletClient();
const [setFee, settingFee] = useVaultSetFee();const [sendTransaction, sending] = useSendTransaction(walletClient);
const loading = settingFee.loading || sending.loading;const error = settingFee.error || sending.error;
// …
const result = await setFee({ // …}).andThen(sendTransaction);
if (result.isErr()) { console.error("Set fee failed:", result.error);} else { console.log("Set fee successful with hash:", result.value);}
Withdraw Fees
Withdraw accumulated fees from your vault (vault owner only).
Withdrawn fees are received in the form of the underlying Reserve aTokens.
First, identify the vault you want to withdraw fees from.
Let's say we have identified a vault that we own with accumulated fees:
Vault with Fees
const vault: Vault = { __typename: "Vault", address: "0x1234567890abcdef1234567890abcdef12345678", owner: "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234", // Your address shareName: "Aave USDC Vault Shares", shareSymbol: "avUSDC", chainId: 1, usedReserve: { __typename: "Reserve", underlyingToken: { __typename: "Currency", symbol: "USDC", name: "USD Coin", address: "0xA0b86a33E6441c8c5f0bb9b7e5e1f8bbf5b78b5c", // … }, // … }, fee: { __typename: "PercentValue", raw: "150000000000000000000000000", decimals: 27, value: "0.15", formatted: "15", // 15% performance fee }, totalFeeRevenue: { __typename: "TokenAmount", amount: { __typename: "DecimalValue", value: "1250.75", // Total fees collected - available for withdrawal // … }, usd: "1250.75", // … }, feesBalance: { __typename: "TokenAmount", amount: { __typename: "DecimalValue", value: "100.00", // Fees currently available for withdrawal // … }, usd: "100.00", // … }, // …};
You must be the vault owner to withdraw fees.
Next, create the transaction request for withdrawing fees.
- React
- TypeScript
- GraphQL
Use the useVaultWithdrawFees hook to create the transaction request for withdrawing fees.
Finally, send the transaction.
- React
- TypeScript
- GraphQL
Use the useSendTransaction hook for the wallet library of your choice to send the transaction.
Viem
import { useWalletClient } from "wagmi";import { useVaultWithdrawFees } from "@aave/react";import { useSendTransaction } from "@aave/react/viem";
// …
const { data: walletClient } = useWalletClient();
const [withdrawFees, withdrawingFees] = useVaultWithdrawFees();const [sendTransaction, sending] = useSendTransaction(walletClient);
const loading = withdrawingFees.loading || sending.loading;const error = withdrawingFees.error || sending.error;
// …
const result = await withdrawFees({ // …}).andThen(sendTransaction);
if (result.isErr()) { console.error("Withdraw fees failed:", result.error);} else { console.log("Withdraw fees successful with hash:", result.value);}
Transfer Vault Ownership
Transfer the ownership of a vault to a new address (vault owner only).
First, identify the vault you want to transfer the ownership of.
Let's say we have identified a vault that we own with the following details:
Owned Vault
const vault: Vault = { __typename: "Vault", address: "0x1234567890abcdef1234567890abcdef12345678", owner: "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234", // Your address shareName: "Aave USDC Vault Shares", shareSymbol: "avUSDC", chainId: 1, usedReserve: { // … }, fee: { // … }, totalFeeRevenue: { // … }, // …};
You must be the vault owner to transfer the ownership.
Next, create the transaction request for transferring the ownership of the vault.
- React
- TypeScript
- GraphQL
Use the useVaultTransferOwnership hook to create the transaction request for transferring the ownership of the vault.
Transfer Ownership
import { useVaultTransferOwnership, evmAddress } from "@aave/react";
// …
const [transferOwnership, transferring] = useVaultTransferOwnership();
const result = await transferOwnership({ chainId: vault.chainId, vault: vault.address, newOwner: evmAddress("0x1234567890abcdef1234567890abcdef12345678"),});
// …
Finally, send the transaction.
- React
- TypeScript
- GraphQL
Use the useSendTransaction hook for the wallet library of your choice to send the transaction.
Viem
import { useWalletClient } from "wagmi";import { useVaultTransferOwnership } from "@aave/react";import { useSendTransaction } from "@aave/react/viem";
// …
const { data: walletClient } = useWalletClient();
const [transferOwnership, transferringOwnership] = useVaultTransferOwnership();const [sendTransaction, sending] = useSendTransaction(walletClient);
const loading = transferringOwnership.loading || sending.loading;const error = transferringOwnership.error || sending.error;
// …
const result = await transferOwnership({ // …}).andThen(sendTransaction);
if (result.isErr()) { console.error("Transfer ownership failed:", result.error);} else { console.log("Transfer ownership successful with hash:", result.value);}