Attribute Macro stellar_axelar_std_derive::when_not_paused

source ·
#[when_not_paused]
Expand description

Ensure that the Stellar contract is not paused before executing the function.

The first argument to the function must be env, and a ContractError error type must be defined in scope, with a ContractPaused variant.

§Example

use stellar_axelar_std::{Pausable, when_not_paused};

#[contracttype]
pub enum ContractError {
    ContractPaused = 1,
}

#[contract]
#[derive(Pausable)]
pub struct Contract;

#[contractimpl]
impl Contract {
    #[when_not_paused]
    pub fn transfer(env: &Env, to: Address, amount: String) {
        // ... transfer logic ...
    }
}