From 5a55b0c75613732de30fcf28a56eae2d1b026dc0 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Mon, 30 Sep 2024 21:25:57 +0100 Subject: [PATCH] (demurrage): small possible gas optimisation --- src/circles/Demurrage.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/circles/Demurrage.sol b/src/circles/Demurrage.sol index 92ed82f..2f26c5e 100644 --- a/src/circles/Demurrage.sol +++ b/src/circles/Demurrage.sol @@ -256,9 +256,10 @@ contract Demurrage is ICirclesDemurrageErrors { R[_dayDifference] = demurrageFactor; } return demurrageFactor; - } else { - return Math64x64.pow(GAMMA_64x64, _dayDifference); } + // if the day difference is for older than 14 days, calculate the value + // and do not cache it + return Math64x64.pow(GAMMA_64x64, _dayDifference); } /**