Protocol Integration SDK
Tycho Protocol SDK is a library to integrate DEXs and other onchain liquidity protocols into Tycho.
Integration Process
To integrate with Tycho, you need to provide 3 components:
Protocol logic: Provides simulations of the protocols logic.
Indexing: Provide access to the protocol state that the simulation needs.
Execution: Define how to encode and execute swaps against your protocol.
To propose an integration, create a pull request in this repository with the above components implemented.
Protocol Logic
Tycho currently exposes two integration modes to specify the protocols' underlying logic:
VM Integration: This integration type requires implementing an adapter interface in any language that compiles to the respective VM byte code. This SDK provides the interface only in Solidity. Read more here.
Native Rust Integration (coming soon): Implement a Rust trait that describes the protocol logic.
Indexing
Provide a substreams package that emits a specified set of messages. If your protocol already has a substreams package, you can adjust it to emit the required messages.
VM Integration Currently the only supported integration is for EVM protocols to complement the Solidity protocol logic. Read more here.
Native Integration (coming soon): Complements the native Rust protocol logic.
Execution
To let solvers execute over your protocol, implement the SwapExecutor
and SwapStructEncoder
interfaces.
SwapExecutor: Component to swap over liquidity pools. Handles token approvals, manages input/output amounts, and executes securely and gas-efficiently. You need to implement your own SwapExecutor
(Solidity contract), tailored to your protocol's logic.
SwapStructEncoder: Implement a SwapStructEncoder
Python class, compatible with your SwapExecutor,
formats input/output tokens, pool addresses, and other parameters correctly for the SwapExecutor
.
Last updated