fix: validate factory admin, add has_position, document credit rate behavior - #214
Merged
ritaifeoluwa merged 5 commits intoAug 28, 2026
Merged
Conversation
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
|
@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! 🚀 |
✅ Deploy Preview for sdcontracts ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #196, Closes #197, Closes #195, Closes #194
Type of Change
Summary
Four targeted fixes across the factory and farming-pool contracts:
initializenow rejects zero-address admin, preventing permanent admin lock.has_positionlightweight existence check to FarmingPool, cheaper thanget_user_positionfor UI conditional rendering.set_credit_ratedoes not checkpoint existing users — the new rate applies at next user interaction.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