Adapter Pattern

Adapters are specialized, individual smart contracts that act as translators or intermediaries between the generic InfiRouter and the unique interfaces and functionalities of specific underlying DEX protocols.

  • Protocol-Specific Logic: Each Adapter contains the necessary logic to interact directly with its target DEX’s smart contracts

  • Standardized Interface (IAdapter.sol): To ensure interoperability and allow the InfiRouter to treat all DEX integrations uniformly, every Adapter contract must implement the IAdapter interface.

  • Benefits of Modularity:

    – Extensibility: Integrating a new DEX protocol becomes a matter of developing a new Adapter contract conforming to the IAdapter interface and registering its address with the InfiRouter via the administrative functions. The core router logic remains unchanged.

    – Maintainability: Updates or fixes specific to a single DEX integration can be handled by upgrading only the relevant Adapter contract, minimizing disruption to the overall system.

    – Isolation: Potential issues or complexities within one DEX integration are largely contained within its specific Adapter contract.

Last updated