Utilities
Purpose
Allows contracts to be paused and unpaused by authorized accounts.
This utility contract can be used with any token standard (fungible, non-fungible, multi-token).
Design
To make it easier to spot when inspecting the code, we turned this simple functionality into a macro that can annotate your smart contract functions.
An example:
#[when_paused]
pub fn emergency_reset(e: &Env) {
e.storage().instance().set(&DataKey::Counter, &0);
}
Which will expand into the below code:
pub fn emergency_reset(e: &Env) {
when_paused(e);
e.storage().instance().set(&DataKey::Counter, &0);
}