-
Notifications
You must be signed in to change notification settings - Fork 20
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
return early linear adaptation zero #88
return early linear adaptation zero #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with it!
I would not indent all the code in the else branch though if using early returns (we're indenting twice for no reason)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, and the test for it is in #80 here :
morpho-blue-irm/test/SpeedJumpIrmTest.sol
Lines 163 to 178 in 3fbeaf1
function testRateAfterUtilizationTargetNoPing(uint256 elapsed) public { | |
elapsed = bound(elapsed, 0, type(uint48).max); | |
Market memory market; | |
market.totalSupplyAssets = 1 ether; | |
market.totalBorrowAssets = uint128(uint256(TARGET_UTILIZATION)); | |
assertEq(irm.borrowRate(marketParams, market), uint256(INITIAL_RATE_AT_TARGET)); | |
assertEq(irm.rateAtTarget(marketParams.id()), INITIAL_RATE_AT_TARGET); | |
market.lastUpdate = uint128(block.timestamp); | |
vm.warp(block.timestamp + elapsed); | |
irm.borrowRate(marketParams, market); | |
assertEq(irm.rateAtTarget(marketParams.id()), INITIAL_RATE_AT_TARGET); | |
} |
I did it because the code is already like that (for when startBorrowRate==0) |
No description provided.