Return correctedTime
in getters that rely on block.timestamp
#228
Replies: 5 comments 11 replies
-
I will review this and the related PR tomorrow if that's OK! |
Beta Was this translation helpful? Give feedback.
-
I am not sure I understand what are you referring to. How do you calculate the As mentioned on slack, we won't have anymore the |
Beta Was this translation helpful? Give feedback.
-
My ReinterpretationI have reviewed your findings in #220 and the proposal herein now. Absolutely stellar work, @smol-ninja. This was a tough nut to crack. To explain the problem in my own terms:
Questions
Alternative SolutionI think that the discrete snapshot time is a better idea, but here's an alternative solution.
This solution might result in more calculations and an increased gas cost. P.S. it looks like it was a good thing after all to use a token with 6 decimals as the default. |
Beta Was this translation helpful? Give feedback.
-
Responding to @andreivladbrg here:
That would work, but I have this gnawing sense that the implementation would become increasingly uglier, like a Rube Goldberg machine. I am starting to like the remainder tracker solution more because it's cleaner, which also means (slightly) safer and easier to audit. WDYT? |
Beta Was this translation helpful? Give feedback.
-
Closing this discussion now. |
Beta Was this translation helpful? Give feedback.
-
Recently, I've realized that there is no point in having
block.timestamp
anywhere in the code. The debt calculations rely more on the value of the corrected time (#220) thanblock.timestamp
. Even when we passblock.timestamp
, the theoretical amounts calculated may not match because they are rounded down using corrected time.Thus, I propose to go with one of the following options:
block.timestamp
from functions likecoveredDebtOf
,totalDebt
, etc., and introduce atime
input parameter.correctedTime
in all these functions to inform users that the returned amounts are calculated based oncorrectedTime
and notblock.timestamp
.PS: in option (1), we would still have to return
correctedTime
so only option (2) makes sense.cc @sablier-labs/solidity
Beta Was this translation helpful? Give feedback.
All reactions