Skip to content

Commit 4e01724

Browse files
committed
remove debugging things
1 parent bd236da commit 4e01724

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

src/indexer/allo/roundMetadata.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export const RoundMetadataSchema = z
77
quadraticFundingConfig: z
88
.object({
99
matchingFundsAvailable: z.number(),
10-
})
11-
.optional(),
10+
}),
1211
})
1312
.passthrough();

src/indexer/allo/v2/handleEvent.ts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ export async function handleEvent(
398398

399399
if (
400400
parsedMetadata.success &&
401-
token !== null &&
402-
parsedMetadata.data.quadraticFundingConfig !== undefined
401+
token !== null
403402
) {
404403
matchAmount = parseUnits(
405404
parsedMetadata.data.quadraticFundingConfig.matchingFundsAvailable.toString(),
@@ -484,6 +483,22 @@ export async function handleEvent(
484483
applicationsEndTime = getDateFromTimestamp(registrationEndTimeResolved);
485484
donationsStartTime = getDateFromTimestamp(poolStartTimeResolved);
486485
donationsEndTime = getDateFromTimestamp(poolEndTimeResolved);
486+
487+
if (parsedMetadata.success && token !== null) {
488+
matchAmount = parseUnits(
489+
parsedMetadata.data.quadraticFundingConfig.matchingFundsAvailable.toString(),
490+
token.decimals
491+
);
492+
matchAmountInUsd = (
493+
await convertToUSD(
494+
priceProvider,
495+
chainId,
496+
matchTokenAddress,
497+
matchAmount,
498+
event.blockNumber
499+
)
500+
).amount;
501+
}
487502
}
488503

489504
const fundedAmount = event.params.amount;
@@ -546,6 +561,12 @@ export async function handleEvent(
546561
},
547562
];
548563

564+
565+
566+
// Admin roles for the pool are emitted before the pool is created
567+
// so a pending round role is inserted in the db.
568+
// Now that the PoolCreated event is emitted, we can convert
569+
// pending roles to actual round roles.
549570
const pendingAdminRoundRoles = await db.getPendingRoundRolesByRole(
550571
chainId,
551572
adminRole
@@ -571,6 +592,10 @@ export async function handleEvent(
571592
});
572593
}
573594

595+
// Manager roles for the pool are emitted before the pool is created
596+
// so a pending round role is inserted in the db.
597+
// Now that the PoolCreated event is emitted, we can convert
598+
// pending roles to actual round roles.
574599
const pendingManagerRoundRoles = await db.getPendingRoundRolesByRole(
575600
chainId,
576601
managerRole
@@ -799,8 +824,7 @@ export async function handleEvent(
799824

800825
if (
801826
parsedMetadata.success &&
802-
token !== null &&
803-
parsedMetadata.data.quadraticFundingConfig !== undefined
827+
token !== null
804828
) {
805829
matchAmount = parseUnits(
806830
parsedMetadata.data.quadraticFundingConfig.matchingFundsAvailable.toString(),

0 commit comments

Comments
 (0)