getters: last_checkpoint_ledger (#255), vesting_dates (#256), emergency_withdrawal_count (#257), upgrade_count (#258) - #265
Merged
Conversation
…martDropLabs#256), emergency_withdrawal_count (SmartDropLabs#257), upgrade_count (SmartDropLabs#258) - SmartDropLabs#255: farming-pool gains `last_checkpoint_ledger(user) -> Option<u32>`, returning `UserStake.start_ledger` (which `checkpoint` resets on every stake/unstake/set_boost) or None when the user has no active stake. - SmartDropLabs#256: vesting-wallet gains `vesting_dates() -> Result<(u32, u32, u32), VestingError>` returning (start, cliff, end) in one read for schedule display; `require_initialized` gated like the other views. - SmartDropLabs#257: farming-pool now keeps `DataKey::EmergencyWithdrawalCount`, incremented on each successful `emergency_withdraw`, exposed via `emergency_withdrawal_count() -> u32` for risk monitoring. - SmartDropLabs#258: factory now keeps `DataKey::UpgradeCount`, incremented on each successful `upgrade_pool`, exposed via `upgrade_count() -> Result<u32, FactoryError>` for version tracking. Also adds the missing `DataKey::StakedUserCount` variant to farming-pool's enum — `increment_staked_user_count` / `decrement_staked_user_count` already reference it but it was never declared. Not built or tested locally.
✅ Deploy Preview for sdcontracts ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@thefadah 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.
Four small analytics/UX getters requested across the farming-pool, vesting-wallet, and factory contracts.
#255 —
last_checkpoint_ledgeron FarmingPoolcheckpoint()resetsUserStake.start_ledgerto the current ledger on everystake/unstake/set_boost, so it is the origin the user's next credit accrual is measured from — it just wasn't exposed.Returns that ledger, or
Nonewhen the user has no active continuous stake.#256 —
vesting_dateson the vesting walletThe three schedule ledgers were only reachable one private getter at a time.
Returns
(start_ledger, cliff_ledger, end_ledger)in a single read,require_initialized-gated likeget_vesting_schedule.#257 —
emergency_withdrawal_counton FarmingPoolNew
DataKey::EmergencyWithdrawalCount, incremented on each successfulemergency_withdraw(right before theemrg_exitevent), exposed via:#258 —
upgrade_counton FactoryNew
DataKey::UpgradeCount, incremented on each successfulupgrade_pool(right before thepool_upgevent), exposed via:Incidental
farming-pool/src/lib.rsalready callsenv.storage().instance().get/set(&DataKey::StakedUserCount, …)inincrement_staked_user_count/decrement_staked_user_count, butDataKey::StakedUserCountwas never declared in the enum. Added it.#[contracttype]enum keys encode by variant name, so adding variants does not change any existing on-chain key.Not built or tested locally.
Closes #255
Closes #256
Closes #257
Closes #258