Skip to content

Commit

Permalink
refactor: borrow rate naming
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinEgalite committed Aug 10, 2023
1 parent 2229157 commit 28014bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Blue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ contract Blue is IBlue {
uint256 marketTotalBorrow = totalBorrow[id];

if (marketTotalBorrow != 0) {
uint256 prevBorrowRate = IIrm(market.irm).prevBorrowRate(market);
uint256 accruedInterests = marketTotalBorrow.wMulDown(prevBorrowRate.wTaylorCompounded(elapsed));
uint256 borrowRate = IIrm(market.irm).borrowRate(market);
uint256 accruedInterests = marketTotalBorrow.wMulDown(borrowRate.wTaylorCompounded(elapsed));
totalBorrow[id] = marketTotalBorrow + accruedInterests;
totalSupply[id] += accruedInterests;

Expand All @@ -424,7 +424,7 @@ contract Blue is IBlue {
totalSupplyShares[id] += feeShares;
}

emit EventsLib.AccrueInterests(id, prevBorrowRate, accruedInterests, feeShares);
emit EventsLib.AccrueInterests(id, borrowRate, accruedInterests, feeShares);
}

lastUpdate[id] = block.timestamp;
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IIrm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import {Market} from "./IBlue.sol";
/// @notice Interface that IRMs used by Blue must implement.
interface IIrm {
/// @notice Returns the borrow rate of a `market`.
function prevBorrowRate(Market memory market) external returns (uint256);
function borrowRate(Market memory market) external returns (uint256);
}
2 changes: 1 addition & 1 deletion src/mocks/IrmMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract IrmMock is IIrm {
BLUE = blue;
}

function prevBorrowRate(Market memory market) external view returns (uint256) {
function borrowRate(Market memory market) external view returns (uint256) {
Id id = market.id();
uint256 utilization = BLUE.totalBorrow(id).wDivDown(BLUE.totalSupply(id));

Expand Down

0 comments on commit 28014bd

Please sign in to comment.