# 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: 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:

```
GET https://docs.veilnyx.com/technical-implementation/protocol-interoperability.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
