> For the complete documentation index, see [llms.txt](https://limitless.gitbook.io/ramm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://limitless.gitbook.io/ramm/instrument-examples-and-usage/inter-protocol-underwriting-middleware.md).

# Inter-protocol Underwriting Middleware

Any entity can delegate the underwriting process for *any* **yield source** to a set of managers from the RAMM protocol.&#x20;

These entities we call (liquidity)**suppliers** can be, but not limited to,&#x20;

1. other DAOs that want risk assessment/structuring for their treasuries by a non-centralized party,&#x20;
2. protocols looking for assessment and insurance in complex yield sources they want to invest in,&#x20;
3. protocols that want to lend to a counterparty but are in need of an underwriting and structuring system.&#x20;
4. lending protocols who want assessment + insurance of the borrower's creditworthiness or collateral.&#x20;

<img src="/files/RuEi7HRmdvRErn3wPWTS" alt="RAMM would act as a risk assessment gate for the supplier&#x27;s investments" class="gitbook-drawing">

For a given **yield source** a **supplier**(i.e DAOs, protocols) is considering investing in, the following procedure will be undertaken by the protocol. &#x20;

### 0. [Propose](/ramm/protocol-flow/proposal.md)&#x20;

A **yield source** needs to be proposed to the protocol by a [utilizer](/ramm/participants/utilizers.md)(anyone associated with the **supplier** DAO and the **yield source** such as strategists, loan originators, borrowers, etc)

### 1. [Assessment](/ramm/protocol-flow/assessment-and-decision-aggregation.md)&#x20;

During this phase, the [managers](/ramm/participants/managers.md) will buy [**`longZCB`**](/ramm/introduction/key-terms.md) from the [prediction market](/ramm/prediction-market-and-amm-technical/tradable-tranches.md) if they deem the yield source to have high-risk adjusted returns. Hedgers(investors in the supplier protocol) will buy **`shortZCB`** tokens if they want to hedge the risk in the new yield source. The (capital used to buy **`longZCB`** - capital used to buy **`shortZCB`**) = X amount will be directed to the `Middleware` contract.&#x20;

<img src="/files/DCnqQD6GKIFOUPFx89Cw" alt="" class="gitbook-drawing">

### 2. [Approval](/ramm/protocol-flow/assessment-and-decision-aggregation.md)

When [`approvalCriterion`](/ramm/protocol-flow/assessment-and-decision-aggregation.md) is met, the protocol participants have essentially decided the yield source is worth investing in. The **supplier** can then supply Y amount of capital to the yield source, executed through the following atomic transaction.&#x20;

1. Supply Y amount of capital to the `Middleware`, which triggers the `investToYieldSource` function.&#x20;
2. The `Middleware`  then invests the supplier's Y amount and the assessors' X amount of capital to the yield source.&#x20;
3. The `Middleware` escrows the IOU token to itself and gives the supplier a promissory note for its senior tranche portion of the investment. &#x20;

> Note: At no point does the supplier's capital is escrowed to the `Middleware`, they are invested directly to the yield source contract within a tx, minimizing smart contract risk.
>
> Also, note that the **supplier** may opt out from the **yield source** even if [`approvalCriterion`](/ramm/protocol-flow/assessment-and-decision-aggregation.md) is met, by simply not supplying to the `Middleware`&#x20;

<img src="/files/UTcG5S2qzO43wuIW1dfr" alt="" class="gitbook-drawing">

### 3. [Post Approval](/ramm/prediction-market-and-amm-technical/post-approval.md)

During the post-approval phase after the **yield source** has been supplied, anyone can still participate in the AMM as a tool to hedge or gain more exposure to the yield source. It's a zero-sum prediction market.&#x20;

### 4a. Supplier Withdraw

When the supplier decides to withdraw, it will send a message to the `Middleware`, which will invoke its `withdrawFromYieldSource` function. This will withdraw the invested X+Y amount \* whatever returns the **yield source** has generated. As in 2), the supplier will receive its investment and its senior portion of the returns within a single tx.&#x20;

The remaining capital would be escrowed back to the AMM from the `Middleware` for the assessors to redeem.&#x20;

<img src="/files/HXLKztqPE1LtSTnbLrVW" alt="" class="gitbook-drawing">

### 4b. Managers and Hedgers Withdraw

Managers and hedgers can redeem their `longZCB` and `shortZCB` tokens from the AMM, where their redemption price is going to be computed from the returns the yield source has generated.&#x20;

<img src="/files/ZcFdLWYFXx96J2wjttWe" alt="" class="gitbook-drawing">

###

{% hint style="info" %}
Parameters that the **Suppliers** can control are

1. **The degree of tranching**; more tranching means the managers incur higher risk and higher returns. No tranching means the managers and the **suppliers** share the same payoff.&#x20;
2. **How much `leverageFactor` managers will incur**; a higher `leverageFactor` entails managers are more incentivized to participate in assessment, but results in a lower insurance buffer for the suppliers. It also means less returns allocated for the supplier's senior tranche.
3. **How much should the managers have to put up as collateral** as a collective for `approvalCondition` to hold, determined by the parameter `alpha`.&#x20;
4. **How much `reputationScore` is required** for a manager to participate in the assessment.&#x20;

{% endhint %}

{% hint style="info" %}
Benefit for **Suppliers**&#x20;

1. The underwriting module can be applied to *any* investable asset including those that are non-trivial to gauge risk in a non-centralized and incentive-compatible manner, expanding the universe of possible investments for the suppliers.&#x20;
2. Offers a bidirectional insurance market even after the investment has been supplied.&#x20;
3. First loss protection from manager's collateral.&#x20;
4. Higher risk-adjusted yields
   1. More skilled(higher reputation) managers are weighted heavier during the decision aggregation
   2. Decentralization entails the inclusion of more private information, increasing the accuracy of predictions.&#x20;
5. No extra smart contract risk is introduced from the underwriting module.&#x20;

Benefit for **Managers**

1. Earn higher yields with their financial knowledge, which is further amplified by gaining a good track record.&#x20;
   {% endhint %}


---

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

```
GET https://limitless.gitbook.io/ramm/instrument-examples-and-usage/inter-protocol-underwriting-middleware.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.
