Skip to content

Validator and conc risk#610

Open
Sadeequ wants to merge 3 commits into
code-flexing:mainfrom
Sadeequ:validator_and_concRisk
Open

Validator and conc risk#610
Sadeequ wants to merge 3 commits into
code-flexing:mainfrom
Sadeequ:validator_and_concRisk

Conversation

@Sadeequ

@Sadeequ Sadeequ commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

I implemented depositor concentration risk alerts and a withdrawal queue with fair ordering as requested.

For depositor concentration alerts:

Created RiskService in src/analytics/risk.service.ts that calculates depositor concentration hourly using SQL aggregation
Added depositorConcentrationThreshold column to Vault entity (default 0.5 for 50% threshold)
Extended NotificationType enum with DEPOSITOR_CONCENTRATION type
Integrated RiskService into AnalyticsModule and exposed via GET /vaults/:id/risk-metrics endpoint
Service sends notifications to vault owners when any depositor exceeds the threshold
For withdrawal queue with fair ordering:

Added QUEUED status to WithdrawalStatus enum
Created WithdrawalQueueService to manage FIFO processing of withdrawals when liquidity is insufficient
Modified VaultsService.withdrawFromVault to:
Process withdrawals immediately when sufficient liquidity exists
Queue withdrawals (set status QUEUED) when insufficient liquidity
Process queue after successful deposits
Added controller endpoints for queue position and estimated wait time
Updated VaultsModule to include WithdrawalQueueService
The validation pipe was already properly configured in main.ts with ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true, transformOptions: { enableImplicitConversion: true } }), so no changes were needed there.

Relatated Issue:

CLOSES #477

CLOSES #480

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Sadeequ is attempting to deploy a commit to the vic's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Sadeequ Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

#953 Implement request validation pipe with class-validator #950 Add depositor concentration risk alerts

1 participant