Skip to content

Commit

Permalink
Merge pull request #40 from morpho-labs/docs/speed-factor
Browse files Browse the repository at this point in the history
Document speed factor value
  • Loading branch information
MerlinEgalite authored Sep 28, 2023
2 parents dc62943 + e969a32 commit 6a6cc51
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/SpeedJumpIrm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ contract SpeedJumpIrm is IIrm {

/* CONSTANTS */

/// @notice Max rate (1B% APR).
/// @notice Maximum rate per second (scaled by WAD) (1B% APR).
uint256 public constant MAX_RATE = uint256(1e7 ether) / 365 days;
/// @notice Min rate (0.1% APR).
/// @notice Mininimum rate per second (scaled by WAD) (0.1% APR).
uint256 public constant MIN_RATE = uint256(0.001 ether) / 365 days;
/// @notice Address of Morpho.
address public immutable MORPHO;
/// @notice Ln of the jump factor (scaled by WAD).
uint256 public immutable LN_JUMP_FACTOR;
/// @notice Speed factor (scaled by WAD).
/// @dev The speed is per second, so the rate moves at a speed of SPEED_FACTOR * err each second (while being
/// continuously compounded). A typical value for the SPEED_FACTOR would be 10 ethers / 365 days.
uint256 public immutable SPEED_FACTOR;
/// @notice Target utilization (scaled by WAD).
uint256 public immutable TARGET_UTILIZATION;
Expand Down Expand Up @@ -146,7 +148,7 @@ contract SpeedJumpIrm is IIrm {
// Safe "unchecked" cast to uint256 because linearVariation < 0 <=> newBorrowRate <= borrowRateAfterJump.
else avgBorrowRate = uint256((int256(newBorrowRate) - int256(borrowRateAfterJump)).wDivDown(linearVariation));

// We bound both newBorrowRate and avgBorrowRate between 1e-18 and MAX_RATE.
// We bound both newBorrowRate and avgBorrowRate between MIN_RATE and MAX_RATE.
return (err, uint128(newBorrowRate.bound(MIN_RATE, MAX_RATE)), uint128(avgBorrowRate.bound(MIN_RATE, MAX_RATE)));
}
}

0 comments on commit 6a6cc51

Please sign in to comment.