Skip to content

Commit

Permalink
Merge pull request #167 from pooltogether/fix/twablib-getbalanceat
Browse files Browse the repository at this point in the history
fix(TwabLib): don't store getBalanceAt calculation
  • Loading branch information
PierrickGT committed Oct 5, 2021
2 parents 575ad94 + 88ebd11 commit e28d68a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions contracts/libraries/TwabLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,7 @@ library TwabLib {
);

// Difference in amount / time
uint224 differenceInAmount = afterOrAt.amount - beforeOrAt.amount;
uint32 differenceInTime = afterOrAt.timestamp - beforeOrAt.timestamp;

return differenceInAmount / differenceInTime;
return (afterOrAt.amount - beforeOrAt.amount) / (afterOrAt.timestamp - beforeOrAt.timestamp);
}

/// @notice Calculates the TWAB for a given timestamp. It interpolates as necessary.
Expand Down

0 comments on commit e28d68a

Please sign in to comment.