> For the complete documentation index, see [llms.txt](https://docs.metalex.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metalex.tech/building-on-the-protocol/reference/contracts/lexscrowlite.md).

# LeXscroWLite

LeXscroWLite is the atomic deal-closing escrow. It is implemented as the **`LexScrowStorage` library**, linked into the deal and round managers; the repository has no standalone `LeXscroWLite.sol` contract.

* [`src/storage/LexScrowStorage.sol`](https://github.com/MetaLex-Tech/cybercorps-contracts/blob/develop/src/storage/LexScrowStorage.sol) is the escrow library: `Escrow` and `Token` structs, `EscrowStatus` (`PENDING → PAID → FINALIZED`, or `VOIDED`), per-escrow `ICondition` lists, payment intake (`handleCounterPartyPayment`, with exact-amount checks against fee-on-transfer tokens), `finalizeEscrow` (asset delivery plus platform-fee distribution), `voidAndRefund`, and `conditionCheck`. The library declares the escrow events (`DealPaidAt`, `DealVoidedAt`, `DealFinalizedAt`, `FeeDistributed`). Linked library functions run in the manager's context by `DELEGATECALL`, so those logs come from the manager's address.
* [`src/interfaces/ILexScrowStorage.sol`](https://github.com/MetaLex-Tech/cybercorps-contracts/blob/develop/src/interfaces/ILexScrowStorage.sol) is the interface both managers implement: the escrow views (`getEscrowDetails`, `conditionCheck`), the fee hooks each manager supplies (`computeFee`, `getPlatformPayable`), and the shared `AgreementConditionsNotMet` error.

Both managers expose the escrow on their own proxies:

* [`DealManager`](/building-on-the-protocol/reference/contracts/dealmanager.md) escrows payment and Ledger Entry Token (LET) effects across a deal's `proposeDeal` → `signDealAndPay` → `finalizeDeal` lifecycle, with `signToVoid`, `revokeDeal`, `voidExpiredDeal` and `refundVoidedDeal` for stale or voided deals. It runs a parallel `SecondaryEscrow` for secondary-trade settlements. Primary escrows pay the DealManager's primary fee; secondary settlements pay its separate secondary fee.
* [`RoundManager`](/building-on-the-protocol/reference/contracts/roundmanager.md) does the same across `submitEOI` → `allocate` / `reject` / `recallEOI`.

On each, `getEscrowDetails(agreementId)` returns the `Escrow` struct and `conditionCheck(agreementId)` evaluates the attached conditions. Both managers also implement `onERC721Received` / `onERC1155Received`, so assets can be safe-transferred into escrow.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.metalex.tech/building-on-the-protocol/reference/contracts/lexscrowlite.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
