From 47a2a8f503220e8edf6a0f7793575b3d5008a460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pr=C3=A9vost?= <998369+prevostc@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:43:58 +0200 Subject: [PATCH] Fix rewardPool lifecycle --- src/clm/lifecycle.ts | 8 ++++++-- src/clm/utils/clm-data.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/clm/lifecycle.ts b/src/clm/lifecycle.ts index 52fa456..23e4390 100644 --- a/src/clm/lifecycle.ts +++ b/src/clm/lifecycle.ts @@ -269,8 +269,12 @@ export function handleRewardPoolInitialized(event: RewardPoolInitialized): void const rewardPoolToken = fetchAndSaveTokenData(rewardPoolAddress) const clm = getCLM(managerAddress) - clm.rewardPoolTokens.push(rewardPoolToken.id) - clm.rewardPoolsTotalSupply.push(ZERO_BI) + const rewardPoolTokens = clm.rewardPoolTokens + rewardPoolTokens.push(rewardPoolToken.id) + clm.rewardPoolTokens = rewardPoolTokens + const rewardPoolsTotalSupply = clm.rewardPoolsTotalSupply + rewardPoolsTotalSupply.push(ZERO_BI) + clm.rewardPoolsTotalSupply = rewardPoolsTotalSupply clm.save() log.info("handleRewardPoolInitialized: Reward pool {} initialized for CLM {} on block {}", [ diff --git a/src/clm/utils/clm-data.ts b/src/clm/utils/clm-data.ts index 4329a08..582c172 100644 --- a/src/clm/utils/clm-data.ts +++ b/src/clm/utils/clm-data.ts @@ -259,7 +259,7 @@ export function fetchCLMData(clm: CLM): CLMData { throw new Error("Unsupported price oracle type") } } else { - log.error("Failed to fetch nativeToUSDPrice for CLM {}", [clm.id.toString()]) + log.error("Failed to fetch nativeToUSDPrice for CLM {}", [clm.id.toHexString()]) } // only some clms have a reward pool token