makerdao / univ2-lp-oracle

GNU Affero General Public License v3.0
23 stars 13 forks source link

Strange check here #22

Closed alexisgayte closed 3 years ago

alexisgayte commented 3 years ago

https://github.com/makerdao/univ2-lp-oracle/blob/c500d2197f153f70da0e3005e74b87c37ee33a40/src/Univ2LpOracle.sol#L231-232

if (normalizer0 > 1) Is that for gas saving?

If not and it is to avoid the 0, Don't we want to move it into the constructor? if normalizer0 ==0 ? normalizer0 =1

brianmcmichael commented 3 years ago

normalizer0 is an immutable variable, which is part of the bytecode, so this comparison costs 3 gas.