Skip to content

Commit

Permalink
Merge pull request #243 from morpho-labs/fix/fee-accrue-interests
Browse files Browse the repository at this point in the history
fix(set-fee): accrue interests before changing fee
  • Loading branch information
MathisGD authored Aug 9, 2023
2 parents f2b70d7 + aa0a463 commit b899622
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Blue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ contract Blue is IBlue {
Id id = market.id();
require(lastUpdate[id] != 0, Errors.MARKET_NOT_CREATED);
require(newFee <= MAX_FEE, Errors.MAX_FEE_EXCEEDED);

// Accrue interests using the previous fee set before changing it.
_accrueInterests(market, id);

fee[id] = newFee;

emit SetFee(id, newFee);
Expand All @@ -131,6 +135,7 @@ contract Blue is IBlue {
require(isIrmEnabled[market.irm], Errors.IRM_NOT_ENABLED);
require(isLltvEnabled[market.lltv], Errors.LLTV_NOT_ENABLED);
require(lastUpdate[id] == 0, Errors.MARKET_CREATED);

lastUpdate[id] = block.timestamp;

emit CreateMarket(id, market);
Expand Down

0 comments on commit b899622

Please sign in to comment.