> For the complete documentation index, see [llms.txt](https://docs.zama.org/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/protocol/confidential-swap/reference/contract-interface.md).

# Contract interface

Every entry point a maker or market maker calls on the ConfidentialSwap proxy, who can call it, and when.

Every entry point lives on the `ConfidentialSwap` proxy. Take the address from [Contract addresses](/protocol/confidential-swap/reference/addresses.md) rather than hard-coding one — the proxy address is stable, but deployments are replaced.

This page covers the surface a maker or a market maker calls. Protocol administration is out of scope.

## Who can call what

| Role                | What it can do                                                                                                                                                       |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Anyone              | Create an intent, resolve an auction, reclaim an expired intent                                                                                                      |
| `MARKET_MAKER_ROLE` | Quote and settle. Granting or revoking it redeploys the protocol decryption context, so a market maker can only act on intents created after it was granted the role |
| Compliance address  | Decryption rights over the intent. An address, not a callable role                                                                                                   |

Intent creation can additionally be gated by a **maker gateway**. When one is configured, only allowlisted addresses can create intents and everyone else is rejected with `ProtocolAccess__MakerNotAllowed`. When none is set, creation is open.

Trading can be paused. All lifecycle calls revert with `EnforcedPause` while it is.

## Intent lifecycle

| Function                                        | Who                                                                             | When                                                                                   |
| ----------------------------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `createIntent(intent, inputProof)`              | anyone, or gated by the maker gateway                                           | not paused                                                                             |
| `quoteIntent(intentId, eQuotes, inputProof)`    | market makers delegated on the intent                                           | `block ≤ quotingEndsAtBlock` and not resolved                                          |
| `resolveQuoting(intentId)`                      | anyone                                                                          | after the quoting window, or once every snapshotted market maker has quoted. Once only |
| `settleIntent(intentId)`                        | only the winning market maker settles; any other market maker's call is a no-op | the intent is resolved and `block ≤ settlementEndsAtBlock`                             |
| `reclaimExpiredIntent(intentId, noWinnerProof)` | anyone; funds return to the maker                                               | see [How it works](/protocol/confidential-swap/protocol/how-it-works.md#5-reclaim)     |

Settling requires an initialized confidential balance on **every** asset the bundle touches, not only the ones the trade moves — otherwise the call reverts with `ConfidentialSwap__ConfidentialBalanceNotInitialized`. [Protecting your privacy](/protocol/confidential-swap/protocol/privacy.md) explains why.

### Reading an intent

| Function                              | Returns                                                                                                        |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `getIntent(intentId)`                 | The full intent: candidate orders, encrypted fields, windows, delegation context, resolution and reclaim flags |
| `numberOfIntents()`                   | Total intents created — ids are sequential from one, so this is also the highest id                            |
| `getIndexMask(intentId, marketMaker)` | That market maker's one-time-pad mask, or an uninitialized handle if it never quoted                           |

## Pairs

Pairs are admin-curated and change without a redeployment, so read them from the contract rather than hard-coding.

| Function                                            | Returns                                  |
| --------------------------------------------------- | ---------------------------------------- |
| `getActivePairIds()`                                | Every currently active pair id           |
| `getActivePairCount()` · `getActivePairIdAt(index)` | The same set, read by index              |
| `getPair(pairId)`                                   | `{ asset0, asset1, feeShift }`           |
| `isActivePair(pairId)`                              | Whether the pair can be traded right now |
| `computePairId(asset0, asset1)`                     | The id for a pair you already know. Pure |

Assets in a pair are stored in canonical ascending address order — `asset0` is the lower address. `feeShift` is the pair's fee, explained in [Fees and the slippage floor](/protocol/confidential-swap/protocol/fees.md).

## Bounds

| Constant                                       | Meaning                                           |
| ---------------------------------------------- | ------------------------------------------------- |
| `MIN_PERIOD()`                                 | Minimum quoting or settlement duration, in blocks |
| `maxQuotingPeriod()` · `maxSettlementPeriod()` | Maximum durations you may request on an intent    |

{% hint style="info" %}
**These are mutable.** Maximum periods, pair fees, and the maker gateway can all change without the proxy address changing. Read the ones that matter to you from chain rather than trusting a documented value.
{% endhint %}

## The market-maker set

Market makers are on-chain state, not configuration. Query the current set rather than relying on a published list:

```solidity
getRoleMembers(MARKET_MAKER_ROLE())
```

Note that membership at the time you read it is not the same as membership snapshotted on an older intent. Only market makers delegated on an intent's own decryption context can quote or settle it.

An intent cannot be created while the set is empty. An intent can also restrict itself to a chosen subset: every address on that list must hold the role at creation, and only those market makers can quote and settle it.


---

# 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.zama.org/protocol/confidential-swap/reference/contract-interface.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.
