From bdf4794d2e8a1c89c40df6c32aca61a73e81aca9 Mon Sep 17 00:00:00 2001 From: feyyazcigim Date: Mon, 29 Dec 2025 04:36:59 +0300 Subject: [PATCH 1/3] add codegen validation to prevent outdated generated files --- .github/workflows/ci.yml | 22 ++++++++++++++++++++-- .husky/pre-commit | 26 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f07918eb8..d79f79714 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,11 +34,29 @@ jobs: # if: steps.node-modules-cache.outputs.cache-hit != 'true' run: yarn install - # 5. Build only if build artifacts aren't cached + # 5. Check codegen is up to date + - name: Check codegen is up to date + run: | + echo "Running codegen to check if outputs are current..." + yarn generate + + echo "Checking if codegen outputs changed..." + if ! git diff --exit-code src/generated/; then + echo "❌ Codegen outputs are outdated!" + echo "The following files have changes:" + git diff --name-only src/generated/ + echo "" + echo "Please run 'yarn generate' locally and commit the changes." + exit 1 + fi + + echo "✅ Codegen outputs are up to date" + + # 6. Build only if build artifacts aren't cached - name: Build run: yarn build - # 6. Run tests + # 7. Run tests - name: Run tests run: yarn test diff --git a/.husky/pre-commit b/.husky/pre-commit index b903358dc..dc141bace 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,6 +1,32 @@ # Get list of staged files before running formatter/linter STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR) +# Check if any GraphQL queries or schema-related files are being committed +GRAPHQL_FILES=$(echo "$STAGED_FILES" | grep -E '\.(graphql|gql)$' || true) +SCHEMA_RELATED_FILES=$(echo "$STAGED_FILES" | grep -E '(codegen\.ts|wagmi\.config\.ts)$' || true) + +# If GraphQL or schema files are being committed, check codegen +if [ -n "$GRAPHQL_FILES" ] || [ -n "$SCHEMA_RELATED_FILES" ]; then + echo "🔍 GraphQL or schema files detected, checking codegen..." + + # Run codegen + yarn generate + + # Check if codegen outputs changed + if ! git diff --exit-code src/generated/; then + echo "⚠️ Codegen outputs have changed!" + echo "The following files were updated:" + git diff --name-only src/generated/ + echo "" + echo "These changes will be automatically staged for commit." + + # Stage the generated files + git add src/generated/ + else + echo "✅ Codegen outputs are up to date" + fi +fi + # Run format and lint yarn format-and-lint From 743c0b23686a65cbc325be75f2324574246698c0 Mon Sep 17 00:00:00 2001 From: feyyazcigim Date: Wed, 7 Jan 2026 15:32:59 +0300 Subject: [PATCH 2/3] add cached queries-endpoints and apply these changes to hooks --- codegen.ts | 12 +- src/constants/subgraph.ts | 6 +- src/generated/gql/cache/gql.ts | 94 +++ src/generated/gql/cache/graphql.ts | 745 ++++++++++++++++++ src/generated/gql/cache/index.ts | 1 + .../seasonal/CacheFarmerSeasonalSilo.graphql | 16 + .../CacheFarmerSeasonalSiloAsset.graphql | 16 + .../cache/seasonal/CacheSeasonalBean.graphql | 21 + .../cache/seasonal/CacheSeasonalField.graphql | 32 + .../seasonal/CacheSeasonalGaugesInfo.graphql | 17 + .../CacheSeasonalMarketPerformance.graphql | 21 + .../cache/seasonal/CacheSeasonalSilo.graphql | 31 + .../CacheSeasonalWrappedDeposit.graphql | 18 + .../cache/seasonal/CacheSeasons.graphql | 17 + .../seasonal/queries/useSeasonalBeanBeanSG.ts | 35 +- .../queries/useSeasonalBeanstalkFieldSG.ts | 43 +- .../queries/useSeasonalBeanstalkSiloSG.ts | 65 +- .../useSeasonalBeanstalkWrappedDepositsSG.ts | 41 +- .../seasonal/queries/useSeasonalGaugeInfo.ts | 39 +- .../queries/useSeasonalMarketPerformance.ts | 69 +- src/state/seasonal/seasonalDataHooks.ts | 12 +- src/state/useSeasonsData.ts | 160 ++-- src/utils/paginateSubgraph.ts | 59 ++ 23 files changed, 1311 insertions(+), 259 deletions(-) create mode 100644 src/generated/gql/cache/gql.ts create mode 100644 src/generated/gql/cache/graphql.ts create mode 100644 src/generated/gql/cache/index.ts create mode 100644 src/queries/cache/seasonal/CacheFarmerSeasonalSilo.graphql create mode 100644 src/queries/cache/seasonal/CacheFarmerSeasonalSiloAsset.graphql create mode 100644 src/queries/cache/seasonal/CacheSeasonalBean.graphql create mode 100644 src/queries/cache/seasonal/CacheSeasonalField.graphql create mode 100644 src/queries/cache/seasonal/CacheSeasonalGaugesInfo.graphql create mode 100644 src/queries/cache/seasonal/CacheSeasonalMarketPerformance.graphql create mode 100644 src/queries/cache/seasonal/CacheSeasonalSilo.graphql create mode 100644 src/queries/cache/seasonal/CacheSeasonalWrappedDeposit.graphql create mode 100644 src/queries/cache/seasonal/CacheSeasons.graphql diff --git a/codegen.ts b/codegen.ts index b1a39f03d..83cccadcb 100644 --- a/codegen.ts +++ b/codegen.ts @@ -32,8 +32,16 @@ const config: CodegenConfig = { presetConfig: { fragmentMasking: false, }, - }, + }, + "src/generated/gql/cache/": { + schema: "https://graph.pinto.money/cache", + documents: ["src/queries/cache/**/*.graphql"], + preset: "client", + presetConfig: { + fragmentMasking: false, + }, + }, }, -}; +}; export default config; diff --git a/src/constants/subgraph.ts b/src/constants/subgraph.ts index 207e0c65c..103ad98d7 100644 --- a/src/constants/subgraph.ts +++ b/src/constants/subgraph.ts @@ -1,25 +1,29 @@ import { arbitrum, base, localhost } from "viem/chains"; -export const subgraphs: { [chainId: number]: { beanstalk: string; bean: string; basin: string } } = { +export const subgraphs: { [chainId: number]: { beanstalk: string; bean: string; basin: string; cache: string } } = { [arbitrum.id]: { beanstalk: "https://graph.bean.money/beanstalk-dev", bean: "https://graph.bean.money/bean-dev", basin: "https://graph.bean.money/exchange-dev", + cache: "https://graph.bean.money/cache", }, [base.id]: { beanstalk: "https://graph.pinto.money/pintostalk", bean: "https://graph.pinto.money/pinto", basin: "https://graph.pinto.money/exchange", + cache: "https://graph.pinto.money/cache", }, [localhost.id]: { beanstalk: "https://graph.pinto.money/pintostalk", bean: "https://graph.pinto.money/pinto", basin: "https://graph.pinto.money/exchange", + cache: "https://graph.pinto.money/cache", }, [41337]: { beanstalk: "https://graph.pinto.money/pintostalk", bean: "https://graph.pinto.money/pinto", basin: "https://graph.pinto.money/exchange", + cache: "https://graph.pinto.money/cache", }, }; diff --git a/src/generated/gql/cache/gql.ts b/src/generated/gql/cache/gql.ts new file mode 100644 index 000000000..fc23170a7 --- /dev/null +++ b/src/generated/gql/cache/gql.ts @@ -0,0 +1,94 @@ +/* eslint-disable */ +import * as types from './graphql'; +import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; + +/** + * Map of all GraphQL operations in the project. + * + * This map has several performance disadvantages: + * 1. It is not tree-shakeable, so it will include all operations in the project. + * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle. + * 3. It does not support dead code elimination, so it will add unused operations. + * + * Therefore it is highly recommended to use the babel or swc plugin for production. + * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size + */ +type Documents = { + "query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n createdAt\n plantedBeans\n stalk\n germinatingStalk\n depositedBDV\n }\n}": typeof types.CacheFarmerSeasonalSiloDocument, + "query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloAssetHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n depositedAmount\n depositedBDV\n deltaDepositedBDV\n deltaDepositedAmount\n createdAt\n }\n}": typeof types.CacheFarmerSeasonalSiloAssetDocument, + "query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_beanHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n seasonNumber\n supply\n marketCap\n instPrice\n l2sr\n liquidityUSD\n twaPrice\n twaDeltaB\n instDeltaB\n crosses\n supplyInPegLP\n createdTimestamp\n }\n}": typeof types.CacheSeasonalBeanDocument, + "query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_fieldHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n caseId\n issuedSoil\n deltaSownBeans\n sownBeans\n deltaPodDemand\n blocksToSoldOutSoil\n podRate\n temperature\n deltaTemperature\n cultivationTemperature\n harvestableIndex\n harvestablePods\n harvestedPods\n numberOfSowers\n numberOfSows\n podIndex\n realRateOfReturn\n seasonBlock\n soil\n soilSoldOut\n unharvestablePods\n createdAt\n }\n}": typeof types.CacheSeasonalFieldDocument, + "query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_gaugesInfoHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n g0CultivationFactor\n g1BlightFactor\n g1ConvertDownPenalty\n g2BdvConvertedThisSeason\n g2BonusStalkPerBdv\n g2MaxConvertCapacity\n createdAt\n }\n}": typeof types.CacheSeasonalGaugesInfoDocument, + "query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_marketPerformanceSeasonals(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n timestamp\n thisSeasonTokenUsdPrices\n usdChange\n percentChange\n totalUsdChange\n totalPercentChange\n cumulativeUsdChange\n cumulativePercentChange\n cumulativeTotalUsdChange\n cumulativeTotalPercentChange\n }\n}": typeof types.CacheSeasonalMarketPerformanceDocument, + "query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n stalk\n beanToMaxLpGpPerBdvRatio\n deltaBeanToMaxLpGpPerBdvRatio\n cropRatio\n deltaCropRatio\n avgGrownStalkPerBdvPerSeason\n depositedBDV\n germinatingStalk\n createdAt\n }\n}\n\nquery CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n activeFarmers\n }\n}": typeof types.CacheSeasonalSiloDocument, + "query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_wrappedDepositERC20HourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n supply\n redeemRate\n apy24h\n apy7d\n apy30d\n apy90d\n createdAt\n }\n}": typeof types.CacheSeasonalWrappedDepositDocument, + "query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_seasons(where: $where, orderBy: $orderBy, orderDirection: $orderDirection) {\n id\n season\n sunriseBlock\n rewardBeans\n price\n deltaBeans\n raining\n createdAt\n }\n}": typeof types.CacheSeasonsDocument, +}; +const documents: Documents = { + "query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n createdAt\n plantedBeans\n stalk\n germinatingStalk\n depositedBDV\n }\n}": types.CacheFarmerSeasonalSiloDocument, + "query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloAssetHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n depositedAmount\n depositedBDV\n deltaDepositedBDV\n deltaDepositedAmount\n createdAt\n }\n}": types.CacheFarmerSeasonalSiloAssetDocument, + "query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_beanHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n seasonNumber\n supply\n marketCap\n instPrice\n l2sr\n liquidityUSD\n twaPrice\n twaDeltaB\n instDeltaB\n crosses\n supplyInPegLP\n createdTimestamp\n }\n}": types.CacheSeasonalBeanDocument, + "query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_fieldHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n caseId\n issuedSoil\n deltaSownBeans\n sownBeans\n deltaPodDemand\n blocksToSoldOutSoil\n podRate\n temperature\n deltaTemperature\n cultivationTemperature\n harvestableIndex\n harvestablePods\n harvestedPods\n numberOfSowers\n numberOfSows\n podIndex\n realRateOfReturn\n seasonBlock\n soil\n soilSoldOut\n unharvestablePods\n createdAt\n }\n}": types.CacheSeasonalFieldDocument, + "query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_gaugesInfoHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n g0CultivationFactor\n g1BlightFactor\n g1ConvertDownPenalty\n g2BdvConvertedThisSeason\n g2BonusStalkPerBdv\n g2MaxConvertCapacity\n createdAt\n }\n}": types.CacheSeasonalGaugesInfoDocument, + "query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_marketPerformanceSeasonals(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n timestamp\n thisSeasonTokenUsdPrices\n usdChange\n percentChange\n totalUsdChange\n totalPercentChange\n cumulativeUsdChange\n cumulativePercentChange\n cumulativeTotalUsdChange\n cumulativeTotalPercentChange\n }\n}": types.CacheSeasonalMarketPerformanceDocument, + "query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n stalk\n beanToMaxLpGpPerBdvRatio\n deltaBeanToMaxLpGpPerBdvRatio\n cropRatio\n deltaCropRatio\n avgGrownStalkPerBdvPerSeason\n depositedBDV\n germinatingStalk\n createdAt\n }\n}\n\nquery CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n activeFarmers\n }\n}": types.CacheSeasonalSiloDocument, + "query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_wrappedDepositERC20HourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n supply\n redeemRate\n apy24h\n apy7d\n apy30d\n apy90d\n createdAt\n }\n}": types.CacheSeasonalWrappedDepositDocument, + "query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_seasons(where: $where, orderBy: $orderBy, orderDirection: $orderDirection) {\n id\n season\n sunriseBlock\n rewardBeans\n price\n deltaBeans\n raining\n createdAt\n }\n}": types.CacheSeasonsDocument, +}; + +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * + * + * @example + * ```ts + * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * ``` + * + * The query argument is unknown! + * Please regenerate the types. + */ +export function graphql(source: string): unknown; + +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n createdAt\n plantedBeans\n stalk\n germinatingStalk\n depositedBDV\n }\n}"): (typeof documents)["query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n createdAt\n plantedBeans\n stalk\n germinatingStalk\n depositedBDV\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloAssetHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n depositedAmount\n depositedBDV\n deltaDepositedBDV\n deltaDepositedAmount\n createdAt\n }\n}"): (typeof documents)["query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloAssetHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n depositedAmount\n depositedBDV\n deltaDepositedBDV\n deltaDepositedAmount\n createdAt\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_beanHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n seasonNumber\n supply\n marketCap\n instPrice\n l2sr\n liquidityUSD\n twaPrice\n twaDeltaB\n instDeltaB\n crosses\n supplyInPegLP\n createdTimestamp\n }\n}"): (typeof documents)["query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_beanHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n seasonNumber\n supply\n marketCap\n instPrice\n l2sr\n liquidityUSD\n twaPrice\n twaDeltaB\n instDeltaB\n crosses\n supplyInPegLP\n createdTimestamp\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_fieldHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n caseId\n issuedSoil\n deltaSownBeans\n sownBeans\n deltaPodDemand\n blocksToSoldOutSoil\n podRate\n temperature\n deltaTemperature\n cultivationTemperature\n harvestableIndex\n harvestablePods\n harvestedPods\n numberOfSowers\n numberOfSows\n podIndex\n realRateOfReturn\n seasonBlock\n soil\n soilSoldOut\n unharvestablePods\n createdAt\n }\n}"): (typeof documents)["query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_fieldHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n caseId\n issuedSoil\n deltaSownBeans\n sownBeans\n deltaPodDemand\n blocksToSoldOutSoil\n podRate\n temperature\n deltaTemperature\n cultivationTemperature\n harvestableIndex\n harvestablePods\n harvestedPods\n numberOfSowers\n numberOfSows\n podIndex\n realRateOfReturn\n seasonBlock\n soil\n soilSoldOut\n unharvestablePods\n createdAt\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_gaugesInfoHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n g0CultivationFactor\n g1BlightFactor\n g1ConvertDownPenalty\n g2BdvConvertedThisSeason\n g2BonusStalkPerBdv\n g2MaxConvertCapacity\n createdAt\n }\n}"): (typeof documents)["query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_gaugesInfoHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n g0CultivationFactor\n g1BlightFactor\n g1ConvertDownPenalty\n g2BdvConvertedThisSeason\n g2BonusStalkPerBdv\n g2MaxConvertCapacity\n createdAt\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_marketPerformanceSeasonals(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n timestamp\n thisSeasonTokenUsdPrices\n usdChange\n percentChange\n totalUsdChange\n totalPercentChange\n cumulativeUsdChange\n cumulativePercentChange\n cumulativeTotalUsdChange\n cumulativeTotalPercentChange\n }\n}"): (typeof documents)["query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_marketPerformanceSeasonals(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n timestamp\n thisSeasonTokenUsdPrices\n usdChange\n percentChange\n totalUsdChange\n totalPercentChange\n cumulativeUsdChange\n cumulativePercentChange\n cumulativeTotalUsdChange\n cumulativeTotalPercentChange\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n stalk\n beanToMaxLpGpPerBdvRatio\n deltaBeanToMaxLpGpPerBdvRatio\n cropRatio\n deltaCropRatio\n avgGrownStalkPerBdvPerSeason\n depositedBDV\n germinatingStalk\n createdAt\n }\n}\n\nquery CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n activeFarmers\n }\n}"): (typeof documents)["query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n stalk\n beanToMaxLpGpPerBdvRatio\n deltaBeanToMaxLpGpPerBdvRatio\n cropRatio\n deltaCropRatio\n avgGrownStalkPerBdvPerSeason\n depositedBDV\n germinatingStalk\n createdAt\n }\n}\n\nquery CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n activeFarmers\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_wrappedDepositERC20HourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n supply\n redeemRate\n apy24h\n apy7d\n apy30d\n apy90d\n createdAt\n }\n}"): (typeof documents)["query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_wrappedDepositERC20HourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n supply\n redeemRate\n apy24h\n apy7d\n apy30d\n apy90d\n createdAt\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_seasons(where: $where, orderBy: $orderBy, orderDirection: $orderDirection) {\n id\n season\n sunriseBlock\n rewardBeans\n price\n deltaBeans\n raining\n createdAt\n }\n}"): (typeof documents)["query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_seasons(where: $where, orderBy: $orderBy, orderDirection: $orderDirection) {\n id\n season\n sunriseBlock\n rewardBeans\n price\n deltaBeans\n raining\n createdAt\n }\n}"]; + +export function graphql(source: string) { + return (documents as any)[source] ?? {}; +} + +export type DocumentType> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never; \ No newline at end of file diff --git a/src/generated/gql/cache/graphql.ts b/src/generated/gql/cache/graphql.ts new file mode 100644 index 000000000..f76bac7ba --- /dev/null +++ b/src/generated/gql/cache/graphql.ts @@ -0,0 +1,745 @@ +/* eslint-disable */ +import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; +export type Maybe = T | null; +export type InputMaybe = Maybe; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string; } + String: { input: string; output: string; } + Boolean: { input: boolean; output: boolean; } + Int: { input: number; output: number; } + Float: { input: number; output: number; } + BigDecimal: { input: any; output: any; } + BigInt: { input: any; output: any; } + Bytes: { input: any; output: any; } +}; + +export type BeanHourlySnapshot = { + __typename?: 'BeanHourlySnapshot'; + createdTimestamp: Scalars['BigInt']['output']; + crosses: Scalars['Int']['output']; + deltaCrosses: Scalars['Int']['output']; + deltaLiquidityUSD: Scalars['BigDecimal']['output']; + deltaVolume: Scalars['BigInt']['output']; + deltaVolumeUSD: Scalars['BigDecimal']['output']; + id: Scalars['ID']['output']; + instDeltaB: Scalars['BigDecimal']['output']; + instPrice: Scalars['BigDecimal']['output']; + l2sr: Scalars['BigDecimal']['output']; + lastUpdateBlockNumber: Scalars['BigInt']['output']; + lastUpdateTimestamp: Scalars['BigInt']['output']; + liquidityUSD: Scalars['BigDecimal']['output']; + lockedBeans: Scalars['BigInt']['output']; + marketCap: Scalars['BigDecimal']['output']; + seasonNumber: Scalars['Int']['output']; + supply: Scalars['BigInt']['output']; + supplyInPegLP: Scalars['BigDecimal']['output']; + twaBeanLiquidityUSD: Scalars['BigDecimal']['output']; + twaDeltaB: Scalars['BigDecimal']['output']; + twaLiquidityUSD: Scalars['BigDecimal']['output']; + twaNonBeanLiquidityUSD: Scalars['BigDecimal']['output']; + twaPrice: Scalars['BigDecimal']['output']; + volume: Scalars['BigInt']['output']; + volumeUSD: Scalars['BigDecimal']['output']; +}; + +export type BeanstalkHourlySnapshot = { + __typename?: 'BeanstalkHourlySnapshot'; + createdTimestamp: Scalars['BigInt']['output']; + cumulativeBuyVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeConvertDownVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeConvertNeutralTradeVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeConvertNeutralTransferVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeConvertUpVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeConvertVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeSellVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeTradeVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeTransferVolumeUSD: Scalars['BigDecimal']['output']; + deltaBuyVolumeUSD: Scalars['BigDecimal']['output']; + deltaConvertDownVolumeUSD: Scalars['BigDecimal']['output']; + deltaConvertNeutralTradeVolumeUSD: Scalars['BigDecimal']['output']; + deltaConvertNeutralTransferVolumeUSD: Scalars['BigDecimal']['output']; + deltaConvertUpVolumeUSD: Scalars['BigDecimal']['output']; + deltaConvertVolumeUSD: Scalars['BigDecimal']['output']; + deltaLiquidityUSD: Scalars['BigDecimal']['output']; + deltaSellVolumeUSD: Scalars['BigDecimal']['output']; + deltaTradeVolumeUSD: Scalars['BigDecimal']['output']; + deltaTransferVolumeUSD: Scalars['BigDecimal']['output']; + id: Scalars['ID']['output']; + lastUpdateBlockNumber: Scalars['BigInt']['output']; + lastUpdateTimestamp: Scalars['BigInt']['output']; + season: Scalars['Int']['output']; + totalLiquidityUSD: Scalars['BigDecimal']['output']; +}; + +export type FarmerBalanceHourlySnapshot = { + __typename?: 'FarmerBalanceHourlySnapshot'; + createdTimestamp: Scalars['BigInt']['output']; + deltaFarmBalance: Scalars['BigInt']['output']; + deltaTotalBalance: Scalars['BigInt']['output']; + deltaWalletBalance: Scalars['BigInt']['output']; + farmBalance: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + lastUpdateBlockNumber: Scalars['BigInt']['output']; + lastUpdateTimestamp: Scalars['BigInt']['output']; + seasonNumber: Scalars['Int']['output']; + totalBalance: Scalars['BigInt']['output']; + walletBalance: Scalars['BigInt']['output']; +}; + +export type FieldHourlySnapshot = { + __typename?: 'FieldHourlySnapshot'; + blocksToSoldOutSoil?: Maybe; + caseId?: Maybe; + createdAt: Scalars['BigInt']['output']; + cultivationFactor?: Maybe; + cultivationTemperature?: Maybe; + deltaCultivationFactor?: Maybe; + deltaCultivationTemperature?: Maybe; + deltaHarvestableIndex: Scalars['BigInt']['output']; + deltaHarvestablePods: Scalars['BigInt']['output']; + deltaHarvestedPods: Scalars['BigInt']['output']; + deltaIssuedSoil: Scalars['BigInt']['output']; + deltaNumberOfSowers: Scalars['Int']['output']; + deltaNumberOfSows: Scalars['Int']['output']; + deltaPodDemand: Scalars['BigInt']['output']; + deltaPodIndex: Scalars['BigInt']['output']; + deltaPodRate: Scalars['BigDecimal']['output']; + deltaRealRateOfReturn: Scalars['BigDecimal']['output']; + deltaSoil: Scalars['BigInt']['output']; + deltaSownBeans: Scalars['BigInt']['output']; + deltaTemperature: Scalars['BigDecimal']['output']; + deltaUnharvestablePods: Scalars['BigInt']['output']; + fieldId: Scalars['BigInt']['output']; + harvestableIndex: Scalars['BigInt']['output']; + harvestablePods: Scalars['BigInt']['output']; + harvestedPods: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + issuedSoil: Scalars['BigInt']['output']; + numberOfSowers: Scalars['Int']['output']; + numberOfSows: Scalars['Int']['output']; + podIndex: Scalars['BigInt']['output']; + podRate: Scalars['BigDecimal']['output']; + realRateOfReturn: Scalars['BigDecimal']['output']; + season: Scalars['Int']['output']; + seasonBlock: Scalars['BigInt']['output']; + soil: Scalars['BigInt']['output']; + soilSoldOut: Scalars['Boolean']['output']; + sownBeans: Scalars['BigInt']['output']; + temperature: Scalars['BigDecimal']['output']; + unharvestablePods: Scalars['BigInt']['output']; + updatedAt: Scalars['BigInt']['output']; +}; + +export type GaugesInfoHourlySnapshot = { + __typename?: 'GaugesInfoHourlySnapshot'; + createdAt: Scalars['BigInt']['output']; + deltaG0CultivationFactor?: Maybe; + deltaG0IsActive: Scalars['Boolean']['output']; + deltaG1BlightFactor?: Maybe; + deltaG1ConvertDownPenalty?: Maybe; + deltaG1IsActive: Scalars['Boolean']['output']; + deltaG2BdvConvertedThisSeason?: Maybe; + deltaG2BonusStalkPerBdv?: Maybe; + deltaG2IsActive: Scalars['Boolean']['output']; + deltaG2MaxConvertCapacity?: Maybe; + deltaG2MaxTwaDeltaB?: Maybe; + g0CultivationFactor?: Maybe; + g0IsActive: Scalars['Boolean']['output']; + g1BlightFactor?: Maybe; + g1ConvertDownPenalty?: Maybe; + g1IsActive: Scalars['Boolean']['output']; + g2BdvConvertedThisSeason?: Maybe; + g2BonusStalkPerBdv?: Maybe; + g2IsActive: Scalars['Boolean']['output']; + g2MaxConvertCapacity?: Maybe; + g2MaxTwaDeltaB?: Maybe; + id: Scalars['ID']['output']; + season: Scalars['Int']['output']; + updatedAt: Scalars['BigInt']['output']; +}; + +export type MarketPerformanceSeasonal = { + __typename?: 'MarketPerformanceSeasonal'; + cumulativePercentChange?: Maybe>; + cumulativeTotalPercentChange?: Maybe; + cumulativeTotalUsdChange?: Maybe; + cumulativeUsdChange?: Maybe>; + id: Scalars['ID']['output']; + percentChange?: Maybe>; + prevSeasonTokenBalances: Array; + prevSeasonTokenUsdPrices: Array; + prevSeasonTokenUsdValues: Array; + prevSeasonTotalUsd: Scalars['BigDecimal']['output']; + season: Scalars['Int']['output']; + thisSeasonTokenUsdPrices?: Maybe>; + thisSeasonTokenUsdValues?: Maybe>; + thisSeasonTotalUsd?: Maybe; + timestamp?: Maybe; + totalPercentChange?: Maybe; + totalUsdChange?: Maybe; + usdChange?: Maybe>; + valid: Scalars['Boolean']['output']; +}; + +export type PodMarketplaceHourlySnapshot = { + __typename?: 'PodMarketplaceHourlySnapshot'; + availableListedPods: Scalars['BigInt']['output']; + availableOrderBeans: Scalars['BigInt']['output']; + beanVolume: Scalars['BigInt']['output']; + cancelledListedPods: Scalars['BigInt']['output']; + cancelledOrderBeans: Scalars['BigInt']['output']; + createdAt: Scalars['BigInt']['output']; + deltaAvailableListedPods: Scalars['BigInt']['output']; + deltaAvailableOrderBeans: Scalars['BigInt']['output']; + deltaBeanVolume: Scalars['BigInt']['output']; + deltaCancelledListedPods: Scalars['BigInt']['output']; + deltaCancelledOrderBeans: Scalars['BigInt']['output']; + deltaExpiredListedPods: Scalars['BigInt']['output']; + deltaFilledListedPods: Scalars['BigInt']['output']; + deltaFilledOrderBeans: Scalars['BigInt']['output']; + deltaFilledOrderedPods: Scalars['BigInt']['output']; + deltaListedPods: Scalars['BigInt']['output']; + deltaOrderBeans: Scalars['BigInt']['output']; + deltaPodVolume: Scalars['BigInt']['output']; + expiredListedPods: Scalars['BigInt']['output']; + filledListedPods: Scalars['BigInt']['output']; + filledOrderBeans: Scalars['BigInt']['output']; + filledOrderedPods: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + listedPods: Scalars['BigInt']['output']; + orderBeans: Scalars['BigInt']['output']; + podVolume: Scalars['BigInt']['output']; + season: Scalars['Int']['output']; + updatedAt: Scalars['BigInt']['output']; +}; + +export type PoolHourlySnapshot = { + __typename?: 'PoolHourlySnapshot'; + createdTimestamp: Scalars['BigInt']['output']; + crosses: Scalars['Int']['output']; + deltaCrosses: Scalars['Int']['output']; + deltaLiquidityUSD: Scalars['BigDecimal']['output']; + deltaReserves: Array; + deltaVolume: Scalars['BigInt']['output']; + deltaVolumeUSD: Scalars['BigDecimal']['output']; + id: Scalars['ID']['output']; + instDeltaB: Scalars['BigDecimal']['output']; + instPrice: Scalars['BigDecimal']['output']; + lastUpdateBlockNumber: Scalars['BigInt']['output']; + lastUpdateTimestamp: Scalars['BigInt']['output']; + liquidityUSD: Scalars['BigDecimal']['output']; + reserves: Array; + seasonNumber: Scalars['Int']['output']; + twaBeanLiquidityUSD: Scalars['BigDecimal']['output']; + twaDeltaB: Scalars['BigDecimal']['output']; + twaLiquidityUSD: Scalars['BigDecimal']['output']; + twaNonBeanLiquidityUSD: Scalars['BigDecimal']['output']; + twaPrice: Scalars['BigDecimal']['output']; + twaReserves: Array; + twaToken2Price: Scalars['BigDecimal']['output']; + volume: Scalars['BigInt']['output']; + volumeUSD: Scalars['BigDecimal']['output']; +}; + +export type Query = { + __typename?: 'Query'; + cache_beanHourlySnapshots: Array; + cache_beanstalkHourlySnapshots: Array; + cache_farmerBalanceHourlySnapshots: Array; + cache_fieldHourlySnapshots: Array; + cache_gaugesInfoHourlySnapshots: Array; + cache_marketPerformanceSeasonals: Array; + cache_podMarketplaceHourlySnapshots: Array; + cache_poolHourlySnapshots: Array; + cache_seasons: Array; + cache_siloAssetHourlySnapshots: Array; + cache_siloHourlySnapshots: Array; + cache_tokenHourlySnapshots: Array; + cache_tractorHourlySnapshots: Array; + cache_unripeTokenHourlySnapshots: Array; + cache_wellHourlySnapshots: Array; + cache_whitelistTokenHourlySnapshots: Array; + cache_wrappedDepositERC20HourlySnapshots: Array; +}; + + +export type QueryCacheBeanHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheBeanstalkHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheFarmerBalanceHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheFieldHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheGaugesInfoHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheMarketPerformanceSeasonalsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCachePodMarketplaceHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCachePoolHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheSeasonsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheSiloAssetHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheSiloHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheTokenHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheTractorHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheUnripeTokenHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheWellHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheWhitelistTokenHourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + + +export type QueryCacheWrappedDepositErc20HourlySnapshotsArgs = { + first?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + where?: InputMaybe; +}; + +export type Season = { + __typename?: 'Season'; + beans: Scalars['BigInt']['output']; + createdAt: Scalars['BigInt']['output']; + deltaB: Scalars['BigInt']['output']; + deltaBeans: Scalars['BigInt']['output']; + floodFieldBeans: Scalars['BigInt']['output']; + floodSiloBeans: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + incentiveBeans: Scalars['BigInt']['output']; + marketCap: Scalars['BigDecimal']['output']; + price: Scalars['BigDecimal']['output']; + raining: Scalars['Boolean']['output']; + rewardBeans: Scalars['BigInt']['output']; + season: Scalars['Int']['output']; + sunriseBlock: Scalars['BigInt']['output']; + unmigratedL1Beans?: Maybe; +}; + +export type SiloAssetHourlySnapshot = { + __typename?: 'SiloAssetHourlySnapshot'; + createdAt: Scalars['BigInt']['output']; + deltaDepositedAmount: Scalars['BigInt']['output']; + deltaDepositedBDV: Scalars['BigInt']['output']; + deltaWithdrawnAmount: Scalars['BigInt']['output']; + depositedAmount: Scalars['BigInt']['output']; + depositedBDV: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + season: Scalars['Int']['output']; + updatedAt: Scalars['BigInt']['output']; + withdrawnAmount: Scalars['BigInt']['output']; +}; + +export type SiloHourlySnapshot = { + __typename?: 'SiloHourlySnapshot'; + activeFarmers: Scalars['Int']['output']; + avgConvertDownPenalty: Scalars['BigDecimal']['output']; + avgGrownStalkPerBdvPerSeason: Scalars['BigInt']['output']; + beanMints: Scalars['BigInt']['output']; + beanToMaxLpGpPerBdvRatio: Scalars['BigInt']['output']; + bonusStalkConvertUp: Scalars['BigInt']['output']; + caseId?: Maybe; + convertDownPenalty?: Maybe; + createdAt: Scalars['BigInt']['output']; + cropRatio: Scalars['BigDecimal']['output']; + deltaActiveFarmers: Scalars['Int']['output']; + deltaAvgConvertDownPenalty: Scalars['BigDecimal']['output']; + deltaAvgGrownStalkPerBdvPerSeason: Scalars['BigInt']['output']; + deltaBeanMints: Scalars['BigInt']['output']; + deltaBeanToMaxLpGpPerBdvRatio: Scalars['BigInt']['output']; + deltaBonusStalkConvertUp: Scalars['BigInt']['output']; + deltaConvertDownPenalty?: Maybe; + deltaCropRatio: Scalars['BigDecimal']['output']; + deltaDepositedBDV: Scalars['BigInt']['output']; + deltaGerminatingStalk: Scalars['BigInt']['output']; + deltaGrownStalkPerSeason: Scalars['BigInt']['output']; + deltaPenalizedStalkConvertDown: Scalars['BigInt']['output']; + deltaPlantableStalk: Scalars['BigInt']['output']; + deltaPlantedBeans: Scalars['BigInt']['output']; + deltaRoots: Scalars['BigInt']['output']; + deltaStalk: Scalars['BigInt']['output']; + deltaTotalBdvConvertUp: Scalars['BigInt']['output']; + deltaTotalBdvConvertUpBonus: Scalars['BigInt']['output']; + deltaUnpenalizedStalkConvertDown: Scalars['BigInt']['output']; + depositedBDV: Scalars['BigInt']['output']; + germinatingStalk: Scalars['BigInt']['output']; + grownStalkPerSeason: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + penalizedStalkConvertDown: Scalars['BigInt']['output']; + plantableStalk: Scalars['BigInt']['output']; + plantedBeans: Scalars['BigInt']['output']; + roots: Scalars['BigInt']['output']; + season: Scalars['Int']['output']; + stalk: Scalars['BigInt']['output']; + totalBdvConvertUp: Scalars['BigInt']['output']; + totalBdvConvertUpBonus: Scalars['BigInt']['output']; + unpenalizedStalkConvertDown: Scalars['BigInt']['output']; + updatedAt: Scalars['BigInt']['output']; +}; + +export type TokenHourlySnapshot = { + __typename?: 'TokenHourlySnapshot'; + createdTimestamp: Scalars['BigInt']['output']; + decimals: Scalars['BigInt']['output']; + deltaFarmBalance: Scalars['BigInt']['output']; + deltaLastPriceUSD: Scalars['BigDecimal']['output']; + deltaPooledBalance: Scalars['BigInt']['output']; + deltaSupply: Scalars['BigInt']['output']; + deltaWalletBalance: Scalars['BigInt']['output']; + farmBalance: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + lastPriceUSD: Scalars['BigDecimal']['output']; + lastUpdateBlockNumber: Scalars['BigInt']['output']; + lastUpdateTimestamp: Scalars['BigInt']['output']; + name: Scalars['String']['output']; + pooledBalance: Scalars['BigInt']['output']; + seasonNumber: Scalars['Int']['output']; + supply: Scalars['BigInt']['output']; + walletBalance: Scalars['BigInt']['output']; +}; + +export type TractorHourlySnapshot = { + __typename?: 'TractorHourlySnapshot'; + createdAt: Scalars['BigInt']['output']; + deltaTotalExecutions: Scalars['Int']['output']; + deltaTotalNegBeanTips: Scalars['BigInt']['output']; + deltaTotalPosBeanTips: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + season: Scalars['Int']['output']; + totalExecutions: Scalars['Int']['output']; + totalNegBeanTips: Scalars['BigInt']['output']; + totalPosBeanTips: Scalars['BigInt']['output']; + updatedAt: Scalars['BigInt']['output']; +}; + +export type UnripeTokenHourlySnapshot = { + __typename?: 'UnripeTokenHourlySnapshot'; + amountUnderlyingOne: Scalars['BigInt']['output']; + bdvUnderlyingOne: Scalars['BigInt']['output']; + chopRate: Scalars['BigDecimal']['output']; + choppableAmountOne: Scalars['BigInt']['output']; + choppableBdvOne: Scalars['BigInt']['output']; + createdAt: Scalars['BigInt']['output']; + deltaAmountUnderlyingOne: Scalars['BigInt']['output']; + deltaBdvUnderlyingOne: Scalars['BigInt']['output']; + deltaChopRate: Scalars['BigDecimal']['output']; + deltaChoppableAmountOne: Scalars['BigInt']['output']; + deltaChoppableBdvOne: Scalars['BigInt']['output']; + deltaRecapPercent: Scalars['BigDecimal']['output']; + deltaTotalChoppedAmount: Scalars['BigInt']['output']; + deltaTotalChoppedBdv: Scalars['BigInt']['output']; + deltaTotalChoppedBdvReceived: Scalars['BigInt']['output']; + deltaTotalUnderlying: Scalars['BigInt']['output']; + deltaUnderlyingToken: Scalars['Boolean']['output']; + id: Scalars['ID']['output']; + recapPercent: Scalars['BigDecimal']['output']; + season: Scalars['Int']['output']; + totalChoppedAmount: Scalars['BigInt']['output']; + totalChoppedBdv: Scalars['BigInt']['output']; + totalChoppedBdvReceived: Scalars['BigInt']['output']; + totalUnderlying: Scalars['BigInt']['output']; + updatedAt: Scalars['BigInt']['output']; +}; + +export type WellHourlySnapshot = { + __typename?: 'WellHourlySnapshot'; + convertVolumeReserves: Array; + convertVolumeReservesUSD: Array; + convertVolumeUSD: Scalars['BigDecimal']['output']; + createdTimestamp: Scalars['BigInt']['output']; + cumulativeBiTradeVolumeReserves: Array; + cumulativeTradeVolumeReserves: Array; + cumulativeTradeVolumeReservesUSD: Array; + cumulativeTradeVolumeUSD: Scalars['BigDecimal']['output']; + cumulativeTransferVolumeReserves: Array; + cumulativeTransferVolumeReservesUSD: Array; + cumulativeTransferVolumeUSD: Scalars['BigDecimal']['output']; + deltaBiTradeVolumeReserves: Array; + deltaConvertVolumeReserves: Array; + deltaConvertVolumeReservesUSD: Array; + deltaConvertVolumeUSD: Scalars['BigDecimal']['output']; + deltaLiquidityUSD: Scalars['BigDecimal']['output']; + deltaLpTokenSupply: Scalars['BigInt']['output']; + deltaTokenRates: Array; + deltaTradeVolumeReserves: Array; + deltaTradeVolumeReservesUSD: Array; + deltaTradeVolumeUSD: Scalars['BigDecimal']['output']; + deltaTransferVolumeReserves: Array; + deltaTransferVolumeReservesUSD: Array; + deltaTransferVolumeUSD: Scalars['BigDecimal']['output']; + hour: Scalars['Int']['output']; + id: Scalars['ID']['output']; + lastUpdateBlockNumber: Scalars['BigInt']['output']; + lastUpdateTimestamp: Scalars['BigInt']['output']; + lpTokenSupply: Scalars['BigInt']['output']; + season: Scalars['Int']['output']; + tokenRates: Array; + totalLiquidityUSD: Scalars['BigDecimal']['output']; +}; + +export type WhitelistTokenHourlySnapshot = { + __typename?: 'WhitelistTokenHourlySnapshot'; + bdv?: Maybe; + createdAt: Scalars['BigInt']['output']; + deltaBdv?: Maybe; + deltaGaugePoints?: Maybe; + deltaIsGaugeEnabled: Scalars['Boolean']['output']; + deltaMilestoneSeason: Scalars['Int']['output']; + deltaOptimalPercentDepositedBdv?: Maybe; + deltaStalkEarnedPerSeason: Scalars['BigInt']['output']; + deltaStalkIssuedPerBdv: Scalars['BigInt']['output']; + deltaStemTip: Scalars['BigInt']['output']; + gaugePoints?: Maybe; + id: Scalars['ID']['output']; + isGaugeEnabled: Scalars['Boolean']['output']; + milestoneSeason: Scalars['Int']['output']; + optimalPercentDepositedBdv?: Maybe; + season: Scalars['Int']['output']; + selector: Scalars['Bytes']['output']; + stalkEarnedPerSeason: Scalars['BigInt']['output']; + stalkIssuedPerBdv: Scalars['BigInt']['output']; + stemTip: Scalars['BigInt']['output']; + updatedAt: Scalars['BigInt']['output']; +}; + +export type WrappedDepositErc20HourlySnapshot = { + __typename?: 'WrappedDepositERC20HourlySnapshot'; + apy7d?: Maybe; + apy24h?: Maybe; + apy30d?: Maybe; + apy90d?: Maybe; + createdAt: Scalars['BigInt']['output']; + deltaRedeemRate: Scalars['BigInt']['output']; + deltaSupply: Scalars['BigInt']['output']; + id: Scalars['ID']['output']; + redeemRate: Scalars['BigInt']['output']; + season: Scalars['Int']['output']; + supply: Scalars['BigInt']['output']; + updatedAt: Scalars['BigInt']['output']; +}; + +export type CacheFarmerSeasonalSiloQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheFarmerSeasonalSiloQuery = { __typename?: 'Query', cache_siloHourlySnapshots: Array<{ __typename?: 'SiloHourlySnapshot', id: string, season: number, createdAt: any, plantedBeans: any, stalk: any, germinatingStalk: any, depositedBDV: any }> }; + +export type CacheFarmerSeasonalSiloAssetQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheFarmerSeasonalSiloAssetQuery = { __typename?: 'Query', cache_siloAssetHourlySnapshots: Array<{ __typename?: 'SiloAssetHourlySnapshot', id: string, season: number, depositedAmount: any, depositedBDV: any, deltaDepositedBDV: any, deltaDepositedAmount: any, createdAt: any }> }; + +export type CacheSeasonalBeanQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheSeasonalBeanQuery = { __typename?: 'Query', cache_beanHourlySnapshots: Array<{ __typename?: 'BeanHourlySnapshot', id: string, seasonNumber: number, supply: any, marketCap: any, instPrice: any, l2sr: any, liquidityUSD: any, twaPrice: any, twaDeltaB: any, instDeltaB: any, crosses: number, supplyInPegLP: any, createdTimestamp: any }> }; + +export type CacheSeasonalFieldQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheSeasonalFieldQuery = { __typename?: 'Query', cache_fieldHourlySnapshots: Array<{ __typename?: 'FieldHourlySnapshot', id: string, season: number, caseId?: any | null, issuedSoil: any, deltaSownBeans: any, sownBeans: any, deltaPodDemand: any, blocksToSoldOutSoil?: any | null, podRate: any, temperature: any, deltaTemperature: any, cultivationTemperature?: any | null, harvestableIndex: any, harvestablePods: any, harvestedPods: any, numberOfSowers: number, numberOfSows: number, podIndex: any, realRateOfReturn: any, seasonBlock: any, soil: any, soilSoldOut: boolean, unharvestablePods: any, createdAt: any }> }; + +export type CacheSeasonalGaugesInfoQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheSeasonalGaugesInfoQuery = { __typename?: 'Query', cache_gaugesInfoHourlySnapshots: Array<{ __typename?: 'GaugesInfoHourlySnapshot', id: string, season: number, g0CultivationFactor?: any | null, g1BlightFactor?: any | null, g1ConvertDownPenalty?: any | null, g2BdvConvertedThisSeason?: any | null, g2BonusStalkPerBdv?: any | null, g2MaxConvertCapacity?: any | null, createdAt: any }> }; + +export type CacheSeasonalMarketPerformanceQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheSeasonalMarketPerformanceQuery = { __typename?: 'Query', cache_marketPerformanceSeasonals: Array<{ __typename?: 'MarketPerformanceSeasonal', id: string, season: number, timestamp?: any | null, thisSeasonTokenUsdPrices?: Array | null, usdChange?: Array | null, percentChange?: Array | null, totalUsdChange?: any | null, totalPercentChange?: any | null, cumulativeUsdChange?: Array | null, cumulativePercentChange?: Array | null, cumulativeTotalUsdChange?: any | null, cumulativeTotalPercentChange?: any | null }> }; + +export type CacheSeasonalSiloQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheSeasonalSiloQuery = { __typename?: 'Query', cache_siloHourlySnapshots: Array<{ __typename?: 'SiloHourlySnapshot', id: string, season: number, stalk: any, beanToMaxLpGpPerBdvRatio: any, deltaBeanToMaxLpGpPerBdvRatio: any, cropRatio: any, deltaCropRatio: any, avgGrownStalkPerBdvPerSeason: any, depositedBDV: any, germinatingStalk: any, createdAt: any }> }; + +export type CacheSeasonalSiloActiveFarmersQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheSeasonalSiloActiveFarmersQuery = { __typename?: 'Query', cache_siloHourlySnapshots: Array<{ __typename?: 'SiloHourlySnapshot', id: string, season: number, activeFarmers: number }> }; + +export type CacheSeasonalWrappedDepositQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheSeasonalWrappedDepositQuery = { __typename?: 'Query', cache_wrappedDepositERC20HourlySnapshots: Array<{ __typename?: 'WrappedDepositERC20HourlySnapshot', id: string, season: number, supply: any, redeemRate: any, apy24h?: any | null, apy7d?: any | null, apy30d?: any | null, apy90d?: any | null, createdAt: any }> }; + +export type CacheSeasonsQueryVariables = Exact<{ + where: Scalars['String']['input']; + orderBy: Scalars['String']['input']; + orderDirection: Scalars['String']['input']; +}>; + + +export type CacheSeasonsQuery = { __typename?: 'Query', cache_seasons: Array<{ __typename?: 'Season', id: string, season: number, sunriseBlock: any, rewardBeans: any, price: any, deltaBeans: any, raining: boolean, createdAt: any }> }; + + +export const CacheFarmerSeasonalSiloDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheFarmerSeasonalSilo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_siloHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"plantedBeans"}},{"kind":"Field","name":{"kind":"Name","value":"stalk"}},{"kind":"Field","name":{"kind":"Name","value":"germinatingStalk"}},{"kind":"Field","name":{"kind":"Name","value":"depositedBDV"}}]}}]}}]} as unknown as DocumentNode; +export const CacheFarmerSeasonalSiloAssetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheFarmerSeasonalSiloAsset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_siloAssetHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"depositedAmount"}},{"kind":"Field","name":{"kind":"Name","value":"depositedBDV"}},{"kind":"Field","name":{"kind":"Name","value":"deltaDepositedBDV"}},{"kind":"Field","name":{"kind":"Name","value":"deltaDepositedAmount"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; +export const CacheSeasonalBeanDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalBean"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_beanHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"seasonNumber"}},{"kind":"Field","name":{"kind":"Name","value":"supply"}},{"kind":"Field","name":{"kind":"Name","value":"marketCap"}},{"kind":"Field","name":{"kind":"Name","value":"instPrice"}},{"kind":"Field","name":{"kind":"Name","value":"l2sr"}},{"kind":"Field","name":{"kind":"Name","value":"liquidityUSD"}},{"kind":"Field","name":{"kind":"Name","value":"twaPrice"}},{"kind":"Field","name":{"kind":"Name","value":"twaDeltaB"}},{"kind":"Field","name":{"kind":"Name","value":"instDeltaB"}},{"kind":"Field","name":{"kind":"Name","value":"crosses"}},{"kind":"Field","name":{"kind":"Name","value":"supplyInPegLP"}},{"kind":"Field","name":{"kind":"Name","value":"createdTimestamp"}}]}}]}}]} as unknown as DocumentNode; +export const CacheSeasonalFieldDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalField"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_fieldHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"caseId"}},{"kind":"Field","name":{"kind":"Name","value":"issuedSoil"}},{"kind":"Field","name":{"kind":"Name","value":"deltaSownBeans"}},{"kind":"Field","name":{"kind":"Name","value":"sownBeans"}},{"kind":"Field","name":{"kind":"Name","value":"deltaPodDemand"}},{"kind":"Field","name":{"kind":"Name","value":"blocksToSoldOutSoil"}},{"kind":"Field","name":{"kind":"Name","value":"podRate"}},{"kind":"Field","name":{"kind":"Name","value":"temperature"}},{"kind":"Field","name":{"kind":"Name","value":"deltaTemperature"}},{"kind":"Field","name":{"kind":"Name","value":"cultivationTemperature"}},{"kind":"Field","name":{"kind":"Name","value":"harvestableIndex"}},{"kind":"Field","name":{"kind":"Name","value":"harvestablePods"}},{"kind":"Field","name":{"kind":"Name","value":"harvestedPods"}},{"kind":"Field","name":{"kind":"Name","value":"numberOfSowers"}},{"kind":"Field","name":{"kind":"Name","value":"numberOfSows"}},{"kind":"Field","name":{"kind":"Name","value":"podIndex"}},{"kind":"Field","name":{"kind":"Name","value":"realRateOfReturn"}},{"kind":"Field","name":{"kind":"Name","value":"seasonBlock"}},{"kind":"Field","name":{"kind":"Name","value":"soil"}},{"kind":"Field","name":{"kind":"Name","value":"soilSoldOut"}},{"kind":"Field","name":{"kind":"Name","value":"unharvestablePods"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; +export const CacheSeasonalGaugesInfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalGaugesInfo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_gaugesInfoHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"g0CultivationFactor"}},{"kind":"Field","name":{"kind":"Name","value":"g1BlightFactor"}},{"kind":"Field","name":{"kind":"Name","value":"g1ConvertDownPenalty"}},{"kind":"Field","name":{"kind":"Name","value":"g2BdvConvertedThisSeason"}},{"kind":"Field","name":{"kind":"Name","value":"g2BonusStalkPerBdv"}},{"kind":"Field","name":{"kind":"Name","value":"g2MaxConvertCapacity"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; +export const CacheSeasonalMarketPerformanceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalMarketPerformance"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_marketPerformanceSeasonals"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"timestamp"}},{"kind":"Field","name":{"kind":"Name","value":"thisSeasonTokenUsdPrices"}},{"kind":"Field","name":{"kind":"Name","value":"usdChange"}},{"kind":"Field","name":{"kind":"Name","value":"percentChange"}},{"kind":"Field","name":{"kind":"Name","value":"totalUsdChange"}},{"kind":"Field","name":{"kind":"Name","value":"totalPercentChange"}},{"kind":"Field","name":{"kind":"Name","value":"cumulativeUsdChange"}},{"kind":"Field","name":{"kind":"Name","value":"cumulativePercentChange"}},{"kind":"Field","name":{"kind":"Name","value":"cumulativeTotalUsdChange"}},{"kind":"Field","name":{"kind":"Name","value":"cumulativeTotalPercentChange"}}]}}]}}]} as unknown as DocumentNode; +export const CacheSeasonalSiloDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalSilo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_siloHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"stalk"}},{"kind":"Field","name":{"kind":"Name","value":"beanToMaxLpGpPerBdvRatio"}},{"kind":"Field","name":{"kind":"Name","value":"deltaBeanToMaxLpGpPerBdvRatio"}},{"kind":"Field","name":{"kind":"Name","value":"cropRatio"}},{"kind":"Field","name":{"kind":"Name","value":"deltaCropRatio"}},{"kind":"Field","name":{"kind":"Name","value":"avgGrownStalkPerBdvPerSeason"}},{"kind":"Field","name":{"kind":"Name","value":"depositedBDV"}},{"kind":"Field","name":{"kind":"Name","value":"germinatingStalk"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; +export const CacheSeasonalSiloActiveFarmersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalSiloActiveFarmers"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_siloHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"activeFarmers"}}]}}]}}]} as unknown as DocumentNode; +export const CacheSeasonalWrappedDepositDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalWrappedDeposit"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_wrappedDepositERC20HourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"supply"}},{"kind":"Field","name":{"kind":"Name","value":"redeemRate"}},{"kind":"Field","name":{"kind":"Name","value":"apy24h"}},{"kind":"Field","name":{"kind":"Name","value":"apy7d"}},{"kind":"Field","name":{"kind":"Name","value":"apy30d"}},{"kind":"Field","name":{"kind":"Name","value":"apy90d"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; +export const CacheSeasonsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasons"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_seasons"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"sunriseBlock"}},{"kind":"Field","name":{"kind":"Name","value":"rewardBeans"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"deltaBeans"}},{"kind":"Field","name":{"kind":"Name","value":"raining"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/src/generated/gql/cache/index.ts b/src/generated/gql/cache/index.ts new file mode 100644 index 000000000..af7839936 --- /dev/null +++ b/src/generated/gql/cache/index.ts @@ -0,0 +1 @@ +export * from "./gql"; \ No newline at end of file diff --git a/src/queries/cache/seasonal/CacheFarmerSeasonalSilo.graphql b/src/queries/cache/seasonal/CacheFarmerSeasonalSilo.graphql new file mode 100644 index 000000000..387080544 --- /dev/null +++ b/src/queries/cache/seasonal/CacheFarmerSeasonalSilo.graphql @@ -0,0 +1,16 @@ +query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_siloHourlySnapshots( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + createdAt + plantedBeans + stalk + germinatingStalk + depositedBDV + } +} + diff --git a/src/queries/cache/seasonal/CacheFarmerSeasonalSiloAsset.graphql b/src/queries/cache/seasonal/CacheFarmerSeasonalSiloAsset.graphql new file mode 100644 index 000000000..c192b37c8 --- /dev/null +++ b/src/queries/cache/seasonal/CacheFarmerSeasonalSiloAsset.graphql @@ -0,0 +1,16 @@ +query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_siloAssetHourlySnapshots( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + depositedAmount + depositedBDV + deltaDepositedBDV + deltaDepositedAmount + createdAt + } +} + diff --git a/src/queries/cache/seasonal/CacheSeasonalBean.graphql b/src/queries/cache/seasonal/CacheSeasonalBean.graphql new file mode 100644 index 000000000..2c2014685 --- /dev/null +++ b/src/queries/cache/seasonal/CacheSeasonalBean.graphql @@ -0,0 +1,21 @@ +query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_beanHourlySnapshots( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + seasonNumber + supply + marketCap + instPrice + l2sr + liquidityUSD + twaPrice + twaDeltaB + instDeltaB + crosses + supplyInPegLP + createdTimestamp + } +} diff --git a/src/queries/cache/seasonal/CacheSeasonalField.graphql b/src/queries/cache/seasonal/CacheSeasonalField.graphql new file mode 100644 index 000000000..f0ce9c1ef --- /dev/null +++ b/src/queries/cache/seasonal/CacheSeasonalField.graphql @@ -0,0 +1,32 @@ +query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_fieldHourlySnapshots( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + caseId + issuedSoil + deltaSownBeans + sownBeans + deltaPodDemand + blocksToSoldOutSoil + podRate + temperature + deltaTemperature + cultivationTemperature + harvestableIndex + harvestablePods + harvestedPods + numberOfSowers + numberOfSows + podIndex + realRateOfReturn + seasonBlock + soil + soilSoldOut + unharvestablePods + createdAt + } +} diff --git a/src/queries/cache/seasonal/CacheSeasonalGaugesInfo.graphql b/src/queries/cache/seasonal/CacheSeasonalGaugesInfo.graphql new file mode 100644 index 000000000..e0c71080e --- /dev/null +++ b/src/queries/cache/seasonal/CacheSeasonalGaugesInfo.graphql @@ -0,0 +1,17 @@ +query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_gaugesInfoHourlySnapshots( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + g0CultivationFactor + g1BlightFactor + g1ConvertDownPenalty + g2BdvConvertedThisSeason + g2BonusStalkPerBdv + g2MaxConvertCapacity + createdAt + } +} diff --git a/src/queries/cache/seasonal/CacheSeasonalMarketPerformance.graphql b/src/queries/cache/seasonal/CacheSeasonalMarketPerformance.graphql new file mode 100644 index 000000000..acd960eef --- /dev/null +++ b/src/queries/cache/seasonal/CacheSeasonalMarketPerformance.graphql @@ -0,0 +1,21 @@ +query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_marketPerformanceSeasonals( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + timestamp + thisSeasonTokenUsdPrices + usdChange + percentChange + totalUsdChange + totalPercentChange + cumulativeUsdChange + cumulativePercentChange + cumulativeTotalUsdChange + cumulativeTotalPercentChange + } +} + diff --git a/src/queries/cache/seasonal/CacheSeasonalSilo.graphql b/src/queries/cache/seasonal/CacheSeasonalSilo.graphql new file mode 100644 index 000000000..4c3ea4364 --- /dev/null +++ b/src/queries/cache/seasonal/CacheSeasonalSilo.graphql @@ -0,0 +1,31 @@ +query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_siloHourlySnapshots( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + stalk + beanToMaxLpGpPerBdvRatio + deltaBeanToMaxLpGpPerBdvRatio + cropRatio + deltaCropRatio + avgGrownStalkPerBdvPerSeason + depositedBDV + germinatingStalk + createdAt + } +} + +query CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_siloHourlySnapshots( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + activeFarmers + } +} diff --git a/src/queries/cache/seasonal/CacheSeasonalWrappedDeposit.graphql b/src/queries/cache/seasonal/CacheSeasonalWrappedDeposit.graphql new file mode 100644 index 000000000..75bdb1972 --- /dev/null +++ b/src/queries/cache/seasonal/CacheSeasonalWrappedDeposit.graphql @@ -0,0 +1,18 @@ +query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_wrappedDepositERC20HourlySnapshots( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + supply + redeemRate + apy24h + apy7d + apy30d + apy90d + createdAt + } +} + diff --git a/src/queries/cache/seasonal/CacheSeasons.graphql b/src/queries/cache/seasonal/CacheSeasons.graphql new file mode 100644 index 000000000..ac0dba81e --- /dev/null +++ b/src/queries/cache/seasonal/CacheSeasons.graphql @@ -0,0 +1,17 @@ +query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) { + cache_seasons( + where: $where + orderBy: $orderBy + orderDirection: $orderDirection + ) { + id + season + sunriseBlock + rewardBeans + price + deltaBeans + raining + createdAt + } +} + diff --git a/src/state/seasonal/queries/useSeasonalBeanBeanSG.ts b/src/state/seasonal/queries/useSeasonalBeanBeanSG.ts index f37e0a8f4..65b2a0505 100644 --- a/src/state/seasonal/queries/useSeasonalBeanBeanSG.ts +++ b/src/state/seasonal/queries/useSeasonalBeanBeanSG.ts @@ -1,28 +1,10 @@ import { subgraphs } from "@/constants/subgraph"; -import { BeanHourlySnapshot, BeanSeasonalBeanDocument, BeanSeasonalBeanQuery } from "@/generated/gql/pinto/graphql"; -import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; +import { BeanHourlySnapshot, CacheSeasonalBeanDocument, CacheSeasonalBeanQuery } from "@/generated/gql/cache/graphql"; +import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; import { UseSeasonalResult } from "@/utils/types"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; -const paginateSettings: PaginationSettings< - BeanHourlySnapshot, - BeanSeasonalBeanQuery, - "beanHourlySnapshots", - SeasonalQueryVars -> = { - primaryPropertyName: "beanHourlySnapshots", - idField: "id", - nextVars: (value1000: BeanHourlySnapshot, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - from: Number(value1000.season.season), - }; - } - }, -}; - export default function useSeasonalBeanBeanSG( fromSeason: number, toSeason: number, @@ -30,8 +12,19 @@ export default function useSeasonalBeanBeanSG( { enabled = true } = {}, ): UseSeasonalResult { const chainId = useChainId(); + const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await paginateSubgraph(paginateSettings, subgraphs[chainId].bean, BeanSeasonalBeanDocument, vars); + return await fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalBeanDocument, + { + // BeanHourlySnapshot uses seasonNumber instead of season + where: buildCacheWhereClause(vars.from, vars.to, undefined, "seasonNumber"), + orderBy: "seasonNumber", + orderDirection: "asc", + }, + "cache_beanHourlySnapshots", + ); }; return useSeasonalQueries("BeanSeasonalBeanQuery", { diff --git a/src/state/seasonal/queries/useSeasonalBeanstalkFieldSG.ts b/src/state/seasonal/queries/useSeasonalBeanstalkFieldSG.ts index da0bce239..1456902d7 100644 --- a/src/state/seasonal/queries/useSeasonalBeanstalkFieldSG.ts +++ b/src/state/seasonal/queries/useSeasonalBeanstalkFieldSG.ts @@ -1,47 +1,42 @@ import { subgraphs } from "@/constants/subgraph"; import { beanstalkAddress } from "@/generated/contractHooks"; import { - BeanstalkSeasonalFieldDocument, - BeanstalkSeasonalFieldQuery, + CacheSeasonalFieldDocument, + CacheSeasonalFieldQuery, FieldHourlySnapshot, -} from "@/generated/gql/pintostalk/graphql"; -import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; +} from "@/generated/gql/cache/graphql"; +import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; import { UseSeasonalResult } from "@/utils/types"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; -const paginateSettings: PaginationSettings< - FieldHourlySnapshot, - BeanstalkSeasonalFieldQuery, - "fieldHourlySnapshots", - SeasonalQueryVars -> = { - primaryPropertyName: "fieldHourlySnapshots", - idField: "id", - nextVars: (value1000: FieldHourlySnapshot, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - from: Number(value1000.season), - }; - } - }, -}; - export default function useSeasonalBeanstalkFieldSG( fromSeason: number, toSeason: number, convertResult: ConvertEntryFn, ): UseSeasonalResult { const chainId = useChainId(); + const fieldAddress = beanstalkAddress[chainId].toLowerCase(); + const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await paginateSubgraph(paginateSettings, subgraphs[chainId].beanstalk, BeanstalkSeasonalFieldDocument, vars); + const results = await fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalFieldDocument, + { + where: buildCacheWhereClause(vars.from, vars.to), + orderBy: "season", + orderDirection: "asc", + }, + "cache_fieldHourlySnapshots", + ); + // Filter by field address client-side (cache doesn't support id_contains) + return results.filter((r) => r.id.toLowerCase().includes(fieldAddress)); }; return useSeasonalQueries("BeanstalkSeasonalFieldQuery", { fromSeason, toSeason, - queryVars: { field: beanstalkAddress[chainId].toLowerCase() }, + queryVars: { field: fieldAddress }, historicalQueryFnFactory: queryFnFactory, currentQueryFnFactory: queryFnFactory, resultTimestamp: (entry) => { diff --git a/src/state/seasonal/queries/useSeasonalBeanstalkSiloSG.ts b/src/state/seasonal/queries/useSeasonalBeanstalkSiloSG.ts index 62799ebb6..9a4fbc03a 100644 --- a/src/state/seasonal/queries/useSeasonalBeanstalkSiloSG.ts +++ b/src/state/seasonal/queries/useSeasonalBeanstalkSiloSG.ts @@ -1,48 +1,43 @@ import { subgraphs } from "@/constants/subgraph"; import { beanstalkAddress } from "@/generated/contractHooks"; import { - BeanstalkSeasonalSiloActiveFarmersDocument, - BeanstalkSeasonalSiloDocument, - BeanstalkSeasonalSiloQuery, + CacheSeasonalSiloActiveFarmersDocument, + CacheSeasonalSiloDocument, + CacheSeasonalSiloQuery, SiloHourlySnapshot, -} from "@/generated/gql/pintostalk/graphql"; -import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; +} from "@/generated/gql/cache/graphql"; +import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; import { UseSeasonalResult } from "@/utils/types"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; -const paginateSettings: PaginationSettings< - SiloHourlySnapshot, - BeanstalkSeasonalSiloQuery, - "siloHourlySnapshots", - SeasonalQueryVars -> = { - primaryPropertyName: "siloHourlySnapshots", - idField: "id", - nextVars: (value1000: SiloHourlySnapshot, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - from: Number(value1000.season), - }; - } - }, -}; - export default function useSeasonalBeanstalkSiloSG( fromSeason: number, toSeason: number, convertResult: ConvertEntryFn, ): UseSeasonalResult { const chainId = useChainId(); + const siloId = beanstalkAddress[chainId].toLowerCase(); + const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await paginateSubgraph(paginateSettings, subgraphs[chainId].beanstalk, BeanstalkSeasonalSiloDocument, vars); + const results = await fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalSiloDocument, + { + where: buildCacheWhereClause(vars.from, vars.to), + orderBy: "season", + orderDirection: "asc", + }, + "cache_siloHourlySnapshots", + ); + // Filter by silo address client-side (cache doesn't support id_contains) + return results.filter((r) => r.id.toLowerCase().includes(siloId)); }; return useSeasonalQueries("BeanstalkSeasonalSiloQuery", { fromSeason, toSeason, - queryVars: { silo: beanstalkAddress[chainId] }, + queryVars: { silo: siloId }, historicalQueryFnFactory: queryFnFactory, currentQueryFnFactory: queryFnFactory, resultTimestamp: (entry) => { @@ -58,19 +53,27 @@ export function useSeasonalBeanstalkSiloActiveFarmersSG( convertResult: ConvertEntryFn, ): UseSeasonalResult { const chainId = useChainId(); + const siloId = beanstalkAddress[chainId].toLowerCase(); + const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await paginateSubgraph( - paginateSettings, - subgraphs[chainId].beanstalk, - BeanstalkSeasonalSiloActiveFarmersDocument, - vars, + const results = await fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalSiloActiveFarmersDocument, + { + where: buildCacheWhereClause(vars.from, vars.to), + orderBy: "season", + orderDirection: "asc", + }, + "cache_siloHourlySnapshots", ); + // Filter by silo address client-side (cache doesn't support id_contains) + return results.filter((r) => r.id.toLowerCase().includes(siloId)); }; return useSeasonalQueries("BeanstalkSeasonalSiloActiveFarmersQuery", { fromSeason, toSeason, - queryVars: { silo: beanstalkAddress[chainId] }, + queryVars: { silo: siloId }, historicalQueryFnFactory: queryFnFactory, currentQueryFnFactory: queryFnFactory, resultTimestamp: (entry) => { diff --git a/src/state/seasonal/queries/useSeasonalBeanstalkWrappedDepositsSG.ts b/src/state/seasonal/queries/useSeasonalBeanstalkWrappedDepositsSG.ts index 441ae16e1..eaee4e298 100644 --- a/src/state/seasonal/queries/useSeasonalBeanstalkWrappedDepositsSG.ts +++ b/src/state/seasonal/queries/useSeasonalBeanstalkWrappedDepositsSG.ts @@ -1,33 +1,15 @@ import { subgraphs } from "@/constants/subgraph"; import { - BeanstalkSeasonalWrappedDepositErc20Document, - BeanstalkSeasonalWrappedDepositErc20Query, + CacheSeasonalWrappedDepositDocument, + CacheSeasonalWrappedDepositQuery, WrappedDepositErc20HourlySnapshot, -} from "@/generated/gql/pintostalk/graphql"; -import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; +} from "@/generated/gql/cache/graphql"; +import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; import { UseSeasonalResult } from "@/utils/types"; import { useCallback } from "react"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; -const paginateSettings: PaginationSettings< - WrappedDepositErc20HourlySnapshot, - BeanstalkSeasonalWrappedDepositErc20Query, - "wrappedDepositERC20HourlySnapshots", - SeasonalQueryVars -> = { - primaryPropertyName: "wrappedDepositERC20HourlySnapshots", - idField: "id", - nextVars: (value1000: WrappedDepositErc20HourlySnapshot, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - from: Number(value1000.season), - }; - } - }, -}; - export const WRAPPED_MAIN_TOKEN_DEPLOY_SEASON = 2538; export function truncateBeanstalkWrappedDespositsSeasons(fromSeason: number, toSeason: number) { @@ -47,14 +29,19 @@ export default function useSeasonalBeanstalkWrappedDepositsSG( convertResult: ConvertEntryFn, ): UseSeasonalResult { const chainId = useChainId(); + const queryFnFactory = useCallback( (vars: SeasonalQueryVars) => { return () => - paginateSubgraph( - paginateSettings, - subgraphs[chainId].beanstalk, - BeanstalkSeasonalWrappedDepositErc20Document, - vars, + fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalWrappedDepositDocument, + { + where: buildCacheWhereClause(vars.from, vars.to), + orderBy: "season", + orderDirection: "asc", + }, + "cache_wrappedDepositERC20HourlySnapshots", ); }, [chainId], diff --git a/src/state/seasonal/queries/useSeasonalGaugeInfo.ts b/src/state/seasonal/queries/useSeasonalGaugeInfo.ts index cfeda5a9a..edfccc8ea 100644 --- a/src/state/seasonal/queries/useSeasonalGaugeInfo.ts +++ b/src/state/seasonal/queries/useSeasonalGaugeInfo.ts @@ -1,32 +1,13 @@ import { subgraphs } from "@/constants/subgraph"; -import { beanstalkAddress } from "@/generated/contractHooks"; import { + CacheSeasonalGaugesInfoDocument, + CacheSeasonalGaugesInfoQuery, GaugesInfoHourlySnapshot, - SeasonalGaugesInfoDocument, - SeasonalGaugesInfoQuery, -} from "@/generated/gql/pintostalk/graphql"; -import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; +} from "@/generated/gql/cache/graphql"; +import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; -const paginateSettings: PaginationSettings< - GaugesInfoHourlySnapshot, - SeasonalGaugesInfoQuery, - "gaugesInfoHourlySnapshots", - SeasonalQueryVars -> = { - primaryPropertyName: "gaugesInfoHourlySnapshots", - idField: "id", - nextVars: (value1000: GaugesInfoHourlySnapshot, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - from: Number(value1000.season), - }; - } - }, -}; - const NO_VARS = {} as const; export default function useSeasonalGaugeInfo( @@ -35,8 +16,18 @@ export default function useSeasonalGaugeInfo( convertResult: ConvertEntryFn, ) { const chainId = useChainId(); + const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await paginateSubgraph(paginateSettings, subgraphs[chainId].beanstalk, SeasonalGaugesInfoDocument, vars); + return await fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalGaugesInfoDocument, + { + where: buildCacheWhereClause(vars.from, vars.to), + orderBy: "season", + orderDirection: "asc", + }, + "cache_gaugesInfoHourlySnapshots", + ); }; return useSeasonalQueries("BeanstalkSeasonalGaugesInfoQuery", { diff --git a/src/state/seasonal/queries/useSeasonalMarketPerformance.ts b/src/state/seasonal/queries/useSeasonalMarketPerformance.ts index 75ba5d270..644464eb1 100644 --- a/src/state/seasonal/queries/useSeasonalMarketPerformance.ts +++ b/src/state/seasonal/queries/useSeasonalMarketPerformance.ts @@ -1,20 +1,12 @@ import { subgraphs } from "@/constants/subgraph"; +import { LP_TOKENS } from "@/constants/tokens"; import { - PINTO_CBBTC_TOKEN, - PINTO_CBETH_TOKEN, - PINTO_USDC_TOKEN, - PINTO_WETH_TOKEN, - PINTO_WSOL_TOKEN, -} from "@/constants/tokens"; -import { - BeanstalkSeasonalMarketPerformanceDocument, - BeanstalkSeasonalMarketPerformanceQuery, + CacheSeasonalMarketPerformanceDocument, + CacheSeasonalMarketPerformanceQuery, MarketPerformanceSeasonal, -} from "@/generated/gql/pintostalk/graphql"; +} from "@/generated/gql/cache/graphql"; import { useLPTokenToNonPintoUnderlyingMap } from "@/hooks/pinto/useTokenMap"; -import useTokenData from "@/state/useTokenData"; -import { useChainConstant } from "@/utils/chain"; -import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; +import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; import { SeasonalMarketPerformanceChartData, UseSeasonalMarketPerformanceResult, @@ -55,24 +47,6 @@ const accumulator = (chartType: SMPChartType): ((prev: number, curr: number) => } }; -const paginateSettings: PaginationSettings< - MarketPerformanceSeasonal, - BeanstalkSeasonalMarketPerformanceQuery, - "marketPerformanceSeasonals", - SeasonalQueryVars -> = { - primaryPropertyName: "marketPerformanceSeasonals", - idField: "id", - nextVars: (value1000: MarketPerformanceSeasonal, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - from: Number(value1000.season), - }; - } - }, -}; - export function useSeasonalMarketPerformanceData( fromSeason: number, toSeason: number, @@ -81,11 +55,15 @@ export function useSeasonalMarketPerformanceData( const chainId = useChainId(); const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await paginateSubgraph( - paginateSettings, - subgraphs[chainId].beanstalk, - BeanstalkSeasonalMarketPerformanceDocument, - vars, + return await fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalMarketPerformanceDocument, + { + where: buildCacheWhereClause(vars.from, vars.to), + orderBy: "season", + orderDirection: "asc", + }, + "cache_marketPerformanceSeasonals", ); }; @@ -114,8 +92,10 @@ export function useMarketPerformanceCalc( chartType: SMPChartType, startSeasons: Record = {}, ): SeasonalMarketPerformanceChartData { - const mainToken = useTokenData().mainToken; + const chainId = useChainId(); const lpToUnderlyingMap = useLPTokenToNonPintoUnderlyingMap(); + // Use LP_TOKENS to get the whitelisted token addresses (cache doesn't have silo.allWhitelistedTokens) + const lpTokens = LP_TOKENS[chainId] ?? []; const responseData = useMemo(() => { const result: SeasonalMarketPerformanceChartData = {}; @@ -149,14 +129,10 @@ export function useMarketPerformanceCalc( }); } - let tokenIdx = 0; - for (const token of season.silo.allWhitelistedTokens) { - // Skip Pinto token - if (token === mainToken.address) { - continue; - } - - const underlyingToken = lpToUnderlyingMap[token]; + // Iterate through LP tokens (cache doesn't provide silo.allWhitelistedTokens) + for (let tokenIdx = 0; tokenIdx < lpTokens.length; tokenIdx++) { + const lpToken = lpTokens[tokenIdx]; + const underlyingToken = lpToUnderlyingMap[lpToken.address.toLowerCase()]; if (!underlyingToken) { continue; } @@ -197,12 +173,11 @@ export function useMarketPerformanceCalc( timestamp: new Date(Number(season.timestamp) * 1000), }); } - ++tokenIdx; } } } return result; - }, [seasonalData, chartType, startSeasons, mainToken.address, lpToUnderlyingMap]); + }, [seasonalData, chartType, startSeasons, lpTokens, lpToUnderlyingMap]); return responseData; } diff --git a/src/state/seasonal/seasonalDataHooks.ts b/src/state/seasonal/seasonalDataHooks.ts index a7e9a48d7..6e94acc98 100644 --- a/src/state/seasonal/seasonalDataHooks.ts +++ b/src/state/seasonal/seasonalDataHooks.ts @@ -2,12 +2,12 @@ import { TV } from "@/classes/TokenValue"; import { SeasonalChartData } from "@/components/charts/SeasonalChart"; import { PODS, STALK } from "@/constants/internalTokens"; import { MAIN_TOKEN, PINTO, S_MAIN_TOKEN } from "@/constants/tokens"; -import { SiloHourlySnapshot } from "@/generated/gql/pintostalk/graphql"; +import { SiloHourlySnapshot } from "@/generated/gql/cache/graphql"; import { useProtocolAddress } from "@/hooks/pinto/useProtocolAddress"; import { useChainConstant } from "@/utils/chain"; import { Token, UseSeasonalResult } from "@/utils/types"; import { HashString, MayArray } from "@/utils/types.generic"; -import { useCallback, useMemo } from "react"; +import { useMemo } from "react"; import { useAccount } from "wagmi"; import useSeasonalBasinSummarySG from "./queries/useSeasonalBasinSummarySG"; import useSeasonalBeanBeanSG from "./queries/useSeasonalBeanBeanSG"; @@ -33,7 +33,7 @@ export function useSeasonalPrice(fromSeason: number, toSeason: number, enabled = fromSeason, toSeason, (beanHourly, _timestamp) => ({ - season: Number(beanHourly.season.season), + season: beanHourly.seasonNumber, value: Number(beanHourly.instPrice), timestamp: new Date(Number(beanHourly.createdTimestamp) * 1000), }), @@ -43,7 +43,7 @@ export function useSeasonalPrice(fromSeason: number, toSeason: number, enabled = export function useSeasonalSupply(fromSeason: number, toSeason: number): UseSeasonalResult { return useSeasonalBeanBeanSG(fromSeason, toSeason, (beanHourly, timestamp) => ({ - season: Number(beanHourly.season.season), + season: beanHourly.seasonNumber, value: TV.fromBlockchain(beanHourly.supply, PINTO.decimals).toNumber(), timestamp, })); @@ -51,7 +51,7 @@ export function useSeasonalSupply(fromSeason: number, toSeason: number): UseSeas export function useSeasonalMcap(fromSeason: number, toSeason: number): UseSeasonalResult { return useSeasonalBeanBeanSG(fromSeason, toSeason, (beanHourly, _timestamp) => ({ - season: Number(beanHourly.season.season), + season: beanHourly.seasonNumber, value: Number(beanHourly.marketCap), timestamp: new Date(Number(beanHourly.createdTimestamp) * 1000), })); @@ -59,7 +59,7 @@ export function useSeasonalMcap(fromSeason: number, toSeason: number): UseSeason export function useSeasonalL2SR(fromSeason: number, toSeason: number): UseSeasonalResult { return useSeasonalBeanBeanSG(fromSeason, toSeason, (beanHourly, _timestamp) => { - const season = Number(beanHourly.season.season); + const season = beanHourly.seasonNumber; let value = Number(beanHourly.l2sr); // For seasons 1-3, the twa liquidity isnt computable onchain, thus the protocl l2sr is not computable. // Use a manual calculation from the instantaneous liquidity instead. diff --git a/src/state/useSeasonsData.ts b/src/state/useSeasonsData.ts index c883ab0b9..d146754ef 100644 --- a/src/state/useSeasonsData.ts +++ b/src/state/useSeasonsData.ts @@ -2,17 +2,23 @@ import { TokenValue } from "@/classes/TokenValue"; import { PODS, STALK } from "@/constants/internalTokens"; import { subgraphs } from "@/constants/subgraph"; import { - BasinAdvancedChartDocument, - BasinAdvancedChartQuery, - BeanstalkHourlySnapshot, -} from "@/generated/gql/exchange/graphql"; -import { BeanAdvancedChartDocument, BeanAdvancedChartQuery, Season as BeanSeason } from "@/generated/gql/pinto/graphql"; -import { - BeanstalkAdvancedChartDocument, - BeanstalkAdvancedChartQuery, - Season as BeanstalkSeason, -} from "@/generated/gql/pintostalk/graphql"; -import { PaginationSettings, paginateMultiQuerySubgraph, paginateSubgraph } from "@/utils/paginateSubgraph"; + BeanHourlySnapshot, + CacheSeasonalBeanDocument, + CacheSeasonalBeanQuery, + CacheSeasonalFieldDocument, + CacheSeasonalFieldQuery, + CacheSeasonalGaugesInfoDocument, + CacheSeasonalGaugesInfoQuery, + CacheSeasonalSiloDocument, + CacheSeasonalSiloQuery, + CacheSeasonsDocument, + CacheSeasonsQuery, + FieldHourlySnapshot, + GaugesInfoHourlySnapshot, + Season, + SiloHourlySnapshot, +} from "@/generated/gql/cache/graphql"; +import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; import { Duration } from "luxon"; import { useCallback, useMemo } from "react"; import { useChainId } from "wagmi"; @@ -150,56 +156,13 @@ const marketStartSeasonToSymbolMappingPercent = { marketCumulativeWsolPercent: "WSOL", }; -const stalkPaginateSettings: PaginationSettings< - BeanstalkSeason, - BeanstalkAdvancedChartQuery, - "seasons", - SeasonalQueryVars -> = { - primaryPropertyName: "seasons", - idField: "id", - nextVars: (value1000: BeanstalkSeason, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - to: Number(value1000.season), - }; - } - }, -}; - -const beanPaginateSettings: PaginationSettings = { - primaryPropertyName: "seasons", - idField: "id", - nextVars: (value1000: BeanSeason, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - to: Number(value1000.beanHourlySnapshot.season.season), - }; - } - }, - orderBy: "desc", -}; - -const basinPaginateSettings: PaginationSettings< - BeanstalkHourlySnapshot, - BasinAdvancedChartQuery, - "beanstalkHourlySnapshots", - SeasonalQueryVars -> = { - primaryPropertyName: "beanstalkHourlySnapshots", - idField: "id", - nextVars: (value1000: BeanstalkHourlySnapshot, prevVars: SeasonalQueryVars) => { - if (value1000) { - return { - ...prevVars, - to: Number(value1000.season.season), - }; - } - }, - orderBy: "desc", -}; +// Combined result type for beanstalk data from cache +interface CacheBeanstalkData { + seasons: Season[]; + fieldHourlySnapshots: FieldHourlySnapshot[]; + siloHourlySnapshots: SiloHourlySnapshot[]; + gaugesInfoHourlySnapshots: GaugesInfoHourlySnapshot[]; +} export default function useSeasonsData( fromSeason: number, @@ -223,21 +186,65 @@ export default function useSeasonsData( const tokenData = useTokenData(); const syncOffset = seasonSync ? 1 : 0; + // Fetch all beanstalk data from cache in parallel const stalkQueryFnFactory = useCallback( - (vars: SeasonalQueryVars) => async () => { - return paginateMultiQuerySubgraph( - stalkPaginateSettings, - subgraphs[chainId].beanstalk, - BeanstalkAdvancedChartDocument, - vars, - ); + (vars: SeasonalQueryVars) => async (): Promise => { + const cacheVars = { + where: buildCacheWhereClause(vars.from, vars.to), + orderBy: "season", + orderDirection: "desc", + }; + + const [seasons, fieldSnapshots, siloSnapshots, gaugeSnapshots] = await Promise.all([ + fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonsDocument, + cacheVars, + "cache_seasons", + ), + fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalFieldDocument, + cacheVars, + "cache_fieldHourlySnapshots", + ), + fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalSiloDocument, + cacheVars, + "cache_siloHourlySnapshots", + ), + fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalGaugesInfoDocument, + cacheVars, + "cache_gaugesInfoHourlySnapshots", + ), + ]); + + return { + seasons, + fieldHourlySnapshots: fieldSnapshots, + siloHourlySnapshots: siloSnapshots, + gaugesInfoHourlySnapshots: gaugeSnapshots, + }; }, [chainId], ); + // Fetch bean data from cache (uses seasonNumber instead of season) const beanQueryFnFactory = useCallback( (vars: SeasonalQueryVars) => async () => { - return paginateSubgraph(beanPaginateSettings, subgraphs[chainId].bean, BeanAdvancedChartDocument, vars); + return fetchCacheQuery( + subgraphs[chainId].cache, + CacheSeasonalBeanDocument, + { + where: buildCacheWhereClause(vars.from, vars.to, undefined, "seasonNumber"), + orderBy: "seasonNumber", + orderDirection: "desc", + }, + "cache_beanHourlySnapshots", + ); }, [chainId], ); @@ -454,22 +461,23 @@ export default function useSeasonsData( } } - if (beanData && idx + syncOffset < countSubgraphSeasons) { - const beanHourly = beanResults[idx + syncOffset].beanHourlySnapshot; + if (beanData && idx + syncOffset < beanResults.length) { + // Cache returns flat BeanHourlySnapshot objects directly + const beanHourly = beanResults[idx + syncOffset]; allData.crosses = beanHourly.crosses; allData.marketCap = Number(beanHourly.marketCap); allData.supply = TokenValue.fromBlockchain(beanHourly.supply, tokenData.mainToken.decimals); - allData.supplyInPegLP = TokenValue.fromBlockchain(beanHourly.supply, tokenData.mainToken.decimals); + allData.supplyInPegLP = TokenValue.fromHuman(beanHourly.supplyInPegLP || 0, tokenData.mainToken.decimals); allData.instDeltaB = TokenValue.fromHuman(beanHourly.instDeltaB, tokenData.mainToken.decimals); allData.instPrice = TokenValue.fromHuman(beanHourly.instPrice, tokenData.mainToken.decimals); - allData.l2sr = TokenValue.fromHuman(beanHourly.l2sr * 100, 2); + allData.l2sr = TokenValue.fromHuman(Number(beanHourly.l2sr) * 100, 2); allData.twaDeltaB = TokenValue.fromHuman(beanHourly.twaDeltaB, 2); allData.twaPrice = TokenValue.fromHuman(beanHourly.twaPrice, 4); if (!allData.season) { - const season = beanResults[idx].season; - allData.season = season.season; - allData.timestamp = Number(season.timestamp || 0); + // Cache uses seasonNumber and createdTimestamp directly + allData.season = beanHourly.seasonNumber; + allData.timestamp = Number(beanHourly.createdTimestamp || 0); } } diff --git a/src/utils/paginateSubgraph.ts b/src/utils/paginateSubgraph.ts index 98b6e1a8c..13061041a 100644 --- a/src/utils/paginateSubgraph.ts +++ b/src/utils/paginateSubgraph.ts @@ -3,6 +3,65 @@ import request, { RequestDocument } from "graphql-request"; const PAGE_SIZE = 1000; +// ============================================================================ +// Cache Query Helper - Fetches all results in a single request from cache endpoint +// ============================================================================ + +export interface CacheQueryVars { + where: string; + orderBy: string; + orderDirection: string; +} + +/** + * Fetches data from the cache endpoint in a single request. + * Unlike paginateSubgraph, this returns all results without pagination limits. + * + * @param url - The cache endpoint URL + * @param document - The GraphQL document (generated from codegen) + * @param vars - Query variables including where (JSON string), orderBy, orderDirection + * @param resultKey - The key in the result object that contains the data array + */ +export const fetchCacheQuery = async ( + url: string, + document: RequestDocument | TypedQueryDocumentNode, + vars: CacheQueryVars, + resultKey: keyof T, +): Promise => { + const results = await request(url, document, vars); + return results[resultKey] as R[]; +}; + +/** + * Builds the where clause string for cache queries. + * Uses GraphQL object syntax: "key: value, key: value" + * + * @param fromSeason - The starting season number + * @param toSeason - The ending season number + * @param additionalFilters - Additional filter key-value pairs + * @param seasonField - The field name for season filtering (default: "season", use "seasonNumber" for BeanHourlySnapshot) + */ +export const buildCacheWhereClause = ( + fromSeason: number, + toSeason: number, + additionalFilters?: Record, + seasonField: string = "season", +): string => { + const parts: string[] = [`${seasonField}_gte: ${fromSeason}`, `${seasonField}_lte: ${toSeason}`]; + + if (additionalFilters) { + for (const [key, value] of Object.entries(additionalFilters)) { + if (typeof value === "string") { + parts.push(`${key}: "${value}"`); + } else { + parts.push(`${key}: ${value}`); + } + } + } + + return parts.join(", "); +}; + export interface PaginationSettings { primaryPropertyName: Extract; idField: Extract; From d08b8a2dd62fa5435aa06fe28960cda366aa7c81 Mon Sep 17 00:00:00 2001 From: feyyazcigim Date: Fri, 9 Jan 2026 11:26:23 +0300 Subject: [PATCH 3/3] Revert "add cached queries-endpoints and apply these changes to hooks" This reverts commit 743c0b23686a65cbc325be75f2324574246698c0. --- codegen.ts | 12 +- src/constants/subgraph.ts | 6 +- src/generated/gql/cache/gql.ts | 94 --- src/generated/gql/cache/graphql.ts | 745 ------------------ src/generated/gql/cache/index.ts | 1 - .../seasonal/CacheFarmerSeasonalSilo.graphql | 16 - .../CacheFarmerSeasonalSiloAsset.graphql | 16 - .../cache/seasonal/CacheSeasonalBean.graphql | 21 - .../cache/seasonal/CacheSeasonalField.graphql | 32 - .../seasonal/CacheSeasonalGaugesInfo.graphql | 17 - .../CacheSeasonalMarketPerformance.graphql | 21 - .../cache/seasonal/CacheSeasonalSilo.graphql | 31 - .../CacheSeasonalWrappedDeposit.graphql | 18 - .../cache/seasonal/CacheSeasons.graphql | 17 - .../seasonal/queries/useSeasonalBeanBeanSG.ts | 35 +- .../queries/useSeasonalBeanstalkFieldSG.ts | 43 +- .../queries/useSeasonalBeanstalkSiloSG.ts | 65 +- .../useSeasonalBeanstalkWrappedDepositsSG.ts | 41 +- .../seasonal/queries/useSeasonalGaugeInfo.ts | 39 +- .../queries/useSeasonalMarketPerformance.ts | 69 +- src/state/seasonal/seasonalDataHooks.ts | 12 +- src/state/useSeasonsData.ts | 160 ++-- src/utils/paginateSubgraph.ts | 59 -- 23 files changed, 259 insertions(+), 1311 deletions(-) delete mode 100644 src/generated/gql/cache/gql.ts delete mode 100644 src/generated/gql/cache/graphql.ts delete mode 100644 src/generated/gql/cache/index.ts delete mode 100644 src/queries/cache/seasonal/CacheFarmerSeasonalSilo.graphql delete mode 100644 src/queries/cache/seasonal/CacheFarmerSeasonalSiloAsset.graphql delete mode 100644 src/queries/cache/seasonal/CacheSeasonalBean.graphql delete mode 100644 src/queries/cache/seasonal/CacheSeasonalField.graphql delete mode 100644 src/queries/cache/seasonal/CacheSeasonalGaugesInfo.graphql delete mode 100644 src/queries/cache/seasonal/CacheSeasonalMarketPerformance.graphql delete mode 100644 src/queries/cache/seasonal/CacheSeasonalSilo.graphql delete mode 100644 src/queries/cache/seasonal/CacheSeasonalWrappedDeposit.graphql delete mode 100644 src/queries/cache/seasonal/CacheSeasons.graphql diff --git a/codegen.ts b/codegen.ts index 83cccadcb..b1a39f03d 100644 --- a/codegen.ts +++ b/codegen.ts @@ -32,16 +32,8 @@ const config: CodegenConfig = { presetConfig: { fragmentMasking: false, }, - }, - "src/generated/gql/cache/": { - schema: "https://graph.pinto.money/cache", - documents: ["src/queries/cache/**/*.graphql"], - preset: "client", - presetConfig: { - fragmentMasking: false, - }, - }, + }, }, -}; +}; export default config; diff --git a/src/constants/subgraph.ts b/src/constants/subgraph.ts index 103ad98d7..207e0c65c 100644 --- a/src/constants/subgraph.ts +++ b/src/constants/subgraph.ts @@ -1,29 +1,25 @@ import { arbitrum, base, localhost } from "viem/chains"; -export const subgraphs: { [chainId: number]: { beanstalk: string; bean: string; basin: string; cache: string } } = { +export const subgraphs: { [chainId: number]: { beanstalk: string; bean: string; basin: string } } = { [arbitrum.id]: { beanstalk: "https://graph.bean.money/beanstalk-dev", bean: "https://graph.bean.money/bean-dev", basin: "https://graph.bean.money/exchange-dev", - cache: "https://graph.bean.money/cache", }, [base.id]: { beanstalk: "https://graph.pinto.money/pintostalk", bean: "https://graph.pinto.money/pinto", basin: "https://graph.pinto.money/exchange", - cache: "https://graph.pinto.money/cache", }, [localhost.id]: { beanstalk: "https://graph.pinto.money/pintostalk", bean: "https://graph.pinto.money/pinto", basin: "https://graph.pinto.money/exchange", - cache: "https://graph.pinto.money/cache", }, [41337]: { beanstalk: "https://graph.pinto.money/pintostalk", bean: "https://graph.pinto.money/pinto", basin: "https://graph.pinto.money/exchange", - cache: "https://graph.pinto.money/cache", }, }; diff --git a/src/generated/gql/cache/gql.ts b/src/generated/gql/cache/gql.ts deleted file mode 100644 index fc23170a7..000000000 --- a/src/generated/gql/cache/gql.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* eslint-disable */ -import * as types from './graphql'; -import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; - -/** - * Map of all GraphQL operations in the project. - * - * This map has several performance disadvantages: - * 1. It is not tree-shakeable, so it will include all operations in the project. - * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle. - * 3. It does not support dead code elimination, so it will add unused operations. - * - * Therefore it is highly recommended to use the babel or swc plugin for production. - * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size - */ -type Documents = { - "query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n createdAt\n plantedBeans\n stalk\n germinatingStalk\n depositedBDV\n }\n}": typeof types.CacheFarmerSeasonalSiloDocument, - "query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloAssetHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n depositedAmount\n depositedBDV\n deltaDepositedBDV\n deltaDepositedAmount\n createdAt\n }\n}": typeof types.CacheFarmerSeasonalSiloAssetDocument, - "query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_beanHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n seasonNumber\n supply\n marketCap\n instPrice\n l2sr\n liquidityUSD\n twaPrice\n twaDeltaB\n instDeltaB\n crosses\n supplyInPegLP\n createdTimestamp\n }\n}": typeof types.CacheSeasonalBeanDocument, - "query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_fieldHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n caseId\n issuedSoil\n deltaSownBeans\n sownBeans\n deltaPodDemand\n blocksToSoldOutSoil\n podRate\n temperature\n deltaTemperature\n cultivationTemperature\n harvestableIndex\n harvestablePods\n harvestedPods\n numberOfSowers\n numberOfSows\n podIndex\n realRateOfReturn\n seasonBlock\n soil\n soilSoldOut\n unharvestablePods\n createdAt\n }\n}": typeof types.CacheSeasonalFieldDocument, - "query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_gaugesInfoHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n g0CultivationFactor\n g1BlightFactor\n g1ConvertDownPenalty\n g2BdvConvertedThisSeason\n g2BonusStalkPerBdv\n g2MaxConvertCapacity\n createdAt\n }\n}": typeof types.CacheSeasonalGaugesInfoDocument, - "query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_marketPerformanceSeasonals(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n timestamp\n thisSeasonTokenUsdPrices\n usdChange\n percentChange\n totalUsdChange\n totalPercentChange\n cumulativeUsdChange\n cumulativePercentChange\n cumulativeTotalUsdChange\n cumulativeTotalPercentChange\n }\n}": typeof types.CacheSeasonalMarketPerformanceDocument, - "query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n stalk\n beanToMaxLpGpPerBdvRatio\n deltaBeanToMaxLpGpPerBdvRatio\n cropRatio\n deltaCropRatio\n avgGrownStalkPerBdvPerSeason\n depositedBDV\n germinatingStalk\n createdAt\n }\n}\n\nquery CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n activeFarmers\n }\n}": typeof types.CacheSeasonalSiloDocument, - "query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_wrappedDepositERC20HourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n supply\n redeemRate\n apy24h\n apy7d\n apy30d\n apy90d\n createdAt\n }\n}": typeof types.CacheSeasonalWrappedDepositDocument, - "query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_seasons(where: $where, orderBy: $orderBy, orderDirection: $orderDirection) {\n id\n season\n sunriseBlock\n rewardBeans\n price\n deltaBeans\n raining\n createdAt\n }\n}": typeof types.CacheSeasonsDocument, -}; -const documents: Documents = { - "query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n createdAt\n plantedBeans\n stalk\n germinatingStalk\n depositedBDV\n }\n}": types.CacheFarmerSeasonalSiloDocument, - "query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloAssetHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n depositedAmount\n depositedBDV\n deltaDepositedBDV\n deltaDepositedAmount\n createdAt\n }\n}": types.CacheFarmerSeasonalSiloAssetDocument, - "query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_beanHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n seasonNumber\n supply\n marketCap\n instPrice\n l2sr\n liquidityUSD\n twaPrice\n twaDeltaB\n instDeltaB\n crosses\n supplyInPegLP\n createdTimestamp\n }\n}": types.CacheSeasonalBeanDocument, - "query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_fieldHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n caseId\n issuedSoil\n deltaSownBeans\n sownBeans\n deltaPodDemand\n blocksToSoldOutSoil\n podRate\n temperature\n deltaTemperature\n cultivationTemperature\n harvestableIndex\n harvestablePods\n harvestedPods\n numberOfSowers\n numberOfSows\n podIndex\n realRateOfReturn\n seasonBlock\n soil\n soilSoldOut\n unharvestablePods\n createdAt\n }\n}": types.CacheSeasonalFieldDocument, - "query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_gaugesInfoHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n g0CultivationFactor\n g1BlightFactor\n g1ConvertDownPenalty\n g2BdvConvertedThisSeason\n g2BonusStalkPerBdv\n g2MaxConvertCapacity\n createdAt\n }\n}": types.CacheSeasonalGaugesInfoDocument, - "query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_marketPerformanceSeasonals(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n timestamp\n thisSeasonTokenUsdPrices\n usdChange\n percentChange\n totalUsdChange\n totalPercentChange\n cumulativeUsdChange\n cumulativePercentChange\n cumulativeTotalUsdChange\n cumulativeTotalPercentChange\n }\n}": types.CacheSeasonalMarketPerformanceDocument, - "query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n stalk\n beanToMaxLpGpPerBdvRatio\n deltaBeanToMaxLpGpPerBdvRatio\n cropRatio\n deltaCropRatio\n avgGrownStalkPerBdvPerSeason\n depositedBDV\n germinatingStalk\n createdAt\n }\n}\n\nquery CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n activeFarmers\n }\n}": types.CacheSeasonalSiloDocument, - "query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_wrappedDepositERC20HourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n supply\n redeemRate\n apy24h\n apy7d\n apy30d\n apy90d\n createdAt\n }\n}": types.CacheSeasonalWrappedDepositDocument, - "query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_seasons(where: $where, orderBy: $orderBy, orderDirection: $orderDirection) {\n id\n season\n sunriseBlock\n rewardBeans\n price\n deltaBeans\n raining\n createdAt\n }\n}": types.CacheSeasonsDocument, -}; - -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - * - * - * @example - * ```ts - * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`); - * ``` - * - * The query argument is unknown! - * Please regenerate the types. - */ -export function graphql(source: string): unknown; - -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n createdAt\n plantedBeans\n stalk\n germinatingStalk\n depositedBDV\n }\n}"): (typeof documents)["query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n createdAt\n plantedBeans\n stalk\n germinatingStalk\n depositedBDV\n }\n}"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloAssetHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n depositedAmount\n depositedBDV\n deltaDepositedBDV\n deltaDepositedAmount\n createdAt\n }\n}"): (typeof documents)["query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloAssetHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n depositedAmount\n depositedBDV\n deltaDepositedBDV\n deltaDepositedAmount\n createdAt\n }\n}"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_beanHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n seasonNumber\n supply\n marketCap\n instPrice\n l2sr\n liquidityUSD\n twaPrice\n twaDeltaB\n instDeltaB\n crosses\n supplyInPegLP\n createdTimestamp\n }\n}"): (typeof documents)["query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_beanHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n seasonNumber\n supply\n marketCap\n instPrice\n l2sr\n liquidityUSD\n twaPrice\n twaDeltaB\n instDeltaB\n crosses\n supplyInPegLP\n createdTimestamp\n }\n}"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_fieldHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n caseId\n issuedSoil\n deltaSownBeans\n sownBeans\n deltaPodDemand\n blocksToSoldOutSoil\n podRate\n temperature\n deltaTemperature\n cultivationTemperature\n harvestableIndex\n harvestablePods\n harvestedPods\n numberOfSowers\n numberOfSows\n podIndex\n realRateOfReturn\n seasonBlock\n soil\n soilSoldOut\n unharvestablePods\n createdAt\n }\n}"): (typeof documents)["query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_fieldHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n caseId\n issuedSoil\n deltaSownBeans\n sownBeans\n deltaPodDemand\n blocksToSoldOutSoil\n podRate\n temperature\n deltaTemperature\n cultivationTemperature\n harvestableIndex\n harvestablePods\n harvestedPods\n numberOfSowers\n numberOfSows\n podIndex\n realRateOfReturn\n seasonBlock\n soil\n soilSoldOut\n unharvestablePods\n createdAt\n }\n}"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_gaugesInfoHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n g0CultivationFactor\n g1BlightFactor\n g1ConvertDownPenalty\n g2BdvConvertedThisSeason\n g2BonusStalkPerBdv\n g2MaxConvertCapacity\n createdAt\n }\n}"): (typeof documents)["query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_gaugesInfoHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n g0CultivationFactor\n g1BlightFactor\n g1ConvertDownPenalty\n g2BdvConvertedThisSeason\n g2BonusStalkPerBdv\n g2MaxConvertCapacity\n createdAt\n }\n}"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_marketPerformanceSeasonals(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n timestamp\n thisSeasonTokenUsdPrices\n usdChange\n percentChange\n totalUsdChange\n totalPercentChange\n cumulativeUsdChange\n cumulativePercentChange\n cumulativeTotalUsdChange\n cumulativeTotalPercentChange\n }\n}"): (typeof documents)["query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_marketPerformanceSeasonals(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n timestamp\n thisSeasonTokenUsdPrices\n usdChange\n percentChange\n totalUsdChange\n totalPercentChange\n cumulativeUsdChange\n cumulativePercentChange\n cumulativeTotalUsdChange\n cumulativeTotalPercentChange\n }\n}"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n stalk\n beanToMaxLpGpPerBdvRatio\n deltaBeanToMaxLpGpPerBdvRatio\n cropRatio\n deltaCropRatio\n avgGrownStalkPerBdvPerSeason\n depositedBDV\n germinatingStalk\n createdAt\n }\n}\n\nquery CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n activeFarmers\n }\n}"): (typeof documents)["query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n stalk\n beanToMaxLpGpPerBdvRatio\n deltaBeanToMaxLpGpPerBdvRatio\n cropRatio\n deltaCropRatio\n avgGrownStalkPerBdvPerSeason\n depositedBDV\n germinatingStalk\n createdAt\n }\n}\n\nquery CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_siloHourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n activeFarmers\n }\n}"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_wrappedDepositERC20HourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n supply\n redeemRate\n apy24h\n apy7d\n apy30d\n apy90d\n createdAt\n }\n}"): (typeof documents)["query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_wrappedDepositERC20HourlySnapshots(\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n season\n supply\n redeemRate\n apy24h\n apy7d\n apy30d\n apy90d\n createdAt\n }\n}"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql(source: "query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_seasons(where: $where, orderBy: $orderBy, orderDirection: $orderDirection) {\n id\n season\n sunriseBlock\n rewardBeans\n price\n deltaBeans\n raining\n createdAt\n }\n}"): (typeof documents)["query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) {\n cache_seasons(where: $where, orderBy: $orderBy, orderDirection: $orderDirection) {\n id\n season\n sunriseBlock\n rewardBeans\n price\n deltaBeans\n raining\n createdAt\n }\n}"]; - -export function graphql(source: string) { - return (documents as any)[source] ?? {}; -} - -export type DocumentType> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never; \ No newline at end of file diff --git a/src/generated/gql/cache/graphql.ts b/src/generated/gql/cache/graphql.ts deleted file mode 100644 index f76bac7ba..000000000 --- a/src/generated/gql/cache/graphql.ts +++ /dev/null @@ -1,745 +0,0 @@ -/* eslint-disable */ -import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; -export type Maybe = T | null; -export type InputMaybe = Maybe; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; -/** All built-in and custom scalars, mapped to their actual values */ -export type Scalars = { - ID: { input: string; output: string; } - String: { input: string; output: string; } - Boolean: { input: boolean; output: boolean; } - Int: { input: number; output: number; } - Float: { input: number; output: number; } - BigDecimal: { input: any; output: any; } - BigInt: { input: any; output: any; } - Bytes: { input: any; output: any; } -}; - -export type BeanHourlySnapshot = { - __typename?: 'BeanHourlySnapshot'; - createdTimestamp: Scalars['BigInt']['output']; - crosses: Scalars['Int']['output']; - deltaCrosses: Scalars['Int']['output']; - deltaLiquidityUSD: Scalars['BigDecimal']['output']; - deltaVolume: Scalars['BigInt']['output']; - deltaVolumeUSD: Scalars['BigDecimal']['output']; - id: Scalars['ID']['output']; - instDeltaB: Scalars['BigDecimal']['output']; - instPrice: Scalars['BigDecimal']['output']; - l2sr: Scalars['BigDecimal']['output']; - lastUpdateBlockNumber: Scalars['BigInt']['output']; - lastUpdateTimestamp: Scalars['BigInt']['output']; - liquidityUSD: Scalars['BigDecimal']['output']; - lockedBeans: Scalars['BigInt']['output']; - marketCap: Scalars['BigDecimal']['output']; - seasonNumber: Scalars['Int']['output']; - supply: Scalars['BigInt']['output']; - supplyInPegLP: Scalars['BigDecimal']['output']; - twaBeanLiquidityUSD: Scalars['BigDecimal']['output']; - twaDeltaB: Scalars['BigDecimal']['output']; - twaLiquidityUSD: Scalars['BigDecimal']['output']; - twaNonBeanLiquidityUSD: Scalars['BigDecimal']['output']; - twaPrice: Scalars['BigDecimal']['output']; - volume: Scalars['BigInt']['output']; - volumeUSD: Scalars['BigDecimal']['output']; -}; - -export type BeanstalkHourlySnapshot = { - __typename?: 'BeanstalkHourlySnapshot'; - createdTimestamp: Scalars['BigInt']['output']; - cumulativeBuyVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeConvertDownVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeConvertNeutralTradeVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeConvertNeutralTransferVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeConvertUpVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeConvertVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeSellVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeTradeVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeTransferVolumeUSD: Scalars['BigDecimal']['output']; - deltaBuyVolumeUSD: Scalars['BigDecimal']['output']; - deltaConvertDownVolumeUSD: Scalars['BigDecimal']['output']; - deltaConvertNeutralTradeVolumeUSD: Scalars['BigDecimal']['output']; - deltaConvertNeutralTransferVolumeUSD: Scalars['BigDecimal']['output']; - deltaConvertUpVolumeUSD: Scalars['BigDecimal']['output']; - deltaConvertVolumeUSD: Scalars['BigDecimal']['output']; - deltaLiquidityUSD: Scalars['BigDecimal']['output']; - deltaSellVolumeUSD: Scalars['BigDecimal']['output']; - deltaTradeVolumeUSD: Scalars['BigDecimal']['output']; - deltaTransferVolumeUSD: Scalars['BigDecimal']['output']; - id: Scalars['ID']['output']; - lastUpdateBlockNumber: Scalars['BigInt']['output']; - lastUpdateTimestamp: Scalars['BigInt']['output']; - season: Scalars['Int']['output']; - totalLiquidityUSD: Scalars['BigDecimal']['output']; -}; - -export type FarmerBalanceHourlySnapshot = { - __typename?: 'FarmerBalanceHourlySnapshot'; - createdTimestamp: Scalars['BigInt']['output']; - deltaFarmBalance: Scalars['BigInt']['output']; - deltaTotalBalance: Scalars['BigInt']['output']; - deltaWalletBalance: Scalars['BigInt']['output']; - farmBalance: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - lastUpdateBlockNumber: Scalars['BigInt']['output']; - lastUpdateTimestamp: Scalars['BigInt']['output']; - seasonNumber: Scalars['Int']['output']; - totalBalance: Scalars['BigInt']['output']; - walletBalance: Scalars['BigInt']['output']; -}; - -export type FieldHourlySnapshot = { - __typename?: 'FieldHourlySnapshot'; - blocksToSoldOutSoil?: Maybe; - caseId?: Maybe; - createdAt: Scalars['BigInt']['output']; - cultivationFactor?: Maybe; - cultivationTemperature?: Maybe; - deltaCultivationFactor?: Maybe; - deltaCultivationTemperature?: Maybe; - deltaHarvestableIndex: Scalars['BigInt']['output']; - deltaHarvestablePods: Scalars['BigInt']['output']; - deltaHarvestedPods: Scalars['BigInt']['output']; - deltaIssuedSoil: Scalars['BigInt']['output']; - deltaNumberOfSowers: Scalars['Int']['output']; - deltaNumberOfSows: Scalars['Int']['output']; - deltaPodDemand: Scalars['BigInt']['output']; - deltaPodIndex: Scalars['BigInt']['output']; - deltaPodRate: Scalars['BigDecimal']['output']; - deltaRealRateOfReturn: Scalars['BigDecimal']['output']; - deltaSoil: Scalars['BigInt']['output']; - deltaSownBeans: Scalars['BigInt']['output']; - deltaTemperature: Scalars['BigDecimal']['output']; - deltaUnharvestablePods: Scalars['BigInt']['output']; - fieldId: Scalars['BigInt']['output']; - harvestableIndex: Scalars['BigInt']['output']; - harvestablePods: Scalars['BigInt']['output']; - harvestedPods: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - issuedSoil: Scalars['BigInt']['output']; - numberOfSowers: Scalars['Int']['output']; - numberOfSows: Scalars['Int']['output']; - podIndex: Scalars['BigInt']['output']; - podRate: Scalars['BigDecimal']['output']; - realRateOfReturn: Scalars['BigDecimal']['output']; - season: Scalars['Int']['output']; - seasonBlock: Scalars['BigInt']['output']; - soil: Scalars['BigInt']['output']; - soilSoldOut: Scalars['Boolean']['output']; - sownBeans: Scalars['BigInt']['output']; - temperature: Scalars['BigDecimal']['output']; - unharvestablePods: Scalars['BigInt']['output']; - updatedAt: Scalars['BigInt']['output']; -}; - -export type GaugesInfoHourlySnapshot = { - __typename?: 'GaugesInfoHourlySnapshot'; - createdAt: Scalars['BigInt']['output']; - deltaG0CultivationFactor?: Maybe; - deltaG0IsActive: Scalars['Boolean']['output']; - deltaG1BlightFactor?: Maybe; - deltaG1ConvertDownPenalty?: Maybe; - deltaG1IsActive: Scalars['Boolean']['output']; - deltaG2BdvConvertedThisSeason?: Maybe; - deltaG2BonusStalkPerBdv?: Maybe; - deltaG2IsActive: Scalars['Boolean']['output']; - deltaG2MaxConvertCapacity?: Maybe; - deltaG2MaxTwaDeltaB?: Maybe; - g0CultivationFactor?: Maybe; - g0IsActive: Scalars['Boolean']['output']; - g1BlightFactor?: Maybe; - g1ConvertDownPenalty?: Maybe; - g1IsActive: Scalars['Boolean']['output']; - g2BdvConvertedThisSeason?: Maybe; - g2BonusStalkPerBdv?: Maybe; - g2IsActive: Scalars['Boolean']['output']; - g2MaxConvertCapacity?: Maybe; - g2MaxTwaDeltaB?: Maybe; - id: Scalars['ID']['output']; - season: Scalars['Int']['output']; - updatedAt: Scalars['BigInt']['output']; -}; - -export type MarketPerformanceSeasonal = { - __typename?: 'MarketPerformanceSeasonal'; - cumulativePercentChange?: Maybe>; - cumulativeTotalPercentChange?: Maybe; - cumulativeTotalUsdChange?: Maybe; - cumulativeUsdChange?: Maybe>; - id: Scalars['ID']['output']; - percentChange?: Maybe>; - prevSeasonTokenBalances: Array; - prevSeasonTokenUsdPrices: Array; - prevSeasonTokenUsdValues: Array; - prevSeasonTotalUsd: Scalars['BigDecimal']['output']; - season: Scalars['Int']['output']; - thisSeasonTokenUsdPrices?: Maybe>; - thisSeasonTokenUsdValues?: Maybe>; - thisSeasonTotalUsd?: Maybe; - timestamp?: Maybe; - totalPercentChange?: Maybe; - totalUsdChange?: Maybe; - usdChange?: Maybe>; - valid: Scalars['Boolean']['output']; -}; - -export type PodMarketplaceHourlySnapshot = { - __typename?: 'PodMarketplaceHourlySnapshot'; - availableListedPods: Scalars['BigInt']['output']; - availableOrderBeans: Scalars['BigInt']['output']; - beanVolume: Scalars['BigInt']['output']; - cancelledListedPods: Scalars['BigInt']['output']; - cancelledOrderBeans: Scalars['BigInt']['output']; - createdAt: Scalars['BigInt']['output']; - deltaAvailableListedPods: Scalars['BigInt']['output']; - deltaAvailableOrderBeans: Scalars['BigInt']['output']; - deltaBeanVolume: Scalars['BigInt']['output']; - deltaCancelledListedPods: Scalars['BigInt']['output']; - deltaCancelledOrderBeans: Scalars['BigInt']['output']; - deltaExpiredListedPods: Scalars['BigInt']['output']; - deltaFilledListedPods: Scalars['BigInt']['output']; - deltaFilledOrderBeans: Scalars['BigInt']['output']; - deltaFilledOrderedPods: Scalars['BigInt']['output']; - deltaListedPods: Scalars['BigInt']['output']; - deltaOrderBeans: Scalars['BigInt']['output']; - deltaPodVolume: Scalars['BigInt']['output']; - expiredListedPods: Scalars['BigInt']['output']; - filledListedPods: Scalars['BigInt']['output']; - filledOrderBeans: Scalars['BigInt']['output']; - filledOrderedPods: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - listedPods: Scalars['BigInt']['output']; - orderBeans: Scalars['BigInt']['output']; - podVolume: Scalars['BigInt']['output']; - season: Scalars['Int']['output']; - updatedAt: Scalars['BigInt']['output']; -}; - -export type PoolHourlySnapshot = { - __typename?: 'PoolHourlySnapshot'; - createdTimestamp: Scalars['BigInt']['output']; - crosses: Scalars['Int']['output']; - deltaCrosses: Scalars['Int']['output']; - deltaLiquidityUSD: Scalars['BigDecimal']['output']; - deltaReserves: Array; - deltaVolume: Scalars['BigInt']['output']; - deltaVolumeUSD: Scalars['BigDecimal']['output']; - id: Scalars['ID']['output']; - instDeltaB: Scalars['BigDecimal']['output']; - instPrice: Scalars['BigDecimal']['output']; - lastUpdateBlockNumber: Scalars['BigInt']['output']; - lastUpdateTimestamp: Scalars['BigInt']['output']; - liquidityUSD: Scalars['BigDecimal']['output']; - reserves: Array; - seasonNumber: Scalars['Int']['output']; - twaBeanLiquidityUSD: Scalars['BigDecimal']['output']; - twaDeltaB: Scalars['BigDecimal']['output']; - twaLiquidityUSD: Scalars['BigDecimal']['output']; - twaNonBeanLiquidityUSD: Scalars['BigDecimal']['output']; - twaPrice: Scalars['BigDecimal']['output']; - twaReserves: Array; - twaToken2Price: Scalars['BigDecimal']['output']; - volume: Scalars['BigInt']['output']; - volumeUSD: Scalars['BigDecimal']['output']; -}; - -export type Query = { - __typename?: 'Query'; - cache_beanHourlySnapshots: Array; - cache_beanstalkHourlySnapshots: Array; - cache_farmerBalanceHourlySnapshots: Array; - cache_fieldHourlySnapshots: Array; - cache_gaugesInfoHourlySnapshots: Array; - cache_marketPerformanceSeasonals: Array; - cache_podMarketplaceHourlySnapshots: Array; - cache_poolHourlySnapshots: Array; - cache_seasons: Array; - cache_siloAssetHourlySnapshots: Array; - cache_siloHourlySnapshots: Array; - cache_tokenHourlySnapshots: Array; - cache_tractorHourlySnapshots: Array; - cache_unripeTokenHourlySnapshots: Array; - cache_wellHourlySnapshots: Array; - cache_whitelistTokenHourlySnapshots: Array; - cache_wrappedDepositERC20HourlySnapshots: Array; -}; - - -export type QueryCacheBeanHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheBeanstalkHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheFarmerBalanceHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheFieldHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheGaugesInfoHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheMarketPerformanceSeasonalsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCachePodMarketplaceHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCachePoolHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheSeasonsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheSiloAssetHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheSiloHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheTokenHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheTractorHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheUnripeTokenHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheWellHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheWhitelistTokenHourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - - -export type QueryCacheWrappedDepositErc20HourlySnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - -export type Season = { - __typename?: 'Season'; - beans: Scalars['BigInt']['output']; - createdAt: Scalars['BigInt']['output']; - deltaB: Scalars['BigInt']['output']; - deltaBeans: Scalars['BigInt']['output']; - floodFieldBeans: Scalars['BigInt']['output']; - floodSiloBeans: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - incentiveBeans: Scalars['BigInt']['output']; - marketCap: Scalars['BigDecimal']['output']; - price: Scalars['BigDecimal']['output']; - raining: Scalars['Boolean']['output']; - rewardBeans: Scalars['BigInt']['output']; - season: Scalars['Int']['output']; - sunriseBlock: Scalars['BigInt']['output']; - unmigratedL1Beans?: Maybe; -}; - -export type SiloAssetHourlySnapshot = { - __typename?: 'SiloAssetHourlySnapshot'; - createdAt: Scalars['BigInt']['output']; - deltaDepositedAmount: Scalars['BigInt']['output']; - deltaDepositedBDV: Scalars['BigInt']['output']; - deltaWithdrawnAmount: Scalars['BigInt']['output']; - depositedAmount: Scalars['BigInt']['output']; - depositedBDV: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - season: Scalars['Int']['output']; - updatedAt: Scalars['BigInt']['output']; - withdrawnAmount: Scalars['BigInt']['output']; -}; - -export type SiloHourlySnapshot = { - __typename?: 'SiloHourlySnapshot'; - activeFarmers: Scalars['Int']['output']; - avgConvertDownPenalty: Scalars['BigDecimal']['output']; - avgGrownStalkPerBdvPerSeason: Scalars['BigInt']['output']; - beanMints: Scalars['BigInt']['output']; - beanToMaxLpGpPerBdvRatio: Scalars['BigInt']['output']; - bonusStalkConvertUp: Scalars['BigInt']['output']; - caseId?: Maybe; - convertDownPenalty?: Maybe; - createdAt: Scalars['BigInt']['output']; - cropRatio: Scalars['BigDecimal']['output']; - deltaActiveFarmers: Scalars['Int']['output']; - deltaAvgConvertDownPenalty: Scalars['BigDecimal']['output']; - deltaAvgGrownStalkPerBdvPerSeason: Scalars['BigInt']['output']; - deltaBeanMints: Scalars['BigInt']['output']; - deltaBeanToMaxLpGpPerBdvRatio: Scalars['BigInt']['output']; - deltaBonusStalkConvertUp: Scalars['BigInt']['output']; - deltaConvertDownPenalty?: Maybe; - deltaCropRatio: Scalars['BigDecimal']['output']; - deltaDepositedBDV: Scalars['BigInt']['output']; - deltaGerminatingStalk: Scalars['BigInt']['output']; - deltaGrownStalkPerSeason: Scalars['BigInt']['output']; - deltaPenalizedStalkConvertDown: Scalars['BigInt']['output']; - deltaPlantableStalk: Scalars['BigInt']['output']; - deltaPlantedBeans: Scalars['BigInt']['output']; - deltaRoots: Scalars['BigInt']['output']; - deltaStalk: Scalars['BigInt']['output']; - deltaTotalBdvConvertUp: Scalars['BigInt']['output']; - deltaTotalBdvConvertUpBonus: Scalars['BigInt']['output']; - deltaUnpenalizedStalkConvertDown: Scalars['BigInt']['output']; - depositedBDV: Scalars['BigInt']['output']; - germinatingStalk: Scalars['BigInt']['output']; - grownStalkPerSeason: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - penalizedStalkConvertDown: Scalars['BigInt']['output']; - plantableStalk: Scalars['BigInt']['output']; - plantedBeans: Scalars['BigInt']['output']; - roots: Scalars['BigInt']['output']; - season: Scalars['Int']['output']; - stalk: Scalars['BigInt']['output']; - totalBdvConvertUp: Scalars['BigInt']['output']; - totalBdvConvertUpBonus: Scalars['BigInt']['output']; - unpenalizedStalkConvertDown: Scalars['BigInt']['output']; - updatedAt: Scalars['BigInt']['output']; -}; - -export type TokenHourlySnapshot = { - __typename?: 'TokenHourlySnapshot'; - createdTimestamp: Scalars['BigInt']['output']; - decimals: Scalars['BigInt']['output']; - deltaFarmBalance: Scalars['BigInt']['output']; - deltaLastPriceUSD: Scalars['BigDecimal']['output']; - deltaPooledBalance: Scalars['BigInt']['output']; - deltaSupply: Scalars['BigInt']['output']; - deltaWalletBalance: Scalars['BigInt']['output']; - farmBalance: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - lastPriceUSD: Scalars['BigDecimal']['output']; - lastUpdateBlockNumber: Scalars['BigInt']['output']; - lastUpdateTimestamp: Scalars['BigInt']['output']; - name: Scalars['String']['output']; - pooledBalance: Scalars['BigInt']['output']; - seasonNumber: Scalars['Int']['output']; - supply: Scalars['BigInt']['output']; - walletBalance: Scalars['BigInt']['output']; -}; - -export type TractorHourlySnapshot = { - __typename?: 'TractorHourlySnapshot'; - createdAt: Scalars['BigInt']['output']; - deltaTotalExecutions: Scalars['Int']['output']; - deltaTotalNegBeanTips: Scalars['BigInt']['output']; - deltaTotalPosBeanTips: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - season: Scalars['Int']['output']; - totalExecutions: Scalars['Int']['output']; - totalNegBeanTips: Scalars['BigInt']['output']; - totalPosBeanTips: Scalars['BigInt']['output']; - updatedAt: Scalars['BigInt']['output']; -}; - -export type UnripeTokenHourlySnapshot = { - __typename?: 'UnripeTokenHourlySnapshot'; - amountUnderlyingOne: Scalars['BigInt']['output']; - bdvUnderlyingOne: Scalars['BigInt']['output']; - chopRate: Scalars['BigDecimal']['output']; - choppableAmountOne: Scalars['BigInt']['output']; - choppableBdvOne: Scalars['BigInt']['output']; - createdAt: Scalars['BigInt']['output']; - deltaAmountUnderlyingOne: Scalars['BigInt']['output']; - deltaBdvUnderlyingOne: Scalars['BigInt']['output']; - deltaChopRate: Scalars['BigDecimal']['output']; - deltaChoppableAmountOne: Scalars['BigInt']['output']; - deltaChoppableBdvOne: Scalars['BigInt']['output']; - deltaRecapPercent: Scalars['BigDecimal']['output']; - deltaTotalChoppedAmount: Scalars['BigInt']['output']; - deltaTotalChoppedBdv: Scalars['BigInt']['output']; - deltaTotalChoppedBdvReceived: Scalars['BigInt']['output']; - deltaTotalUnderlying: Scalars['BigInt']['output']; - deltaUnderlyingToken: Scalars['Boolean']['output']; - id: Scalars['ID']['output']; - recapPercent: Scalars['BigDecimal']['output']; - season: Scalars['Int']['output']; - totalChoppedAmount: Scalars['BigInt']['output']; - totalChoppedBdv: Scalars['BigInt']['output']; - totalChoppedBdvReceived: Scalars['BigInt']['output']; - totalUnderlying: Scalars['BigInt']['output']; - updatedAt: Scalars['BigInt']['output']; -}; - -export type WellHourlySnapshot = { - __typename?: 'WellHourlySnapshot'; - convertVolumeReserves: Array; - convertVolumeReservesUSD: Array; - convertVolumeUSD: Scalars['BigDecimal']['output']; - createdTimestamp: Scalars['BigInt']['output']; - cumulativeBiTradeVolumeReserves: Array; - cumulativeTradeVolumeReserves: Array; - cumulativeTradeVolumeReservesUSD: Array; - cumulativeTradeVolumeUSD: Scalars['BigDecimal']['output']; - cumulativeTransferVolumeReserves: Array; - cumulativeTransferVolumeReservesUSD: Array; - cumulativeTransferVolumeUSD: Scalars['BigDecimal']['output']; - deltaBiTradeVolumeReserves: Array; - deltaConvertVolumeReserves: Array; - deltaConvertVolumeReservesUSD: Array; - deltaConvertVolumeUSD: Scalars['BigDecimal']['output']; - deltaLiquidityUSD: Scalars['BigDecimal']['output']; - deltaLpTokenSupply: Scalars['BigInt']['output']; - deltaTokenRates: Array; - deltaTradeVolumeReserves: Array; - deltaTradeVolumeReservesUSD: Array; - deltaTradeVolumeUSD: Scalars['BigDecimal']['output']; - deltaTransferVolumeReserves: Array; - deltaTransferVolumeReservesUSD: Array; - deltaTransferVolumeUSD: Scalars['BigDecimal']['output']; - hour: Scalars['Int']['output']; - id: Scalars['ID']['output']; - lastUpdateBlockNumber: Scalars['BigInt']['output']; - lastUpdateTimestamp: Scalars['BigInt']['output']; - lpTokenSupply: Scalars['BigInt']['output']; - season: Scalars['Int']['output']; - tokenRates: Array; - totalLiquidityUSD: Scalars['BigDecimal']['output']; -}; - -export type WhitelistTokenHourlySnapshot = { - __typename?: 'WhitelistTokenHourlySnapshot'; - bdv?: Maybe; - createdAt: Scalars['BigInt']['output']; - deltaBdv?: Maybe; - deltaGaugePoints?: Maybe; - deltaIsGaugeEnabled: Scalars['Boolean']['output']; - deltaMilestoneSeason: Scalars['Int']['output']; - deltaOptimalPercentDepositedBdv?: Maybe; - deltaStalkEarnedPerSeason: Scalars['BigInt']['output']; - deltaStalkIssuedPerBdv: Scalars['BigInt']['output']; - deltaStemTip: Scalars['BigInt']['output']; - gaugePoints?: Maybe; - id: Scalars['ID']['output']; - isGaugeEnabled: Scalars['Boolean']['output']; - milestoneSeason: Scalars['Int']['output']; - optimalPercentDepositedBdv?: Maybe; - season: Scalars['Int']['output']; - selector: Scalars['Bytes']['output']; - stalkEarnedPerSeason: Scalars['BigInt']['output']; - stalkIssuedPerBdv: Scalars['BigInt']['output']; - stemTip: Scalars['BigInt']['output']; - updatedAt: Scalars['BigInt']['output']; -}; - -export type WrappedDepositErc20HourlySnapshot = { - __typename?: 'WrappedDepositERC20HourlySnapshot'; - apy7d?: Maybe; - apy24h?: Maybe; - apy30d?: Maybe; - apy90d?: Maybe; - createdAt: Scalars['BigInt']['output']; - deltaRedeemRate: Scalars['BigInt']['output']; - deltaSupply: Scalars['BigInt']['output']; - id: Scalars['ID']['output']; - redeemRate: Scalars['BigInt']['output']; - season: Scalars['Int']['output']; - supply: Scalars['BigInt']['output']; - updatedAt: Scalars['BigInt']['output']; -}; - -export type CacheFarmerSeasonalSiloQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheFarmerSeasonalSiloQuery = { __typename?: 'Query', cache_siloHourlySnapshots: Array<{ __typename?: 'SiloHourlySnapshot', id: string, season: number, createdAt: any, plantedBeans: any, stalk: any, germinatingStalk: any, depositedBDV: any }> }; - -export type CacheFarmerSeasonalSiloAssetQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheFarmerSeasonalSiloAssetQuery = { __typename?: 'Query', cache_siloAssetHourlySnapshots: Array<{ __typename?: 'SiloAssetHourlySnapshot', id: string, season: number, depositedAmount: any, depositedBDV: any, deltaDepositedBDV: any, deltaDepositedAmount: any, createdAt: any }> }; - -export type CacheSeasonalBeanQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheSeasonalBeanQuery = { __typename?: 'Query', cache_beanHourlySnapshots: Array<{ __typename?: 'BeanHourlySnapshot', id: string, seasonNumber: number, supply: any, marketCap: any, instPrice: any, l2sr: any, liquidityUSD: any, twaPrice: any, twaDeltaB: any, instDeltaB: any, crosses: number, supplyInPegLP: any, createdTimestamp: any }> }; - -export type CacheSeasonalFieldQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheSeasonalFieldQuery = { __typename?: 'Query', cache_fieldHourlySnapshots: Array<{ __typename?: 'FieldHourlySnapshot', id: string, season: number, caseId?: any | null, issuedSoil: any, deltaSownBeans: any, sownBeans: any, deltaPodDemand: any, blocksToSoldOutSoil?: any | null, podRate: any, temperature: any, deltaTemperature: any, cultivationTemperature?: any | null, harvestableIndex: any, harvestablePods: any, harvestedPods: any, numberOfSowers: number, numberOfSows: number, podIndex: any, realRateOfReturn: any, seasonBlock: any, soil: any, soilSoldOut: boolean, unharvestablePods: any, createdAt: any }> }; - -export type CacheSeasonalGaugesInfoQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheSeasonalGaugesInfoQuery = { __typename?: 'Query', cache_gaugesInfoHourlySnapshots: Array<{ __typename?: 'GaugesInfoHourlySnapshot', id: string, season: number, g0CultivationFactor?: any | null, g1BlightFactor?: any | null, g1ConvertDownPenalty?: any | null, g2BdvConvertedThisSeason?: any | null, g2BonusStalkPerBdv?: any | null, g2MaxConvertCapacity?: any | null, createdAt: any }> }; - -export type CacheSeasonalMarketPerformanceQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheSeasonalMarketPerformanceQuery = { __typename?: 'Query', cache_marketPerformanceSeasonals: Array<{ __typename?: 'MarketPerformanceSeasonal', id: string, season: number, timestamp?: any | null, thisSeasonTokenUsdPrices?: Array | null, usdChange?: Array | null, percentChange?: Array | null, totalUsdChange?: any | null, totalPercentChange?: any | null, cumulativeUsdChange?: Array | null, cumulativePercentChange?: Array | null, cumulativeTotalUsdChange?: any | null, cumulativeTotalPercentChange?: any | null }> }; - -export type CacheSeasonalSiloQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheSeasonalSiloQuery = { __typename?: 'Query', cache_siloHourlySnapshots: Array<{ __typename?: 'SiloHourlySnapshot', id: string, season: number, stalk: any, beanToMaxLpGpPerBdvRatio: any, deltaBeanToMaxLpGpPerBdvRatio: any, cropRatio: any, deltaCropRatio: any, avgGrownStalkPerBdvPerSeason: any, depositedBDV: any, germinatingStalk: any, createdAt: any }> }; - -export type CacheSeasonalSiloActiveFarmersQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheSeasonalSiloActiveFarmersQuery = { __typename?: 'Query', cache_siloHourlySnapshots: Array<{ __typename?: 'SiloHourlySnapshot', id: string, season: number, activeFarmers: number }> }; - -export type CacheSeasonalWrappedDepositQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheSeasonalWrappedDepositQuery = { __typename?: 'Query', cache_wrappedDepositERC20HourlySnapshots: Array<{ __typename?: 'WrappedDepositERC20HourlySnapshot', id: string, season: number, supply: any, redeemRate: any, apy24h?: any | null, apy7d?: any | null, apy30d?: any | null, apy90d?: any | null, createdAt: any }> }; - -export type CacheSeasonsQueryVariables = Exact<{ - where: Scalars['String']['input']; - orderBy: Scalars['String']['input']; - orderDirection: Scalars['String']['input']; -}>; - - -export type CacheSeasonsQuery = { __typename?: 'Query', cache_seasons: Array<{ __typename?: 'Season', id: string, season: number, sunriseBlock: any, rewardBeans: any, price: any, deltaBeans: any, raining: boolean, createdAt: any }> }; - - -export const CacheFarmerSeasonalSiloDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheFarmerSeasonalSilo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_siloHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"plantedBeans"}},{"kind":"Field","name":{"kind":"Name","value":"stalk"}},{"kind":"Field","name":{"kind":"Name","value":"germinatingStalk"}},{"kind":"Field","name":{"kind":"Name","value":"depositedBDV"}}]}}]}}]} as unknown as DocumentNode; -export const CacheFarmerSeasonalSiloAssetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheFarmerSeasonalSiloAsset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_siloAssetHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"depositedAmount"}},{"kind":"Field","name":{"kind":"Name","value":"depositedBDV"}},{"kind":"Field","name":{"kind":"Name","value":"deltaDepositedBDV"}},{"kind":"Field","name":{"kind":"Name","value":"deltaDepositedAmount"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; -export const CacheSeasonalBeanDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalBean"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_beanHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"seasonNumber"}},{"kind":"Field","name":{"kind":"Name","value":"supply"}},{"kind":"Field","name":{"kind":"Name","value":"marketCap"}},{"kind":"Field","name":{"kind":"Name","value":"instPrice"}},{"kind":"Field","name":{"kind":"Name","value":"l2sr"}},{"kind":"Field","name":{"kind":"Name","value":"liquidityUSD"}},{"kind":"Field","name":{"kind":"Name","value":"twaPrice"}},{"kind":"Field","name":{"kind":"Name","value":"twaDeltaB"}},{"kind":"Field","name":{"kind":"Name","value":"instDeltaB"}},{"kind":"Field","name":{"kind":"Name","value":"crosses"}},{"kind":"Field","name":{"kind":"Name","value":"supplyInPegLP"}},{"kind":"Field","name":{"kind":"Name","value":"createdTimestamp"}}]}}]}}]} as unknown as DocumentNode; -export const CacheSeasonalFieldDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalField"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_fieldHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"caseId"}},{"kind":"Field","name":{"kind":"Name","value":"issuedSoil"}},{"kind":"Field","name":{"kind":"Name","value":"deltaSownBeans"}},{"kind":"Field","name":{"kind":"Name","value":"sownBeans"}},{"kind":"Field","name":{"kind":"Name","value":"deltaPodDemand"}},{"kind":"Field","name":{"kind":"Name","value":"blocksToSoldOutSoil"}},{"kind":"Field","name":{"kind":"Name","value":"podRate"}},{"kind":"Field","name":{"kind":"Name","value":"temperature"}},{"kind":"Field","name":{"kind":"Name","value":"deltaTemperature"}},{"kind":"Field","name":{"kind":"Name","value":"cultivationTemperature"}},{"kind":"Field","name":{"kind":"Name","value":"harvestableIndex"}},{"kind":"Field","name":{"kind":"Name","value":"harvestablePods"}},{"kind":"Field","name":{"kind":"Name","value":"harvestedPods"}},{"kind":"Field","name":{"kind":"Name","value":"numberOfSowers"}},{"kind":"Field","name":{"kind":"Name","value":"numberOfSows"}},{"kind":"Field","name":{"kind":"Name","value":"podIndex"}},{"kind":"Field","name":{"kind":"Name","value":"realRateOfReturn"}},{"kind":"Field","name":{"kind":"Name","value":"seasonBlock"}},{"kind":"Field","name":{"kind":"Name","value":"soil"}},{"kind":"Field","name":{"kind":"Name","value":"soilSoldOut"}},{"kind":"Field","name":{"kind":"Name","value":"unharvestablePods"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; -export const CacheSeasonalGaugesInfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalGaugesInfo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_gaugesInfoHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"g0CultivationFactor"}},{"kind":"Field","name":{"kind":"Name","value":"g1BlightFactor"}},{"kind":"Field","name":{"kind":"Name","value":"g1ConvertDownPenalty"}},{"kind":"Field","name":{"kind":"Name","value":"g2BdvConvertedThisSeason"}},{"kind":"Field","name":{"kind":"Name","value":"g2BonusStalkPerBdv"}},{"kind":"Field","name":{"kind":"Name","value":"g2MaxConvertCapacity"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; -export const CacheSeasonalMarketPerformanceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalMarketPerformance"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_marketPerformanceSeasonals"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"timestamp"}},{"kind":"Field","name":{"kind":"Name","value":"thisSeasonTokenUsdPrices"}},{"kind":"Field","name":{"kind":"Name","value":"usdChange"}},{"kind":"Field","name":{"kind":"Name","value":"percentChange"}},{"kind":"Field","name":{"kind":"Name","value":"totalUsdChange"}},{"kind":"Field","name":{"kind":"Name","value":"totalPercentChange"}},{"kind":"Field","name":{"kind":"Name","value":"cumulativeUsdChange"}},{"kind":"Field","name":{"kind":"Name","value":"cumulativePercentChange"}},{"kind":"Field","name":{"kind":"Name","value":"cumulativeTotalUsdChange"}},{"kind":"Field","name":{"kind":"Name","value":"cumulativeTotalPercentChange"}}]}}]}}]} as unknown as DocumentNode; -export const CacheSeasonalSiloDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalSilo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_siloHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"stalk"}},{"kind":"Field","name":{"kind":"Name","value":"beanToMaxLpGpPerBdvRatio"}},{"kind":"Field","name":{"kind":"Name","value":"deltaBeanToMaxLpGpPerBdvRatio"}},{"kind":"Field","name":{"kind":"Name","value":"cropRatio"}},{"kind":"Field","name":{"kind":"Name","value":"deltaCropRatio"}},{"kind":"Field","name":{"kind":"Name","value":"avgGrownStalkPerBdvPerSeason"}},{"kind":"Field","name":{"kind":"Name","value":"depositedBDV"}},{"kind":"Field","name":{"kind":"Name","value":"germinatingStalk"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; -export const CacheSeasonalSiloActiveFarmersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalSiloActiveFarmers"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_siloHourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"activeFarmers"}}]}}]}}]} as unknown as DocumentNode; -export const CacheSeasonalWrappedDepositDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasonalWrappedDeposit"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_wrappedDepositERC20HourlySnapshots"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"supply"}},{"kind":"Field","name":{"kind":"Name","value":"redeemRate"}},{"kind":"Field","name":{"kind":"Name","value":"apy24h"}},{"kind":"Field","name":{"kind":"Name","value":"apy7d"}},{"kind":"Field","name":{"kind":"Name","value":"apy30d"}},{"kind":"Field","name":{"kind":"Name","value":"apy90d"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; -export const CacheSeasonsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"CacheSeasons"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cache_seasons"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"sunriseBlock"}},{"kind":"Field","name":{"kind":"Name","value":"rewardBeans"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"deltaBeans"}},{"kind":"Field","name":{"kind":"Name","value":"raining"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/src/generated/gql/cache/index.ts b/src/generated/gql/cache/index.ts deleted file mode 100644 index af7839936..000000000 --- a/src/generated/gql/cache/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./gql"; \ No newline at end of file diff --git a/src/queries/cache/seasonal/CacheFarmerSeasonalSilo.graphql b/src/queries/cache/seasonal/CacheFarmerSeasonalSilo.graphql deleted file mode 100644 index 387080544..000000000 --- a/src/queries/cache/seasonal/CacheFarmerSeasonalSilo.graphql +++ /dev/null @@ -1,16 +0,0 @@ -query CacheFarmerSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_siloHourlySnapshots( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - createdAt - plantedBeans - stalk - germinatingStalk - depositedBDV - } -} - diff --git a/src/queries/cache/seasonal/CacheFarmerSeasonalSiloAsset.graphql b/src/queries/cache/seasonal/CacheFarmerSeasonalSiloAsset.graphql deleted file mode 100644 index c192b37c8..000000000 --- a/src/queries/cache/seasonal/CacheFarmerSeasonalSiloAsset.graphql +++ /dev/null @@ -1,16 +0,0 @@ -query CacheFarmerSeasonalSiloAsset($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_siloAssetHourlySnapshots( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - depositedAmount - depositedBDV - deltaDepositedBDV - deltaDepositedAmount - createdAt - } -} - diff --git a/src/queries/cache/seasonal/CacheSeasonalBean.graphql b/src/queries/cache/seasonal/CacheSeasonalBean.graphql deleted file mode 100644 index 2c2014685..000000000 --- a/src/queries/cache/seasonal/CacheSeasonalBean.graphql +++ /dev/null @@ -1,21 +0,0 @@ -query CacheSeasonalBean($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_beanHourlySnapshots( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - seasonNumber - supply - marketCap - instPrice - l2sr - liquidityUSD - twaPrice - twaDeltaB - instDeltaB - crosses - supplyInPegLP - createdTimestamp - } -} diff --git a/src/queries/cache/seasonal/CacheSeasonalField.graphql b/src/queries/cache/seasonal/CacheSeasonalField.graphql deleted file mode 100644 index f0ce9c1ef..000000000 --- a/src/queries/cache/seasonal/CacheSeasonalField.graphql +++ /dev/null @@ -1,32 +0,0 @@ -query CacheSeasonalField($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_fieldHourlySnapshots( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - caseId - issuedSoil - deltaSownBeans - sownBeans - deltaPodDemand - blocksToSoldOutSoil - podRate - temperature - deltaTemperature - cultivationTemperature - harvestableIndex - harvestablePods - harvestedPods - numberOfSowers - numberOfSows - podIndex - realRateOfReturn - seasonBlock - soil - soilSoldOut - unharvestablePods - createdAt - } -} diff --git a/src/queries/cache/seasonal/CacheSeasonalGaugesInfo.graphql b/src/queries/cache/seasonal/CacheSeasonalGaugesInfo.graphql deleted file mode 100644 index e0c71080e..000000000 --- a/src/queries/cache/seasonal/CacheSeasonalGaugesInfo.graphql +++ /dev/null @@ -1,17 +0,0 @@ -query CacheSeasonalGaugesInfo($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_gaugesInfoHourlySnapshots( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - g0CultivationFactor - g1BlightFactor - g1ConvertDownPenalty - g2BdvConvertedThisSeason - g2BonusStalkPerBdv - g2MaxConvertCapacity - createdAt - } -} diff --git a/src/queries/cache/seasonal/CacheSeasonalMarketPerformance.graphql b/src/queries/cache/seasonal/CacheSeasonalMarketPerformance.graphql deleted file mode 100644 index acd960eef..000000000 --- a/src/queries/cache/seasonal/CacheSeasonalMarketPerformance.graphql +++ /dev/null @@ -1,21 +0,0 @@ -query CacheSeasonalMarketPerformance($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_marketPerformanceSeasonals( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - timestamp - thisSeasonTokenUsdPrices - usdChange - percentChange - totalUsdChange - totalPercentChange - cumulativeUsdChange - cumulativePercentChange - cumulativeTotalUsdChange - cumulativeTotalPercentChange - } -} - diff --git a/src/queries/cache/seasonal/CacheSeasonalSilo.graphql b/src/queries/cache/seasonal/CacheSeasonalSilo.graphql deleted file mode 100644 index 4c3ea4364..000000000 --- a/src/queries/cache/seasonal/CacheSeasonalSilo.graphql +++ /dev/null @@ -1,31 +0,0 @@ -query CacheSeasonalSilo($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_siloHourlySnapshots( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - stalk - beanToMaxLpGpPerBdvRatio - deltaBeanToMaxLpGpPerBdvRatio - cropRatio - deltaCropRatio - avgGrownStalkPerBdvPerSeason - depositedBDV - germinatingStalk - createdAt - } -} - -query CacheSeasonalSiloActiveFarmers($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_siloHourlySnapshots( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - activeFarmers - } -} diff --git a/src/queries/cache/seasonal/CacheSeasonalWrappedDeposit.graphql b/src/queries/cache/seasonal/CacheSeasonalWrappedDeposit.graphql deleted file mode 100644 index 75bdb1972..000000000 --- a/src/queries/cache/seasonal/CacheSeasonalWrappedDeposit.graphql +++ /dev/null @@ -1,18 +0,0 @@ -query CacheSeasonalWrappedDeposit($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_wrappedDepositERC20HourlySnapshots( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - supply - redeemRate - apy24h - apy7d - apy30d - apy90d - createdAt - } -} - diff --git a/src/queries/cache/seasonal/CacheSeasons.graphql b/src/queries/cache/seasonal/CacheSeasons.graphql deleted file mode 100644 index ac0dba81e..000000000 --- a/src/queries/cache/seasonal/CacheSeasons.graphql +++ /dev/null @@ -1,17 +0,0 @@ -query CacheSeasons($where: String!, $orderBy: String!, $orderDirection: String!) { - cache_seasons( - where: $where - orderBy: $orderBy - orderDirection: $orderDirection - ) { - id - season - sunriseBlock - rewardBeans - price - deltaBeans - raining - createdAt - } -} - diff --git a/src/state/seasonal/queries/useSeasonalBeanBeanSG.ts b/src/state/seasonal/queries/useSeasonalBeanBeanSG.ts index 65b2a0505..f37e0a8f4 100644 --- a/src/state/seasonal/queries/useSeasonalBeanBeanSG.ts +++ b/src/state/seasonal/queries/useSeasonalBeanBeanSG.ts @@ -1,10 +1,28 @@ import { subgraphs } from "@/constants/subgraph"; -import { BeanHourlySnapshot, CacheSeasonalBeanDocument, CacheSeasonalBeanQuery } from "@/generated/gql/cache/graphql"; -import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; +import { BeanHourlySnapshot, BeanSeasonalBeanDocument, BeanSeasonalBeanQuery } from "@/generated/gql/pinto/graphql"; +import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; import { UseSeasonalResult } from "@/utils/types"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; +const paginateSettings: PaginationSettings< + BeanHourlySnapshot, + BeanSeasonalBeanQuery, + "beanHourlySnapshots", + SeasonalQueryVars +> = { + primaryPropertyName: "beanHourlySnapshots", + idField: "id", + nextVars: (value1000: BeanHourlySnapshot, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + from: Number(value1000.season.season), + }; + } + }, +}; + export default function useSeasonalBeanBeanSG( fromSeason: number, toSeason: number, @@ -12,19 +30,8 @@ export default function useSeasonalBeanBeanSG( { enabled = true } = {}, ): UseSeasonalResult { const chainId = useChainId(); - const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalBeanDocument, - { - // BeanHourlySnapshot uses seasonNumber instead of season - where: buildCacheWhereClause(vars.from, vars.to, undefined, "seasonNumber"), - orderBy: "seasonNumber", - orderDirection: "asc", - }, - "cache_beanHourlySnapshots", - ); + return await paginateSubgraph(paginateSettings, subgraphs[chainId].bean, BeanSeasonalBeanDocument, vars); }; return useSeasonalQueries("BeanSeasonalBeanQuery", { diff --git a/src/state/seasonal/queries/useSeasonalBeanstalkFieldSG.ts b/src/state/seasonal/queries/useSeasonalBeanstalkFieldSG.ts index 1456902d7..da0bce239 100644 --- a/src/state/seasonal/queries/useSeasonalBeanstalkFieldSG.ts +++ b/src/state/seasonal/queries/useSeasonalBeanstalkFieldSG.ts @@ -1,42 +1,47 @@ import { subgraphs } from "@/constants/subgraph"; import { beanstalkAddress } from "@/generated/contractHooks"; import { - CacheSeasonalFieldDocument, - CacheSeasonalFieldQuery, + BeanstalkSeasonalFieldDocument, + BeanstalkSeasonalFieldQuery, FieldHourlySnapshot, -} from "@/generated/gql/cache/graphql"; -import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; +} from "@/generated/gql/pintostalk/graphql"; +import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; import { UseSeasonalResult } from "@/utils/types"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; +const paginateSettings: PaginationSettings< + FieldHourlySnapshot, + BeanstalkSeasonalFieldQuery, + "fieldHourlySnapshots", + SeasonalQueryVars +> = { + primaryPropertyName: "fieldHourlySnapshots", + idField: "id", + nextVars: (value1000: FieldHourlySnapshot, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + from: Number(value1000.season), + }; + } + }, +}; + export default function useSeasonalBeanstalkFieldSG( fromSeason: number, toSeason: number, convertResult: ConvertEntryFn, ): UseSeasonalResult { const chainId = useChainId(); - const fieldAddress = beanstalkAddress[chainId].toLowerCase(); - const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - const results = await fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalFieldDocument, - { - where: buildCacheWhereClause(vars.from, vars.to), - orderBy: "season", - orderDirection: "asc", - }, - "cache_fieldHourlySnapshots", - ); - // Filter by field address client-side (cache doesn't support id_contains) - return results.filter((r) => r.id.toLowerCase().includes(fieldAddress)); + return await paginateSubgraph(paginateSettings, subgraphs[chainId].beanstalk, BeanstalkSeasonalFieldDocument, vars); }; return useSeasonalQueries("BeanstalkSeasonalFieldQuery", { fromSeason, toSeason, - queryVars: { field: fieldAddress }, + queryVars: { field: beanstalkAddress[chainId].toLowerCase() }, historicalQueryFnFactory: queryFnFactory, currentQueryFnFactory: queryFnFactory, resultTimestamp: (entry) => { diff --git a/src/state/seasonal/queries/useSeasonalBeanstalkSiloSG.ts b/src/state/seasonal/queries/useSeasonalBeanstalkSiloSG.ts index 9a4fbc03a..62799ebb6 100644 --- a/src/state/seasonal/queries/useSeasonalBeanstalkSiloSG.ts +++ b/src/state/seasonal/queries/useSeasonalBeanstalkSiloSG.ts @@ -1,43 +1,48 @@ import { subgraphs } from "@/constants/subgraph"; import { beanstalkAddress } from "@/generated/contractHooks"; import { - CacheSeasonalSiloActiveFarmersDocument, - CacheSeasonalSiloDocument, - CacheSeasonalSiloQuery, + BeanstalkSeasonalSiloActiveFarmersDocument, + BeanstalkSeasonalSiloDocument, + BeanstalkSeasonalSiloQuery, SiloHourlySnapshot, -} from "@/generated/gql/cache/graphql"; -import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; +} from "@/generated/gql/pintostalk/graphql"; +import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; import { UseSeasonalResult } from "@/utils/types"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; +const paginateSettings: PaginationSettings< + SiloHourlySnapshot, + BeanstalkSeasonalSiloQuery, + "siloHourlySnapshots", + SeasonalQueryVars +> = { + primaryPropertyName: "siloHourlySnapshots", + idField: "id", + nextVars: (value1000: SiloHourlySnapshot, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + from: Number(value1000.season), + }; + } + }, +}; + export default function useSeasonalBeanstalkSiloSG( fromSeason: number, toSeason: number, convertResult: ConvertEntryFn, ): UseSeasonalResult { const chainId = useChainId(); - const siloId = beanstalkAddress[chainId].toLowerCase(); - const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - const results = await fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalSiloDocument, - { - where: buildCacheWhereClause(vars.from, vars.to), - orderBy: "season", - orderDirection: "asc", - }, - "cache_siloHourlySnapshots", - ); - // Filter by silo address client-side (cache doesn't support id_contains) - return results.filter((r) => r.id.toLowerCase().includes(siloId)); + return await paginateSubgraph(paginateSettings, subgraphs[chainId].beanstalk, BeanstalkSeasonalSiloDocument, vars); }; return useSeasonalQueries("BeanstalkSeasonalSiloQuery", { fromSeason, toSeason, - queryVars: { silo: siloId }, + queryVars: { silo: beanstalkAddress[chainId] }, historicalQueryFnFactory: queryFnFactory, currentQueryFnFactory: queryFnFactory, resultTimestamp: (entry) => { @@ -53,27 +58,19 @@ export function useSeasonalBeanstalkSiloActiveFarmersSG( convertResult: ConvertEntryFn, ): UseSeasonalResult { const chainId = useChainId(); - const siloId = beanstalkAddress[chainId].toLowerCase(); - const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - const results = await fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalSiloActiveFarmersDocument, - { - where: buildCacheWhereClause(vars.from, vars.to), - orderBy: "season", - orderDirection: "asc", - }, - "cache_siloHourlySnapshots", + return await paginateSubgraph( + paginateSettings, + subgraphs[chainId].beanstalk, + BeanstalkSeasonalSiloActiveFarmersDocument, + vars, ); - // Filter by silo address client-side (cache doesn't support id_contains) - return results.filter((r) => r.id.toLowerCase().includes(siloId)); }; return useSeasonalQueries("BeanstalkSeasonalSiloActiveFarmersQuery", { fromSeason, toSeason, - queryVars: { silo: siloId }, + queryVars: { silo: beanstalkAddress[chainId] }, historicalQueryFnFactory: queryFnFactory, currentQueryFnFactory: queryFnFactory, resultTimestamp: (entry) => { diff --git a/src/state/seasonal/queries/useSeasonalBeanstalkWrappedDepositsSG.ts b/src/state/seasonal/queries/useSeasonalBeanstalkWrappedDepositsSG.ts index eaee4e298..441ae16e1 100644 --- a/src/state/seasonal/queries/useSeasonalBeanstalkWrappedDepositsSG.ts +++ b/src/state/seasonal/queries/useSeasonalBeanstalkWrappedDepositsSG.ts @@ -1,15 +1,33 @@ import { subgraphs } from "@/constants/subgraph"; import { - CacheSeasonalWrappedDepositDocument, - CacheSeasonalWrappedDepositQuery, + BeanstalkSeasonalWrappedDepositErc20Document, + BeanstalkSeasonalWrappedDepositErc20Query, WrappedDepositErc20HourlySnapshot, -} from "@/generated/gql/cache/graphql"; -import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; +} from "@/generated/gql/pintostalk/graphql"; +import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; import { UseSeasonalResult } from "@/utils/types"; import { useCallback } from "react"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; +const paginateSettings: PaginationSettings< + WrappedDepositErc20HourlySnapshot, + BeanstalkSeasonalWrappedDepositErc20Query, + "wrappedDepositERC20HourlySnapshots", + SeasonalQueryVars +> = { + primaryPropertyName: "wrappedDepositERC20HourlySnapshots", + idField: "id", + nextVars: (value1000: WrappedDepositErc20HourlySnapshot, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + from: Number(value1000.season), + }; + } + }, +}; + export const WRAPPED_MAIN_TOKEN_DEPLOY_SEASON = 2538; export function truncateBeanstalkWrappedDespositsSeasons(fromSeason: number, toSeason: number) { @@ -29,19 +47,14 @@ export default function useSeasonalBeanstalkWrappedDepositsSG( convertResult: ConvertEntryFn, ): UseSeasonalResult { const chainId = useChainId(); - const queryFnFactory = useCallback( (vars: SeasonalQueryVars) => { return () => - fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalWrappedDepositDocument, - { - where: buildCacheWhereClause(vars.from, vars.to), - orderBy: "season", - orderDirection: "asc", - }, - "cache_wrappedDepositERC20HourlySnapshots", + paginateSubgraph( + paginateSettings, + subgraphs[chainId].beanstalk, + BeanstalkSeasonalWrappedDepositErc20Document, + vars, ); }, [chainId], diff --git a/src/state/seasonal/queries/useSeasonalGaugeInfo.ts b/src/state/seasonal/queries/useSeasonalGaugeInfo.ts index edfccc8ea..cfeda5a9a 100644 --- a/src/state/seasonal/queries/useSeasonalGaugeInfo.ts +++ b/src/state/seasonal/queries/useSeasonalGaugeInfo.ts @@ -1,13 +1,32 @@ import { subgraphs } from "@/constants/subgraph"; +import { beanstalkAddress } from "@/generated/contractHooks"; import { - CacheSeasonalGaugesInfoDocument, - CacheSeasonalGaugesInfoQuery, GaugesInfoHourlySnapshot, -} from "@/generated/gql/cache/graphql"; -import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; + SeasonalGaugesInfoDocument, + SeasonalGaugesInfoQuery, +} from "@/generated/gql/pintostalk/graphql"; +import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; import { useChainId } from "wagmi"; import useSeasonalQueries, { ConvertEntryFn, SeasonalQueryVars } from "./useSeasonalInternalQueries"; +const paginateSettings: PaginationSettings< + GaugesInfoHourlySnapshot, + SeasonalGaugesInfoQuery, + "gaugesInfoHourlySnapshots", + SeasonalQueryVars +> = { + primaryPropertyName: "gaugesInfoHourlySnapshots", + idField: "id", + nextVars: (value1000: GaugesInfoHourlySnapshot, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + from: Number(value1000.season), + }; + } + }, +}; + const NO_VARS = {} as const; export default function useSeasonalGaugeInfo( @@ -16,18 +35,8 @@ export default function useSeasonalGaugeInfo( convertResult: ConvertEntryFn, ) { const chainId = useChainId(); - const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalGaugesInfoDocument, - { - where: buildCacheWhereClause(vars.from, vars.to), - orderBy: "season", - orderDirection: "asc", - }, - "cache_gaugesInfoHourlySnapshots", - ); + return await paginateSubgraph(paginateSettings, subgraphs[chainId].beanstalk, SeasonalGaugesInfoDocument, vars); }; return useSeasonalQueries("BeanstalkSeasonalGaugesInfoQuery", { diff --git a/src/state/seasonal/queries/useSeasonalMarketPerformance.ts b/src/state/seasonal/queries/useSeasonalMarketPerformance.ts index 644464eb1..75ba5d270 100644 --- a/src/state/seasonal/queries/useSeasonalMarketPerformance.ts +++ b/src/state/seasonal/queries/useSeasonalMarketPerformance.ts @@ -1,12 +1,20 @@ import { subgraphs } from "@/constants/subgraph"; -import { LP_TOKENS } from "@/constants/tokens"; import { - CacheSeasonalMarketPerformanceDocument, - CacheSeasonalMarketPerformanceQuery, + PINTO_CBBTC_TOKEN, + PINTO_CBETH_TOKEN, + PINTO_USDC_TOKEN, + PINTO_WETH_TOKEN, + PINTO_WSOL_TOKEN, +} from "@/constants/tokens"; +import { + BeanstalkSeasonalMarketPerformanceDocument, + BeanstalkSeasonalMarketPerformanceQuery, MarketPerformanceSeasonal, -} from "@/generated/gql/cache/graphql"; +} from "@/generated/gql/pintostalk/graphql"; import { useLPTokenToNonPintoUnderlyingMap } from "@/hooks/pinto/useTokenMap"; -import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; +import useTokenData from "@/state/useTokenData"; +import { useChainConstant } from "@/utils/chain"; +import { PaginationSettings, paginateSubgraph } from "@/utils/paginateSubgraph"; import { SeasonalMarketPerformanceChartData, UseSeasonalMarketPerformanceResult, @@ -47,6 +55,24 @@ const accumulator = (chartType: SMPChartType): ((prev: number, curr: number) => } }; +const paginateSettings: PaginationSettings< + MarketPerformanceSeasonal, + BeanstalkSeasonalMarketPerformanceQuery, + "marketPerformanceSeasonals", + SeasonalQueryVars +> = { + primaryPropertyName: "marketPerformanceSeasonals", + idField: "id", + nextVars: (value1000: MarketPerformanceSeasonal, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + from: Number(value1000.season), + }; + } + }, +}; + export function useSeasonalMarketPerformanceData( fromSeason: number, toSeason: number, @@ -55,15 +81,11 @@ export function useSeasonalMarketPerformanceData( const chainId = useChainId(); const queryFnFactory = (vars: SeasonalQueryVars) => async () => { - return await fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalMarketPerformanceDocument, - { - where: buildCacheWhereClause(vars.from, vars.to), - orderBy: "season", - orderDirection: "asc", - }, - "cache_marketPerformanceSeasonals", + return await paginateSubgraph( + paginateSettings, + subgraphs[chainId].beanstalk, + BeanstalkSeasonalMarketPerformanceDocument, + vars, ); }; @@ -92,10 +114,8 @@ export function useMarketPerformanceCalc( chartType: SMPChartType, startSeasons: Record = {}, ): SeasonalMarketPerformanceChartData { - const chainId = useChainId(); + const mainToken = useTokenData().mainToken; const lpToUnderlyingMap = useLPTokenToNonPintoUnderlyingMap(); - // Use LP_TOKENS to get the whitelisted token addresses (cache doesn't have silo.allWhitelistedTokens) - const lpTokens = LP_TOKENS[chainId] ?? []; const responseData = useMemo(() => { const result: SeasonalMarketPerformanceChartData = {}; @@ -129,10 +149,14 @@ export function useMarketPerformanceCalc( }); } - // Iterate through LP tokens (cache doesn't provide silo.allWhitelistedTokens) - for (let tokenIdx = 0; tokenIdx < lpTokens.length; tokenIdx++) { - const lpToken = lpTokens[tokenIdx]; - const underlyingToken = lpToUnderlyingMap[lpToken.address.toLowerCase()]; + let tokenIdx = 0; + for (const token of season.silo.allWhitelistedTokens) { + // Skip Pinto token + if (token === mainToken.address) { + continue; + } + + const underlyingToken = lpToUnderlyingMap[token]; if (!underlyingToken) { continue; } @@ -173,11 +197,12 @@ export function useMarketPerformanceCalc( timestamp: new Date(Number(season.timestamp) * 1000), }); } + ++tokenIdx; } } } return result; - }, [seasonalData, chartType, startSeasons, lpTokens, lpToUnderlyingMap]); + }, [seasonalData, chartType, startSeasons, mainToken.address, lpToUnderlyingMap]); return responseData; } diff --git a/src/state/seasonal/seasonalDataHooks.ts b/src/state/seasonal/seasonalDataHooks.ts index 6e94acc98..a7e9a48d7 100644 --- a/src/state/seasonal/seasonalDataHooks.ts +++ b/src/state/seasonal/seasonalDataHooks.ts @@ -2,12 +2,12 @@ import { TV } from "@/classes/TokenValue"; import { SeasonalChartData } from "@/components/charts/SeasonalChart"; import { PODS, STALK } from "@/constants/internalTokens"; import { MAIN_TOKEN, PINTO, S_MAIN_TOKEN } from "@/constants/tokens"; -import { SiloHourlySnapshot } from "@/generated/gql/cache/graphql"; +import { SiloHourlySnapshot } from "@/generated/gql/pintostalk/graphql"; import { useProtocolAddress } from "@/hooks/pinto/useProtocolAddress"; import { useChainConstant } from "@/utils/chain"; import { Token, UseSeasonalResult } from "@/utils/types"; import { HashString, MayArray } from "@/utils/types.generic"; -import { useMemo } from "react"; +import { useCallback, useMemo } from "react"; import { useAccount } from "wagmi"; import useSeasonalBasinSummarySG from "./queries/useSeasonalBasinSummarySG"; import useSeasonalBeanBeanSG from "./queries/useSeasonalBeanBeanSG"; @@ -33,7 +33,7 @@ export function useSeasonalPrice(fromSeason: number, toSeason: number, enabled = fromSeason, toSeason, (beanHourly, _timestamp) => ({ - season: beanHourly.seasonNumber, + season: Number(beanHourly.season.season), value: Number(beanHourly.instPrice), timestamp: new Date(Number(beanHourly.createdTimestamp) * 1000), }), @@ -43,7 +43,7 @@ export function useSeasonalPrice(fromSeason: number, toSeason: number, enabled = export function useSeasonalSupply(fromSeason: number, toSeason: number): UseSeasonalResult { return useSeasonalBeanBeanSG(fromSeason, toSeason, (beanHourly, timestamp) => ({ - season: beanHourly.seasonNumber, + season: Number(beanHourly.season.season), value: TV.fromBlockchain(beanHourly.supply, PINTO.decimals).toNumber(), timestamp, })); @@ -51,7 +51,7 @@ export function useSeasonalSupply(fromSeason: number, toSeason: number): UseSeas export function useSeasonalMcap(fromSeason: number, toSeason: number): UseSeasonalResult { return useSeasonalBeanBeanSG(fromSeason, toSeason, (beanHourly, _timestamp) => ({ - season: beanHourly.seasonNumber, + season: Number(beanHourly.season.season), value: Number(beanHourly.marketCap), timestamp: new Date(Number(beanHourly.createdTimestamp) * 1000), })); @@ -59,7 +59,7 @@ export function useSeasonalMcap(fromSeason: number, toSeason: number): UseSeason export function useSeasonalL2SR(fromSeason: number, toSeason: number): UseSeasonalResult { return useSeasonalBeanBeanSG(fromSeason, toSeason, (beanHourly, _timestamp) => { - const season = beanHourly.seasonNumber; + const season = Number(beanHourly.season.season); let value = Number(beanHourly.l2sr); // For seasons 1-3, the twa liquidity isnt computable onchain, thus the protocl l2sr is not computable. // Use a manual calculation from the instantaneous liquidity instead. diff --git a/src/state/useSeasonsData.ts b/src/state/useSeasonsData.ts index d146754ef..c883ab0b9 100644 --- a/src/state/useSeasonsData.ts +++ b/src/state/useSeasonsData.ts @@ -2,23 +2,17 @@ import { TokenValue } from "@/classes/TokenValue"; import { PODS, STALK } from "@/constants/internalTokens"; import { subgraphs } from "@/constants/subgraph"; import { - BeanHourlySnapshot, - CacheSeasonalBeanDocument, - CacheSeasonalBeanQuery, - CacheSeasonalFieldDocument, - CacheSeasonalFieldQuery, - CacheSeasonalGaugesInfoDocument, - CacheSeasonalGaugesInfoQuery, - CacheSeasonalSiloDocument, - CacheSeasonalSiloQuery, - CacheSeasonsDocument, - CacheSeasonsQuery, - FieldHourlySnapshot, - GaugesInfoHourlySnapshot, - Season, - SiloHourlySnapshot, -} from "@/generated/gql/cache/graphql"; -import { buildCacheWhereClause, fetchCacheQuery } from "@/utils/paginateSubgraph"; + BasinAdvancedChartDocument, + BasinAdvancedChartQuery, + BeanstalkHourlySnapshot, +} from "@/generated/gql/exchange/graphql"; +import { BeanAdvancedChartDocument, BeanAdvancedChartQuery, Season as BeanSeason } from "@/generated/gql/pinto/graphql"; +import { + BeanstalkAdvancedChartDocument, + BeanstalkAdvancedChartQuery, + Season as BeanstalkSeason, +} from "@/generated/gql/pintostalk/graphql"; +import { PaginationSettings, paginateMultiQuerySubgraph, paginateSubgraph } from "@/utils/paginateSubgraph"; import { Duration } from "luxon"; import { useCallback, useMemo } from "react"; import { useChainId } from "wagmi"; @@ -156,13 +150,56 @@ const marketStartSeasonToSymbolMappingPercent = { marketCumulativeWsolPercent: "WSOL", }; -// Combined result type for beanstalk data from cache -interface CacheBeanstalkData { - seasons: Season[]; - fieldHourlySnapshots: FieldHourlySnapshot[]; - siloHourlySnapshots: SiloHourlySnapshot[]; - gaugesInfoHourlySnapshots: GaugesInfoHourlySnapshot[]; -} +const stalkPaginateSettings: PaginationSettings< + BeanstalkSeason, + BeanstalkAdvancedChartQuery, + "seasons", + SeasonalQueryVars +> = { + primaryPropertyName: "seasons", + idField: "id", + nextVars: (value1000: BeanstalkSeason, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + to: Number(value1000.season), + }; + } + }, +}; + +const beanPaginateSettings: PaginationSettings = { + primaryPropertyName: "seasons", + idField: "id", + nextVars: (value1000: BeanSeason, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + to: Number(value1000.beanHourlySnapshot.season.season), + }; + } + }, + orderBy: "desc", +}; + +const basinPaginateSettings: PaginationSettings< + BeanstalkHourlySnapshot, + BasinAdvancedChartQuery, + "beanstalkHourlySnapshots", + SeasonalQueryVars +> = { + primaryPropertyName: "beanstalkHourlySnapshots", + idField: "id", + nextVars: (value1000: BeanstalkHourlySnapshot, prevVars: SeasonalQueryVars) => { + if (value1000) { + return { + ...prevVars, + to: Number(value1000.season.season), + }; + } + }, + orderBy: "desc", +}; export default function useSeasonsData( fromSeason: number, @@ -186,65 +223,21 @@ export default function useSeasonsData( const tokenData = useTokenData(); const syncOffset = seasonSync ? 1 : 0; - // Fetch all beanstalk data from cache in parallel const stalkQueryFnFactory = useCallback( - (vars: SeasonalQueryVars) => async (): Promise => { - const cacheVars = { - where: buildCacheWhereClause(vars.from, vars.to), - orderBy: "season", - orderDirection: "desc", - }; - - const [seasons, fieldSnapshots, siloSnapshots, gaugeSnapshots] = await Promise.all([ - fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonsDocument, - cacheVars, - "cache_seasons", - ), - fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalFieldDocument, - cacheVars, - "cache_fieldHourlySnapshots", - ), - fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalSiloDocument, - cacheVars, - "cache_siloHourlySnapshots", - ), - fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalGaugesInfoDocument, - cacheVars, - "cache_gaugesInfoHourlySnapshots", - ), - ]); - - return { - seasons, - fieldHourlySnapshots: fieldSnapshots, - siloHourlySnapshots: siloSnapshots, - gaugesInfoHourlySnapshots: gaugeSnapshots, - }; + (vars: SeasonalQueryVars) => async () => { + return paginateMultiQuerySubgraph( + stalkPaginateSettings, + subgraphs[chainId].beanstalk, + BeanstalkAdvancedChartDocument, + vars, + ); }, [chainId], ); - // Fetch bean data from cache (uses seasonNumber instead of season) const beanQueryFnFactory = useCallback( (vars: SeasonalQueryVars) => async () => { - return fetchCacheQuery( - subgraphs[chainId].cache, - CacheSeasonalBeanDocument, - { - where: buildCacheWhereClause(vars.from, vars.to, undefined, "seasonNumber"), - orderBy: "seasonNumber", - orderDirection: "desc", - }, - "cache_beanHourlySnapshots", - ); + return paginateSubgraph(beanPaginateSettings, subgraphs[chainId].bean, BeanAdvancedChartDocument, vars); }, [chainId], ); @@ -461,23 +454,22 @@ export default function useSeasonsData( } } - if (beanData && idx + syncOffset < beanResults.length) { - // Cache returns flat BeanHourlySnapshot objects directly - const beanHourly = beanResults[idx + syncOffset]; + if (beanData && idx + syncOffset < countSubgraphSeasons) { + const beanHourly = beanResults[idx + syncOffset].beanHourlySnapshot; allData.crosses = beanHourly.crosses; allData.marketCap = Number(beanHourly.marketCap); allData.supply = TokenValue.fromBlockchain(beanHourly.supply, tokenData.mainToken.decimals); - allData.supplyInPegLP = TokenValue.fromHuman(beanHourly.supplyInPegLP || 0, tokenData.mainToken.decimals); + allData.supplyInPegLP = TokenValue.fromBlockchain(beanHourly.supply, tokenData.mainToken.decimals); allData.instDeltaB = TokenValue.fromHuman(beanHourly.instDeltaB, tokenData.mainToken.decimals); allData.instPrice = TokenValue.fromHuman(beanHourly.instPrice, tokenData.mainToken.decimals); - allData.l2sr = TokenValue.fromHuman(Number(beanHourly.l2sr) * 100, 2); + allData.l2sr = TokenValue.fromHuman(beanHourly.l2sr * 100, 2); allData.twaDeltaB = TokenValue.fromHuman(beanHourly.twaDeltaB, 2); allData.twaPrice = TokenValue.fromHuman(beanHourly.twaPrice, 4); if (!allData.season) { - // Cache uses seasonNumber and createdTimestamp directly - allData.season = beanHourly.seasonNumber; - allData.timestamp = Number(beanHourly.createdTimestamp || 0); + const season = beanResults[idx].season; + allData.season = season.season; + allData.timestamp = Number(season.timestamp || 0); } } diff --git a/src/utils/paginateSubgraph.ts b/src/utils/paginateSubgraph.ts index 13061041a..98b6e1a8c 100644 --- a/src/utils/paginateSubgraph.ts +++ b/src/utils/paginateSubgraph.ts @@ -3,65 +3,6 @@ import request, { RequestDocument } from "graphql-request"; const PAGE_SIZE = 1000; -// ============================================================================ -// Cache Query Helper - Fetches all results in a single request from cache endpoint -// ============================================================================ - -export interface CacheQueryVars { - where: string; - orderBy: string; - orderDirection: string; -} - -/** - * Fetches data from the cache endpoint in a single request. - * Unlike paginateSubgraph, this returns all results without pagination limits. - * - * @param url - The cache endpoint URL - * @param document - The GraphQL document (generated from codegen) - * @param vars - Query variables including where (JSON string), orderBy, orderDirection - * @param resultKey - The key in the result object that contains the data array - */ -export const fetchCacheQuery = async ( - url: string, - document: RequestDocument | TypedQueryDocumentNode, - vars: CacheQueryVars, - resultKey: keyof T, -): Promise => { - const results = await request(url, document, vars); - return results[resultKey] as R[]; -}; - -/** - * Builds the where clause string for cache queries. - * Uses GraphQL object syntax: "key: value, key: value" - * - * @param fromSeason - The starting season number - * @param toSeason - The ending season number - * @param additionalFilters - Additional filter key-value pairs - * @param seasonField - The field name for season filtering (default: "season", use "seasonNumber" for BeanHourlySnapshot) - */ -export const buildCacheWhereClause = ( - fromSeason: number, - toSeason: number, - additionalFilters?: Record, - seasonField: string = "season", -): string => { - const parts: string[] = [`${seasonField}_gte: ${fromSeason}`, `${seasonField}_lte: ${toSeason}`]; - - if (additionalFilters) { - for (const [key, value] of Object.entries(additionalFilters)) { - if (typeof value === "string") { - parts.push(`${key}: "${value}"`); - } else { - parts.push(`${key}: ${value}`); - } - } - } - - return parts.join(", "); -}; - export interface PaginationSettings { primaryPropertyName: Extract; idField: Extract;