Skip to content

Add creator to pool_crtd event, per-admin pool count, vesting revoked getter, and clarify get_stake - #271

Merged
ritaifeoluwa merged 1 commit into
SmartDropLabs:mainfrom
meshackyaro:fix/233-234-235-236-factory-getters-and-events
Aug 29, 2026
Merged

Add creator to pool_crtd event, per-admin pool count, vesting revoked getter, and clarify get_stake#271
ritaifeoluwa merged 1 commit into
SmartDropLabs:mainfrom
meshackyaro:fix/233-234-235-236-factory-getters-and-events

Conversation

@meshackyaro

Copy link
Copy Markdown
Contributor

Summary

Closes #233, Closes #234, Closes #235, Closes #236

  • create_pool event does not include creator admin address #233Factory::create_pool's pool_crtd event now includes the pool's admin address alongside the existing fields, so off-chain indexers can attribute pool creation to its creator without a follow-up RPC call.
  • No per-admin pool count in Factory #236 — Added Factory::get_admin_pool_count(admin), a cheap companion to the existing get_pools_by_admin for callers who only need the count rather than the full pool-ID list.
  • No public is_revoked getter in vesting wallet #235 — Added a public VestingWallet::revoked() getter (mirroring the existing revocable()), so frontends can check revocation status directly instead of inferring it from a failed revoke() call.
  • get_stake returns raw data without computed credits #234FarmingPool::get_stake already computes credits_banked on the fly (matching get_credits) rather than returning a stale checkpoint; documented this explicitly, including what it does and does not cover relative to get_credits (it's the flexible/boost system only — a user's locked Position or banked emergency_withdraw credits aren't included).

Also included: repairs a broken main

While building on main to work these issues, cargo check failed on both the factory and farming-pool crates — 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 ever landing in types.rs, plus a duplicate add_total_credits definition. Restored the missing DataKey variants/helper and removed the duplicate so both crates build again — this is what get_pools_by_admin/get_admin_pool_count for #236 build on top of.

That same merge had also silently zeroed factory's MIN_LOCK_PERIOD constant (10), disabling the flash-loan-lock-period guard entirely (min_lock_period < MIN_LOCK_PERIOD is unreachable when the floor is 0, which is also why cargo clippy denies it as absurd_extreme_comparisons). Restored it to its original value of 1.

Also cleared the workspace's cargo fmt/cargo clippy --all-targets -- -D warnings backlog (unused imports, missing #[allow(deprecated)] on a couple of event publish calls, an unnecessary mut, a manual div_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 --release
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace — 249 tests pass (factory: 68 unit + 5 integration, farming-pool: 143, vesting-wallet: 33), including new tests for get_admin_pool_count and revoked() and the updated pool_crtd payload assertion.

…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.
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@netlify

netlify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploy Preview for sdcontracts ready!

Name Link
🔨 Latest commit f32acfd
🔍 Latest deploy log https://app.netlify.com/projects/sdcontracts/deploys/6a92dc437fbe520008ef2b53
😎 Deploy Preview https://deploy-preview-271--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 2a8ae61 into SmartDropLabs:main Aug 29, 2026
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