Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
aeolianeth committed Aug 29, 2024
1 parent e00ea9e commit 74c8519
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/packages/v2v3/contexts/Project/useV2V3ProjectState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PV_V2 } from 'constants/pv'
import { RomanStormVariables } from 'constants/romanStorm'
import {
ETH_PAYOUT_SPLIT_GROUP,
RESERVED_TOKEN_SPLIT_GROUP,
Expand Down Expand Up @@ -30,7 +31,6 @@ import {
V2V3_CURRENCY_ETH,
} from 'packages/v2v3/utils/currency'
import { useContext, useMemo } from 'react'
import { RomanStormVariables } from 'constants/romanStorm'
import { V2V3ProjectContractsContext } from '../ProjectContracts/V2V3ProjectContractsContext'
import { V2V3ProjectContextType } from './V2V3ProjectContext'

Expand Down Expand Up @@ -113,15 +113,15 @@ export function useV2V3ProjectState({ projectId }: { projectId: number }) {
const projectRomanStormStatsData = first(romanStormData?.projects)

let totalVolume = projectStatsData?.volume
let paymentsCount = projectStatsData?.paymentsCount
let paymentsCount = projectStatsData?.paymentsCount ?? 0

if (projectId === RomanStormVariables.PROJECT_ID && projectStatsData) {
const BIG_ZERO = BigNumber.from(0)

totalVolume = (totalVolume || BIG_ZERO).sub(
projectRomanStormStatsData?.volume || BIG_ZERO,
)
paymentsCount -= projectRomanStormStatsData?.paymentsCount
paymentsCount -= projectRomanStormStatsData?.paymentsCount ?? 0
}

const { createdAt, trendingVolume } = projectStatsData ?? {}
Expand Down
10 changes: 5 additions & 5 deletions src/pages/api/projects/trending.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { PV_V1, PV_V2 } from 'constants/pv'
import { RomanStormVariables } from 'constants/romanStorm'
import { BigNumber } from 'ethers'
import {
OrderDirection,
Project_OrderBy,
Expand All @@ -7,12 +9,10 @@ import {
TrendingProjectsQuery,
} from 'generated/graphql'
import { serverClient } from 'lib/apollo/serverClient'
import { BigNumber } from 'ethers'
import { NextApiHandler } from 'next'
import { V1ArchivedProjectIds } from 'packages/v1/constants/archivedProjects'
import { V2ArchivedProjectIds } from 'packages/v2v3/constants/archivedProjects'
import { getSubgraphIdForProject } from 'utils/graph'
import { RomanStormVariables } from 'constants/romanStorm'

const CACHE_MAXAGE = 60 * 5 // 5 minutes

Expand Down Expand Up @@ -79,9 +79,9 @@ const handler: NextApiHandler = async (req, res) => {

projects[romanProjectIndex] = {
...projects[romanProjectIndex],
volume: BigNumber.from(romanProject.volume)
.sub(romanProjectSnapshot.volume)
.toString() as BigNumber, // Incorrect types are declared
volume: BigNumber.from(romanProject.volume ?? 0).sub(
BigNumber.from(romanProjectSnapshot.volume ?? 0),
), // Incorrect types are declared
paymentsCount:
romanProject.paymentsCount - romanProjectSnapshot.paymentsCount,
}
Expand Down

0 comments on commit 74c8519

Please sign in to comment.