celo-org / uniswap-v3-info

Interface for Uniswap V3 analytics. 📊
https://info.uniswap.org/#/
GNU General Public License v3.0
0 stars 0 forks source link

Updating Uniwap Celo Subgraph #1

Closed amitchuapf closed 6 months ago

amitchuapf commented 7 months ago

Is your feature request related to a problem? Please describe. Per Uniswap support's feedback, we need to whitelist new tokens on Celo's Uniswap Subgraph in order for their to be proper routing for token swaps. I.E. native USDC isn't currently whitelisted on the Celo Uniswap Subgraph, therefore swapping between cUSD to CHAR creates incurs significant slippage even though there is a USDC/CHAR pool because the trade doesn't automatically route through this pool.

USDC/CHAR pool - https://info.uniswap.org/#/celo/pools/0x7f7c4335ccac291ddedcef4429a626c442b627ed

Describe the solution you'd like We'd like the ability to whitelist tokens on Celo's Uniswap Subgraph.

https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo/graphql?query=%23%0A%23+Welcome+to+The+GraphiQL%0A%23%0A%23+The+GraphiQL+is+an+in-browser+tool+for+writing%2C+validating%2C+and%0A%23+testing+GraphQL+queries.%0A%23%0A%23+Type+queries+into+this+side+of+the+screen%2C+and+you+will+see+intelligent%0A%23+typeaheads+aware+of+the+current+GraphQL+type+schema+and+live+syntax+and%0A%23+validation+errors+highlighted+within+the+text.%0A%23%0A%23+GraphQL+queries+typically+start+with+a+%22%7B%22+character.+Lines+that+start%0A%23+with+a+%23+are+ignored.%0A%23%0A%23+An+example+GraphQL+query+might+look+like%3A%0A%23%0A%23+++++%7B%0A%23+++++++field%28arg%3A+%22value%22%29+%7B%0A%23+++++++++subField%0A%23+++++++%7D%0A%23+++++%7D%0A%23%0A%23+Keyboard+shortcuts%3A%0A%23%0A%23++Prettify+Query%3A++Shift-Ctrl-P+%28or+press+the+prettify+button+above%29%0A%23%0A%23+++++Merge+Query%3A++Shift-Ctrl-M+%28or+press+the+merge+button+above%29%0A%23%0A%23+++++++Run+Query%3A++Ctrl-Enter+%28or+press+the+play+button+above%29%0A%23%0A%23+++Auto+Complete%3A++Ctrl-Space+%28or+just+start+typing%29%0A%23%0A

Describe alternatives you've considered N/A. Open to suggestions

Additional context Add any other context or screenshots about the feature request here.

amitchuapf commented 7 months ago

photo_2024-03-26_16-45-38 photo_2024-03-26_16-45-32

arthurgousset commented 7 months ago

Great point, thanks for flagging @amitchuapf. I'm taking on this issue. I'll first get access to the existing Celo Uniswap Subgraph. I can't currently see or find it.

arthurgousset commented 7 months ago

I can see Celo subgraphs are used in various places across Uniswap repos.

Github search: org:Uniswap https://api.thegraph.com/subgraphs/name/jesse-sawa

  1. Uniswap/interface > apps/web/src/graphql/thegraph/apollo.ts
[ChainId.CELO]: 'https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo?source=uniswap',
  1. Uniswap/v3-info > src/apollo/client.ts
export const celoClient = new ApolloClient({
  uri: 'https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo?source=uniswap',
  cache: new InMemoryCache({
// ...
export const celoBlockClient = new ApolloClient({
  uri: 'https://api.thegraph.com/subgraphs/name/jesse-sawa/celo-blocks',
  cache: new InMemoryCache(),
  1. Uniswap/smart-order-router > src/providers/v3/subgraph-provider.ts
[ChainId.CELO]:
    'https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo',
  1. Uniswap/interface-fork > src/graphql/thegraph/apollo.ts
[SupportedChainId.CELO]: 'https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo',
}
  1. Uniswap/interface-apr-2023-fork > src/graphql/thegraph/apollo.ts
[SupportedChainId.CELO]: 'https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo',

My thinking:

Overall the repos don't matter much, because each uses the same subgraph URL https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo.

So editing that subgraph should mean the changes are reflected across repositories.

arthurgousset commented 7 months ago

Asked TheGraph on Slack about best practices regarding the namespace and account used to manage the subgraph.

I notice the name space is jesse-sawa.

arthurgousset commented 7 months ago

This might be the source code for the subgraph: https://github.com/Uniswap/v3-subgraph

But, I'm not sure yet, I have to look into it in more detail.

arthurgousset commented 7 months ago

@jcortejoso kindly agreed to own the account management and deployment side of the new subgraph. (See Slack convo)

arthurgousset commented 7 months ago

Jesse helped me find the source code for the Celo subgraph deployed at https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo.

It's in this PR:

in this repo: Jesse-Sawa/v3-subgraph

arthurgousset commented 7 months ago

I made a new fork of the repo in the celo-org scope: celo-org/v3-subgraph

arthurgousset commented 7 months ago

I'll proceed in two steps:

  1. Reproduce Jesse's original subgraph in the celo-org/v3-subgraph fork: https://github.com/celo-org/v3-subgraph/pull/1
  2. Update the subgraph with new tokens as requested in this issue
amitchuapf commented 7 months ago

Thank you Arthur!

If helpful as a refresher, we'd like to add native USDC & USDT to the Celo Uniswap subgraph:

https://celoscan.io/token/0xceba9300f2b948710d2653dd7b07f33a8b32118c https://celoscan.io/address/0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e

On Mon, Apr 1, 2024 at 6:33 AM Arthur Gousset @.***> wrote:

I'll proceed in two steps:

  1. Reproduce Jesse's original subgraph in the celo-org/v3-subgraph https://github.com/celo-org/v3-subgraph fork
  2. Update the subgraph with new tokens as requested in this issue

— Reply to this email directly, view it on GitHub https://github.com/celo-org/uniswap-v3-info/issues/1#issuecomment-2029766651, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCXWJJ36QQOOH5JXTYQXY3TY3FO2TAVCNFSM6AAAAABFJ3XP2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZG43DMNRVGE . You are receiving this because you were mentioned.Message ID: @.***>

arthurgousset commented 7 months ago

Thank you Arthur! If helpful as a refresher, we'd like to add native USDC & USDT to the Celo Uniswap subgraph: https://celoscan.io/token/0xceba9300f2b948710d2653dd7b07f33a8b32118c https://celoscan.io/address/0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e

Perfect, thanks for the addresses @amitchuapf 👍

arthurgousset commented 6 months ago

Small update here, we are blocked by the Uniswap team, because their front-end interface repository has bug that prevents us from testing the new subgraph with it.

I'd like to test the new subgraph in a locally built and hosted front-end to ensure everything works smoothly. Once that's done, I'll submit a PR to update the subgraph in Uniswap's relevant production repos.

@jcortejoso has got the subgraph hosting side of things figured out 🙏

arthurgousset commented 6 months ago

Updates USDC address for Celo Alfajores testnet in Uniswap interface:

arthurgousset commented 6 months ago

Noticed that @mzywang is working on similar changes in:

Contacted him on Slack, because it might not make sense to open a PR if @mzywang is working on the same changes.

arthurgousset commented 6 months ago

TLDR:

  1. Uniswap Labs will host the Celo subgraph used in production, and
  2. Uniswap Labs will own and maintain the v3-subgraph repo that generates the subgraph.

On that basis, community members can request new tokens to be whitelisted by opening a PR in the v3-subgraph repo.

@mzywang expects the new Celo subgraph will be live and used in production in the order of "weeks" (not days or months).

For future reference:

On that basis, I'll close this issue and associated PRs, since all work streams here are and will be owned by Uniswap.