Skip to content

fix(farming-pool): credit total_deposits and guard it in lock_assets - #594

Merged
ritaifeoluwa merged 2 commits into
SmartDropLabs:mainfrom
goldandrew:fix/farming-pool-stake-validation-hardening
Oct 21, 2026
Merged

ritaifeoluwa merged 2 commits into
SmartDropLabs:mainfrom
goldandrew:fix/farming-pool-stake-validation-hardening

Conversation

@goldandrew

@goldandrew goldandrew commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

closes #464, closes #465, closes #466, closes #467 (all four issues describe the same farming-pool stake validation problem; their bodies do not name a specific defect, so this PR is scoped to the concrete gap found by reading the code).

Changes

  • lock_assets now credits TotalDeposits. The field is documented as tracking deposits from both stake and lock_assets, but lock_assets never updated it, so total_deposits and the tvl_ratio in get_pool_analytics understated the pool's deposits.
  • lock_assets checks the pool-wide deposit total for overflow before any write, the same pre-write guard stake already uses, returning ExceedsMaxStake instead of trapping in add_total_deposits.
  • Tests: test_lock_assets_credits_total_deposits and test_lock_assets_overflowing_total_deposits_returns_typed_error_without_writing_state.

Testing

Not run in this environment: build and test commands were excluded by request. Please run make test before merging.

@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for sdcontracts ready!

Name Link
🔨 Latest commit 5845340
🔍 Latest deploy log https://app.netlify.com/projects/sdcontracts/deploys/6ad87db63b7c9b9e9cb6b4b7
😎 Deploy Preview https://deploy-preview-594--sdcontracts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

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

lock_assets never added the deposit to TotalDeposits, although the
field is documented as tracking deposits from both stake and
lock_assets. That left total_deposits and the tvl_ratio in
get_pool_analytics understating the pool's deposits.

lock_assets now checks the pool-wide deposit total for overflow before
any write, matching stake, and credits TotalDeposits alongside
total_staked and total_locked.

Refs SmartDropLabs#464, SmartDropLabs#465, SmartDropLabs#466, SmartDropLabs#467
@goldandrew
goldandrew force-pushed the fix/farming-pool-stake-validation-hardening branch from f551d71 to d069f91 Compare October 21, 2026 00:32
@ritaifeoluwa
ritaifeoluwa merged commit 5fc3554 into SmartDropLabs:main Oct 21, 2026
4 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

2 participants