Closed greg-nagy closed 1 year ago
I wonder if we can greatly simplify this whole thing by using the expectedSlippage
response from 0x?
I ran a few tests, and based on that:
expectedSlippage
is always null — tested on optimism and mainnet, with multiple pairs and couldn't find one which is not null price
api result has a estimatedPriceImpact
property and it returns the value of the price impact displayed on matcha as a string
estimatedPriceImpact
is 0 meanwhile we get price data from coingeckoAdditional observation from #2236 and #2449:
sellTokenToEthRate
and buyTokenToEthRate
is populated even if we don't get price data from coingecko. Eg. optimism OP<>sBTCestimatedPriceImpact
is 0 > I think this signals that they don't have data
sellTokenToEthRate
orbuyTokenToEthRate
is 0 in the 0x quote api response, when we can't resolve USD or ETH price for an asset from coingeckosellTokenToEthRate
andbuyTokenToEthRate
if it's 0 in the 0x quote response and inform the user that we don't know about the price impact