From a72a70add288aff28bf7b5c6bedaac13dbbf36a6 Mon Sep 17 00:00:00 2001 From: Fraz Arshad Date: Tue, 14 May 2024 17:24:08 +0500 Subject: [PATCH] fix: save data for liquidated and liquidating state --- src/mappings/events/vaults.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/mappings/events/vaults.ts b/src/mappings/events/vaults.ts index 7899e059..489cfcc1 100644 --- a/src/mappings/events/vaults.ts +++ b/src/mappings/events/vaults.ts @@ -99,19 +99,17 @@ export const vaultsEventKit = (block: any, data: any, module: string, path: stri const oraclPriceId = `${denom}-USD`; const oraclePrice = await OraclePrice.get(oraclPriceId); - if (payload?.vaultState === 'liquidated') { - if (vaultManagerGovernance && vault.vaultManagerGovernance === undefined) - vault.vaultManagerGovernance = { - liquidationMarginNumerator: vaultManagerGovernance.liquidationMarginNumerator, - liquidationMarginDenominator: vaultManagerGovernance.liquidationMarginDenominator, - }; - - if (oraclePrice && vault.oraclePrice === undefined) - vault.oraclePrice = { - typeInAmount: oraclePrice.typeInAmount, - typeOutAmount: oraclePrice.typeOutAmount, - }; - } + if (vaultManagerGovernance && vault.vaultManagerGovernance === undefined) + vault.vaultManagerGovernance = { + liquidationMarginNumerator: vaultManagerGovernance.liquidationMarginNumerator, + liquidationMarginDenominator: vaultManagerGovernance.liquidationMarginDenominator, + }; + + if (oraclePrice && vault.oraclePrice === undefined) + vault.oraclePrice = { + typeInAmount: oraclePrice.typeInAmount, + typeOutAmount: oraclePrice.typeOutAmount, + }; vault.coin = denom; vault.denom = denom;