> For the complete documentation index, see [llms.txt](https://docs.creditcoop.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.creditcoop.xyz/developers/v1-developer-material/functions-and-methods/escrow.sol.md).

# Escrow\.sol

Core functions and methods of Escrow\.sol

* Allows a Borrower to deposit tokens as collateral for a Line of Credit
* Allows a Borrower to withdraw collateral so long as it doesn't cause the status of a Line to be LIQUIDATABLE
* Allows Arbiter to whitelist (enable) specific collateral allowed for a Line
* Allows Arbiter to liquidate collateral if the status is LIQUIDATABLE
* External calls to - Oracle.sol, LineOfCredit.sol
* Libraries - LineLib.sol, CreditLib.sol, EscrowLib.sol

<details>

<summary>External Functions</summary>

```solidity
function enableCollateral(address token) external returns (bool)
function addCollateral(uint256 amount, address token) external payable nonReentrant returns (uint256)
function getCollateralRatio() external returns (uint256)
function getCollateralValue() external returns (uint256)
function releaseCollateral(uint256 amount, address token, address to) external nonReentrant returns (uint256)
function liquidate(uint256 amount, address token, address to) external nonReentrant returns (bool)
function updateLine(address _line) external returns(bool)
function line() external view override returns(address)
function isLiquidatable() external returns(bool)
```

</details>

<details>

<summary>Methods</summary>

`function enableCollateral():` Allows an Arbiter to whitelist an ERC-20 token or ERC-4626 vault to be used as collateral

`function addCollateral():` Allows a Borrower to adds whitelisted (enabled) tokens as collateral after which the app updates the collateral ratio

`function getCollateralRatio():` Returns the ratio of the value of collateral to outstanding debt

`function getCollateralValue():` Returns the latest value of the collateral deposited by a Borrower (in USD)

`function releaseCollateral():` Allows a Borrower to withdraw any amount of collateral as long as the minimum collateral ratio is maintained.

`function liquidate():` Allows the Arbiter to liquidate collateral

`function updateLine():` Allows a Borrower to transfer (roll over) collateral to a new Line of Credit.

`function line():` Returns the address of the the current controller of the Escrow contract

`function isLiquidatable():` Returns true if the collateral ratio is lower than minimum collateral ratio

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.creditcoop.xyz/developers/v1-developer-material/functions-and-methods/escrow.sol.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
