feat: add active stake check, analytics getters, enriched lock_assets… - #268
Open
ExcelDsigN-tech wants to merge 1 commit into
Open
Conversation
… event, and fix position credit accounting - set_boost now rejects callers with no active stake (stake or lock_assets) - add active_stake_count() getter tracking lock/unlock lifecycle - add credit_rate_change_count() getter tracking admin rate changes - lock_assets event now emits (user, amount, total_position) instead of just (user, amount) - set_credit_rate event now includes ledger_sequence as third field - checkpoint_position now tracks position credits in total_distributed_credits - position credits no longer apply boost multiplier (boost only affects stake credits) - fix test assertions to match new event shapes and Soroban test env behavior
✅ Deploy Preview for sdcontracts ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@ExcelDsigN-tech 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! 🚀 |
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.
feat: Active stake guard, analytics getters, enriched lock_assets event, and position credit fixes
Closes #237, Closes #240, Closes #242, Closes #264
Overview
Adds operational safeguards and observability features to the
FarmingPoolsmart contract, while resolving a position credit accounting bug where boost multipliers were incorrectly applied to locked-position accruals.Feature Summary
set_boostto prevent callers without staked or locked assets from configuring boostactive_stake_countandcredit_rate_change_countlockedandrate_setto expose position totals and ledger sequence numbers to indexersUserStakepathdocs/events.md) to reflect the new event schemasTechnical Implementation
soroban/contracts/farming-pool/src/lib.rs):set_boostto verify active stake or locked assets before allowing boost updatescalculate_credits,get_user_position, andget_creditscheckpoint_positionto ensure accrued position credits are added tototal_distributed_creditssoroban/contracts/farming-pool/src/types.rs,src/lib.rs):DataKey::ActiveStakeCountandDataKey::CreditRateChangeCountvariants to storage keysactive_stake_count() -> u32tracking users with active positions (incremented onstake/lock_assets, decremented onunstake/unlock_assets)credit_rate_change_count() -> u32tracking historical admin calls toset_credit_ratesoroban/contracts/farming-pool/src/lib.rs,docs/events.md):lockedevent topic/data schema to(user, amount, total_position)rate_setevent topic/data schema to(old_rate, new_rate, ledger_sequence)docs/events.mdTest Coverage
soroban/contracts/farming-pool/src/test.rs)Checklists
set_boostactive_stake_countandcredit_rate_change_countanalytics getterslockedandrate_setevent schemas with extra contextual fieldscheckpoint_positionproperly updatestotal_distributed_creditsdocs/events.mdwith revised event structures