# Diagrams

## Contract Architecture

Architecture of all smart contracts

<figure><img src="/files/N6htflVhVYChyPxfRwbQ" alt=""><figcaption></figcaption></figure>

## Scenarios

A collection of scenarios to help you understand how Isle Finance works from end to end

### Borrowing

#### Seller mints receivables NFT

{% @mermaid/diagram content="flowchart LR;
S((Seller))
R\[Receivables]
S -- "mintReceivable" --> R
R -- "transferReceivable" --> S" %}

#### Buyer requests for a loan to be created for the receivable

{% @mermaid/diagram content="flowchart LR;
B((Buyer))
LM\[LoanManager]
B -- "requestLoan" --> LM" %}

#### Pool Admin funds loan

{% @mermaid/diagram content="flowchart LR;
PM((PoolAdmin))
PC\[PoolConfigurator]
LM\[LoanManager]
P\[Pool]
PM -- "fundLoan" --> LM
LM -- "requestFunds" --> PC
PC -- "transferFrom" --> P
P -- "transferFunds" --> LM" %}

#### Seller withdraws funds by submitting the invoice

{% @mermaid/diagram content="flowchart LR
S((Seller))
LM((LoanManager))
S -- "withdrawFunds" --> LM
S -- "transferReceivables" --> LM
LM -- "transferFunds" --> S
" %}

#### Buyer repays loan

{% @mermaid/diagram content="flowchart LR
B((Buyer))
LM\[LoanManager]
TV\[Treasury Vault]
PA((Pool Admin))
P\[Pool]
B -- "repayLoan" --> LM
B -- "transferFunds" --> LM
LM -- "transferFunds" --> PA
LM -- "transferFunds" --> P
LM -- "transferFunds" --> TV" %}

### Lending

#### Lender deposits funds

{% @mermaid/diagram content="flowchart LR
LP((Lender))
P\[Pool]
LP -- "deposit" --> P
LP -- "transferFunds" --> P
P -- "transferShares" --> LP" %}

#### Lender requests redemption

{% @mermaid/diagram content="flowchart LR
LP((Lender))
P\[Pool]
PC\[PoolConfigurator]
WM\[WithdrawalManager]
LP -- "requestRedeem" --> P
P -- "requestRedeem" --> PC
PC -- "addShares" --> WM
LP -- "transferShares" --> WM" %}

#### Lender redeems funds

{% @mermaid/diagram content="flowchart LR
LP((Lender))
P\[Pool]
PC\[PoolConfigurator]
WM\[WithdrawalManager]
LP -- "redeem" --> P
P -- "processRedeem" --> PC
PC -- "processExit" --> WM
P -- "transferFunds" --> LP" %}

#### Lender remove redemption request

{% @mermaid/diagram content="flowchart LR
LP((Lender))
P\[Pool]
PC\[PoolConfigurator]
WM\[WithdrawalManager]
LP -- "removeShares" --> P
P -- "removeShares" --> PC
PC -- "removeShares" --> WM
WM -- "transferShares" --> LP" %}

### Pool Configuration

{% hint style="info" %}
There could be multiple sellers, but only a single buyer for a pool.
{% endhint %}

{% @mermaid/diagram content="flowchart LR;
PA((Pool Admin))
PC\[Pool Configurator]
PA -- "setBuyer" --> PC
PA -- "setValidSeller" --> PC
PA -- "setValidLender" --> PC
PA -- "setOpenToPublic" --> PC
PA -- "setAdminFee" --> PC
" %}

{% @mermaid/diagram content="flowchart LR
GV((Governor))
PC\[Pool Configurator]
GV -- "setPoolLimit" --> PC
GV -- "setMaxCoverLiquidation" --> PC
GV -- "setMinCover" --> PC" %}


---

# 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.isle.finance/contract-documentation/diagrams.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.
