The operate function starts from performing few sanity checks. We are looking at this code:

Remember that this function handles all operations in one place:
supplyAmount > 0-> we are doing a regular supplysupplyAmount < 0-> we are withdrawing liquidityborrowAmount > 0-> we are doing a regular borrowborrowAmount < 0-> we are paying back borrowed assets
So we perform straightforward sanity checks in this order:
Making sure we are not supplying or borrowing zero amount of tokens
Making sure supply and borrow amounts are in the correct range of
type(int128).Although amounts are
int256when calling theoperatefunction, we are checking for thetype(int128)range because it gives us flexibility later, knowing that we can fit two variables in 256 bits. For example, when calculating total liquidity passed as deposit + payback.Making sure we are not withdrawing or borrowing to the zero address
Making sure we passed
msg.valuefor the native tokenLike the majority of protocols, Fluid uses a standard convention to represent the native token address as:
/// @dev address that is mapped to the chain native token address internal constant NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;