> For the complete documentation index, see [llms.txt](https://docs.idle.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.idle.finance/developers/best-yield/architecture.md).

# Architecture

Developers > Best Yield > Architecture

The main smart contracts used by Idle are the following:

* `IdleToken` holds pooled funds of all users for a specific asset and issues ERC20 shares of the pool (IdleTokens) for each deposit.
* `IdleCompound`, `IdleAave` wrappers contract used by `IdleToken` to interact with the lending protocols implemented

<figure><img src="https://4022236167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lw-v0NTae0RVW1spR9R%2Fuploads%2FNAfRpwB8DYhsV7Ai3sCn%2FIdle%20BY%20Dev.png?alt=media&amp;token=a5cc67a9-6c72-4e1f-a691-d33848b7d919" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
BY strategies are also ERC-4626 compliant! Deployed wrappers can be found [here](/developers/best-yield/deployed-contracts.md#erc-4626-wrappers-for-best-yield-tokens).
{% endhint %}

Idle Rebalancer automatically analyses supply rate functions across integrated protocols and total funds in the pool to constantly rebalance capital across any number of protocols to **earn the highest interest rate possible** with very high precision. When a new allocation can improve the aggregated APY of an IdleTokens, the Rebalancer submits new allocations to the contract.&#x20;

{% hint style="info" %}
New allocations are not enforced, but when they are submitted, any user can trigger a rebalance.
{% endhint %}

During the rebalance process, `IdleToken` contracts check if the new allocation is different and eventually accept it. This triggers a rebalance which mints or redeem the pooled funds on different lending protocols via the dedicated wrappers (`IdleCompound`, `IdleAave`, ...).

{% hint style="warning" %}
If no rebalance is triggered after some time (currently every \~3h), an off-chain bot rebalances the pool for everyone.
{% endhint %}

All Idle strategies use the same set of smart contracts, but each allocation uses a different instance of those contracts.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.idle.finance/developers/best-yield/architecture.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
