> ## Documentation Index
> Fetch the complete documentation index at: https://docs.groundtech.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate a gVault

> Connect user wallets to a Ground gVault.

After the gVault is ready, allowlist each user wallet before its first deposit.

## Before each user's first deposit

1. Your backend calls `POST /v2/gvaults/{gVaultId}/allowlist` with the user's
   wallet address.
2. Poll `GET /v2/gvaults/{gVaultId}/allowlist` until `allowed` is `true`.
3. Enable the deposit action in your app.

Never expose the Ground API key in the client or send a deposit before the
onchain access check is confirmed.

## Deposit

Have the user approve the gVault to spend its deposit token, then call:

```solidity theme={"theme":{"light":"github-light","dark":"github-dark"}}
deposit(uint256 assets, address receiver)
```

Set `receiver` to the wallet sending the transaction. The wallet receives
gVault shares directly.

## Withdraw

Read `maxWithdraw(walletAddress)` or `maxRedeem(walletAddress)` before building
an instant withdrawal. Within that limit, call the standard ERC-4626 method:

```solidity theme={"theme":{"light":"github-light","dark":"github-dark"}}
withdraw(uint256 assets, address receiver, address owner)
// or
redeem(uint256 shares, address receiver, address owner)
```

Set `owner` to the wallet sending the transaction. Instant capacity depends on
the underlying vault's current liquidity.

For a larger exit, call `requestRedeem(owner, shares)`. Ground processes the
queued redemption, and the owner later calls `claimRedeem(owner, requestId)`.

Removing a wallet from the allowlist blocks future deposits but leaves its
withdrawal access available.
