Skip to content

fix(contracts): fix vault share price calculation — wrong denominator causes depositors to lose value#272

Open
wheval wants to merge 2 commits intoSuncrest-Labs:mainfrom
wheval:available_assets
Open

fix(contracts): fix vault share price calculation — wrong denominator causes depositors to lose value#272
wheval wants to merge 2 commits intoSuncrest-Labs:mainfrom
wheval:available_assets

Conversation

@wheval
Copy link
Copy Markdown
Contributor

@wheval wheval commented Apr 23, 2026

Summary

Summary

  • Fix deposit share-price denominator to use gross total_assets during share minting.
  • Fix withdrawal performance fee to charge only on realized yield vs user cost basis.
  • Add regression tests for fee-accrual multi-depositor deposits and post-yield depositor exits.

Why

The previous logic could misprice shares for new depositors after fee accrual and compute performance fee using mismatched units (assets - shares), which could charge fee on principal.

Test Plan

  • Run vault contract tests once wasm artifact path/build setup is restored.
  • Validate second depositor share mint after management fee accrual.
  • Validate no performance fee is charged on principal for post-yield depositors without additional gain.

Closes #156

Closing

Closes #156

…ositors to lose value

- Suncrest-Labs#156: fix(contracts): fix vault share price calculation — wrong denominator causes depositors to lose value

Closes Suncrest-Labs#156
@wheval wheval requested a review from 0xDeon as a code owner April 23, 2026 10:59
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 23, 2026

@wheval 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

@wheval wheval changed the title fix: resolve #156 - fix(contracts): fix vault share price calculation — wrong denominator causes depositors to lose value fix(contracts): fix vault share price calculation — wrong denominator causes depositors to lose value Apr 23, 2026
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.

fix(contracts): fix vault share price calculation — wrong denominator causes depositors to lose value

1 participant