This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Description
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:
|
if cfg.Invert { |
|
scaledERC20AdjustedPrice := new(big.Float).Quo(price, erc20ScalingFactor) |
|
return new(big.Float).Quo(big.NewFloat(1), scaledERC20AdjustedPrice) |
|
} |
The second reversal occurs get provider price:
|
if cfg.Invert { |
|
return new(big.Float).Quo(big.NewFloat(1), price), nil |
|
} |
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.