Skip to Content
docs

Manage an Aave Simple Earn Vault

Manage your deployed vaults with fee configuration and revenue collection.

Identify the Vault

All actions below apply to a vault you own. Fetch the vault first; this page uses the following vault in its examples:

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: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      // …
    },
    // …
  },
  fee: {
    __typename: "PercentValue",
    raw: "150000000000000000000000000",
    decimals: 27,
    value: "0.15",
    formatted: "15", // 15% performance fee
  },
  totalFeeRevenue: {
    __typename: "TokenAmount",
    amount: {
      __typename: "DecimalValue",
      value: "1250.75", // Lifetime fees collected
      // …
    },
    usd: "1250.75",
    // …
  },
  feesBalance: {
    __typename: "TokenAmount",
    amount: {
      __typename: "DecimalValue",
      value: "100.00", // Fees currently available for withdrawal
      // …
    },
    usd: "100.00",
    // …
  },
  // …
};

Set Vault Fee

The fee can be 0% to 100%. Aave Labs automatically receives 50% of it.

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

1. Prepare the Fee Update

Next, create the transaction request for updating the vault fee. Use the useVaultSetFee hook in React, the vaultSetFee action in TypeScript, or the vaultSetFee query in GraphQL to create the transaction request for updating the vault fee.

Set Fee
import { useVaultSetFee, bigDecimal } from "@aave/react";

// …

const [setFee, settingFee] = useVaultSetFee();

const result = await setFee({
  chainId: vault.chainId,
  vault: vault.address,
  newFee: bigDecimal(15), // 15% performance fee
});

// …

2. Send the Fee Update

Finally, send the transaction.

  • React: Use the useSendTransaction hook for the wallet library of your choice to send the transaction.
  • TypeScript: Use sendWith for your chosen wallet library to initiate the transaction, and await indexing with client.waitForTransaction.
  • GraphQL: The response is a TransactionRequest that can be sent directly using the wallet associated with the from address.
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).

Fees are withdrawn as the reserve’s aTokens.

1. Prepare the Fee Withdrawal

Next, create the transaction request for withdrawing fees. Use the useVaultWithdrawFees hook in React, the vaultWithdrawFees action in TypeScript, or the vaultWithdrawFees query in GraphQL to create the transaction request for withdrawing fees.

import { useVaultWithdrawFees, bigDecimal } from "@aave/react";

// …

const [withdrawFees, withdrawingFees] = useVaultWithdrawFees();

const result = await withdrawFees({
  chainId: vault.chainId,
  vault: vault.address,
  amount: {
    exact: bigDecimal(100), // 100 USDC of fees
  },
  // sendTo: evmAddress("0x1234…"), if different from vault owner
});

// …

2. Send the Fee Withdrawal

Finally, send the transaction.

  • React: Use the useSendTransaction hook for the wallet library of your choice to send the transaction.
  • TypeScript: Use sendWith for your chosen wallet library to initiate the transaction, and await indexing with client.waitForTransaction.
  • GraphQL: The response is a TransactionRequest that can be sent directly using the wallet associated with the from address.
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).

1. Prepare the Ownership Transfer

Next, create the transaction request for transferring the ownership of the vault. Use the useVaultTransferOwnership hook in React, the vaultTransferOwnership action in TypeScript, or the vaultTransferOwnership query in GraphQL 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("0x9876543210fedcba9876543210fedcba98765432"),
});

// …

2. Send the Ownership Transfer

Finally, send the transaction.

  • React: Use the useSendTransaction hook for the wallet library of your choice to send the transaction.
  • TypeScript: Use sendWith for your chosen wallet library to initiate the transaction, and await indexing with client.waitForTransaction.
  • GraphQL: The response is a TransactionRequest that can be sent directly using the wallet associated with the from address.
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);
}