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

Make params constant #103

Merged
merged 7 commits into from
Dec 12, 2023
Merged

Make params constant #103

merged 7 commits into from
Dec 12, 2023

Conversation

MathisGD
Copy link
Contributor

@MathisGD MathisGD commented Dec 3, 2023

Fixes #102 and sets the new initial rate at target

test/ExpLibTest.sol Outdated Show resolved Hide resolved
Copy link
Contributor

@Rubilmax Rubilmax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked analytical values, which can be summed up as being scaled by 4 considering that it's linear in the initial rate at target which was multiplied by 4

@MathisGD MathisGD requested a review from Jean-Grimal December 4, 2023 15:52
@Rubilmax Rubilmax changed the base branch from main to post-cantina December 7, 2023 08:17
@MathisGD MathisGD requested a review from adhusson December 11, 2023 13:03
@MathisGD MathisGD merged commit d596b3b into post-cantina Dec 12, 2023
3 checks passed
@MathisGD MathisGD deleted the chore/constants branch December 12, 2023 09:29
@Rubilmax Rubilmax mentioned this pull request Dec 19, 2023
@@ -8,24 +8,6 @@ interface IAdaptiveCurveIrm is IIrm {
/// @notice Address of Morpho.
function MORPHO() external view returns (address);

/// @notice Curve steepness (scaled by WAD).
/// @dev Verified to be inside the expected range at construction.
function CURVE_STEEPNESS() external view returns (int256);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that these functions should be accessible outside? Because you can anyway expose, implement and return the direct value from ConstantLib

Copy link
Contributor

@MerlinEgalite MerlinEgalite Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary tbh

int256 targetUtilization,
int256 initialRateAtTarget
) {
constructor(address morpho) {
require(morpho != address(0), ErrorsLib.ZERO_ADDRESS);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like suggested by this comment https://github.com/morpho-org/morpho-blue-irm/pull/103/files#r1423108397 it would be good to have those sanity checks added (as an additional check) at deployment level so you always know that the deployed IRM is conforming the previous established ranges.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added a test for this, I think that's enough

/// @notice Mininimum rate at target per second (scaled by WAD) (0.1% APR).
int256 internal constant MIN_RATE_AT_TARGET = int256(0.001 ether) / 365 days;
/// @notice Adjustment speed per second (scaled by WAD).
int256 public constant ADJUSTMENT_SPEED = int256(50 ether) / 365 days;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that part of the "old" ADJUSTMENT_SPEED natspec defined in IAdaptiveCurveIrm has not been moved here

@dev The speed is per second, so the rate moves at a speed of ADJUSTMENT_SPEED * err each second (while being continuously compounded).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make parameters constant
7 participants