RiskGuard
Centralized risk policy for Dual Investment entries. Validates health factor, per‑user size caps, and per‑market utilization limits; supports emergency and per‑market pauses.
Responsibilities
Gate borrow‑path entries (collateral‑only entries skip borrow checks).
Enforce
minHealthFactor, user position caps (as ratio of liquidity), and market utilization ceilings.Provide owner controls for emergency pause and market‑level controls.
Key Functions
checkPositionEntry(user, cTokenIn, positionValueUSD, useCollateral) -> (bool, reason)Borrow path: checks controller
borrowAllowed, liquidity, health factor, and policy limits.
updateUserPositionValue(user, oldValue, newValue)[onlyOwner]updateMarketUtilization(market, change, isIncrease)[onlyOwner]Views:
getMaxPositionValueForUser(user),getUserHealthFactor(user).Admin:
setMinHealthFactor,setMaxPositionSizeRatio,setMarketMaxUtilization,setWhitelistedUser,setEmergencyPause,setMarketPaused.
Notes
Conservative guards in try/catch avoid blocking when external controller calls revert.
Last updated