Adapter

Purpose

  • Uniform Interface: Adapters implement the IProtocolAdapter interface, providing a consistent set of functions regardless of underlying protocol differences.

  • Simplified Interaction: They allow Polystream to interact seamlessly with multiple DeFi protocols without dealing directly with each protocol's unique implementations.

  • Yield Management: Adapters handle yield harvesting, compounding, and fee management, simplifying profit calculations and risk management.

Key Components and Functionalities

IProtocolAdapter.sol

Defines the standardized interface that all adapters must implement, including methods to:

  • Supply and withdraw assets.

  • Harvest and compound yields.

  • Convert platform fees to rewards.

  • Retrieve APY, balances, and principal data.

AaveAdapter.sol

Specific adapter for interacting with the Aave lending protocol:

  • Handles supplying and withdrawing of assets to/from Aave pools.

  • Harvests yield by withdrawing accrued interest and redepositing it, thereby compounding returns.

  • Manages the conversion of fees into yield, tracks principal deposits, and calculates APY from Aave's interest rate models.

LayerBankAdapter.sol

Adapter specifically designed for LayerBank protocol:

  • Manages asset deposits, withdrawals, and yield harvesting on LayerBank.

  • Implements advanced handling, including error management for different redeem methods.

  • Calculates APY based on LayerBank’s rate models, compounding yields by harvesting interest regularly.

Last updated