Skip to content

Commit

Permalink
update(TwabLib): use _computeNextTwab in _calculateTwab
Browse files Browse the repository at this point in the history
  • Loading branch information
kamescg committed Oct 6, 2021
1 parent 4c9f635 commit ae8755c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions contracts/libraries/TwabLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,7 @@ library TwabLib {
uint224 heldBalance = (afterOrAtStart.amount - beforeOrAtStart.amount) /
(afterOrAtStart.timestamp - beforeOrAtStart.timestamp);

uint224 amount = beforeOrAtStart.amount +
heldBalance *
(targetTimestamp - beforeOrAtStart.timestamp);

return ObservationLib.Observation({ amount: amount, timestamp: targetTimestamp });
return _computeNextTwab(beforeOrAtStart, heldBalance, targetTimestamp);
}

/// @notice Records a new TWAB.
Expand Down

0 comments on commit ae8755c

Please sign in to comment.