> For the complete documentation index, see [llms.txt](https://docs.polystream.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.polystream.xyz/smart-contracts/adapter.md).

# 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`](https://github.com/polystream-core/polystream-contracts/blob/main/src/adapters/interfaces/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`](https://github.com/polystream-core/polystream-contracts/blob/main/src/adapters/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`](https://github.com/polystream-core/polystream-contracts/blob/main/src/adapters/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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.polystream.xyz/smart-contracts/adapter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
