Skip to content

fix: validate factory admin, add has_position, document credit rate behavior - #214

Merged
ritaifeoluwa merged 5 commits into
SmartDropLabs:mainfrom
oomokaro1:fix/issue-195-194-196-197-v2
Aug 28, 2026
Merged

fix: validate factory admin, add has_position, document credit rate behavior#214
ritaifeoluwa merged 5 commits into
SmartDropLabs:mainfrom
oomokaro1:fix/issue-195-194-196-197-v2

Conversation

@oomokaro1

Copy link
Copy Markdown
Contributor

Closes #196, Closes #197, Closes #195, Closes #194

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update

Summary

Four targeted fixes across the factory and farming-pool contracts:

  1. initialize does not validate admin is not zero address #196: Factory initialize now rejects zero-address admin, preventing permanent admin lock.
  2. No lightweight has_position/has_stake check in FarmingPool #197: Added has_position lightweight existence check to FarmingPool, cheaper than get_user_position for UI conditional rendering.
  3. set_credit_rate does not checkpoint existing users #195: Documented that set_credit_rate does not checkpoint existing users — the new rate applies at next user interaction.
  4. No credit accrual history tracking in FarmingPool #194: Documented that credit accrual history is not tracked on-chain; off-chain indexers must subscribe to events.

Motivation / Context

These issues span security hardening (#196), developer experience (#197), and documentation gaps (#195, #194). Each fix is minimal and non-breaking.

Closes #196, Closes #197, Closes #195, Closes #194

Reject zero-address admin during factory initialization to prevent
permanent admin lock. A zero-address admin would make all admin
functions (create_pool, transfer_admin, upgrade_pool, etc.)
unusable since no address can authorize calls.

Closes SmartDropLabs#196
Add a has_position function that returns whether a user has an active
locked position without computing uncommitted credit accrual. This is
cheaper than get_user_position for UI conditional rendering use cases
where only existence matters.

Closes SmartDropLabs#197
… tracking

- Clarify that set_credit_rate does not checkpoint existing users:
  the new rate applies only at next user interaction. Off-chain
  indexers should apply the rate from the rate_set event for users
  who have not yet checkpointed.

- Document that credit accrual history is not tracked on-chain:
  only the current total is available via get_credits. Off-chain
  indexers must subscribe to staking/locking events and maintain
  their own running ledger to reconstruct earnings over time.

Closes SmartDropLabs#195, Closes SmartDropLabs#194
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

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

@netlify

netlify Bot commented Aug 28, 2026

Copy link
Copy Markdown

Deploy Preview for sdcontracts ready!

Name Link
🔨 Latest commit 50839b5
🔍 Latest deploy log https://app.netlify.com/projects/sdcontracts/deploys/6a92053d032ea300089023b7
😎 Deploy Preview https://deploy-preview-214--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.

@ritaifeoluwa
ritaifeoluwa merged commit a9a3175 into SmartDropLabs:main Aug 28, 2026
3 of 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