Skip to content

fix matching distribution #3799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/builder/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/data-layer/src/data-layer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ describe("applications search", () => {
});
});

describe("v2 projects retrieval", () => {
describe.skip("v2 projects retrieval", () => {
test("can retrieve project by id", async () => {
const fetchMock = vi.fn().mockResolvedValue({
status: 200,
Expand Down
4 changes: 1 addition & 3 deletions packages/data-layer/src/data.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ export type DistributionMatch = {
};

export type RoundForManager = V2RoundWithProject & {
matchingDistribution: {
matchingDistribution: DistributionMatch[];
} | null;
matchingDistribution: DistributionMatch[];
tags: string[];
matchAmount: string;
matchAmountInUsd: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,28 @@ export const useGroupProjectsByPaymentStatus = (

const allProjects: MatchingStatsData[] = useMemo(
() =>
round.matchingDistribution?.matchingDistribution.map(
(matchingStatsData) => {
return {
projectName: matchingStatsData.projectName,
contributionsCount: matchingStatsData.contributionsCount,
matchPoolPercentage: matchingStatsData.matchPoolPercentage,
projectId: matchingStatsData.projectId,
applicationId: matchingStatsData.applicationId,
anchorAddress: applications?.find(
(application) =>
application.projectId === matchingStatsData.projectId
)?.anchorAddress,
matchAmountInToken: BigNumber.from(
matchingStatsData.matchAmountInToken
),
originalMatchAmountInToken: BigNumber.from(
matchingStatsData.originalMatchAmountInToken
),
projectPayoutAddress: matchingStatsData.projectPayoutAddress,
};
}
) ?? [],
[round.matchingDistribution?.matchingDistribution, applications]
round.matchingDistribution?.map((matchingStatsData) => {
const anchorAddress = applications?.find(
(application) => application.projectId === matchingStatsData.projectId
)?.anchorAddress;

return {
projectName: matchingStatsData.projectName,
contributionsCount: matchingStatsData.contributionsCount,
matchPoolPercentage: matchingStatsData.matchPoolPercentage,
projectId: matchingStatsData.projectId,
applicationId: matchingStatsData.applicationId,
anchorAddress,
matchAmountInToken: BigNumber.from(
matchingStatsData.matchAmountInToken
),
originalMatchAmountInToken: BigNumber.from(
matchingStatsData.originalMatchAmountInToken
),
projectPayoutAddress: matchingStatsData.projectPayoutAddress,
};
}) ?? [],
[round.matchingDistribution, applications]
);

useEffect(() => {
Expand All @@ -103,11 +102,13 @@ export const useGroupProjectsByPaymentStatus = (
let tmpProject = project;

if (projectStatus === "paid") {
const hash = paidProjects?.find(
(p) => p.projectId === project.projectId
)?.distributionTransaction;

tmpProject = {
...project,
hash:
paidProjects?.find((p) => p.projectId === project.projectId)
?.distributionTransaction || undefined,
hash: hash || undefined,
status: "",
};
}
Expand All @@ -118,7 +119,7 @@ export const useGroupProjectsByPaymentStatus = (
}

fetchData();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [allProjects]);
}, [allProjects, paidProjects, paidProjectIds]);

return groupedProjects;
};
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function useRevisedMatchingFunds(
round.matchingDistribution !== null &&
round.readyForPayoutTransaction !== null
) {
return round.matchingDistribution.matchingDistribution.map((m) => {
return round.matchingDistribution.map((m) => {
return {
applicationId: m.applicationId,
payoutAddress: m.projectPayoutAddress,
Expand Down
2 changes: 1 addition & 1 deletion packages/round-manager/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function useAlloIndexerClient(): Client {
}
return new Client(
fetch.bind(window),
process.env.REACT_APP_INDEXER_V2_API_URL ?? "",
process.env.REACT_APP_INDEXER_V1_API_URL ?? "",
chainId
);
}, [chainId]);
Expand Down
4 changes: 2 additions & 2 deletions packages/round-manager/src/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export const makeRoundData = (overrides: Partial<Round> = {}): Round => {
matchAmountInUsd: 0,
fundedAmount: 0n,
fundedAmountInUsd: 0,
matchingDistribution: null,
readyForPayoutTransaction: null,
matchingDistribution: [],
...overrides,
};
};
Expand Down Expand Up @@ -192,7 +192,7 @@ export const makeDirectGrantRoundData = (
matchAmountInUsd: 0,
fundedAmount: 0n,
fundedAmountInUsd: 0,
matchingDistribution: null,
matchingDistribution: [],
readyForPayoutTransaction: null,
...overrides,
};
Expand Down