diff --git a/.env.bartio b/.env.bartio index f60fa3433..c33e0f0e5 100644 --- a/.env.bartio +++ b/.env.bartio @@ -119,7 +119,6 @@ NEXT_PUBLIC_BALANCER_API_CHAIN_NAME="BARTIO" # HUB Addresses =================================================================== NEXT_PUBLIC_BGT_ADDRESS="0xbDa130737BDd9618301681329bF2e46A016ff9Ad" NEXT_PUBLIC_BGT_STAKER="0x791fb53432eED7e2fbE4cf8526ab6feeA604Eb6d" -NEXT_PUBLIC_POL_ENDPOINT="https://bartio-pol-indexer.berachain.com/berachain/v1alpha1/beacon" NEXT_PUBLIC_BERA_CHEF_ADDRESS="0xfb81E39E3970076ab2693fA5C45A07Cc724C93c2" NEXT_PUBLIC_REWARD_VAULT_FACTORY_ADDRESS="0x2B6e40f65D82A0cB98795bC7587a71bfa49fBB2B" diff --git a/apps/hub/src/app/pools/usePoolTable.tsx b/apps/hub/src/app/pools/usePoolTable.tsx index b06bbe067..de09fb403 100755 --- a/apps/hub/src/app/pools/usePoolTable.tsx +++ b/apps/hub/src/app/pools/usePoolTable.tsx @@ -166,7 +166,6 @@ export const usePoolTable = ({ /> ), cell: ({ row }) => { - const { data: bgtInflation } = useBgtInflation(); return (
@@ -71,7 +81,7 @@ export default function GaugeInfoCard() { ) : ( => { - if (!config.endpoints?.polEndpoint) { - throw new Error("Missing backend endpoint in config"); - } - const [res, apiRes] = await Promise.all([ - fetch(`${config.endpoints.polEndpoint}/homepage`), - bexApiGraphqlClient.query({ - query: GlobalData, - }), - ]); + const apiRes = await bexApiGraphqlClient.query< + GlobalDataQuery, + GlobalDataQueryVariables + >({ + query: GlobalData, + variables: { + chain: balancerApiChainName as GqlChain, + }, + }); - const data = await res.json(); - const apiData = apiRes.data; + const data = apiRes.data; return { - bgtInfo: data.bgtInfo, - sumAllIncentivesInHoney: data.sumAllIncentivesInHoney, - validatorCount: data.validatorCount, - vaultCount: data.vaultCount, - incentiveCount: data.incentiveCount, - top3Incentives: data.top3Incentives, - ...apiData, + bgtInfo: { + // TODO: get bgt inflation somehow, maybe from the backend + bgtInflation: 0, + totalStakeBgt: Number(data.polGetGlobalInfo?.totalBGTStaked ?? "0"), + }, + sumAllIncentivesInHoney: + data.polGetGlobalInfo?.totalActiveIncentivesValueUSD ?? "0", + validatorCount: data.polGetGlobalInfo?.totalValidators ?? 0, + vaultCount: data.polGetGlobalInfo?.totalRewardVaults ?? 0, + top3EmittingValidators: apiRes.data.top3EmittingValidators, } satisfies GlobalInfo; }; diff --git a/packages/berajs/src/config/defaultBeraConfig.ts b/packages/berajs/src/config/defaultBeraConfig.ts index 470d45bd5..8d2d949a6 100755 --- a/packages/berajs/src/config/defaultBeraConfig.ts +++ b/packages/berajs/src/config/defaultBeraConfig.ts @@ -16,7 +16,6 @@ import { lendUIDataProviderAddress, marketListUrl, multicallAddress, - polEndpointUrl, polSubgraphUrl, tokenListUrl, tradingContractAddress, @@ -31,7 +30,6 @@ export const defaultBeraConfig: BeraConfig = { validatorList: validatorListUrl, marketList: marketListUrl, validatorInfo: validatorListUrl, - polEndpoint: polEndpointUrl, }, subgraphs: { honeySubgraph: honeySubgraphUrl, diff --git a/packages/berajs/src/types/global.ts b/packages/berajs/src/types/global.ts index 20f2bfad0..6af3ec4d4 100755 --- a/packages/berajs/src/types/global.ts +++ b/packages/berajs/src/types/global.ts @@ -9,7 +9,6 @@ export interface BeraConfig { validatorList?: string; marketList?: string; validatorInfo?: string; - polEndpoint?: string; }; subgraphs?: { honeySubgraph?: string; diff --git a/packages/config/env/index.ts b/packages/config/env/index.ts index 02b4dfe39..4805abcd5 100755 --- a/packages/config/env/index.ts +++ b/packages/config/env/index.ts @@ -18,7 +18,6 @@ export const blockExplorerUrl = process.env .NEXT_PUBLIC_BLOCK_EXPLORER as string; export const blockExplorerName = process.env .NEXT_PUBLIC_BLOCK_EXPLORER_NAME as string; -export const polEndpointUrl = process.env.NEXT_PUBLIC_POL_ENDPOINT as string; // Subgraphs export const balancerApiUrl = process.env diff --git a/packages/graphql/src/modules/pol/api.graphql b/packages/graphql/src/modules/pol/api.graphql index 6c1f91e19..c8d50ba2f 100644 --- a/packages/graphql/src/modules/pol/api.graphql +++ b/packages/graphql/src/modules/pol/api.graphql @@ -2,7 +2,6 @@ fragment ApiVaultIncentive on GqlRewardVaultIncentive { active amountRemaining incentiveRate - tokenAddress token { address @@ -133,7 +132,7 @@ query GetRewardVault($vaultId: String!, $chain: GqlChain!) { } } -query GlobalData { +query GlobalData($chain: GqlChain!) { top3EmittingValidators: polGetValidators( orderBy: bgtCapturePercentage orderDirection: desc @@ -141,12 +140,13 @@ query GlobalData { ) { ...ApiValidator } - top3Vaults: polGetRewardVaults( - orderBy: last24hBGTReceived - orderDirection: desc - first: 3 - ) { - ...ApiVault + + polGetGlobalInfo(chain: $chain) { + totalBGTStaked + totalValidators + totalRewardVaults + totalActiveIncentives + totalActiveIncentivesValueUSD } } diff --git a/secrets b/secrets index 2d72c31b9..3d85e31f9 160000 --- a/secrets +++ b/secrets @@ -1 +1 @@ -Subproject commit 2d72c31b98e91b1d86b643fd029ac04400c5cc1b +Subproject commit 3d85e31f9ecb56ed064e82525da4d7bb14df3686