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

# getDepositCap

> Read the deposit supply cap and fee module info from the on-chain DCD contract

Reads the deposit supply cap and fee module information from the CommunityCodeDepositor (DCD) contract on-chain. Uses `supplyCapInBase()` and `feeModule()` to determine whether the account has a deposit cap and/or deposit fees configured.

<Info>
  Only available for accounts with both a `communityCodeDepositorAddress` and a `depositFeeModuleAddress`. Throws an `APIError` if either is missing.
</Info>

## Import

```ts theme={null}
import { getDepositCap } from '@paxoslabs/amplify-sdk'
```

## Usage

```ts theme={null}
import { getDepositCap, getVaultsByConfig, YieldType } from '@paxoslabs/amplify-sdk'

const [vault] = await getVaultsByConfig({ yieldType: YieldType.CORE, chainId: 1 })

const cap = await getDepositCap({
  vaultName: vault.name,
  chainId: 1,
  assetAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
})

console.log(cap.hasDepositCap) // true if supply cap is set and not unlimited
console.log(cap.supplyCapInBase) // bigint — raw supply cap in base asset units
console.log(cap.hasFees) // true if deposit fee module is configured
```

## Parameters

| Parameter      | Type      | Required | Description                             |
| -------------- | --------- | -------- | --------------------------------------- |
| `vaultName`    | `string`  | Yes      | Account name from `getVaultsByConfig()` |
| `chainId`      | `ChainId` | Yes      | Blockchain network ID                   |
| `assetAddress` | `Address` | Yes      | Asset address for account lookup        |

```ts theme={null}
interface GetDepositCapParams {
  vaultName: string
  chainId: ChainId
  assetAddress: Address
}
```

## Return Type

```ts theme={null}
interface DepositCapResult {
  /** Supply cap in base asset units (raw uint256 from DCD contract) */
  supplyCapInBase: bigint
  /** True when supplyCapInBase is neither 0 nor maxUint256 (unlimited) */
  hasDepositCap: boolean
  /** Deposit fee module contract address from the DCD */
  depositFeeModuleAddress: Address
  /** True if the fee module address is not the zero address */
  hasFees: boolean
}
```

## Example: Supply Cap UI

```tsx theme={null}
import { getDepositCap, getVaultsByConfig, YieldType } from '@paxoslabs/amplify-sdk'
import { formatUnits } from 'viem'

const [vault] = await getVaultsByConfig({ yieldType: YieldType.CORE, chainId: 1 })

const cap = await getDepositCap({
  vaultName: vault.name,
  chainId: 1,
  assetAddress: usdcAddress,
})

if (cap.hasDepositCap) {
  console.log(
    `Deposit cap: ${formatUnits(cap.supplyCapInBase, 6)} base units`,
  )
}
```

## Error Handling

| Error Message Pattern                   | Description                      | Resolution                                  |
| --------------------------------------- | -------------------------------- | ------------------------------------------- |
| `"Deposit cap not available for vault"` | Account has no DCD or fee module | Only accounts with fee modules support caps |
| `"No vault found"`                      | No account matches parameters    | Verify vaultName, asset, chainId            |
| `"SDK not initialized"`                 | SDK not initialized              | Call `initAmplifySDK()` first               |

## Related

* [calculateDepositFee](./calculateDepositFee) — Calculate deposit fees for an amount
* [Deposits Guide](/v0.5.3/intro/products/earn/developers/guides/deposits) — Complete deposit flow
