CompoundBorrowRouter
Performs safe borrowing from cToken markets and routes borrowed underlyings to authorized destinations (e.g., VaultExecutor).
Responsibilities
Enforce health factor / liquidity constraints before borrowing.
Integrate with Peridottroller risk checks and price oracle for USD projections.
Route funds to a destination or pull from user if underlying was credited to them.
Key Functions
borrowAndRoute(cToken, borrowAmount, destination, user)[onlyAuthorizedDestination]Requires no shortfall; checks health factor after borrow ≥ min threshold; borrows and routes.
canUserBorrow(user, cToken, borrowAmount) -> (bool, reason)Dry‑run: controller
borrowAllowed, liquidity, projected health factor.
getUserHealthFactor(user)view.Admin:
setAuthorizedDestination(addr, authorized),setMinHealthFactor(factor1e18),setMaxLTV(bps1e18),emergencyRepay,emergencyWithdraw.
Events
BorrowAndRoute(user, cToken, destination, borrowAmount, healthBefore, healthAfter)
Last updated