Skip to content

Commit

Permalink
Merge pull request #110 from morpho-org/fix/constants-1
Browse files Browse the repository at this point in the history
refactor irm constants
  • Loading branch information
MathisGD authored Dec 18, 2023
2 parents 87eb634 + 497e446 commit ee3600a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/libraries/adaptive-curve/ConstantsLib.sol
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {WAD_INT} from "../MathLib.sol";

/// @title ConstantsLib
/// @author Morpho Labs
/// @custom:contact security@morpho.org
library ConstantsLib {
/// @notice 1 bps = 0.01% (scaled by WAD).
int256 public constant ONE_BPS = 0.0001 ether;

/// @notice Curve steepness (scaled by WAD).
/// @dev Curve steepness = 4.
int256 public constant CURVE_STEEPNESS = 4 ether;

/// @notice Adjustment speed per second (scaled by WAD).
int256 public constant ADJUSTMENT_SPEED = int256(50 ether) / 365 days;
/// @dev Adjustment speed = 50/year.
int256 public constant ADJUSTMENT_SPEED = 50 ether / int256(365 days);

/// @notice Target utilization (scaled by WAD).
/// @dev Target utilization = 90%.
int256 public constant TARGET_UTILIZATION = 0.9 ether;

/// @notice Initial rate at target per second (scaled by WAD) (1% min APR / 16% max APR).
int256 public constant INITIAL_RATE_AT_TARGET = 4_00 * ONE_BPS / 365 days;
/// @notice Initial rate at target per second (scaled by WAD).
/// @dev Initial rate at target = 4% (rate between 1% and 16%).
int256 public constant INITIAL_RATE_AT_TARGET = 0.04 ether / int256(365 days);

/// @notice Minimum rate at target per second (scaled by WAD) (0.025% min APR).
int256 public constant MIN_RATE_AT_TARGET = 10 * ONE_BPS / 365 days;
/// @notice Minimum rate at target per second (scaled by WAD).
/// @dev Minimum rate at target = 0.1% (minimum rate = 0.025%).
int256 public constant MIN_RATE_AT_TARGET = 0.001 ether / int256(365 days);

/// @notice Maximum rate at target per second (scaled by WAD) (800% max APR).
int256 public constant MAX_RATE_AT_TARGET = 200_00 * ONE_BPS / 365 days;
/// @notice Maximum rate at target per second (scaled by WAD).
/// @dev Maximum rate at target = 200% (maximum rate = 800%).
int256 public constant MAX_RATE_AT_TARGET = 2.0 ether / int256(365 days);
}

0 comments on commit ee3600a

Please sign in to comment.