diff --git a/docusaurus/docs/examples/using-odra-modules.md b/docusaurus/docs/examples/using-odra-modules.md index 38f4da0aa..ce3ecc542 100644 --- a/docusaurus/docs/examples/using-odra-modules.md +++ b/docusaurus/docs/examples/using-odra-modules.md @@ -164,7 +164,7 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. [Installation guide]: ../getting-started/installation.md diff --git a/docusaurus/docs/tutorials/pauseable.md b/docusaurus/docs/tutorials/pauseable.md index f655a45c0..14f1a7664 100644 --- a/docusaurus/docs/tutorials/pauseable.md +++ b/docusaurus/docs/tutorials/pauseable.md @@ -2,9 +2,9 @@ sidebar_position: 5 --- -# Pauseable +# Pausable -The `Pauseable` module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently. +The `Pausable` module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently. ## Code @@ -51,7 +51,7 @@ use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] -pub struct Pauseable { +pub struct Pausable { is_paused: Var } ``` @@ -61,7 +61,7 @@ pub struct Pauseable { Now, let's move to state checks and guards. ```rust title=pauseable.rs showLineNumbers -impl Pauseable { +impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } @@ -89,7 +89,7 @@ impl Pauseable { Finally, we will add the ability to switch the module state. ```rust title=pauseable.rs showLineNumbers -impl Pauseable { +impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); @@ -113,9 +113,9 @@ impl Pauseable { `pause()` and `unpause()` functions do three things: ensure the contract is the right state (unpaused for `pause()`, not paused for `unpause()`), updates the state, and finally emits events (`Paused`/`Unpaused`). -## Pauseable counter +## Pausable counter -In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called `PauseableCounter`. The contract consists of a Var `value` and a `Pauseable` module. The counter can only be incremented if the contract is in a normal state (is not paused). +In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called `PausableCounter`. The contract consists of a Var `value` and a `Pausable` module. The counter can only be incremented if the contract is in a normal state (is not paused). ```rust title=pauseable.rs showLineNumbers ... @@ -123,13 +123,13 @@ use odra::SubModule; ... #[odra::module] -pub struct PauseableCounter { +pub struct PausableCounter { value: Var, - pauseable: SubModule + pauseable: SubModule } #[odra::module] -impl PauseableCounter { +impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); @@ -158,7 +158,7 @@ mod test { #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); - let mut contract = PauseableCounterHostRef::deploy(&test_env, NoArgs); + let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause(); diff --git a/docusaurus/versioned_docs/version-0.3.0/examples/using-odra-modules.md b/docusaurus/versioned_docs/version-0.3.0/examples/using-odra-modules.md index 3b1d40038..81ccacab4 100644 --- a/docusaurus/versioned_docs/version-0.3.0/examples/using-odra-modules.md +++ b/docusaurus/versioned_docs/version-0.3.0/examples/using-odra-modules.md @@ -158,5 +158,5 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. diff --git a/docusaurus/versioned_docs/version-0.3.1/examples/using-odra-modules.md b/docusaurus/versioned_docs/version-0.3.1/examples/using-odra-modules.md index a0faf177b..765e500e2 100644 --- a/docusaurus/versioned_docs/version-0.3.1/examples/using-odra-modules.md +++ b/docusaurus/versioned_docs/version-0.3.1/examples/using-odra-modules.md @@ -158,5 +158,5 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. diff --git a/docusaurus/versioned_docs/version-0.4.0/examples/using-odra-modules.md b/docusaurus/versioned_docs/version-0.4.0/examples/using-odra-modules.md index a0faf177b..765e500e2 100644 --- a/docusaurus/versioned_docs/version-0.4.0/examples/using-odra-modules.md +++ b/docusaurus/versioned_docs/version-0.4.0/examples/using-odra-modules.md @@ -158,5 +158,5 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. diff --git a/docusaurus/versioned_docs/version-0.5.0/examples/using-odra-modules.md b/docusaurus/versioned_docs/version-0.5.0/examples/using-odra-modules.md index a0faf177b..765e500e2 100644 --- a/docusaurus/versioned_docs/version-0.5.0/examples/using-odra-modules.md +++ b/docusaurus/versioned_docs/version-0.5.0/examples/using-odra-modules.md @@ -158,5 +158,5 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. diff --git a/docusaurus/versioned_docs/version-0.6.0/examples/using-odra-modules.md b/docusaurus/versioned_docs/version-0.6.0/examples/using-odra-modules.md index a0faf177b..765e500e2 100644 --- a/docusaurus/versioned_docs/version-0.6.0/examples/using-odra-modules.md +++ b/docusaurus/versioned_docs/version-0.6.0/examples/using-odra-modules.md @@ -158,5 +158,5 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. diff --git a/docusaurus/versioned_docs/version-0.7.0/examples/using-odra-modules.md b/docusaurus/versioned_docs/version-0.7.0/examples/using-odra-modules.md index a0faf177b..765e500e2 100644 --- a/docusaurus/versioned_docs/version-0.7.0/examples/using-odra-modules.md +++ b/docusaurus/versioned_docs/version-0.7.0/examples/using-odra-modules.md @@ -158,5 +158,5 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. diff --git a/docusaurus/versioned_docs/version-0.7.0/tutorials/pauseable.md b/docusaurus/versioned_docs/version-0.7.0/tutorials/pauseable.md index be9fef213..4f4fcc260 100644 --- a/docusaurus/versioned_docs/version-0.7.0/tutorials/pauseable.md +++ b/docusaurus/versioned_docs/version-0.7.0/tutorials/pauseable.md @@ -2,9 +2,9 @@ sidebar_position: 5 --- -# Pauseable +# Pausable -The `Pauseable` module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently. +The `Pausable` module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently. ## Code @@ -47,7 +47,7 @@ The module storage is extremely simple - has a single `Variable` of type bool, t ```rust showLineNumbers #[odra::module] -pub struct Pauseable { +pub struct Pausable { is_paused: Variable } ``` @@ -57,7 +57,7 @@ pub struct Pauseable { Now, let's move to state checks and guards. ```rust title=pauseable.rs showLineNumbers -impl Pauseable { +impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } @@ -85,7 +85,7 @@ impl Pauseable { Finally, we will add the ability to switch the module state. ```rust showLineNumbers -impl Pauseable { +impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); @@ -111,22 +111,22 @@ impl Pauseable { `pause()` and `unpause()` functions do three things: ensure the contract is the right state (unpaused for `pause()`, not paused for `unpause()`), updates the state, and finally emits events (`Paused`/`Unpaused`). -## Pauseable counter +## Pausable counter -In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called `PauseableCounter`. The contract consists of a Variable `value` and a `Pauseable` module. The counter can only be incremented if the contract is in a normal state (is not paused). +In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called `PausableCounter`. The contract consists of a Variable `value` and a `Pausable` module. The counter can only be incremented if the contract is in a normal state (is not paused). ```rust showLineNumbers use odra::Variable; -use odra_modules::security::Pauseable; +use odra_modules::security::Pausable; #[odra::module] -pub struct PauseableCounter { +pub struct PausableCounter { value: Variable, - pauseable: Pauseable + pauseable: Pausable } #[odra::module] -impl PauseableCounter { +impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); @@ -149,12 +149,12 @@ impl PauseableCounter { #[cfg(test)] mod test { - use super::PauseableCounterDeployer; + use super::PausableCounterDeployer; use odra_modules::security::errors::Error; #[test] fn increment_only_if_unpaused() { - let mut contract = PauseableCounterDeployer::default(); + let mut contract = PausableCounterDeployer::default(); assert_eq!(contract.get_value(), 0); contract.increment(); diff --git a/docusaurus/versioned_docs/version-0.8.0/examples/using-odra-modules.md b/docusaurus/versioned_docs/version-0.8.0/examples/using-odra-modules.md index 38f4da0aa..ce3ecc542 100644 --- a/docusaurus/versioned_docs/version-0.8.0/examples/using-odra-modules.md +++ b/docusaurus/versioned_docs/version-0.8.0/examples/using-odra-modules.md @@ -164,7 +164,7 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. [Installation guide]: ../getting-started/installation.md diff --git a/docusaurus/versioned_docs/version-0.8.0/tutorials/pauseable.md b/docusaurus/versioned_docs/version-0.8.0/tutorials/pauseable.md index f655a45c0..14f1a7664 100644 --- a/docusaurus/versioned_docs/version-0.8.0/tutorials/pauseable.md +++ b/docusaurus/versioned_docs/version-0.8.0/tutorials/pauseable.md @@ -2,9 +2,9 @@ sidebar_position: 5 --- -# Pauseable +# Pausable -The `Pauseable` module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently. +The `Pausable` module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently. ## Code @@ -51,7 +51,7 @@ use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] -pub struct Pauseable { +pub struct Pausable { is_paused: Var } ``` @@ -61,7 +61,7 @@ pub struct Pauseable { Now, let's move to state checks and guards. ```rust title=pauseable.rs showLineNumbers -impl Pauseable { +impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } @@ -89,7 +89,7 @@ impl Pauseable { Finally, we will add the ability to switch the module state. ```rust title=pauseable.rs showLineNumbers -impl Pauseable { +impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); @@ -113,9 +113,9 @@ impl Pauseable { `pause()` and `unpause()` functions do three things: ensure the contract is the right state (unpaused for `pause()`, not paused for `unpause()`), updates the state, and finally emits events (`Paused`/`Unpaused`). -## Pauseable counter +## Pausable counter -In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called `PauseableCounter`. The contract consists of a Var `value` and a `Pauseable` module. The counter can only be incremented if the contract is in a normal state (is not paused). +In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called `PausableCounter`. The contract consists of a Var `value` and a `Pausable` module. The counter can only be incremented if the contract is in a normal state (is not paused). ```rust title=pauseable.rs showLineNumbers ... @@ -123,13 +123,13 @@ use odra::SubModule; ... #[odra::module] -pub struct PauseableCounter { +pub struct PausableCounter { value: Var, - pauseable: SubModule + pauseable: SubModule } #[odra::module] -impl PauseableCounter { +impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); @@ -158,7 +158,7 @@ mod test { #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); - let mut contract = PauseableCounterHostRef::deploy(&test_env, NoArgs); + let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause(); diff --git a/docusaurus/versioned_docs/version-0.8.1/examples/using-odra-modules.md b/docusaurus/versioned_docs/version-0.8.1/examples/using-odra-modules.md index 431a6787e..ddd04b5dc 100644 --- a/docusaurus/versioned_docs/version-0.8.1/examples/using-odra-modules.md +++ b/docusaurus/versioned_docs/version-0.8.1/examples/using-odra-modules.md @@ -164,7 +164,7 @@ Ownership can be transferred in a two-step process by using `transfer_ownership( ### Security -#### Pauseable +#### Pausable A module allowing to implement an emergency stop mechanism that can be triggered by any account. [Installation guide]: ../getting-started/installation.md diff --git a/docusaurus/versioned_docs/version-0.8.1/tutorials/pauseable.md b/docusaurus/versioned_docs/version-0.8.1/tutorials/pauseable.md index f655a45c0..14f1a7664 100644 --- a/docusaurus/versioned_docs/version-0.8.1/tutorials/pauseable.md +++ b/docusaurus/versioned_docs/version-0.8.1/tutorials/pauseable.md @@ -2,9 +2,9 @@ sidebar_position: 5 --- -# Pauseable +# Pausable -The `Pauseable` module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently. +The `Pausable` module is like your smart contract's safety switch. It lets authorized users temporarily pause certain features if needed. It's a great way to boost security, but it's not meant to be used on its own. Think of it as an extra tool in your access control toolbox, giving you more control to manage your smart contract safely and efficiently. ## Code @@ -51,7 +51,7 @@ use odra::Var; ... #[odra::module(events = [Paused, Unpaused])] -pub struct Pauseable { +pub struct Pausable { is_paused: Var } ``` @@ -61,7 +61,7 @@ pub struct Pauseable { Now, let's move to state checks and guards. ```rust title=pauseable.rs showLineNumbers -impl Pauseable { +impl Pausable { pub fn is_paused(&self) -> bool { self.is_paused.get_or_default() } @@ -89,7 +89,7 @@ impl Pauseable { Finally, we will add the ability to switch the module state. ```rust title=pauseable.rs showLineNumbers -impl Pauseable { +impl Pausable { pub fn pause(&mut self) { self.require_not_paused(); self.is_paused.set(true); @@ -113,9 +113,9 @@ impl Pauseable { `pause()` and `unpause()` functions do three things: ensure the contract is the right state (unpaused for `pause()`, not paused for `unpause()`), updates the state, and finally emits events (`Paused`/`Unpaused`). -## Pauseable counter +## Pausable counter -In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called `PauseableCounter`. The contract consists of a Var `value` and a `Pauseable` module. The counter can only be incremented if the contract is in a normal state (is not paused). +In the end, let's use the module in a contract. For this purpose, we will implement a mock contract called `PausableCounter`. The contract consists of a Var `value` and a `Pausable` module. The counter can only be incremented if the contract is in a normal state (is not paused). ```rust title=pauseable.rs showLineNumbers ... @@ -123,13 +123,13 @@ use odra::SubModule; ... #[odra::module] -pub struct PauseableCounter { +pub struct PausableCounter { value: Var, - pauseable: SubModule + pauseable: SubModule } #[odra::module] -impl PauseableCounter { +impl PausableCounter { pub fn increment(&mut self) { self.pauseable.require_not_paused(); @@ -158,7 +158,7 @@ mod test { #[test] fn increment_only_if_unpaused() { let test_env = odra_test::env(); - let mut contract = PauseableCounterHostRef::deploy(&test_env, NoArgs); + let mut contract = PausableCounterHostRef::deploy(&test_env, NoArgs); contract.increment(); contract.pause();