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

Update subgraph urls (moving away from hosted service) #581

Merged
merged 4 commits into from
Jun 26, 2024

Conversation

brunoguerios
Copy link
Member

@brunoguerios brunoguerios commented Jun 12, 2024

Closes #580

Main changes:

  • Update subgraph and gaugesSubgraph config url for all chains

Questions:

  • do we still need to support blockNumbersSubgraph? -> used to calculate accumulated swapFees on the last 24h
  • do we need to push those changes to the master branch and perform a latest release?
  • I didn't add subgraph info for Mode because we don't have any config info for it - do we need to add it?
  • I didn't update subgraph info for Goerli because we don't have a new one - should we remove all config info for Goerli and drop support for it?

@brunoguerios brunoguerios requested a review from johngrantuk June 12, 2024 13:41
@brunoguerios brunoguerios self-assigned this Jun 12, 2024
@brunoguerios brunoguerios requested a review from mendesfabio June 12, 2024 13:44
@mendesfabio
Copy link
Member

do we still need to support blockNumbersSubgraph? -> used to calculate accumulated swapFees on the last 24h

I'm not sure but if you need here are the endpoints you can use.

https://api.studio.thegraph.com/query/48427/ethereum-blocks/version/latest⁠
https://api.studio.thegraph.com/query/48427/avalanche-blocks/version/latest
https://api.studio.thegraph.com/query/48427/arbitrum-blocks/version/latest
https://api.studio.thegraph.com/query/48427/optimism-blocks/version/latest
https://api.studio.thegraph.com/query/48427/polygon-blocks/version/latest
https://api.studio.thegraph.com/query/48427/gnosis-blocks/version/latest

I didn't add subgraph info for Mode because we don't have any config info for it - do we need to add it?

Mode is already there right? 🤔 and it looks because it already uses the Studio endpoint.

I didn't update subgraph info for Goerli because we don't have a new one - should we remove all config info for Goerli and drop support for it?

I suggest removing it. Goerli has stopped producing blocks and it's not useful anymore.

@brunoguerios
Copy link
Member Author

brunoguerios commented Jun 12, 2024

Thanks for the feedback!

  • if we have endpoints for blockNumbersSubgraph, I'll simply update them 👍
  • didn't see Mode there - ignore the comment 😅
  • I'll go ahead and remove Goerli - will leave that for now and come back once we've handled other high priority tasks

@brunoguerios
Copy link
Member Author

Not sure it's related, but there are a few failing APR tests.
It seems to be related to token price repository still using coingecko as their main source of data. On other areas of the code we already moved to the API as source for token prices.
Not sure this is something we'd like to spend time on, so will put this on hold for now.
Questions we'd need to answer:

  • is someone using the SDK as source of data for this info? or is this already being taken care somewhere else (e.g. api)?
  • is it ok to simply skip those tests for now and eventually remove APR content from the old SDK?

@johngrantuk
Copy link
Member

Another alternative is to keep the APR functionality but update to make it a proxy to the API. Would keep the functionality incase anyone is using it. I think this would be fairly easy to do and would probably allow us to remove a bunch of dependecies.

@peterpolman
Copy link

Hi @brunoguerios @johngrantuk! When can we expect to be merged in?

The hosted subgraphs used by the SDK have been made unavailable since 8:30 CET breaking most of its features. I'll cherry pick this branch for now to solve the issues we're having because of this.

@johngrantuk johngrantuk merged commit d2b9855 into develop Jun 26, 2024
2 of 3 checks passed
@johngrantuk johngrantuk deleted the update-subgraph-urls branch June 26, 2024 08:55
@johngrantuk
Copy link
Member

Hi @brunoguerios @johngrantuk! When can we expect to be merged in?

The hosted subgraphs used by the SDK have been made unavailable since 8:30 CET breaking most of its features. I'll cherry pick this branch for now to solve the issues we're having because of this.

@peterpolman - Sorry about that, just released now in: @balancer-labs/[email protected]. Please open a ticket or reach out if there are still issues.
Also worth noting, this SDK will be deprecated in favour of a new one with narrower focus. Any depreacted functionality (e.g. APRs) should be available from the API: https://api-v3.balancer.fi/, which should give you a better UX.

@peterpolman
Copy link

Thanks for the patch! Tested and solves the issues🙏

  • Aware of the new version as well. Will schedule a task for a migration.
  • Not aware of the API tbh. How can I query for the APR and token pair prices of my pool?

@johngrantuk
Copy link
Member

Thanks for the patch! Tested and solves the issues🙏

* Aware of the new version as well. Will schedule a task for a migration.

* Not aware of the API tbh. How can I query for the APR and token pair prices of my pool?

The API is running as a graphql server and is deployed at https://api-v3.balancer.fi/, its self-documenting so you can click around the link to explore.
This example query gets pools details including APRs:

{
  poolGetPool(id: "0x7f2b3b7fbd3226c5be438cde49a519f442ca2eda00020000000000000000067d", chain:MAINNET) {
    id
    name
    type
    version
    allTokens {
      address
      name
    }
    displayTokens {
      ...on GqlPoolTokenDisplay {
        symbol
      }
    }
    dynamicData {
      totalLiquidity
      apr {
        swapApr
        nativeRewardApr {
          ...on GqlPoolAprTotal {
            total
          }
        }
        thirdPartyApr {
          ...on GqlPoolAprTotal {
            total
          }
        }
        items {
          title
          apr {
            ...on GqlPoolAprRange {
              min
              max
            }
            ...on GqlPoolAprTotal {
              total
            }
          }
        }
      }
    }
  }
}

If you confirm what you mean by token pair prices (and maybe how you currently do that) I could try to find the best query for you.

@peterpolman
Copy link

Thanks! I appreciate that 🙏

This method is responsible for updating price information periodically using the SDK:
https://github.com/thxprotocol/monorepo/blob/develop/apps/api/src/app/services/BalancerService.ts#L109-L130

The USD value of the token pair 20USD-80THX, our token THX and USDC.e are consumed by our frontend. Additionally we fetch the latest BAL USD value from Coinbase, but preferably we fetch this from the API as well.

20USD-80THX:
https://app.balancer.fi/#/polygon/pool/0xb204bf10bc3a5435017d3db247f56da601dfe08a0002000000000000000000fe

@johngrantuk
Copy link
Member

Thanks! I appreciate that 🙏

This method is responsible for updating price information periodically using the SDK: https://github.com/thxprotocol/monorepo/blob/develop/apps/api/src/app/services/BalancerService.ts#L109-L130

The USD value of the token pair 20USD-80THX, our token THX and USDC.e are consumed by our frontend. Additionally we fetch the latest BAL USD value from Coinbase, but preferably we fetch this from the API as well.

20USD-80THX: https://app.balancer.fi/#/polygon/pool/0xb204bf10bc3a5435017d3db247f56da601dfe08a0002000000000000000000fe

You can use:

{
  tokenGetCurrentPrices(chains: [POLYGON]) {
    chain
    address
    price
  }
}

and filter for the token addresses.

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 this pull request may close these issues.

Subgraph endpoint update required
4 participants