# Protocol Integration

You can integrate with most of the protocols with the Veilnyx protocol, to allow anonymous transactions for the users. Your users will be using their shielded account instead of a public account to interact with your protocol.

For this, you'll have to write and deploy a stateless contract that acts as a logic layer between the Veilnyx core and the target protocol that you're integrating. We call these contracts **Adaptors**. The reason is that these contracts take input assets from the user's shielded account, convert those assets to some other (output) assets, and return these output assets to Veilnyx. The interaction basically converts from one asset to another. Some examples:

* When `WETH` with `USDC` On Uniswap, you're converting your `WETH` (input) to `USDC` (output).
* When staking `WETH` On Lido, you convert your `WETH` (input) to `wstETH` (output).
* When lending `USDT` On Aave, you convert it to `aUSDT`.

### Adaptor Contracts

These are the smart contacts that implement the `IAdaptor`interface:

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

The interface only requires the implementation of the `convert` method as seen above.&#x20;

* `inAssetIds` is the list of asset IDs of the assets given to this contract.
* `inValues` is the corresponding value of the specified asset IDs in that order.
* `payload` is an arbitrary data passed on that might be required, for example, user input for the necessary operation.

Note that `handleAssets` the function is `delegatecall`ed by the Veilnyx's `AdaptorHandler` contract. At the time of the call, the `AdaptorHandler` holder holds exactly the amount of assets that were specified by the `inAssetIds` holder and `inValues`. So, you don't need to do any ERC-20 operation like `transferFrom(...)` or anything to get the assets - you already have them.

Simply do any necessary operation within the `handleAssets(...)` method and return any output assets by returning `outAssetIds` and `outValues`. Please make sure that after performing your `convert` operation, you only have those assets (`outAssetIds`) and exactly that amount of the assets (`outValues`).

### Examples

[*UniswapV3 integration with* ](https://docs.veilnyx.com/veilnyx-sdk/integrating-with-defi-protocols)Veilnyx
