Open override-coder opened 2 months ago
Description of the Issue: The current implementation performs price inversion twice within the cfg.Invert block, both of which happen after the ERC20 price scaling. The first inversion happens here: https://github.com/skip-mev/connect/blob/e197035e90656f1a5f840a90e23dfa2b9174f70d/providers/apis/defi/uniswapv3/math.go#L44-L47
The second reversal occurs get provider price: https://github.com/skip-mev/connect/blob/e197035e90656f1a5f840a90e23dfa2b9174f70d/pkg/math/oracle/utils.go#L32-L34
This results in a double inversion of the price when cfg.Invert is set to true, which could lead to incorrect calculations.
Suggested Fix: Remove the first inversion and only perform the scaling operation on the ERC20 price.
Description of the Issue: The current implementation performs price inversion twice within the cfg.Invert block, both of which happen after the ERC20 price scaling. The first inversion happens here: https://github.com/skip-mev/connect/blob/e197035e90656f1a5f840a90e23dfa2b9174f70d/providers/apis/defi/uniswapv3/math.go#L44-L47
The second reversal occurs get provider price: https://github.com/skip-mev/connect/blob/e197035e90656f1a5f840a90e23dfa2b9174f70d/pkg/math/oracle/utils.go#L32-L34
This results in a double inversion of the price when cfg.Invert is set to true, which could lead to incorrect calculations.
Suggested Fix: Remove the first inversion and only perform the scaling operation on the ERC20 price.