@merkl/api 0.20.29 → 0.20.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -875,7 +875,7 @@ export declare abstract class OpportunityRepository {
|
|
875
875
|
* @returns
|
876
876
|
*/
|
877
877
|
static updateRecords(opportunityId: string, apr: AprRecord["model"], tvl: TvlRecord["model"], dailyRewards: DailyRewardsRecord["model"]): Promise<{
|
878
|
-
aprRecord: {
|
878
|
+
aprRecord: false | {
|
879
879
|
id: string;
|
880
880
|
opportunityId: string;
|
881
881
|
timestamp: bigint;
|
@@ -422,15 +422,16 @@ export class OpportunityRepository {
|
|
422
422
|
* @returns
|
423
423
|
*/
|
424
424
|
static async updateRecords(opportunityId, apr, tvl, dailyRewards) {
|
425
|
-
const aprRecord =
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
425
|
+
const aprRecord = apr.cumulated >= 0 &&
|
426
|
+
(await apiDbClient.aprRecord.create({
|
427
|
+
data: {
|
428
|
+
id: AprService.hashId(opportunityId, apr.timestamp),
|
429
|
+
timestamp: apr.timestamp,
|
430
|
+
cumulated: apr.cumulated,
|
431
|
+
Opportunity: { connect: { id: opportunityId } },
|
432
|
+
AprBreakdown: { createMany: { data: apr.breakdowns } },
|
433
|
+
},
|
434
|
+
}));
|
434
435
|
const tvlRecord = await apiDbClient.tVLRecord.create({
|
435
436
|
data: {
|
436
437
|
id: TvlService.hashId(opportunityId, tvl.timestamp),
|