Skip to content

AdaptiveCurveIrm

0xcf247Df3A2322Dea0D408f011c194906E77a6f62 | Git Source

Inherits: IAdaptiveCurveIrm

State Variables

MORPHO

Address of Morpho.

solidity
address public immutable MORPHO

rateAtTarget

solidity
mapping(Id => int256) public rateAtTarget

Functions

constructor

Constructor.

solidity
constructor(address morpho) ;

Parameters

NameTypeDescription
morphoaddressThe address of Morpho.

borrowRateView

Returns the borrow rate per second (scaled by WAD) of the market marketParams without modifying any storage.

Assumes that market corresponds to marketParams.

solidity
function borrowRateView(MarketParams memory marketParams, Market memory market) external view returns (uint256);

borrowRate

Returns the borrow rate per second (scaled by WAD) of the market marketParams.

Assumes that market corresponds to marketParams.

solidity
function borrowRate(MarketParams memory marketParams, Market memory market) external returns (uint256);

_borrowRate

Returns avgRate and endRateAtTarget.

Assumes that the inputs marketParams and id match.

solidity
function _borrowRate(Id id, Market memory market) private view returns (uint256, int256);

_curve

Returns the rate for a given _rateAtTarget and an err. The formula of the curve is the following: r = ((1-1/C)_err + 1) _ rateAtTarget if err < 0 ((C-1)_err + 1) _ rateAtTarget else.

solidity
function _curve(int256 _rateAtTarget, int256 err) private pure returns (int256);

_newRateAtTarget

Returns the new rate at target, for a given startRateAtTarget and a given linearAdaptation. The formula is: max(min(startRateAtTarget * exp(linearAdaptation), maxRateAtTarget), minRateAtTarget).

solidity
function _newRateAtTarget(int256 startRateAtTarget, int256 linearAdaptation) private pure returns (int256);

Events

BorrowRateUpdate

Emitted when a borrow rate is updated.

solidity
event BorrowRateUpdate(Id indexed id, uint256 avgBorrowRate, uint256 rateAtTarget);