Skip to Content
docs

Savings GHO (sGHO)

Savings GHO (sGHO) is a savings product for the GHO stablecoin, built as a native ERC-4626 vault and deployed on Ethereum mainnet. Users deposit GHO into the vault and receive sGHO shares that steadily increase in GHO value as yield accrues from an on-chain rate. Deposits and withdrawals are instant, with no cooldown period, no slashing risk, and no rehypothecation of deposited funds.

Contract: 0xE175…ca1d (Ethereum Mainnet)

sGHO replaces the legacy Merit-based sGHO contract. To earn the current rate, withdraw GHO from the legacy contract and deposit it into the new vault. See Legacy sGHO.

Vault State

Fetch the current state of the sGHO vault, including rates, totals, and an optional user position.

Use the useSghoVault hook in React, the sghoVault action in TypeScript, or the sghoVault query in GraphQL to read vault data and an optional user position.

In React, the hook supports both a loading state and React Suspense.

const { data, loading, error } = useSghoVault({
  chainId: chainId(1),
  user: evmAddress("0x742d35cc…"), // optional
});

Then read the vault state.

Vault State
import { useSghoVault, chainId, evmAddress } from "@aave/react";
import { useAccount } from "wagmi";

// …

const { address } = useAccount();

const { data, loading, error } = useSghoVault({
  chainId: chainId(1),
  user: address ? evmAddress(address) : undefined,
});

if (loading) return <p>Loading…</p>;
if (error) return <p>Error: {error.message}</p>;

// data.totalAssets       - total GHO locked in the vault
// data.targetRate        - current fixed APR
// data.supplyCap         - maximum GHO that can be deposited
// data.paused            - whether deposits and withdrawals are blocked
// data.user?.shares      - user's sGHO shares balance
// data.user?.balance     - GHO value of the user's shares
// data.user?.maxDeposit  - max GHO the user can deposit
// data.user?.maxWithdraw - max GHO the user can withdraw

Deposit GHO

Deposit GHO into the sGHO vault to start earning yield.

1. Preview the Deposit

Returns the number of sGHO shares that would be minted for a given GHO deposit amount.

In React, the useSghoVaultPreviewDeposit hook supports both a loading state and React Suspense.

const { data, loading, error } = useSghoVaultPreviewDeposit({
  amount: "1000",
  chainId: chainId(1),
});

Then preview the deposit.

Preview Deposit
import { useSghoVaultPreviewDeposit, chainId } from "@aave/react";

// …

const { data, loading, error } = useSghoVaultPreviewDeposit({
  amount: "1000", // GHO to deposit
  chainId: chainId(1),
});

if (loading) return <p>Loading…</p>;
if (error) return <p>Error: {error.message}</p>;

// data: DecimalValue - sGHO shares to be minted

2. Prepare the Deposit Execution Plan

Use the useSghoVaultDeposit hook in React, the sghoVaultDeposit action in TypeScript, or the sghoVaultDeposit query in GraphQL to create the execution plan for depositing GHO.

Deposit GHO
import { useWalletClient } from "wagmi";
import { useSghoVaultDeposit, bigDecimal, evmAddress, chainId } from "@aave/react";

// …

const { data: walletClient } = useWalletClient();

const [deposit, depositing] = useSghoVaultDeposit();

const execute = async () => {
  const result = await deposit({
    amount: {
      value: bigDecimal(1000), // 1000 GHO
    },
    depositor: evmAddress(walletClient!.account.address),
    chainId: chainId(1),
    // sharesRecipient: evmAddress("0x1234…"), // defaults to depositor
  });

  // …
};

3. Process the Deposit Execution Plan

Viem
import { useWalletClient } from "wagmi";
import { errAsync, useSghoVaultDeposit } from "@aave/react";
import { useSendTransaction } from "@aave/react/viem";

// …

const { data: walletClient } = useWalletClient();

const [deposit, depositing] = useSghoVaultDeposit();
const [sendTransaction, sending] = useSendTransaction(walletClient);

const loading = depositing.loading || sending.loading;
const error = depositing.error || sending.error;

// …

const execute = async () => {
  const result = await deposit({
    // …
  }).andThen((plan) => {
    switch (plan.__typename) {
      case "TransactionRequest":
        return sendTransaction(plan);

      case "ApprovalRequired":
        return sendTransaction(plan.approval).andThen(() =>
          sendTransaction(plan.originalTransaction)
        );

      case "InsufficientBalanceError":
        return errAsync(
          new Error(`Insufficient balance: ${plan.required.value} required.`)
        );
    }
  });

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

In GraphQL, if the response is a TransactionRequest, send it directly using the wallet associated with the from address.

TransactionRequest
{
  "data": {
    "sghoVaultDeposit": {
      "__typename": "TransactionRequest",
      "to": "0x1234567890abcdef1234567890abcdef12345678",
      "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "data": "0x6e553f65000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "value": "0",
      "chainId": 1,
      "operation": "SGHO_VAULT_DEPOSIT"
    }
  }
}

If the response is an ApprovalRequired, send the approval transaction first, then the originalTransaction.

ApprovalRequired
{
  "data": {
    "sghoVaultDeposit": {
      "__typename": "ApprovalRequired",
      "reason": "Insufficient allowance for ERC-20 token transfer",
      "requiredAmount": { "value": "1000.0", "decimals": 18 },
      "currentAllowance": { "value": "0.0", "decimals": 18 },
      "approval": {
        "to": "0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f",
        "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
        "data": "0x095ea7b3000000000000000000000000123456789…",
        "value": "0",
        "chainId": 1,
        "operation": null
      },
      "originalTransaction": {
        "to": "0x1234567890abcdef1234567890abcdef12345678",
        "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
        "data": "0x6e553f65000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
        "value": "0",
        "chainId": 1,
        "operation": "SGHO_VAULT_DEPOSIT"
      }
    }
  }
}

If the response is an InsufficientBalanceError, inform the user they don’t have enough GHO to deposit the requested amount.

InsufficientBalanceError
{
  "data": {
    "sghoVaultDeposit": {
      "__typename": "InsufficientBalanceError",
      "required": { "value": "1000.0", "decimals": 18 },
      "available": { "value": "750.0", "decimals": 18 }
    }
  }
}

Redeem sGHO

Redeem sGHO shares for GHO. Withdrawals are atomic with no cooldown period.

1. Preview the Redeem

Returns the GHO amount that would be received for redeeming a given number of sGHO shares.

In React, the useSghoVaultPreviewRedeem hook supports both a loading state and React Suspense.

const { data, loading, error } = useSghoVaultPreviewRedeem({
  amount: "995",
  chainId: chainId(1),
});

Then preview the redemption.

Preview Redeem
import { useSghoVaultPreviewRedeem, chainId } from "@aave/react";

// …

const { data, loading, error } = useSghoVaultPreviewRedeem({
  amount: "995", // sGHO shares to redeem
  chainId: chainId(1),
});

if (loading) return <p>Loading…</p>;
if (error) return <p>Error: {error.message}</p>;

// data: DecimalValue - GHO amount to be received

2. Prepare the Redeem Execution Plan

Use the useSghoVaultRedeemShares hook in React, the sghoVaultRedeemShares action in TypeScript, or the sghoVaultRedeemShares query in GraphQL to create the execution plan. Pass maxRedeem: true to redeem all shares, or shares for an exact amount.

Redeem Shares
import { useWalletClient } from "wagmi";
import {
  useSghoVaultRedeemShares,
  bigDecimal,
  evmAddress,
  chainId,
} from "@aave/react";

// …

const { data: walletClient } = useWalletClient();

const [redeemShares, redeeming] = useSghoVaultRedeemShares();

const execute = async () => {
  const result = await redeemShares({
    amount: { maxRedeem: true }, // or: { shares: bigDecimal(1000) }
    sharesOwner: evmAddress(walletClient!.account.address),
    chainId: chainId(1),
    // recipient: evmAddress("0x1234…"), // defaults to sharesOwner
  });

  // …
};

3. Process the Redeem Execution Plan

Viem
import { useWalletClient } from "wagmi";
import { errAsync, useSghoVaultRedeemShares } from "@aave/react";
import { useSendTransaction } from "@aave/react/viem";

// …

const { data: walletClient } = useWalletClient();

const [redeemShares, redeeming] = useSghoVaultRedeemShares();
const [sendTransaction, sending] = useSendTransaction(walletClient);

const loading = redeeming.loading || sending.loading;
const error = redeeming.error || sending.error;

// …

const execute = async () => {
  const result = await redeemShares({
    // …
  }).andThen((plan) => {
    switch (plan.__typename) {
      case "TransactionRequest":
        return sendTransaction(plan);

      case "InsufficientBalanceError":
        return errAsync(
          new Error(
            `Insufficient balance: ${plan.required.value} is the maximum redemption allowed.`
          )
        );
    }
  });

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

In GraphQL, if the response is a TransactionRequest, send it directly using the wallet associated with the from address.

TransactionRequest
{
  "data": {
    "sghoVaultRedeemShares": {
      "__typename": "TransactionRequest",
      "to": "0x1234567890abcdef1234567890abcdef12345678",
      "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "data": "0xba087652000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "value": "0",
      "chainId": 1,
      "operation": "SGHO_VAULT_REDEEM_SHARES"
    }
  }
}

If the response is an InsufficientBalanceError, inform the user they don’t have enough sGHO shares to redeem.

InsufficientBalanceError
{
  "data": {
    "sghoVaultRedeemShares": {
      "__typename": "InsufficientBalanceError",
      "required": { "value": "1000.0", "decimals": 18 },
      "available": { "value": "750.0", "decimals": 18 }
    }
  }
}

Legacy sGHO

The Merit-based sGHO contract is being phased out, and its reward rate steps down to 0%. Withdraw GHO and deposit into the new ERC-4626 sGHO vault.

The following API covers the legacy sGHO contract (Merit-based reward distribution via Merkl).

Balance

Retrieve the balance of a user’s sGHO. Use the useSavingsGhoBalance hook in React, the savingsGhoBalance action in TypeScript, or the savingsGhoBalance query in GraphQL to fetch the balance of a user’s sGHO.

In React, the hook supports both a loading state and React Suspense.

const { data, loading, error } = useSavingsGhoBalance({
  user: evmAddress("0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234"),
});

Then fetch the balance of a user’s sGHO.

sGHO Balance
import { useSavingsGhoBalance, evmAddress } from "@aave/react";

// …

const { data, loading, error } = useSavingsGhoBalance({
  user: evmAddress("0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234"),
});

if (loading) {
  return <p>Loading sGHO balance…</p>;
}

if (error) {
  return <p>Error: {error.message}</p>;
}

// data: TokenAmount

Withdraw GHO

Withdraw sGHO to GHO instantly with no cooldown period. You can still claim any previous rewards.

Follow these steps to withdraw sGHO to GHO:

1. Prepare the Withdraw Execution Plan

First, prepare the execution plan for the withdrawal operation. Use the useSavingsGhoWithdraw hook in React, the savingsGhoWithdraw action in TypeScript, or the savingsGhoWithdraw query in GraphQL to create the execution plan for withdrawing sGHO to GHO.

Withdraw GHO
import { useWalletClient } from "wagmi";
import { useSavingsGhoWithdraw, bigDecimal, evmAddress } from "@aave/react";

// …

const { data: walletClient } = useWalletClient();

const [withdraw, withdrawing] = useSavingsGhoWithdraw();

const execute = async () => {
  const result = await withdraw({
    amount: {
      exact: bigDecimal(1000), // 1000 sGHO
    },
    sharesOwner: evmAddress(walletClient!.account.address),
    // recipient: evmAddress("0x1234…"), if different from sharesOwner
  });

  // …
};

2. Process the Withdraw Execution Plan

Finally, handle the execution plan.

Viem
import { useWalletClient } from "wagmi";
import { errAsync, useSavingsGhoWithdraw } from "@aave/react";
import { useSendTransaction } from "@aave/react/viem";

// …

const { data: walletClient } = useWalletClient();

const [withdraw, withdrawing] = useSavingsGhoWithdraw();
const [sendTransaction, sending] = useSendTransaction(walletClient);

const loading = withdrawing.loading || sending.loading;
const error = withdrawing.error || sending.error;

// …

const execute = async () => {
  const result = await withdraw({
    // …
  }).andThen((plan) => {
    switch (plan.__typename) {
      case "TransactionRequest":
        return sendTransaction(plan);

      case "ApprovalRequired":
        return sendTransaction(plan.approval).andThen(() =>
          sendTransaction(plan.originalTransaction)
        );

      case "InsufficientBalanceError":
        return errAsync(
          new Error(
            `Insufficient balance to withdraw: ${plan.required.value} is the maximum withdrawal allowed.`
          )
        );
    }
  });

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

In GraphQL, if the response is a TransactionRequest, you can send it directly using the wallet associated with the from address.

TransactionRequest
{
  "data": {
    "savingsGhoWithdraw": {
      "__typename": "TransactionRequest",
      "to": "0x1234567890abcdef1234567890abcdef12345678",
      "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "data": "0x6e553f65000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
      "value": "0",
      "chainId": 1,
      "operation": "SAVINGS_GHO_WITHDRAW"
    }
  }
}

If the response is an ApprovalRequired, you must first send the approval transaction. Once it succeeds, you can then send the originalTransaction.

ApprovalRequired
{
  "data": {
    "savingsGhoWithdraw": {
      "__typename": "ApprovalRequired",
      "reason": "Insufficient allowance for ERC-20 token transfer",
      "requiredAmount": {
        "value": "1000.0",
        "decimals": 18
      },
      "currentAllowance": {
        "value": "0.0",
        "decimals": 18
      },
      "approval": {
        "to": "0x1a88Df1cFe15Af22B3c4c783D4e6F7F9e0C1885d",
        "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
        "data": "0x095ea7b3000000000000000000000000123456789…",
        "value": "0",
        "chainId": 1,
        "operation": null
      },
      "originalTransaction": {
        "to": "0x1234567890abcdef1234567890abcdef12345678",
        "from": "0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
        "data": "0x6e553f65000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234",
        "value": "0",
        "chainId": 1,
        "operation": "SAVINGS_GHO_WITHDRAW"
      }
    }
  }
}

If the response is an InsufficientBalanceError, inform the user that they don’t have enough balance to withdraw the requested amount.

InsufficientBalanceError
{
  "data": {
    "savingsGhoWithdraw": {
      "__typename": "InsufficientBalanceError",
      "required": {
        "value": "1000.0",
        "decimals": 18
      },
      "available": {
        "value": "750.0",
        "decimals": 18
      }
    }
  }
}

Claim Incentives

Users who deposited into the legacy sGHO become eligible for rewards distributed through Merkl.

Claim these rewards separately. They are not added to the sGHO balance.

Users can claim rewards in two ways:

  • Through the ACI Merit UI for a simple interface to view and claim rewards
  • Using the SDK

Follow these steps to claim rewards using the SDK:

1. Fetch the Claimable Rewards

First, determine if a user has claimable rewards. Use the useUserMeritRewards hook in React, the userMeritRewards action in TypeScript, or the userMeritRewards query in GraphQL to fetch the user’s sGHO claimable rewards and the transaction to claim them.

In React, the hook supports both a loading state and React Suspense.

const { data, loading, error } = useUserMeritRewards({
  user: evmAddress("0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234"),
  chainId: chainId(1),
});

Then fetch the user’s claimable rewards and the transaction to claim them.

sGHO Rewards
import { useUserMeritRewards, evmAddress, chainId } from "@aave/react";

// …

const sGHO_ADDRESS = evmAddress("0x1a88Df1cFe15Af22B3c4c783D4e6F7F9e0C1885d");

const { data, loading, error } = useUserMeritRewards({
  user: evmAddress("0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234"),
  chainId: chainId(1),
  filter: {
    tokens: [sGHO_ADDRESS],
  },
});

if (loading) {
  return <p>Loading claimable rewards…</p>;
}

if (error) {
  return <p>Error: {error.message}</p>;
}

// data: UserMeritRewards | null

If data is null, the user has no sGHO claimable rewards.

2. Claim Rewards

Finally, if the user has claimable rewards, they can claim them by sending the transaction.

  • React: Use the useSendTransaction hook for the wallet library of your choice to send the transactions in the execution plan.
  • TypeScript: Use sendWith for your chosen wallet library.
  • GraphQL: Send the transaction request directly using the wallet associated with the from address.
Viem
import { useWalletClient } from "wagmi";
import { useUserMeritRewards } from "@aave/react";
import { useSendTransaction } from "@aave/react/viem";

// …

const { data: walletClient } = useWalletClient();
const { data } = useUserMeritRewards({
  // …
  suspense: true,
});

const [sendTransaction, sending] = useSendTransaction(walletClient);

// …

const execute = async () => {
  if (data !== null) {
    const result = await sendTransaction(data.transaction);

    if (result.isErr()) {
      console.error(result.error.message);
    } else {
      console.log("sGHO claim rewards successful with hash:", result.value);
    }
  }
};

For more details, see the GHO Savings Upgrade forum post.