# Reserves

### Reserves <a href="#reserves" id="reserves"></a>

Reserves are a balance of the base or collateral asset, stored internally in the protocol, which automatically protect users from bad debt. Reserves can also be withdrawn or used through the governance process.

Reserves are generated in two ways: the difference in interest paid by borrowers, and earned by suppliers of the base asset, accrue as reserves into the protocol. Second, the [liquidation](https://docs.compound.finance/liquidation/#liquidation) process uses, and can add to, protocol reserves based on the [target reserve](https://docs.compound.finance/liquidation/#target-reserves) level set by governance.

#### Get Base Asset Reserves <a href="#get-base-asset-reserves" id="get-base-asset-reserves"></a>

This function returns the amount of protocol reserves for the base asset as an integer.

```solidity
function getReserves() public view returns (int)
```

* `RETURNS`: The amount of base asset stored as reserves in the protocol as an unsigned integer scaled up by 10 to the “decimals” integer in the asset’s contract.

#### Get Collateral Asset Reserves <a href="#get-collateral-asset-reserves" id="get-collateral-asset-reserves"></a>

This function returns the amount of protocol reserves for the specified collateral asset as an integer.

```solidity
function getCollateralReserves(address asset) public view returns (uint)
```

* `RETURNS`: The amount of collateral asset stored as reserves in the protocol as an unsigned integer scaled up by 10 to the “decimals” integer in the collateral asset’s contract.

#### Target Reserves <a href="#target-reserves" id="target-reserves"></a>

This immutable value represents the target amount of reserves of the base token. If the protocol holds greater than or equal to this amount of reserves, the [*buyCollateral*](https://docs.compound.finance/liquidation/#buy-collateral) function can no longer be successfully called.

```solidity
function targetReserves() public view returns (uint)
```

* `RETURN`: The target reserve value of the base asset as an integer, scaled up by 10 to the “decimals” integer in the base asset’s contract.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://seahorsefi.gitbook.io/seahorsefi/protocol/liquidation/reserves.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
