Add creator to pool_crtd event, per-admin pool count, vesting revoked getter, and clarify get_stake - #271
Merged
ritaifeoluwa merged 1 commit intoAug 29, 2026
Conversation
…esting revoked getter, and clarify get_stake credits Closes SmartDropLabs#233, Closes SmartDropLabs#234, Closes SmartDropLabs#235, Closes SmartDropLabs#236 - factory: create_pool's pool_crtd event now includes the pool's admin address so off-chain indexers can attribute pool creation (SmartDropLabs#233). - factory: add get_admin_pool_count(admin), a cheap companion to the existing get_pools_by_admin for callers who only need the count (SmartDropLabs#236). - vesting-wallet: add a public revoked() getter so frontends can check revocation status without calling revoke() (SmartDropLabs#235). - farming-pool: document that get_stake's credits_banked is computed on the fly (matching get_credits), not a stale checkpoint, and what it does and does not include relative to get_credits (SmartDropLabs#234). Restores the factory and farming-pool crates to a buildable, lint-clean state: a bad merge (7ad7297/8f02987/b8cdf76) had left lib.rs referencing DataKey::PoolsByAdmin, DataKey::PoolsByWasmHash, BoostCount, TotalLocked, TotalDeposits, TotalWithdrawals, TotalBoostAlloc, and BoostUserCount without the corresponding enum variants, a duplicate add_total_credits definition, and MIN_LOCK_PERIOD silently zeroed (disabling the flash-loan-lock-period guard entirely). Also clears the workspace's cargo fmt/clippy backlog (-D warnings) so CI's fmt/clippy/test steps are green again.
|
@meshackyaro 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.
Summary
Closes #233, Closes #234, Closes #235, Closes #236
Factory::create_pool'spool_crtdevent now includes the pool'sadminaddress alongside the existing fields, so off-chain indexers can attribute pool creation to its creator without a follow-up RPC call.Factory::get_admin_pool_count(admin), a cheap companion to the existingget_pools_by_adminfor callers who only need the count rather than the full pool-ID list.VestingWallet::revoked()getter (mirroring the existingrevocable()), so frontends can check revocation status directly instead of inferring it from a failedrevoke()call.FarmingPool::get_stakealready computescredits_bankedon the fly (matchingget_credits) rather than returning a stale checkpoint; documented this explicitly, including what it does and does not cover relative toget_credits(it's the flexible/boost system only — a user's lockedPositionor bankedemergency_withdrawcredits aren't included).Also included: repairs a broken
mainWhile building on
mainto work these issues,cargo checkfailed on both thefactoryandfarming-poolcrates — a bad merge (7ad7297/8f02987/b8cdf76) had leftlib.rsreferencingDataKey::PoolsByAdmin,DataKey::PoolsByWasmHash,BoostCount,TotalLocked,TotalDeposits,TotalWithdrawals,TotalBoostAlloc, andBoostUserCountwithout the corresponding enum variants ever landing intypes.rs, plus a duplicateadd_total_creditsdefinition. Restored the missingDataKeyvariants/helper and removed the duplicate so both crates build again — this is whatget_pools_by_admin/get_admin_pool_countfor #236 build on top of.That same merge had also silently zeroed
factory'sMIN_LOCK_PERIODconstant (1→0), disabling the flash-loan-lock-period guard entirely (min_lock_period < MIN_LOCK_PERIODis unreachable when the floor is0, which is also whycargo clippydenies it asabsurd_extreme_comparisons). Restored it to its original value of1.Also cleared the workspace's
cargo fmt/cargo clippy --all-targets -- -D warningsbacklog (unused imports, missing#[allow(deprecated)]on a couple of eventpublishcalls, an unnecessarymut, a manualdiv_ceil,assert_eq!(x, bool)→assert!, and one genuinely-unreachable helper marked#[allow(dead_code)]with an explanation) so CI's fmt/clippy/test steps are green again.Test plan
cargo build --workspace --target wasm32v1-none --releasecargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace— 249 tests pass (factory: 68 unit + 5 integration, farming-pool: 143, vesting-wallet: 33), including new tests forget_admin_pool_countandrevoked()and the updatedpool_crtdpayload assertion.