# UTxOs of Deposits in the Fund

The number and structure of UTxOs used to store all the deposits will impact the contracts' complexity and functionality. Among other things, the most critical aspect to take into account is the concurrency and the possibility of keeping centralized, updated, or calculable totals needed for the different calculations.

<br>

To validate the Re-Indexing operation, the contract must able to know how the Investment Unit and the Total Deposited IU are formed, i.e., the actual underlying token assets in the Fund. Only then will it be able to validate an update in the Investment Unit: any change in the definition of the Investment Unit must be reflected in the actual holdings of the Fund.

<br>

For the fee collection calculation, accessing the Total Fees Paid, Total Fees, and Total Fees Collected for each Group is also necessary.

<br>

If I have a single deposit UTxO, it is easy to calculate the totals, but it produces serious concurrency problems; only one User at a time could consume it when making deposits and/or withdrawals.

<br>

If I had one UTxO for each deposit, there would be no concurrency problems, but calculating totals would be very expensive. Processing a large number of UTxOs may not be possible.&#x20;

<br>

Considering these points, the Funds will use the following:

<br>

* Multiple Deposit UTxOs: an amount commensurate with the number of Users deemed able to make deposits and/or withdrawals simultaneously. These UTxOs will be created and administered by the Fund Managers.

<br>

* Each UTxO will accumulate its own totals for each Deposit or Withdrawal operation.

<br>

* Commission Collection operations will use only the totals in the Deposit UTxOs. It is not necessary to calculate the total of all UTxOs beforehand. Commissions may be collected at one time from as many UTxOs as can be aggregated in the transaction. It may take several transactions to collect all the commissions that exist on all the different Deposit UTxOs at any given time.

<br>

* When the Total UI Deposited is needed, it will be calculated in a previous operation. It will be stored in the Fund Datum with a validity time.

<br>

* Deposit and/or withdrawal operations will be suspended for the duration of the validity period.

<br>

* The Total Re-Indexing operation will check that the total received is within its validity time.

<br>

* With this approach, a malicious administrator could indefinitely block a Fund by doing back-to-back totaling operations one after the other.  This solution implies that the calculation of totals is not something that is required to be done often. The re-indexing operation does not seem to be an operation that will be used very often.


---

# 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://mayz.gitbook.io/mayz-whitepaper-v2/mayz-protocol/technical-document/utxos-of-deposits-in-the-fund.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.
