Skip to content

Commit

Permalink
fix: save data for liquidated and liquidating state
Browse files Browse the repository at this point in the history
  • Loading branch information
frazarshad committed May 14, 2024
1 parent 1cb5e76 commit a72a70a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/mappings/events/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a72a70a

Please sign in to comment.