From 75521fe13f294743534ac8ef034d21d23e3473b0 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 29 Jul 2026 13:16:43 +0000 Subject: [PATCH] Add is_paused method to check token contract pause state This implements the token transfer hooks pause state checking as described in issue #457: - Added is_paused() method to BcForgeToken contract that exposes the lifecycle module's pause state - Added isPaused() method to bcForgeClient SDK for checking if the contract is paused before performing operations Co-authored-by: openhands --- contracts/token/src/lib.rs | 6 ++++++ sdk/src/client.ts | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/contracts/token/src/lib.rs b/contracts/token/src/lib.rs index 49b1e981..fb000434 100644 --- a/contracts/token/src/lib.rs +++ b/contracts/token/src/lib.rs @@ -367,6 +367,12 @@ impl BcForgeToken { Ok(()) } + /// Returns whether the contract is currently paused. + pub fn is_paused(env: Env) -> bool { + Self::panic_on_err(&env, Self::ensure_initialized(&env)); + bc_forge_lifecycle::is_paused(&env) + } + /// Upgrades the contract's executable to `new_wasm_hash`. /// /// Gated to `Role::SuperAdmin` (or `Role::Admin`, which is a superset of diff --git a/sdk/src/client.ts b/sdk/src/client.ts index b9783a14..fb5a3a60 100644 --- a/sdk/src/client.ts +++ b/sdk/src/client.ts @@ -419,6 +419,16 @@ export class bcForgeClient { return this.invokeContract('unpause', [], source); } + /** + * Check if the token contract is currently paused. + * + * @returns True if the contract is paused, false otherwise. + */ + async isPaused(): Promise { + const result = await this.queryContract('is_paused', []); + return scValToNative(result) as boolean; + } + // ─── Offline Transaction Builders ────────────────────────────────────────── /**