# Basic Concepts

Learn more about the basic concepts behind the MoneySwitch protocol.

Specific transactions, such as deposits, withdrawals, liquidity requests, and liquidity repayments will trigger updates to the internal mechanics of the system. This approach is efficient, as it ensures that necessary changes to the system's state only occurs when required.

A transaction ether succeeds entirely, or fails completely. This is important when maintaining consistency and reliability. If any part of the transaction fails, or meets an error, the entire transaction is rolled back, and the state remains unchanged.

For any FeederPool, the sum of all FeederPool Units (FU), held by all depositors in that FeederPool will equal the total number of FeederPool Units for that FeederPool. For any transaction

*t*, we can write the Total FeederPool Units (TFU) as:where

*D*is the number of Depositors, in FeederPool*i*.Similarly, the sum of all MasterPool Units (MU), held by all FeederPools connected to that MasterPool, will equal the total number of MasterPool Units. For any transaction

*t*, we can write the Total MasterPool Units (TMU) as:where F is the total number of FeederPools.

The FeederPool Value is equal to the share of MasterPool Units it has, multiplied by the total MasterPool Value (MPV). For any transaction

*t*, we can write the FeederPool Value as:for any given FeederPool

*i*.Similarly, the Depositor Value (DV) is a function of a depositor's share of FeederPool Units they have, multiplied by the FeederPool Value. For ay transaction

*t*, we can write the Depositor Value as:for any depositor

*a*, who has a deposit in FeederPool*i*.We can substitute FV into the equation above. This equation shows that the Depositor Value is a function of the depositor's share in the FeederPool, the FeederPool's share in the MasterPool, and the MasterPool Value.

For example, if a depositor owns 10% of a FeederPool, and the FeederPool owns 20% of a MasterPool, and the MasterPool is worth $1,000,000, then the depositor’s value will be worth $20,000.

When a transaction occurs which updates the system, the MasterPool Value is increased by the amount of interest earned by the system since the last transaction. This adjustment is performed prior to any other calculations, ensuring the utilization of the most accurate and up-to-date MasterPool Value. The amount of interest earned is calculated as follows:

where poolShare is the portion of interest earned by MasterPool. The following equations demonstrate that when the MasterPool Value is increased by the interest earned since the last transaction, depositors benefit from a proportional share of this interest.

Last modified 25d ago