> 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/yield-tranches/architecture.md).

# Architecture

Developers > Yield Tranches > Architecture

The main contract used by users is called `IdleCDO` which allows depositing the underlying and mint tranche tokens (ERC-20), either AA or BB, and redeeming principal and interest from it.

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

The IdleCDO contract pools users' funds together and uses `IIdleCDOStrategy` as a proxy for interacting with the underlying DeFi protocol to deposit funds and collect interest and rewards.

Governance tokens collected as rewards are not redistributed to users directly in the IdleCDO contract but rather sold to the market (`harvest` method) and the underlying reinvested in the downstream lending provider where possible.

### Codebase and contracts

The codebase and a general overview of the architecture can be found at <https://github.com/Idle-Labs/idle-tranches>.

These are the core contracts used:

<details>

<summary>IdleCDO.sol</summary>

A contract that holds all the user pooled assets (both underlying, e.g. DAI, and interest-bearing tokens, e.g. *idleDAI*) and is an entry point for the user to mint tranche tokens and burn them to redeem principal and interest.&#x20;

When users deposit into the CDO they will:&#x20;

* update the global accounting of the system (i.e. split accrued rewards)
* mint their chosen tranche tokens.&#x20;

Funds won't get put in lending right away.&#x20;

The `harvest` method will be called periodically to put new deposits in lending, get fees and update the accounting.&#x20;

During the harvest call, some predefined rewards will be sold into the market (via Uniswap) and released linearly over *x* (currently set a 1500) blocks, to increase the value of all tranche holders. \
On redeem, users will burn their tranche tokens and get underlying using a checkpointed price (set at last harvest to avoid potential theft of interest, updated when dumping governance tokens to increase the tranche price).

</details>

<details>

<summary>IdleCDOTranche.sol</summary>

ERC-20 representing a specific (either AA or BB) tranche token. Only IdleCDO contract can mint and burn tranche tokens.

</details>

On top of these, all the strategies (`IIdleCDOStrategy`) currently used can be found here <https://github.com/Idle-Labs/idle-tranches/tree/master/contracts/strategies>.


---

# 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/yield-tranches/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.
