> For the complete documentation index, see [llms.txt](https://gabriel-j-shapiro.gitbook.io/metalex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gabriel-j-shapiro.gitbook.io/metalex-docs/protocol-reference/conditions.md).

# Conditions

A **condition** is a contract implementing `ICondition`. Conditions gate state transitions — issuance, scripification, de-scripification, deal close, round acceptance — on arbitrary onchain checks.

* **Interface:** [`ICondition.sol`](https://github.com/MetaLex-Tech/cybercorps-contracts/blob/develop/src/interfaces/ICondition.sol)

## The interface

```solidity
interface ICondition {
    function checkCondition(
        address _contract,
        bytes4 _functionSignature,
        bytes memory data
    ) external view returns (bool);
}
```

`checkCondition` is given the calling contract, the function selector being gated, and ABI-encoded context, and returns whether the action may proceed. Where the protocol accepts conditions — e.g. `IssuanceManager.deployCyberScrip` (`certToScripConditions`, `scripToCertConditions`), `DealManager.proposeDeal` (`conditions`), `RoundManager.submitEOI` (`conditions`) — they are passed as `address[]` / `ICondition[]`.

## Built-in conditions

The protocol ships condition contracts for common compliance checks. By name (see the source for exact contracts and constructors):

| Condition                                  | Purpose                                                                                                                                       |
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **lexchexCondition**                       | Requires a valid LeXcheX credential — wraps `ILexChex.hasValidLexCheX`. See [LexChex](/metalex-docs/protocol-reference/contracts/lexchex.md). |
| **NonUSNationalityCondition**              | A zkPassport-backed check that the address is held by a non-US person (Regulation S). See `IZKPassportVerifier`.                              |
| **IssuerApprovalRecertificationCondition** | Requires explicit issuer approval before a non-registered scrip holder can de-scripify into a fresh cyberCERT.                                |
| **OrCondition**                            | Composes child conditions with disjunctive (OR) logic.                                                                                        |

## Custom conditions

Any contract implementing `ICondition` works. Because `checkCondition` receives the calling contract, the selector, and arbitrary `data`, a condition can encode any onchain check — a token balance, a credential, an oracle reading, a governance outcome — and be attached wherever the protocol accepts a condition list.

> The built-in condition contracts live under `src/` (and `src/creds/`). This page describes the `ICondition` interface precisely; verify each built-in condition's constructor and behaviour against its source.


---

# 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://gabriel-j-shapiro.gitbook.io/metalex-docs/protocol-reference/conditions.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.
