From c4266975cc5c94d0262a9ec6727b4b6be812b018 Mon Sep 17 00:00:00 2001 From: Ozgun Ozerk Date: Wed, 29 Jan 2025 16:57:17 +0300 Subject: [PATCH 1/2] docs update --- docs/modules/ROOT/pages/index.adoc | 9 ++++- docs/modules/ROOT/pages/tokens/fungible.adoc | 39 ++++++++++++++++++-- docs/modules/ROOT/pages/utils/pausable.adoc | 35 ++++++++++++++++++ 3 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 docs/modules/ROOT/pages/utils/pausable.adoc diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index a60d4e5..9cd83c2 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -12,10 +12,15 @@ Explore our implementations for token standards on Stellar Soroban: - **Non-Fungible Tokens**: Unique digital assets with verifiable ownership (work in progress). - **Multi-Token**: Hybrid tokens enabling both fungible and non-fungible token functionalities (work in progress). -== Audits +== Utilities +Discover our utility contracts for Stellar Soroban, applicable to all token standards mentioned above: + +- **xref:utils/pausable.adoc[Pausable]**: + +// == Audits // TODO: You can find our audit reports here. -== Get Started +// == Get Started // TODO: link to the Wizard diff --git a/docs/modules/ROOT/pages/tokens/fungible.adoc b/docs/modules/ROOT/pages/tokens/fungible.adoc index e079e8c..c366d8d 100644 --- a/docs/modules/ROOT/pages/tokens/fungible.adoc +++ b/docs/modules/ROOT/pages/tokens/fungible.adoc @@ -3,7 +3,7 @@ :github-icon: pass:[] = Fungible Token Standard -== Source Code link: // TODO +== Source Code https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible[Fungible] == Purpose @@ -11,5 +11,38 @@ The Fungible Token Standard is a contract template designed to facilitate the cr It provides a flexible and secure framework for defining and managing token standards, enabling developers to create and manage tokens with ease. == Extensions -* Mintable: // TODO -* Burnable: // TODO + +We provide the below extensions to enhance the capabilities of the Fungible Token Standard. + +=== Mintable +==== Source Code https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/mintable[Mintable] + +The `Mintable` trait extends the `FungibleToken` trait to provide the capability to mint tokens. + +==== Events +* `mint_event` : broadcasted to the network when the `mint()` function is invoked. + +=== Burnable +==== Source Code https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/burnable[Burnable] + +The `Burnable` trait extends the `FungibleToken` trait to provide the +capability to burn tokens. + +To fully comply with the SEP-41 specification one have to implement the +this `Burnable` trait along with the `[FungibleToken]` trait. +SEP-41 mandates support for token burning to be considered compliant. + +Excluding the `burn` functionality from the `[FungibleToken]` trait +is a deliberate design choice to accommodate flexibility and customization +for various smart contract use cases. + +==== Events +* `burn_event`: broadcasted to the network when the `burn()` or `burn_from()` function is invoked. + +=== Metadata +==== Source Code https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/metadata[Metadata] + +Provides `setter` and `getter` methods for `symbol`, `name`, and `decimal` metadata information for your token. + +==== Events +There are no custom events associated with the `Metadata` trait. diff --git a/docs/modules/ROOT/pages/utils/pausable.adoc b/docs/modules/ROOT/pages/utils/pausable.adoc new file mode 100644 index 0000000..204f83e --- /dev/null +++ b/docs/modules/ROOT/pages/utils/pausable.adoc @@ -0,0 +1,35 @@ +:source-highlighter: highlight.js +:highlightjs-languages: rust +:github-icon: pass:[] += 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); +} +``` From a5726c091c83fa8b2c1b0433f9c271037db84c39 Mon Sep 17 00:00:00 2001 From: Ozgun Ozerk Date: Wed, 29 Jan 2025 17:05:02 +0300 Subject: [PATCH 2/2] formatting --- docs/modules/ROOT/pages/index.adoc | 2 +- docs/modules/ROOT/pages/tokens/fungible.adoc | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index 9cd83c2..41aaf32 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -15,7 +15,7 @@ Explore our implementations for token standards on Stellar Soroban: == Utilities Discover our utility contracts for Stellar Soroban, applicable to all token standards mentioned above: -- **xref:utils/pausable.adoc[Pausable]**: +- **xref:utils/pausable.adoc[Pausable]** // == Audits // TODO: You can find our audit reports here. diff --git a/docs/modules/ROOT/pages/tokens/fungible.adoc b/docs/modules/ROOT/pages/tokens/fungible.adoc index c366d8d..dde7aa2 100644 --- a/docs/modules/ROOT/pages/tokens/fungible.adoc +++ b/docs/modules/ROOT/pages/tokens/fungible.adoc @@ -3,7 +3,7 @@ :github-icon: pass:[] = Fungible Token Standard -== Source Code https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible[Fungible] +https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible[Source Code] == Purpose @@ -14,17 +14,19 @@ It provides a flexible and secure framework for defining and managing token stan We provide the below extensions to enhance the capabilities of the Fungible Token Standard. -=== Mintable -==== Source Code https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/mintable[Mintable] +=== - Mintable +https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/mintable[Source Code] +==== Summary The `Mintable` trait extends the `FungibleToken` trait to provide the capability to mint tokens. ==== Events * `mint_event` : broadcasted to the network when the `mint()` function is invoked. -=== Burnable -==== Source Code https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/burnable[Burnable] +=== - Burnable +https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/burnable[Source Code] +==== Summary The `Burnable` trait extends the `FungibleToken` trait to provide the capability to burn tokens. @@ -39,9 +41,10 @@ for various smart contract use cases. ==== Events * `burn_event`: broadcasted to the network when the `burn()` or `burn_from()` function is invoked. -=== Metadata -==== Source Code https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/metadata[Metadata] +=== - Metadata +https://github.com/OpenZeppelin/stellar-contracts/tree/main/contracts/token/fungible/src/extensions/metadata[Source Code] +==== Summary Provides `setter` and `getter` methods for `symbol`, `name`, and `decimal` metadata information for your token. ==== Events