From 2a93aa9905897490581609142cfd1bd3eff32edd Mon Sep 17 00:00:00 2001 From: franz Date: Mon, 4 Dec 2023 13:03:52 +0100 Subject: [PATCH 1/5] more logs for voting gauges --- modules/vebal/voting-gauges.repository.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vebal/voting-gauges.repository.ts b/modules/vebal/voting-gauges.repository.ts index cd252b8f9..347932c17 100644 --- a/modules/vebal/voting-gauges.repository.ts +++ b/modules/vebal/voting-gauges.repository.ts @@ -128,7 +128,7 @@ export class VotingGaugesRepository { await this.saveVotingGauge(gauge); return gauge; } catch (error) { - saveErrors.push(error as Error); + saveErrors.push(new Error(`Failed to save voting gauge ${gauge.gaugeAddress} with error ${error}`)); return gauge; } }), From 9269002852e80d12031a9f2a6c49761fa4370867 Mon Sep 17 00:00:00 2001 From: franz Date: Mon, 4 Dec 2023 13:22:10 +0100 Subject: [PATCH 2/5] we can have duplicate stakingGauges in the list, will be filtered --- modules/vebal/vebal.prisma | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/vebal/vebal.prisma b/modules/vebal/vebal.prisma index c4b1b3a0f..df28431b5 100644 --- a/modules/vebal/vebal.prisma +++ b/modules/vebal/vebal.prisma @@ -27,7 +27,6 @@ enum PrismaVotingGaugeStatus { model PrismaVotingGauge { @@id([id, chain]) - @@unique([stakingGaugeId, chain]) id String chain Chain From 1305660403a8e5db4e654a7bacb7d63926de0ff5 Mon Sep 17 00:00:00 2001 From: franz Date: Mon, 4 Dec 2023 13:55:14 +0100 Subject: [PATCH 3/5] change to one-to-many --- modules/pool/pool.prisma | 2 +- modules/pool/pool.service.ts | 2 +- modules/vebal/vebal.prisma | 2 +- prisma/schema.prisma | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/pool/pool.prisma b/modules/pool/pool.prisma index 16767b4df..9244c46b5 100644 --- a/modules/pool/pool.prisma +++ b/modules/pool/pool.prisma @@ -423,7 +423,7 @@ model PrismaPoolStakingGauge { chain Chain gaugeAddress String - votingGauge PrismaVotingGauge? + votingGauge PrismaVotingGauge[] rewards PrismaPoolStakingGaugeReward[] status PrismaPoolStakingGaugeStatus @default(ACTIVE) version Int @default(1) diff --git a/modules/pool/pool.service.ts b/modules/pool/pool.service.ts index ae54c3e2b..468a8f201 100644 --- a/modules/pool/pool.service.ts +++ b/modules/pool/pool.service.ts @@ -494,7 +494,7 @@ export class PoolService { if (gauge && gauge.votingGauge) await prisma.prismaVotingGauge.deleteMany({ - where: { chain: this.chain, id: gauge.votingGauge.id }, + where: { chain: this.chain, id: { in: gauge.votingGauge.map((gauge) => gauge.id) } }, }); await prisma.prismaPoolStakingGauge.deleteMany({ diff --git a/modules/vebal/vebal.prisma b/modules/vebal/vebal.prisma index df28431b5..119f4778d 100644 --- a/modules/vebal/vebal.prisma +++ b/modules/vebal/vebal.prisma @@ -31,7 +31,7 @@ model PrismaVotingGauge { id String chain Chain - stakingGauge PrismaPoolStakingGauge? @relation(fields: [stakingGaugeId, chain], references: [id, chain]) + stakingGauge PrismaPoolStakingGauge? @relation(fields: [id, chain], references: [id, chain]) status PrismaVotingGaugeStatus @default(ACTIVE) gaugeAddress String stakingGaugeId String? diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 9ec3e38d1..b4ee18b87 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -469,7 +469,7 @@ model PrismaPoolStakingGauge { chain Chain gaugeAddress String - votingGauge PrismaVotingGauge? + votingGauge PrismaVotingGauge[] rewards PrismaPoolStakingGaugeReward[] status PrismaPoolStakingGaugeStatus @default(ACTIVE) version Int @default(1) @@ -846,12 +846,11 @@ enum PrismaVotingGaugeStatus { model PrismaVotingGauge { @@id([id, chain]) - @@unique([stakingGaugeId, chain]) id String chain Chain - stakingGauge PrismaPoolStakingGauge? @relation(fields: [stakingGaugeId, chain], references: [id, chain]) + stakingGauge PrismaPoolStakingGauge? @relation(fields: [id, chain], references: [id, chain]) status PrismaVotingGaugeStatus @default(ACTIVE) gaugeAddress String stakingGaugeId String? From 7311e8c5933ad4c70e97667c1eef57f460293d6c Mon Sep 17 00:00:00 2001 From: franz Date: Mon, 4 Dec 2023 15:23:03 +0100 Subject: [PATCH 4/5] add migration --- modules/vebal/vebal.prisma | 2 +- .../20231204142011_remove_constraint_votinggauge/migration.sql | 2 ++ prisma/schema.prisma | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 prisma/migrations/20231204142011_remove_constraint_votinggauge/migration.sql diff --git a/modules/vebal/vebal.prisma b/modules/vebal/vebal.prisma index 119f4778d..df28431b5 100644 --- a/modules/vebal/vebal.prisma +++ b/modules/vebal/vebal.prisma @@ -31,7 +31,7 @@ model PrismaVotingGauge { id String chain Chain - stakingGauge PrismaPoolStakingGauge? @relation(fields: [id, chain], references: [id, chain]) + stakingGauge PrismaPoolStakingGauge? @relation(fields: [stakingGaugeId, chain], references: [id, chain]) status PrismaVotingGaugeStatus @default(ACTIVE) gaugeAddress String stakingGaugeId String? diff --git a/prisma/migrations/20231204142011_remove_constraint_votinggauge/migration.sql b/prisma/migrations/20231204142011_remove_constraint_votinggauge/migration.sql new file mode 100644 index 000000000..4b0b35734 --- /dev/null +++ b/prisma/migrations/20231204142011_remove_constraint_votinggauge/migration.sql @@ -0,0 +1,2 @@ +-- DropIndex +DROP INDEX "PrismaVotingGauge_stakingGaugeId_chain_key"; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index b4ee18b87..79f305c65 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -850,7 +850,7 @@ model PrismaVotingGauge { id String chain Chain - stakingGauge PrismaPoolStakingGauge? @relation(fields: [id, chain], references: [id, chain]) + stakingGauge PrismaPoolStakingGauge? @relation(fields: [stakingGaugeId, chain], references: [id, chain]) status PrismaVotingGaugeStatus @default(ACTIVE) gaugeAddress String stakingGaugeId String? From fc6a9e6617a4b012a73b699c8c8da4a4cd63e280 Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:40:14 +0100 Subject: [PATCH 5/5] fix onchain call for gyro supply (#551) --- modules/pool/lib/pool-onchain-data.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/pool/lib/pool-onchain-data.ts b/modules/pool/lib/pool-onchain-data.ts index ca333d132..7a799a481 100644 --- a/modules/pool/lib/pool-onchain-data.ts +++ b/modules/pool/lib/pool-onchain-data.ts @@ -83,7 +83,6 @@ const getTotalSupplyFn = (type: PoolInput['type'], version: number) => { } else if ( type === 'COMPOSABLE_STABLE' || (type === 'WEIGHTED' && version > 1) || - (type === 'GYROE' && version > 1) || (type === 'UNKNOWN' && version > 1) ) { return 'getActualSupply';