> For the complete documentation index, see [llms.txt](https://peridot-finance.gitbook.io/peridot-protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://peridot-finance.gitbook.io/peridot-protocol/technical-architecture/evm/dual-investment/riskguard.md).

# 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.
