Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
fix(studio): Fix PoolTogether community pool fetcher (#3049)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich authored Nov 15, 2023
1 parent 4423929 commit 0876d47
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export abstract class PoolTogetherV3CommunityTicketTokenFetcher extends AppToken
poolBuilders.map(({ address, blockNumber }) =>
this.logProvider.getPoolWithMultipleWinnersBuilderLogs({
fromBlock: blockNumber,
address,
network: this.network,
address,
}),
),
);
Expand All @@ -84,17 +84,16 @@ export abstract class PoolTogetherV3CommunityTicketTokenFetcher extends AppToken
const definitions = await Promise.all(
builderLogs.flatMap(logs =>
flatMap(logs, (logsForType, type: PoolWithMultipleWinnersBuilderCreatedType) =>
logsForType.map(async log => {
const prizePool = log.args[0].toLowerCase();
const prizeStrategy = log.args[1].toLowerCase();
const contract = multicall.wrap(
this.contractFactory.poolTogetherV3MultipleWinners({
network: this.network,
address: prizeStrategy,
}),
);

const ticketAddress = await contract.read.ticket().then(addr => addr.toLowerCase());
logsForType.map(async ({ prizePool, prizeStrategy }) => {
const contract = this.contractFactory.poolTogetherV3MultipleWinners({
network: this.network,
address: prizeStrategy,
});

const ticketAddress = await multicall
.wrap(contract)
.read.ticket()
.then(addr => addr.toLowerCase());

return {
type,
Expand Down
15 changes: 12 additions & 3 deletions src/apps/pool-together-v3/common/pool-together-v3.log-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@ export class PoolTogetherV3LogProvider {
]);

return {
[PoolWithMultipleWinnersBuilderCreatedType.STAKE]: stakeLogs,
[PoolWithMultipleWinnersBuilderCreatedType.COMPOUND]: compoundLogs,
[PoolWithMultipleWinnersBuilderCreatedType.YIELD]: yieldLogs,
[PoolWithMultipleWinnersBuilderCreatedType.STAKE]: stakeLogs.map(log => ({
prizePool: log.args.prizePool!,
prizeStrategy: log.args.prizeStrategy!,
})),
[PoolWithMultipleWinnersBuilderCreatedType.COMPOUND]: compoundLogs.map(log => ({
prizePool: log.args.prizePool!,
prizeStrategy: log.args.prizeStrategy!,
})),
[PoolWithMultipleWinnersBuilderCreatedType.YIELD]: yieldLogs.map(log => ({
prizePool: log.args.prizePool!,
prizeStrategy: log.args.prizeStrategy!,
})),
};
}
}

0 comments on commit 0876d47

Please sign in to comment.