Skip to content

FluidLiquidityUserModule ​

Git Source

Inherits:CoreInternals

Title: Fluid Liquidity UserModule

Fluid Liquidity public facing endpoint logic contract that implements the operate() method. operate can be used to deposit, withdraw, borrow & payback funds, given that they have the necessary user config allowance. Interacting users must be allowed via the Fluid Liquidity AdminModule first. Intended users are thus allow-listed protocols, e.g. the Lending protocol (fTokens), Vault protocol etc.

For view methods / accessing data, use the "LiquidityResolver" periphery contract.

Functions ​

operate ​

inheritdoc IFluidLiquidity

solidity
function operate(
    address token_,
    int256 supplyAmount_,
    int256 borrowAmount_,
    address withdrawTo_,
    address borrowTo_,
    bytes calldata callbackData_
) external payable checkStatus returns (uint256 memVar3_, uint256 memVar4_);

operateOnBehalfOf ​

inheritdoc IFluidLiquidity

skips user and token pause checks: deposits and paybacks reduce risk (add collateral / reduce debt) and the caller is a trusted auth / governance, so a paused position can still be topped up or repaid.

solidity
function operateOnBehalfOf(
    address onBehalf_,
    address token_,
    int256 supplyAmount_,
    int256 borrowAmount_,
    bytes calldata callbackData_
) external payable checkStatus returns (uint256 memVar3_, uint256 memVar4_);

_operateInternal ​

solidity
function _operateInternal(
    address user_,
    address token_,
    int256 supplyAmount_,
    int256 borrowAmount_,
    address withdrawTo_,
    address borrowTo_,
    bytes calldata callbackData_
) internal returns (uint256 memVar3_, uint256 memVar4_);

Parameters

NameTypeDescription
user_addressaddress(0) = use msg.sender with pause checks; non-zero = operate on that position and skip user and token pause checks. Non-zero user_ is a privileged path and must only come from operateOnBehalfOf() after auth / governance checks.
token_address
supplyAmount_int256
borrowAmount_int256
withdrawTo_address
borrowTo_address
callbackData_bytes

Structs ​

OperateMemoryVars ​

struct for vars used in operate() that would otherwise cause a Stack too deep error

solidity
struct OperateMemoryVars {
    int256 netTransfersOut; // when 0 -> normal flow, when -1 -> skip out transfers, when > 0 -> only do net transfer out flow
    uint256 supplyExchangePrice;
    uint256 borrowExchangePrice;
    uint256 supplyRawInterest;
    uint256 supplyInterestFree;
    uint256 borrowRawInterest;
    uint256 borrowInterestFree;
    uint256 totalAmounts;
    uint256 exchangePricesAndConfig;
}