Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor irm constants #110

Merged
merged 5 commits into from
Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
MathisGD marked this conversation as resolved.
Show resolved Hide resolved

/// @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);
}