Constructor
InterestModel (accessible via interestModel()). Sets the initial operator and the global minDebtFloor that applies to every instance’s minDebt parameter.
User-Facing Functions
deploy
params: DeployParams struct containing deployment configuration
lender: Address of the deployed Lender contractcoin: Address of the deployed Coin (ERC‑20) contractvault: Address of the deployed Vault (ERC‑4626) contract
- All bounds listed above are enforced by
Lender’s constructor and revert on violation. params.collateraldecimals must be ≤ 30.params.psmAssetmust differ from the deployedcoin.- If
params.psmVaultis set, its underlyingasset()must equalparams.psmAssetandpsmVaultMinTotalSupplymust be > 0.
- Calculates deterministic addresses using CREATE3
- Deploys contracts in order: Lender → Coin → Vault
- Initializes contracts with proper cross-references
- Records deployment in factory registry
Deployed(lender, coin, vault)
deploymentsLength
uint256: Number of deployments
deployments
deploymentsLength() to enumerate all instances.
interestModel
InterestModel deployed by this Factory’s constructor. All Lenders deployed by this Factory use this same InterestModel instance.
minDebtFloor
minDebt must be ≥ this value at deployment.
pendingOperator
acceptOperator().
operator
address: Current operator address
feeRecipient
address: Fee recipient address
feeBps
uint256: Default fee in bps (e.g., 100 = 1%)
getFeeOf
_lender: Address of the lender deployment
uint256: Fee rate in bps
isDeployed
deployment: Address to check
bool: True if address was deployed by this factory
customFeeBps
lender: Address of the lender deployment
uint256: Custom fee in bps, 0 if using default fee
Operator Functions
setPendingOperator
_pendingOperator: Address to set as pending operator
msg.sendermust be current operator
acceptOperator
msg.sendermust be pending operator
setFeeRecipient
_feeRecipient: New fee recipient address
msg.sendermust be current operator
setFeeBps
_feeBps: New fee rate in bps (max 1000 = 10%)
msg.sendermust be current operator_feeBpsmust be ≤ 1000
setCustomFeeBps
_address: Lender deployment address_feeBps: Custom fee rate in bps (max 1000 = 10%)
msg.sendermust be current operator_feeBpsmust be ≤ 1000
pullReserves
_deployment: Lender deployment address
msg.sendermust be fee recipient_deploymentmust be a valid deployment
Events
Deployed(address indexed lender, address indexed coin, address indexed vault)— emitted bydeploy()with the new instance addresses.CustomFeeBpsSet(address indexed lender, uint256 feeBps)— emitted bysetCustomFeeBps().FeeBpsUpdated(uint256 feeBps)— emitted bysetFeeBps().FeeRecipientUpdated(address indexed feeRecipient)— emitted bysetFeeRecipient().PendingOperatorUpdated(address indexed pendingOperator)— emitted bysetPendingOperator().OperatorUpdated(address indexed operator)— emitted byacceptOperator().ReservesPulled(address indexed lender, address indexed recipient, uint256 amount)— emitted bypullReserves().

