Skip to content

Commit

Permalink
issue 33: gas optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0Louis committed Mar 22, 2023
1 parent 72e293b commit 5867797
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libraries/PairParameterHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,12 @@ library PairParameterHelper {
*/
function updateVolatilityAccumulator(bytes32 params, uint24 activeId) internal pure returns (bytes32) {
uint256 idReference = getIdReference(params);
uint256 deltaId = activeId > idReference ? activeId - idReference : idReference - activeId;

uint256 deltaId;
uint256 volAcc;

unchecked {
deltaId = activeId > idReference ? activeId - idReference : idReference - activeId;
volAcc = (uint256(getVolatilityReference(params)) + deltaId * Constants.BASIS_POINT_MAX);
}

Expand Down

0 comments on commit 5867797

Please sign in to comment.