> For the complete documentation index, see [llms.txt](https://docs.veilnyx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.veilnyx.com/technical-implementation/protocol-interoperability.md).

# Protocol Interoperability

Veilnyx protocol is designed to be interoperable with most of the protocols without requiring any changes in the protocol that integrates Veilnyx. This means users with shielded accounts will be able to perform shielded operations like swaps, staking, lending, etc., anonymously.

Interoperability with a protocol is achieved via a simple contract that we call `Adaptor`. `Adaptor` Contracts are simple stateless contracts that live on-chain to act as a proxy for interacting with a target protocol. This contract must implement a standard interface that exposes a `handleAssets` function. In Solidity, it can be implemented by inheriting the interface `IAdaptor`.

{% code lineNumbers="true" %}

```solidity
contract IAdaptor {
    function handleAssets(
        uint24[] calldata inAssetIds,
        uint256[] calldata inValues,
        bytes calldata payload
    ) external payable virtual returns (uint24[] memory outAssetIds, uint256[] memory outValues);
}
```

{% endcode %}

This reflects the fact that, in general, most asset operations, e.g. swapping, lending, staking, can be thought of as a process of converting from one asset called the input asset to another asset called the output asset. Here are a few examples:

* When swapping ETH for USDC on Uniswap, ETH (input asset) is converted to USDC (output asset).
* When supplying DAI on the AAVE market to earn interest, DAI (input asset) is essentially being converted to aDAI (output asset), the interest-bearing tokens given back in return.
* Staking ETH (input asset) on Lido results in conversion to stETH (output asset) holding which represents your stake plus rewards.

The `handleAssets` function of a `Adaptor` contract is called via `delegatecall` with all the required input tokens/assets already in balance. The implementation of this `handleAssets` is left to the developer of the integrating protocol, allowing full flexibility. The converted assets or outputs are then returned in the same function.

The developers are not required to have any specific knowledge about ZKPs. The core API of their protocol, which may already be deployed, remains the same. No change is required in the already deployed contracts. Only a standalone adaptor contract, acting as a logic layer of communication between Veilnyx and their protocol, needs to be written.

Refer [Integrating with DeFi protocols](/veilnyx-sdk/integrating-with-defi-protocols.md) example to see this in action and add a layer of compliant privacy to your protocol!


---

# 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.veilnyx.com/technical-implementation/protocol-interoperability.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.
