Skip to content

Gate stake, unstake, and set_boost behind pool pause guard#48

Merged
prodbycorne merged 2 commits into
SmartDropLabs:mainfrom
Jennylila:fix/issue-28-pause-guards-stake-boost
Jun 27, 2026
Merged

Gate stake, unstake, and set_boost behind pool pause guard#48
prodbycorne merged 2 commits into
SmartDropLabs:mainfrom
Jennylila:fix/issue-28-pause-guards-stake-boost

Conversation

@Jennylila

Copy link
Copy Markdown
Contributor

Overview

This PR fixes an inconsistency in the farming-pool emergency pause behavior. Previously, pause only blocked lock_assets and unlock_assets, while the boost/stake system (stake, unstake, set_boost) remained callable. This change enforces a unified pause invariant so paused pools cannot accept new stakes or boost changes.

Related Issue

Closes #28

Changes

🛡️ Pause Guard Enforcement

  • [MODIFY] soroban/contracts/farming-pool/src/lib.rs
  • Added pool_is_paused guard to stake
  • Added pool_is_paused guard to unstake
  • Added pool_is_paused guard to set_boost
  • Left set_global_multiplier, pause, and unpause ungated so admins can act during emergencies
  • Updated pause documentation to list all blocked functions

🧪 Tests

  • [MODIFY] soroban/contracts/farming-pool/src/test.rs

  • Added test_pause_blocks_stake and test_unpause_restores_stake

  • Added test_pause_blocks_unstake and test_unpause_restores_unstake

  • Added test_pause_blocks_set_boost and test_unpause_restores_set_boost

  • Added test_set_global_multiplier_callable_while_paused to confirm admin ops still work while paused

  • [ADD] soroban/contracts/farming-pool/test_snapshots/test/*.json

  • Added test snapshots for the new pause-guard coverage

Verification Results

Acceptance Criteria Status
stake blocked when pool is paused
unstake blocked when pool is paused
set_boost blocked when pool is paused
set_global_multiplier remains callable while paused
Test: paused → call → expect rejection (stake/unstake/set_boost)
Test: unpause → call → expect success (stake/unstake/set_boost)
cargo test -p farming-pool ✅ passed (57/57)

Test plan

  • Run cargo test -p farming-pool and confirm all tests pass
  • Confirm stake, unstake, and set_boost revert while paused
  • Confirm those functions succeed again after unpause
  • Confirm set_global_multiplier still works while paused

Jennylila and others added 2 commits June 27, 2026 17:56
Closes SmartDropLabs#28 by blocking boost/stake operations during an emergency pause while keeping admin functions like set_global_multiplier callable.
@prodbycorne prodbycorne merged commit 35f2850 into SmartDropLabs:main Jun 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

farming-pool: pause does not block set_boost, set_global_multiplier, or admin functions

2 participants