diff --git a/README.md b/README.md index 11d2739e8..f2c55d0f6 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,8 @@ The following configuration values can be added to the `.env` file: - Set `GASLESS_WEBHOOK_URL` for sending gasless vote requests to discord +- Set `USE_PRIVATE_SUBGRAPH` to `true` to connect to the subgraph privately + **Optional** Set `DEFENDER_API_KEY_MAINNET` and/or `DEFENDER_API_KEY_TESTNET` to a valid OpenZeppelin Defender Relay key (used for gasless poll voting) **Optional** Set `DEFENDER_API_SECRET_MAINNET` and/or`DEFENDER_API_SECRET_TESTNET` to a valid OpenZeppelin Defender Relay secret **Optional** Set `ALCHEMY_ARBITRUM_KEY` to a valid Alchemy API key for the arbitrum network diff --git a/modules/delegates/api/fetchDelegationMetrics.ts b/modules/delegates/api/fetchDelegationMetrics.ts index 813ce33ab..35ef4b871 100644 --- a/modules/delegates/api/fetchDelegationMetrics.ts +++ b/modules/delegates/api/fetchDelegationMetrics.ts @@ -10,6 +10,8 @@ import { gqlRequest } from 'modules/gql/gqlRequest'; import { allDelegations } from 'modules/gql/queries/subgraph/allDelegations'; import { SupportedNetworks } from 'modules/web3/constants/networks'; import { networkNameToChainId } from 'modules/web3/helpers/chain'; +import { BigNumberWAD } from 'modules/web3/constants/numbers'; +import { BigNumberJS } from 'lib/bigNumberJs'; interface DelegationMetrics { totalMkrDelegated: number; @@ -25,8 +27,7 @@ export async function fetchDelegationMetrics( query: allDelegations }); const delegations = res.delegations; - - const totalMkrDelegated = delegations.reduce((acc, cur) => acc + Number(cur.amount), 0); + const totalMkrDelegated = delegations.reduce((acc, cur) => acc.plus(new BigNumberJS(cur.amount).div(BigNumberWAD)), new BigNumberJS(0)).toNumber(); const delegatorCount = delegations.filter(d => Number(d.amount) > 0).length; return { diff --git a/pages/index.tsx b/pages/index.tsx index b24286103..86cb00c29 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -42,8 +42,6 @@ import { useVotedProposals } from 'modules/executive/hooks/useVotedProposals'; import { fetchLandingPageData } from 'modules/home/api/fetchLandingPageData'; import { LandingPageData } from 'modules/home/api/fetchLandingPageData'; import { useLandingPageDelegates } from 'modules/gql/hooks/useLandingPageDelegates'; -import { fetchDelegationMetrics } from 'modules/delegates/api/fetchDelegationMetrics'; -import { fetchChainDelegates } from 'modules/delegates/api/fetchChainDelegates'; const LandingPage = ({ proposals, @@ -134,25 +132,6 @@ const LandingPage = ({ } }, []); - - useEffect(() => { - const fetchMetrics = async () => { - const metrics = await fetchDelegationMetrics(SupportedNetworks.TENDERLY); - console.log('metrics', metrics); - }; - - fetchMetrics(); - }, []); - - useEffect(() => { - const fetchDelegates = async () => { - const chainDelegates = await fetchChainDelegates(SupportedNetworks.TENDERLY); - console.log('chainDelegates', chainDelegates); - }; - - fetchDelegates(); - }, []); - return (
{delegates.length === 0 && delegatesInfo.length === 0 && polls.length === 0 && (