# 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](/vaults/simple-earn/data#fetching-a-single-vault) first; this page uses the following vault in its examples:

```ts title="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

> [!NOTE]
> 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.

<tabgroup>
<tab label="React">

```tsx title="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
});

// …
```

</tab>
<tab label="TypeScript">

```ts title="Set Fee"
import { bigDecimal } from "@aave/client";
import { vaultSetFee } from "@aave/client/actions";

import { client } from "./client";

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

// …
```

```ts title="client.ts"
import { AaveClient } from "@aave/client";

export const client = AaveClient.create();
```

</tab>
<tab label="GraphQL">

```graphql title="Query"
query {
  vaultSetFee(
    request: {
      chainId: 1
      vault: "0x1234567890abcdef1234567890abcdef12345678"
      newFee: "15"
    }
  ) {
    to
    from
    data
    value
    chainId
  }
}
```

</tab>
</tabgroup>
### 2. Send the Fee Update

Finally, send the transaction.

- **React**: Use the `useSendTransaction` hook for the [wallet library of your choice](/aave-v3/getting-started/react#send-aave-transactions) to send the transaction.
- **TypeScript**: Use `sendWith` for your [chosen wallet library](/aave-v3/getting-started/typescript#send-aave-transactions) 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.

<tabgroup>
<tab label="React">

```tsx title="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);
}
```

</tab>
<tab label="TypeScript">

```ts title="Viem"
import { vaultSetFee } from "@aave/client/actions";
import { sendWith } from "@aave/client/viem";

import { client } from "./client";
import { wallet } from "./wallet";

const result = await vaultSetFee(client, {
  // …
})
  .andThen(sendWith(wallet))
  .andThen(client.waitForTransaction);

if (result.isErr()) {
  console.error("Set fee failed:", result.error);
} else {
  console.log("Set fee successful:", result.value);
}
```

```ts title="wallet.ts"
import { createWalletClient, http, type Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { mainnet } from "viem/chains";

export const wallet = createWalletClient({
  account: privateKeyToAccount(process.env.PRIVATE_KEY as Hex),
  chain: mainnet,
  transport: http(),
});
```

</tab>
<tab label="GraphQL">

```json title="TransactionRequest"
{
  "data": {
    "vaultSetFee": {
      "to": "0x1234567890abcdef1234567890abcdef12345678",
      "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "data": "0x69fe0e2d000000000000000000000000000000000000000000000000000000000000000f",
      "value": "0",
      "chainId": 1
    }
  }
}
```

</tab>
</tabgroup>
## Withdraw Fees

Withdraw accumulated fees from your vault (vault owner only).

> [!NOTE]
> 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.

<tabgroup>
<tab label="React">

```tsx title="Withdraw Exact Amount"
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
});

// …
```

```tsx title="Withdraw Max Amount"
import { useVaultWithdrawFees } from "@aave/react";

// …

const [withdrawFees, withdrawingFees] = useVaultWithdrawFees();

const result = await withdrawFees({
  chainId: vault.chainId,
  vault: vault.address,
  amount: {
    max: true,
  },
  // sendTo: evmAddress("0x1234…"), if different from vault owner
});

// …
```

</tab>
<tab label="TypeScript">

```ts title="Withdraw Exact Amount"
import { bigDecimal } from "@aave/client";
import { vaultWithdrawFees } from "@aave/client/actions";

import { client } from "./client";

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

// …
```

```ts title="Withdraw Max Amount"
import { vaultWithdrawFees } from "@aave/client/actions";

import { client } from "./client";

const result = await vaultWithdrawFees(client, {
  chainId: vault.chainId,
  vault: vault.address,
  amount: {
    max: true,
  },
  // sendTo: evmAddress("0x1234…"), if different from vault owner
});

// …
```

```ts title="client.ts"
import { AaveClient } from "@aave/client";

export const client = AaveClient.create();
```

</tab>
<tab label="GraphQL">

```graphql title="Query"
query {
  vaultWithdrawFees(
    request: {
      chainId: 1
      vault: "0x1234567890abcdef1234567890abcdef12345678"
      amount: {
        exact: "100"
        # OR
        # max: true
      }
      # sendTo: "0x1234…", if different from vault owner
    }
  ) {
    to
    from
    data
    value
    chainId
  }
}
```

</tab>
</tabgroup>
### 2. Send the Fee Withdrawal

Finally, send the transaction.

- **React**: Use the `useSendTransaction` hook for the [wallet library of your choice](/aave-v3/getting-started/react#send-aave-transactions) to send the transaction.
- **TypeScript**: Use `sendWith` for your [chosen wallet library](/aave-v3/getting-started/typescript#send-aave-transactions) 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.

<tabgroup>
<tab label="React">

```tsx title="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);
}
```

</tab>
<tab label="TypeScript">

```ts title="Viem"
import { vaultWithdrawFees } from "@aave/client/actions";
import { sendWith } from "@aave/client/viem";

import { client } from "./client";
import { wallet } from "./wallet";

const result = await vaultWithdrawFees(client, {
  // …
})
  .andThen(sendWith(wallet))
  .andThen(client.waitForTransaction);

if (result.isErr()) {
  console.error("Withdraw fees failed:", result.error);
} else {
  console.log("Withdraw fees successful:", result.value);
}
```

```ts title="wallet.ts"
import { createWalletClient, http, type Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { mainnet } from "viem/chains";

export const wallet = createWalletClient({
  account: privateKeyToAccount(process.env.PRIVATE_KEY as Hex),
  chain: mainnet,
  transport: http(),
});
```

</tab>
<tab label="GraphQL">

```json title="TransactionRequest"
{
  "data": {
    "vaultWithdrawFees": {
      "to": "0x1234567890abcdef1234567890abcdef12345678",
      "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "data": "0xad3b1b47000000000000000000000000742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b12340000000000000000000000000000000000000000000000000000000005f5e100",
      "value": "0",
      "chainId": 1
    }
  }
}
```

</tab>
</tabgroup>
## 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.

<tabgroup>
<tab label="React">

```tsx title="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"),
});

// …
```

</tab>
<tab label="TypeScript">

```ts title="Transfer Ownership"
import { evmAddress } from "@aave/client";
import { vaultTransferOwnership } from "@aave/client/actions";

import { client } from "./client";

const result = await vaultTransferOwnership(client, {
  chainId: vault.chainId,
  vault: vault.address,
  newOwner: evmAddress("0x9876543210fedcba9876543210fedcba98765432"),
});

// …
```

```ts title="client.ts"
import { AaveClient } from "@aave/client";

export const client = AaveClient.create();
```

</tab>
<tab label="GraphQL">

```graphql title="Query"
query {
  vaultTransferOwnership(
    request: {
      chainId: 1
      vault: "0x1234567890abcdef1234567890abcdef12345678"
      newOwner: "0x9876543210fedcba9876543210fedcba98765432"
    }
  ) {
    to
    from
    data
    value
    chainId
  }
}
```

</tab>
</tabgroup>
### 2. Send the Ownership Transfer

Finally, send the transaction.

- **React**: Use the `useSendTransaction` hook for the [wallet library of your choice](/aave-v3/getting-started/react#send-aave-transactions) to send the transaction.
- **TypeScript**: Use `sendWith` for your [chosen wallet library](/aave-v3/getting-started/typescript#send-aave-transactions) 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.

<tabgroup>
<tab label="React">

```tsx title="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);
}
```

</tab>
<tab label="TypeScript">

```ts title="Viem"
import { vaultTransferOwnership } from "@aave/client/actions";
import { sendWith } from "@aave/client/viem";

import { client } from "./client";
import { wallet } from "./wallet";

const result = await vaultTransferOwnership(client, {
  // …
})
  .andThen(sendWith(wallet))
  .andThen(client.waitForTransaction);

if (result.isErr()) {
  console.error("Transfer ownership failed:", result.error);
} else {
  console.log("Transfer ownership successful:", result.value);
}
```

```ts title="wallet.ts"
import { createWalletClient, http, type Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { mainnet } from "viem/chains";

export const wallet = createWalletClient({
  account: privateKeyToAccount(process.env.PRIVATE_KEY as Hex),
  chain: mainnet,
  transport: http(),
});
```

</tab>
<tab label="GraphQL">

```json title="TransactionRequest"
{
  "data": {
    "vaultTransferOwnership": {
      "to": "0x1234567890abcdef1234567890abcdef12345678",
      "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "data": "0xf2fde38b0000000000000000000000009876543210fedcba9876543210fedcba98765432",
      "value": "0",
      "chainId": 1
    }
  }
}
```

</tab>
</tabgroup>
