Skip to content

feat(security_registry): add granular deposit, withdraw and swap pause flags (#1163) - #1304

Open
AdaBliss wants to merge 1 commit into
ceejaylaboratory:mainfrom
AdaBliss:feat/issue-1163-granular-pause-levels
Open

AdaBliss wants to merge 1 commit into
ceejaylaboratory:mainfrom
AdaBliss:feat/issue-1163-granular-pause-levels

Conversation

@AdaBliss

Copy link
Copy Markdown

closes #1163

Summary

Adds granular pause levels to src/security_registry/lib.rs, so the security team can halt risky operations (for example deposits) while users can still withdraw.

Changes

  • New PauseState { deposits_paused, withdrawals_paused, swaps_paused } struct (contracttype, Default), stored under DataKey::PauseFlags.
  • set_pause_flags(admin, flags): super-admin only (same auth and admin check as pause). It extends instance TTL like the other admin setters.
  • is_deposit_paused(), is_withdraw_paused(), is_swap_paused(): effective state for each operation.
  • get_pause_flags(): raw configured flags (defaults to all false).

Design notes

  • The existing global pause / unpause / is_paused kill switch is unchanged, so current integrators (for example escrow_timelock, which calls is_paused) keep working. The granular queries return true when either the global pause or the specific flag is set. The global switch always wins, and granular flags never engage the global pause.
  • is_swap_paused is included alongside the two helpers named in the issue because the struct has a swaps_paused flag.

Verification

  • cargo test --lib -p anchorpoint-security-registry: 11 passed (3 existing + 8 new), covering defaults, deposit-only, withdraw-only and swap-only states, clearing flags, the global pause overriding flags, admin auth plus TTL extension, and rejection of non-admin callers.
  • cargo clippy -p anchorpoint-security-registry --all-targets --all-features -- -D warnings (the CI command): clean.
  • cargo build -p anchorpoint-security-registry --target wasm32v1-none --release: OK.
  • The companion PR for [Soroban/SecurityRegistry] Implement Emergency Admin Transfer with Two-Step Handshake #1164 edits the same file. I placed the changes in separate regions and checked that the two branches merge cleanly together (21 tests pass on the combined result).

…e flags (ceejaylaboratory#1163)

Introduce a PauseState struct (deposits_paused, withdrawals_paused,
swaps_paused) stored alongside the existing global pause. The super
admin sets it with set_pause_flags, and integrators query the effective
state via is_deposit_paused, is_withdraw_paused and is_swap_paused,
which also honour the global kill switch. get_pause_flags exposes the
raw configuration. Includes unit tests for partial pause states.
@drips-wave

drips-wave Bot commented Sep 28, 2026

Copy link
Copy Markdown

@AdaBliss 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

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.

[Soroban/SecurityRegistry] Add Granular Pause Levels (Deposit-Only & Withdraw-Only)

1 participant