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

# Utilisation After Deposit

> Calculate the final utilisation on the Liquidity Layer after a hypothetical deposit.

> [!NOTE]
>
> This guide uses read-only APIs from the Liquidity module. No transactions, keypairs, or ATAs required.

Use the **Liquidity** module from `@jup-ag/lend-read` to fetch real-time market data and compute how utilisation would change if you made a deposit.

**Formula:** Utilisation is the ratio of borrowed assets to supplied assets: `utilisation = totalBorrow / totalSupply`. After a deposit, supply increases while borrow stays the same: `newUtilisation = totalBorrow / (totalSupply + depositAmount)`.

**Example:** If the Liquidity Layer has \$500M supplied and \$200M borrowed (40% utilisation), a \$100M deposit would give new supply \$600M and new utilisation **33.33%** (\$200M / \$600M).

***

## Utilisation After Deposit

## 1. Import Dependencies

```bash theme={null}
npm install @solana/web3.js bn.js @jup-ag/lend-read
```

```typescript theme={null}
import { Client } from "@jup-ag/lend-read";
import { Connection, PublicKey } from "@solana/web3.js";
import BN from "bn.js";
```

## 2. Initialise Connection and Fetch Liquidity Data

Create the RPC connection and client. Use `client.liquidity.getOverallTokenData(token)` to get `totalSupply`, `totalBorrow`, and `lastStoredUtilization` for the target token (e.g. USDC).

```typescript theme={null}
const RPC_URL = "https://api.mainnet-beta.solana.com";
const connection = new Connection(RPC_URL, { commitment: "confirmed" });
const client = new Client(connection);
const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");

const data = await client.liquidity.getOverallTokenData(USDC_MINT);
const totalSupply = new BN(data.totalSupply.toString());
const totalBorrow = new BN(data.totalBorrow.toString());
```

## 3. Convert Deposit to Base Units

Express your deposit in the token's base units. For USDC (6 decimals), \$100M = `100_000_000 * 10^6`.

```typescript theme={null}
const DEPOSIT_USD = 100_000_000;
const USDC_DECIMALS = 6;
const depositAmount = new BN(DEPOSIT_USD).mul(new BN(10).pow(new BN(USDC_DECIMALS)));
```

## 4. Calculate New Utilisation

Add the deposit to supply and compute the new utilisation. Express as basis points (x 10,000) or percentage.

```typescript theme={null}
const newSupply = totalSupply.add(depositAmount);
const newUtilBps = totalBorrow.muln(10_000).div(newSupply); // basis points
const newUtilPercent = Number(newUtilBps) / 100; // e.g. 3333 → 33.33%
console.log("Final utilisation:", newUtilPercent.toFixed(2) + "%");
```

## Full code example

> [!NOTE]
>
> See [Liquidity Data & Analytics](https://developers.jup.ag/docs/lend/liquidity/analytics.md) for more on the Liquidity module and available methods.

```typescript expandable theme={null}
import { Client } from "@jup-ag/lend-read";
import { Connection, PublicKey } from "@solana/web3.js";
import BN from "bn.js";

const RPC_URL = "https://api.mainnet-beta.solana.com";
const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");

const DEPOSIT_USD = 100_000_000;
const USDC_DECIMALS = 6;
const depositAmount = new BN(DEPOSIT_USD).mul(new BN(10).pow(new BN(USDC_DECIMALS)));

function utilizationToPercent(utilizationBps: BN): string {
  return (Number(utilizationBps) / 100).toFixed(2);
}

async function main() {
  const connection = new Connection(RPC_URL, { commitment: "confirmed" });
  const client = new Client(connection);

  const data = await client.liquidity.getOverallTokenData(USDC_MINT);

  const totalSupply = new BN(data.totalSupply.toString());
  const totalBorrow = new BN(data.totalBorrow.toString());
  const currentUtilBps = new BN(data.lastStoredUtilization.toString());

  const newSupply = totalSupply.add(depositAmount);
  const newUtilBps = totalBorrow.muln(10_000).div(newSupply);

  const supplyUsd = Number(totalSupply) / 10 ** USDC_DECIMALS;
  const borrowUsd = Number(totalBorrow) / 10 ** USDC_DECIMALS;
  const depositUsd = Number(depositAmount) / 10 ** USDC_DECIMALS;

  console.log("=== USDC Liquidity Layer ===\n");
  console.log("Current state:");
  console.log(`  Total supply:     $${supplyUsd.toLocaleString()}`);
  console.log(`  Total borrow:     $${borrowUsd.toLocaleString()}`);
  console.log(`  Utilisation:      ${utilizationToPercent(currentUtilBps)}%\n`);
  console.log(`Hypothetical deposit: $${depositUsd.toLocaleString()}\n`);
  console.log("After deposit:");
  console.log(`  New total supply: $${(supplyUsd + depositUsd).toLocaleString()}`);
  console.log(`  Total borrow:     $${borrowUsd.toLocaleString()} (unchanged)`);
  console.log(`  Final utilisation: ${utilizationToPercent(newUtilBps)}%`);
}

main().catch(console.error);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.