# Smart Contracts

The source code of Polystream contracts is available on [Github](https://github.com/polystream-core/polystream-contracts).

The core contracts fall into following categories in the Github repository:

* Adapter
* Core
* Rewards
* Strategy

### Adapter

Adapter contracts serve as standardized connectors between Polystream and various decentralized lending protocols (e.g., Aave, LayerBank). Each adapter abstracts the complexities and differences of individual protocols, enabling a uniform method for supplying assets, withdrawing assets, and harvesting yield.

### Core

The Core contracts serve as the backbone of Polystream, managing user deposits, withdrawals, yield distribution, and the registry of supported DeFi protocols and adapters. They enable smooth interactions between users, adapters, and yield-generating protocols.

### Rewards

The **Rewards** contracts handle the accurate and fair distribution of yield rewards generated by the Polystream vault. Rewards are distributed based on each user's share and the duration their assets are staked (time-weighted contributions). The system ensures that rewards are calculated, tracked, and claimed transparently.

### Strategy

Polystream employs an automated **Yield Optimization Strategy** designed to continuously maximize returns for users. By dynamically evaluating and reallocating funds across supported DeFi protocols, the system ensures user deposits always benefit from the highest available APY (Annual Percentage Yield).


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
