diff --git a/contracts/admin/src/lib.rs b/contracts/admin/src/lib.rs index 5049ea0e..da7780ec 100644 --- a/contracts/admin/src/lib.rs +++ b/contracts/admin/src/lib.rs @@ -770,7 +770,7 @@ impl AdminContract { // Verify new owner is different from current owner if new_owner == current_owner { - panic_with_error!(&e, ContractError::InvalidPauseAction); + panic_with_error!(&e, ContractError::AdminUnchanged); } // Verify new owner is a SuperAdmin diff --git a/contracts/admin/src/pausable.rs b/contracts/admin/src/pausable.rs index 6882306a..9d3085b2 100644 --- a/contracts/admin/src/pausable.rs +++ b/contracts/admin/src/pausable.rs @@ -310,12 +310,18 @@ pub fn execute_pause_proposal(e: &Env, proposal_id: u64) { } fn do_pause(e: &Env, proposal_id: Option, reason: &String) { + if is_paused(e) { + panic_with_error!(e, ContractError::ContractPaused); + } e.storage().instance().set(&DataKey::Paused, &true); e.events() .publish((Symbol::new(e, "paused"),), (proposal_id, reason.clone())); } fn do_unpause(e: &Env, proposal_id: Option) { + if !is_paused(e) { + panic_with_error!(e, ContractError::InvalidPauseAction); + } e.storage().instance().set(&DataKey::Paused, &false); e.events() .publish((Symbol::new(e, "unpaused"),), proposal_id); diff --git a/contracts/arbitration/src/pausable.rs b/contracts/arbitration/src/pausable.rs index 61ac8833..778b48c7 100644 --- a/contracts/arbitration/src/pausable.rs +++ b/contracts/arbitration/src/pausable.rs @@ -242,12 +242,18 @@ pub fn execute_pause_proposal(e: &Env, proposal_id: u64) { } fn do_pause(e: &Env, proposal_id: Option, reason: &String) { + if is_paused(e) { + panic_with_error!(e, ContractError::ContractPaused); + } e.storage().instance().set(&DataKey::Paused, &true); e.events() .publish((Symbol::new(e, "paused"),), (proposal_id, reason.clone())); } fn do_unpause(e: &Env, proposal_id: Option) { + if !is_paused(e) { + panic_with_error!(e, ContractError::InvalidPauseAction); + } e.storage().instance().set(&DataKey::Paused, &false); e.events() .publish((Symbol::new(e, "unpaused"),), proposal_id);