🔄Protocol Interoperability

Labyrinth protocol is designed to be interoperable with most of the protocols without requiring any changes in the protocol integrating Labyrinth. 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 ConvertProxy. ConvertProxy contracts are simple state-less 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 convert functionality or operation. In Solidity, it can be implemented by inheriting the interface IConvertProxy.

interface IConvertProxy {
    function convert(
        uint24[] calldata inAssetIds,
        uint256[] calldata inValues,
        bytes calldata payload
    ) external payable virtual returns (uint24[] memory outAssetIds, uint256[] memory outValues);

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 input asset to another asset called 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 convert function of a ConvertProxy contract is called via delegatecall with all the required input tokens/assets already in balance. The implementation of the convert 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 be already deployed, remains the same. No change is required in the already deployed code. Only a standalone proxy contract, acting as a logic layer of communication between Labyrinth and their protocol, needs to be written.

See What is Labyrinth SDK? for developer docs.

Last updated