From 1bdd11009d51cd6bc2b34fd5063b942571efc361 Mon Sep 17 00:00:00 2001 From: 1emu Date: Tue, 23 Jul 2024 15:37:55 -0300 Subject: [PATCH] chore: use contract method to get vesting total --- src/clients/VestingData.ts | 6 ++---- src/routes/project.ts | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/clients/VestingData.ts b/src/clients/VestingData.ts index 93d41f2f4..172c89bb8 100644 --- a/src/clients/VestingData.ts +++ b/src/clients/VestingData.ts @@ -1,6 +1,6 @@ import { ChainId } from '@dcl/schemas' import { JsonRpcProvider } from '@ethersproject/providers' -import { BigNumber, ethers } from 'ethers' +import { ethers } from 'ethers' import { VestingStatus } from '../entities/Grant/types' import { ErrorService } from '../services/ErrorService' @@ -155,9 +155,7 @@ async function getVestingContractDataV2( const released = parseContractValue(await vestingContract.getReleased()) const releasable = parseContractValue(await vestingContract.getReleasable()) - const vestedPerPeriod: BigNumber[] = await vestingContract.getVestedPerPeriod() - - const total = vestedPerPeriod.map(parseContractValue).reduce((acc, curr) => acc + curr, 0) + const total = parseContractValue(await vestingContract.getTotal()) let status = getInitialVestingStatus(start_at, finish_at) const isRevoked = await vestingContract.getIsRevoked() diff --git a/src/routes/project.ts b/src/routes/project.ts index d51f15d4d..a7cb44201 100644 --- a/src/routes/project.ts +++ b/src/routes/project.ts @@ -65,7 +65,6 @@ async function getProject(req: Request<{ project: string }>) { try { return await ProjectService.getUpdatedProject(id) } catch (e) { - console.log(`Error getting project: ${e}`) //TODO: remove before merging projects to main throw new RequestError(`Project "${id}" not found`, RequestError.NotFound) } }