-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
:source-highlighter: highlight.js | ||
:highlightjs-languages: rust | ||
:github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>] | ||
= Fungible Token Standard | ||
|
||
== Source Code link: https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/utils/pausable[pausable] | ||
|
||
== 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: | ||
```rust | ||
#[when_paused] | ||
pub fn emergency_reset(e: &Env) { | ||
e.storage().instance().set(&DataKey::Counter, &0); | ||
} | ||
``` | ||
|
||
Which will expand into the below code: | ||
|
||
```rust | ||
pub fn emergency_reset(e: &Env) { | ||
when_paused(e); | ||
|
||
e.storage().instance().set(&DataKey::Counter, &0); | ||
} | ||
``` |