Skip to content

Commit

Permalink
create dynamic data on update if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns committed Feb 1, 2024
1 parent 23141a9 commit 36150ec
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/pool/lib/pool-creator.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ export class PoolCreatorService {
});
}

await prisma.prismaPoolTokenDynamicData.createMany({
skipDuplicates: true,
data: pool.tokens!.map((token) => ({
id: token.id,
chain: this.chain,
poolTokenId: token.id,
blockNumber,
priceRate: token.priceRate || '1.0',
weight: token.weight,
balance: token.balance,
balanceUSD: 0,
})),
});

// TODO: It's just a quick fix. Remove after merging json column replacement for tables
if (pool.poolType!.includes('Gyro')) {
await prisma.prismaPoolGyroData.upsert({
Expand Down

0 comments on commit 36150ec

Please sign in to comment.