Skip to content

implement optional insurance fund system for vaults#612

Merged
vic-Gray merged 2 commits into
code-flexing:mainfrom
mrmoney10010-design:feature/vault-activity-feed
Jun 28, 2026
Merged

implement optional insurance fund system for vaults#612
vic-Gray merged 2 commits into
code-flexing:mainfrom
mrmoney10010-design:feature/vault-activity-feed

Conversation

@mrmoney10010-design

Copy link
Copy Markdown

Area: backend · Effort: L

What: Implement an optional insurance fund that vault operators can fund to cover depositor losses in the event of a smart contract exploit or strategy failure.

Why: Insurance funds are a powerful trust signal that separates professional vault operators from anonymous ones. They directly address the biggest user concern: 'what if I lose my funds?'

closes #578

- Add InsuranceClaim entity with vault/depositor relationships and status tracking
- Create InsuranceFundService with Soroban multisig escrow, coverage ratio calculation
- Add depositToFund, processIncident, declareIncident methods with proper auth
- Implement pro-rata payout distribution when insufficient insurance funds
- Add duplicate claim prevention for incident workflow
- Create getAuditTrail for public on-chain auditability
- Add InsuranceFundController with REST endpoints
- Add comprehensive unit and integration tests (47 tests passing)
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

Someone 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

@mrmoney10010-design 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

testersweb0-bug pushed a commit to testersweb0-bug/Harvest-Finance that referenced this pull request Jun 28, 2026
Remove the redundant bcrypt.compare call that re-verified the token
after it had already been confirmed inside the activeUsers loop.

The MoreThan(new Date()) query ensures only users whose
resetPasswordExpires > NOW() are loaded from the database, so
expired tokens are rejected at the query level before any
token-hash comparison occurs.

Add explicit User | null type annotation on the loop accumulator to
resolve the TypeScript narrowing error introduced by the implicit null
start value.

Update auth.service.spec.ts:
- Add find: jest.fn() to the mock repository (the service uses find(),
  not findOne(), for this flow)
- Replace the broken tests that were mocking findOne with correct
  find-based tests
- Add coverage for: no active tokens, hash mismatch, null token,
  successful reset, and expired-token rejection

Fixes code-flexing#315
Fixes code-flexing#612
@vic-Gray vic-Gray merged commit cb234dc into code-flexing:main Jun 28, 2026
18 of 19 checks passed
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.

#1051 Add vault insurance fund mechanism

2 participants