Skip to content

Commit

Permalink
update(TwabLib): call _computeNextTwab in top of _calculateTwab
Browse files Browse the repository at this point in the history
  • Loading branch information
kamescg committed Oct 6, 2021
1 parent 8906897 commit 7a063e1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions contracts/libraries/TwabLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,7 @@ library TwabLib {
) private view returns (ObservationLib.Observation memory) {
// If `_targetTimestamp` is chronologically after the newest TWAB, we extrapolate a new one
if (_newestTwab.timestamp.lt(_targetTimestamp, _time)) {
return
ObservationLib.Observation({
amount: _newestTwab.amount +
_accountDetails.balance *
(_targetTimestamp - _newestTwab.timestamp),
timestamp: _targetTimestamp
});
return _computeNextTwab(_newestTwab, _accountDetails.balance, _targetTimestamp);
}

if (_newestTwab.timestamp == _targetTimestamp) {
Expand Down

0 comments on commit 7a063e1

Please sign in to comment.