tangle-network / relayer

🕸️ The Webb Relayer Network
https://webb-tools.github.io/relayer/
Apache License 2.0
22 stars 13 forks source link

[BUG] Coingecko API is down, need better solution for fetching token prices #402

Closed salman01zp closed 1 year ago

salman01zp commented 1 year ago

Summary

Currently, we just use coin gecko API to fetch prices for tokens, but it went down and due to this issue, the application is unable to fetch real-time cryptocurrency prices and fails with an error

reqwest::Error { kind: Decode, source: Error(\"expected value\", line: 1, column: 1) }"

Solution 1

Use alternative API like coinbase if coingecko API is down.

Solution 2

Use uniswap oracle contract to fetch token prices

shekohex commented 1 year ago

I lowered the priority of that issue for now, as that API will eventually be up again soon. And we will be aiming for a better solution by utilizing a decentralized on chain oracle like for example, Uniswap, 1inch, ..etc.

Examples:

  1. https://docs.uniswap.org/sdk/v3/guides/quoting
  2. https://docs.1inch.io/docs/spot-price-aggregator/examples
  3. https://docs.1inch.io/docs/aggregation-protocol/api/quote-params
shekohex commented 1 year ago

Should be resolved once we implement #403 SPEC

dutterbutter commented 1 year ago

Can we increase the priority here to p0 as this blocks the fee related work on the dApp. @shekohex

shekohex commented 1 year ago

Can we increase the priority here to p0 as this blocks the fee related work on the dApp. @shekohex

I see, we can work on a quick solution by using other Oracle like CoinMarketCap https://github.com/dzhegash/cmc or a deployment where we can mock price oracle (useful for deterministic testing). @Nutomic what do you think?

shekohex commented 1 year ago

Related to #404

shekohex commented 1 year ago

Increasing the priority again, as they seem to be a blocking issue for the deployment.

shekohex commented 1 year ago

Update: The Coingecko API is now working normally However, we shall support different Price oracles for such cases.