Skip to content

Commit

Permalink
fix: access cache not storage (aave-dao#68)
Browse files Browse the repository at this point in the history
accessing the configuration cache should be save in this case and reduces gas overhead by around 300gas per access
  • Loading branch information
sakulstra committed Oct 16, 2024
1 parent 802924b commit f5389a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/contracts/protocol/libraries/logic/ReserveLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ library ReserveLogic {
totalDebt: totalVariableDebt,
reserveFactor: reserveCache.reserveFactor,
reserve: reserveAddress,
usingVirtualBalance: reserve.configuration.getIsVirtualAccActive(),
usingVirtualBalance: reserveCache.reserveConfiguration.getIsVirtualAccActive(),
virtualUnderlyingBalance: reserve.virtualUnderlyingBalance
})
);
Expand All @@ -195,7 +195,7 @@ library ReserveLogic {
reserve.currentVariableBorrowRate = nextVariableRate.toUint128();

// Only affect virtual balance if the reserve uses it
if (reserve.configuration.getIsVirtualAccActive()) {
if (reserveCache.reserveConfiguration.getIsVirtualAccActive()) {
if (liquidityAdded > 0) {
reserve.virtualUnderlyingBalance += liquidityAdded.toUint128();
}
Expand Down

0 comments on commit f5389a4

Please sign in to comment.