primitivefinance / portfolio

Portfolio is an automated market making protocol for implementing custom strategies at the lowest cost possible.

Home Page:https://www.primitive.xyz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

approximateXGivenPrice can fail if priceWad * 1e18 is > type(uint256).max

Alexangelj opened this issue · comments

This function attempts to divide by the strikePriceWad variable. It uses the divWadDown method which will multiply the numerator (priceWad) by 1E18. If this overflows the uint256 max, it will revert with an arithmetic error.

Noted in docs.