Function: borrow(uint256 amount, address recipient)

Allows approved borrower to borrow funds. If borrower is not approved, the _getBorrowerConfig function reverts because msg.sender does not pass verification. Also, function reverts if globalBorrowPaused is true or borrow is paused for msg.sender. The debt tokens will be transferred to the msg.sender, and lent funds will be transferred to the recipient.

Inputs

  • amount

    • Constraints: The circuitBreakerProxy.preCheck function will revert if new utilization ratio is more than capacity.

    • Impact: Amount to borrow.

  • recipient

    • Constraints: Should not be zero address.

    • Impact: Receiver of lending funds.

Branches and code coverage

Negative behavior

  • msg.sender is not an approved as a trusted borrower.

  • amount exceeds available borrow amount.

  • the pause state is true

Function call analysis

  • circuitBreakerProxy.preCheck(address(asset),msg.sender,borrowAmount)

    • What is controllable? borrowAmount.

    • If the return value is controllable, how is it used and how can it go wrong? N/A.

    • What happens if it reverts, reenters or does other unusual control flow? Revert if new utilization ratio exceeds the capacity.

  • debtToken.safeTransferFrom(address(idleStrategyManager), borrower, borrowAmount.scaleUp(_assetScalar))

    • What is controllable? borrowAmount.

    • If the return value is controllable, how is it used and how can it go wrong? N/A.

    • What happens if it reverts, reenters or does other unusual control flow? No problems.

  • idleStrategyManager.withdraw(borrowAmount, recipient);

    • What is controllable? borrowAmount and recipient.

    • If the return value is controllable, how is it used and how can it go wrong? N/A.

    • What happens if it reverts, reenters or does other unusual control flow? Can revert if there are not enough idle funds for lending.

Zellic © 2025Back to top ↑