diff --git a/src/mappings/constants.ts b/src/mappings/constants.ts index 34b97eb5..fcf843a6 100644 --- a/src/mappings/constants.ts +++ b/src/mappings/constants.ts @@ -28,6 +28,7 @@ export const VAULT_STATES = { CLOSED: 'closed', LIQUIDATING: 'liquidating', LIQUIDATED: 'liquidated', + LIQUIDATED_CLOSED: 'liquidatedClosed', }; export const VALUE_KEY = b64encode('value'); diff --git a/src/mappings/events/vaults.ts b/src/mappings/events/vaults.ts index 5e520499..3c7faac6 100644 --- a/src/mappings/events/vaults.ts +++ b/src/mappings/events/vaults.ts @@ -99,11 +99,7 @@ export const vaultsEventKit = (block: any, data: any, module: string, path: stri [VAULT_STATES.LIQUIDATED]: 'liquidated', [VAULT_STATES.LIQUIDATING]: 'liquidating', [VAULT_STATES.CLOSED]: 'closed', - }; - - const closedPropertyMap = { - [VAULT_STATES.ACTIVE]: 'closed', - [VAULT_STATES.LIQUIDATED]: 'liquidatedClosed', + [VAULT_STATES.LIQUIDATED_CLOSED]: 'liquidatedClosed', }; vaultState.blockHeightLast = BigInt(blockHeight); @@ -117,9 +113,8 @@ export const vaultsEventKit = (block: any, data: any, module: string, path: stri (vaultState as any)[oldProperty] -= BigInt(1); } - if ((newState && propertyMap[newState]) || (oldState && closedPropertyMap[oldState])) { - const newProperty = - newState === VAULT_STATES.CLOSED && oldState ? closedPropertyMap[oldState] : propertyMap[newState]; + if ((newState && propertyMap[newState])) { + const newProperty = propertyMap[newState]; (vaultState as any)[newProperty] += BigInt(1); }