Redundant if conditions in the getSellPrice
function
The while condition guarantees that the i
value will be less than data.supply
, so the other internal i < data.supply
checks are redundant.
function getSellPrice(address token, uint256 amount) public view returns (uint256) {
...
while (i < data.supply) {
uint256 price = getPrice(i+1, data.viralityScore);
if (i >= supplyFloor && i < data.supply) {
prices[j] = price;
unchecked { j++; }
}
if (i < data.supply) {
totalPrice += price;
}
unchecked { i++; }
}
...
}
The second redundant check was removed in commit .