Track insurance-fund debt on the vault - #87
Merged
Merged
Conversation
Integration tests drive CollateralVault logs through the mappings, so deposit, debt, halt, and insurance-fund classification are checked against the order the chain actually emits.
The vault, futures, and perps addresses and the subgraph URL already live in config/dev.env and config/prd.env, so the monitor should not keep a second copy in the tfvars.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Depositedis emitted before the mint so a deposit is not counted as debt.Monitoring
A Lambda runs every 5 minutes. It reads the vault subgraph, then reads the vault's USDC balance at that same block, so indexer lag cannot open a false backing gap. Metrics go to CloudWatch and the
col-mar-vault-{env}dashboard: debt, timing debt, uncovered loss, cap, capital, utilization, halt, margin engine, insurance-fund and venue fee balances, backing gap, trader bad debt, subgraph age and indexing errors, hashprice age, and keeper health.Timing debt is expected and is not alarmed. Alarms, with notifications off until the dashboard has been checked:
VAULT_ADDRESS,FUTURES_ADDRESS,PERPS_ADDRESS, andVAULT_SUBGRAPH_URLcome fromconfig/dev.env(dev) andconfig/prd.env(lmn). Create, notifications, the poll interval, the two utilization percentages, the subgraph age limit, and the oracle metric namespace stay in the tfvars.Test plan
pnpm --dir contracts testcovers settle, halt, repayment, and the worked examplepnpm --dir indexer testcovers the debt, halt, transfer, deposit, and withdraw handlerspnpm --dir indexer test:integrationreplays those handlers against a deployed vaultterragrunt renderin.bedrock/02-devand.bedrock/04-lmnshows the four addresses and the subgraph URL from the matching env fileinitializeV2before any venue upgrade, then set the capvault_monitoring.notifications_enabled = falseand confirm the dashboard shows debt 0, a fresh subgraph, backing gap 0, and not halted before turning notifications on