Vault Management

Manage your deployed vaults with fee configuration and revenue collection.

Set Vault Fee

Update the performance fee for your vault (vault owner only).

1

Identify the Vault

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.05",    formatted: "5", // 5% performance fee  },  totalFeeRevenue: {    __typename: "TokenAmount",    amount: {      __typename: "DecimalValue",      value: "1250.75", // Total fees collected      // …    },    // …  },  // …};

You must be the vault owner to update the fee.

2

Prepare the Transaction Request

Next, create the transaction request for updating the vault fee.

Use the useVaultSetFee hook to create the transaction request for updating the vault fee.

Set Fee
import { useWalletClient } from "wagmi";import { useVaultSetFee, bigDecimal, evmAddress } from "@aave/react";
// …
const { data: walletClient } = useWalletClient();
const [setFee, settingFee] = useVaultSetFee();
const execute = async () => {  const result = await setFee({    chainId: vault.chainId,    vault: vault.address,    newFee: bigDecimal(15), // 15% performance fee  });
  // …};

3

Send the Transaction

Finally, send the transaction.

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 execute = async () => {  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.

1

Identify the Vault

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.

2

Prepare the Transaction Request

Next, create the transaction request for withdrawing fees.

Use the useVaultWithdrawFees hook to create the transaction request for withdrawing fees.

import { useWalletClient } from "wagmi";import { useVaultWithdrawFees, bigDecimal, evmAddress } from "@aave/react";
// …
const { data: walletClient } = useWalletClient();
const [withdrawFees, withdrawingFees] = useVaultWithdrawFees();
const execute = async () => {  const result = await withdrawFees({    chainId: vault.chainId,    vault: vault.address,    amount: {      exact: bigDecimal(1000), // 1000 USDC worth of fees    },    // sendTo: evmAddress("0x1234…"), if different from vault owner  });
  // …};

3

Send the Transaction

Finally, send the transaction.

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 execute = async () => {  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);  }};