As mentioned before, all of the liquidity is stored in one contract.
At the time of writing this, this is the state of mainnet liquidity:
https://etherscan.io/address/0x52Aa899454998Be5b000Ad077a46Bbe360F4e497#code

The contract we need to look at is placed inside contracts/liquidity/userModule/main.sol and it’s called FluidLiquidityUserModule. This will be the main point of analysis alongside contracts/liquidity/common/variables.sol, which stores struct and data definitions.

FluidLiquidityUserModule contains one core function called operate, which is meant to be called by consumers to either deposit, withdraw, borrow, or pay back funds

If we go directly to analyze this full function, we will see a body of 500+ lines of code, which at first can look like a complete mess. This is not an uncommon thing for the Fluid codebase, as most of the main flow functions are more like execution pipelines rather than simple “do one thing” functions.
To be able to understand these functions, we will approach them with the standard divide-and-conquer approach, where we break it into multiple parts and analyze snippet by snippet.
Here is the full body of the function:

Sorry that I made you scroll this long :) but get used to it, as we will break even more complex functions later.
On a high level, this operate function can be broken into 11 pieces:
Sanity checksSetup memory variablesDEX callbackThis one will be skipped as we are not touching Fluid DEX for this guideETH payment checkSend funds from senderCalculate exchange pricesSupply or withdrawBorrow or paybackUpdate exchange prices, utilization, and ratiosSend funds to senderEmit event and return
To track progress easier, and to keep things simple, every piece will have a dedicated page. Some will be straightforward, some not, as they will call other internal functions as well.
So let’s start analyzing the pieces, starting from sanity checks performed upon entering the function.