Skip to content

Implement vault TVL high watermark tracking#619

Merged
vic-Gray merged 1 commit into
code-flexing:mainfrom
David-282:feature/vault-tvl-watermark
Jun 29, 2026
Merged

Implement vault TVL high watermark tracking#619
vic-Gray merged 1 commit into
code-flexing:mainfrom
David-282:feature/vault-tvl-watermark

Conversation

@David-282

Copy link
Copy Markdown
Contributor

Implement Vault TVL High Watermark Tracking

closes #508

Summary

This PR implements tracking of each vault's all-time high Total Value Locked (TVL) watermark and exposes it through the API. The watermark is updated only when a vault reaches a new all-time high, ensuring the value is monotonically increasing and can be used as a historical popularity metric.

Changes Made

Database / Entity

  • Added tvlAtHighWatermark field to the Vault entity.
  • Added watermarkAchievedAt field to record when the highest TVL was achieved.

Business Logic

  • Updated VaultsService.deposit() to evaluate the vault's TVL after recalculation.
  • Added logic to update the high watermark only when the current TVL exceeds the previous recorded watermark.
  • Ensured the watermark never decreases.

API

  • Exposed tvlAtHighWatermark and watermarkAchievedAt in:

    • Vault detail endpoint
    • Vault list endpoint
  • Added GET /vaults/leaderboard/tvl endpoint to return vaults ranked by their all-time highest TVL.

Testing

  • Updated VaultFactory to include the new watermark fields for test data generation.

  • Added/updated service tests to verify:

    • Watermark is updated when a new high TVL is reached.
    • Watermark does not decrease when TVL falls.
    • Watermark timestamp is updated only when a new high is achieved.
    • Leaderboard returns vaults ordered by highest TVL watermark.

Acceptance Criteria Checklist

  • Each vault has tvlAtHighWatermark and watermarkAchievedAt.
  • Watermark updates whenever the current TVL exceeds the previous high.
  • Watermark is exposed in vault detail and vault list APIs.
  • Added GET /vaults/leaderboard/tvl.
  • Watermark is monotonically increasing and never decreases.

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@David-282 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 28, 2026

Copy link
Copy Markdown

@David-282 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

@vic-Gray vic-Gray merged commit 72c2f90 into code-flexing:main Jun 29, 2026
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.

#981 Implement vault TVL watermark tracking

2 participants