Skip to content

Commit

Permalink
fix operator wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKurt committed Apr 28, 2024
1 parent 41e37d2 commit 1f38e6f
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions packages/round-manager/src/features/api/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,30 @@ export async function listPrograms(
throw Error("Unable to fetch programs");
}

let programs: Program[] = [];
const programs: Program[] = [];

for (const program of programsRes.programs) {
programs.push({
id: program.id,
metadata: program.metadata,
operatorWallets: program.roles.map(
(role: { address: string }) => role.address
),
tags: program.tags,
chain: {
id: chainId,
name: CHAINS[chainId]?.name,
logo: CHAINS[chainId]?.logo,
},
createdByAddress: program.createdByAddress,
});
if (
program.roles.some(
(role) => role.role === "OWNER" && role.address === address
)
)
programs.push({
id: program.id,
metadata: program.metadata,
operatorWallets: program.roles.map(
(role: { address: string }) => role.address
),
tags: program.tags,
chain: {
id: chainId,
name: CHAINS[chainId]?.name,
logo: CHAINS[chainId]?.logo,
},
createdByAddress: program.createdByAddress,
});
}

// Filter out programs where operatorWallets does not include round.createdByAddress.
// This is to filter out spam rounds created by bots
programs = programs.filter((program) => {
return program.operatorWallets?.includes(address);
});

return programs;
} catch (error) {
datadogLogs.logger.error(`error: listPrograms - ${error}`);
Expand Down

0 comments on commit 1f38e6f

Please sign in to comment.