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

Updating Uniwap Celo Subgraph #1

Closed
amitchuapf opened this issue Mar 26, 2024 · 15 comments
Closed

Updating Uniwap Celo Subgraph #1

amitchuapf opened this issue Mar 26, 2024 · 15 comments
Assignees

Comments

@amitchuapf
Copy link

amitchuapf commented Mar 26, 2024

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
Copy link
Author

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

@arthurgousset
Copy link

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
Copy link

arthurgousset commented Mar 27, 2024

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:

  • (3.) is where the routing logic affects the DEX trades you mention
  • (4.) and (5.) are not relevant, these are experimental forks
  • (1.) and (2.), I'm not sure.

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
Copy link

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
Copy link

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
Copy link

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

@arthurgousset
Copy link

arthurgousset commented Mar 28, 2024

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
Copy link

arthurgousset commented Mar 28, 2024

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

@arthurgousset
Copy link

arthurgousset commented Apr 1, 2024

I'll proceed in two steps:

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

@amitchuapf
Copy link
Author

amitchuapf commented Apr 1, 2024 via email

@arthurgousset
Copy link

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 arthurgousset linked a pull request Apr 24, 2024 that will close this issue
@arthurgousset
Copy link

arthurgousset commented Apr 24, 2024

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
Copy link

Updates USDC address for Celo Alfajores testnet in Uniswap interface:

@arthurgousset
Copy link

arthurgousset commented Apr 29, 2024

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
Copy link

arthurgousset commented May 22, 2024

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:

  • The subgraph affects optimal order routing, Uniswap uses the subgraph for pool discoverability and ranks pools based on TVL.
  • If the subgraph is down (as is the case right now for the one on the hosted service), a static list of tokens is used to determine routes defined in the uniswap interface.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants