Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: index liquidation state timings #5

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

rabi-siddique
Copy link
Collaborator

No description provided.

@@ -55,6 +55,14 @@ export const vaultsEventKit = (block: any, data: any, module: string, path: stri
vault.debt = payload?.debtSnapshot?.debt?.__value;
vault.balance = payload?.locked?.__value;
vault.state = payload?.vaultState;

if (vault.state === 'liquidating' && !vault.liquidationStartedAt) {
vault.liquidationStartedAt = block.block.header.time;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While in the liquidating state, if there is a change in any other field, we will get a state_change event, and at that time, this if condition will be true and this will update the liquidationStartedAt time, which is not correct anymore. The liquidationStartedAt should only have time only first time this state changed into liquidation.

Same is true for liquidatedAt.

@rabi-siddique rabi-siddique force-pushed the rs-index-liquidation-states branch 3 times, most recently from 35891da to 3fe50b0 Compare April 27, 2024 16:05
@@ -17,6 +17,9 @@ export const EVENT_TYPES = {
STORAGE: "storage",
SUBMIT_PROPOSAL: "submit_proposal",
TRANSFER: "transfer",
LIQUIDATING: "liquidating",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EVENT_TYPES are used for different purposes. These are states of Vaults, so a new enum called VAULT_STATES will be better.

@rabi-siddique rabi-siddique merged commit ffe1876 into main Apr 27, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants