Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to bridge or swap FOX on Optimism even though both LiFi and 0x support in their UI #5096

Closed
willyogo opened this issue Aug 17, 2023 · 10 comments · Fixed by #5103
Closed
Assignees
Labels
bug Something isn't working

Comments

@willyogo
Copy link
Contributor

Overview

LiFi's UI and API supports bridging FOX on mainnet to FOX on optimism via a single hop, and 0x's UI (and I assume API) supports swapping FOX/wstETH on Optimism. However, when you try the same pairs in ShapeShift, the app says no rate available.

Ideally we can fix this for both FOX as well as any other pairs that our partners support but we don't (both in the API and interface). At the very least, we should understand why it works in their UI and API but not on ShapeShift.

This is a blocker for launching FOX/wstETH liquidity mining on Optimism, which we've been granted 20k OP for that we're working to get matched by Lido.

References and additional details

Steps to reproduce on LiFi:

  1. Set up a FOX on mainnet to FOX on Optimism bridge on LiFi's UI or API and see it returns a single hop bridge route
  2. Try setting up the same bridge in ShapeShift's UI or API and see it returns 'no rate available'
image image

Steps to reproduce on 0x:

  1. Set up a FOX on Optimism to wstETH on Optimism swap in matcha's UI and see it returns a rate (although note that it does see FOX's price as $0.00 and so calculates a price impact of 100%)
  2. Set up a FOX on Optimism to wstETH on Optimism swap in ShapeShift's UI and see it returns 'no rate available'
image image

Acceptance Criteria

AC:
Ideal: Enable users to swap and single-hop-bridge the same pairs in ShapeShift that they can on 0x and LiFi (at least for tokens that shapeshift supports)
At least: Determine why some pairs such as FOX are supported in 0x and LiFi but not in ShapeShift, and create a separate issue with the details

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

@willyogo willyogo added the bug Something isn't working label Aug 17, 2023
@gomesalexandre gomesalexandre self-assigned this Aug 17, 2023
@gomesalexandre
Copy link
Contributor

This is the offender:

if (!buyAssetUsdRate) throw Error('missing buyAssetUsdRate')

I think we should be able to safely assume FOX price for all bridged versions here, though it definitely feels hacky, as this may happen with other bridged assets we don't have market data for

@twblack88
Copy link
Contributor

@gomesalexandre So like 1 FOX = 1 FOX? sounds like slippage errors and other issues to me. We can keep digging.

@gomesalexandre
Copy link
Contributor

@gomesalexandre So like 1 FOX = 1 FOX? sounds like slippage errors and other issues to me. We can keep digging.

More like we don't have market data for the Optimism flavor of bridged FOX and bail out @twblack88 , instead of using the mainnet market data for it.
This is really just informative anyway, as the rate is only for us to display what the market data is for a given asset, but won't impact the quotes we're getting (we are in fact getting quotes here on that pair, but we bail out early) this is a totally separate concern

@willyogo
Copy link
Contributor Author

I think we should be able to safely assume FOX price for all bridged versions here, though it definitely feels hacky, as this may happen with other bridged assets we don't have market data for

Makes sense to me as long as we're just using it to display a fiat value and the assets are mapped to eachother.

Does this explain for both LiFi and 0x @gomesalexandre? William mentioned another potential issue in discord:

"The API will return an error of insufficient liquidity due to the price impact being higher than the defined limit. The threshold is easily customizable by setting PriceImpactProtectionPercentage anywhere from 0-1, so we encourage every Swap API user to customize this parameter based on their needs and tolerance.

https://0x.org/docs/0x-swap-api/advanced-topics/price-impact-protection"

--

If this is also an issue, I think we should be able to set to 1 because we have solid price impact handling in the UI (and may to give ShapeShift API customers their own ability to set this between 0-1)

@gomesalexandre
Copy link
Contributor

Correct @willyogo this is the same issue for ZRX, see
image

@sktbrd
Copy link

sktbrd commented Aug 21, 2023

Another example of an asset with liquidity on Uniswap v3 showing 'no rate available' on ShapeShift Note to test the ETH:BRZ pair when this fix is deployed (same thing for other chains of the same token)

image
image

@gomesalexandre
Copy link
Contributor

Thanks for reporting this @sktbrd. Unfortunately, we don't have market data for BRZ, thus are unable to show a quote as we don't have USD rate for it.
Matcha use an internal /api/get-usd-prices endpoint to which is how they're able to get a USD rate, unfortunately, their API isn't public so we cannot consume it.

image

@willyogo
Copy link
Contributor Author

@gomesalexandre I'm not sure why we don't have a fiat price for BRZ; it's in coingecko's tokenlist and has a price on coingecko.

Regardless, can you help me understand why we need a fiat price in order to show a quote? I'd expect we could display/return quotes for any assets that 0x can. in the past we've been able to support DEX trading for assets with no fiat value as long as we could get a quote from a provider.

@gomesalexandre
Copy link
Contributor

gomesalexandre commented Aug 21, 2023

@gomesalexandre I'm not sure why we don't have a fiat price for BRZ; it's in coingecko's tokenlist and has a price on coingecko.

Nice catch @willyogo, this would be the explanation

image

Authored #5123 which regenerated asset data, including the updated contract for BRZ.

image

WRT the second point, we do need a USD rate in order to allow user input in fiat, as we are getting quotes as well as to show fiat rates in swapper. Theoretically, we could remove the safeguards against having USD rates for both buy and sell assets, though that's probably more of a product concern here

@willyogo
Copy link
Contributor Author

willyogo commented Aug 22, 2023

thanks @gomesalexandre 🙏 good q for @shapeshift/product on whether we can remove the USD rate safe guard for buy and sell assets. my gut says we could just show either no fiat value or $0.00 and disable inputting a fiat amount. it looks like this will be limited to edge cases though, so may not be worth the squeeze until we support inputting custom tokens via contract address

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants