From 7c8c172e7311e958ef7f1536e71ebf0da1d0edeb Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Fri, 1 Dec 2023 12:07:15 +0200 Subject: [PATCH] fix missing logic --- src/mappings/erc20Template3.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mappings/erc20Template3.ts b/src/mappings/erc20Template3.ts index b858632..fe09699 100644 --- a/src/mappings/erc20Template3.ts +++ b/src/mappings/erc20Template3.ts @@ -118,6 +118,21 @@ export function handlePredictionPayout(event: PredictionPayout): void { predictPrediction.payout = predictionPayout.id predictPrediction.save() + + let shouldUpdateSlot = false + const predictSlot = getPredictSlot( + event.address.toHexString(), + event.params.slot.toI32() + ) + if (event.params.status == 1 && predictSlot.status !== 'Paying') { + predictSlot.status = 'Paying' + shouldUpdateSlot = true + } + if (event.params.status == 2 && predictSlot.status !== 'Canceled') { + predictSlot.status = 'Canceled' + shouldUpdateSlot = true + } + if (shouldUpdateSlot == true) predictSlot.save() } export function handleNewSubscription(event: NewSubscription): void {