Skip to content

Commit

Permalink
Docs for the value-setter module (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkolad authored and preston-evans98 committed Sep 14, 2023
1 parent c3b6e5e commit 132f98d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ It demonstrates the following concepts:

### 2. Functionality:

The `admin` (specified in the `ValueSetter` genesis) can update a single `u32` value by creating `CallMessage::SetValue(new_value)` message. Any other module can query the module state by invoking the `get_value` function.
The `admin` (specified in the `ValueSetter` genesis) can update a single `u32` value by creating `CallMessage::SetValue(new_value)` message. Anyone can query the module state by calling the `valueSetter_queryValue` endpoint.

For implementation details, please check comments in the `genesis.rs, call.rs & query.rs`.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(missing_docs)]
#![doc = include_str!("../README.md")]
mod call;
mod genesis;

Expand All @@ -13,7 +15,9 @@ pub use query::{Response, ValueSetterRpcImpl, ValueSetterRpcServer};
use sov_modules_api::{Error, ModuleInfo};
use sov_state::WorkingSet;

/// Initial configuration for sov-value-setter module.
pub struct ValueSetterConfig<C: sov_modules_api::Context> {
/// Admin of the module.
pub admin: C::Address,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#![allow(missing_docs)]
use jsonrpsee::core::RpcResult;
use sov_modules_api::macros::rpc_gen;
use sov_state::WorkingSet;

use super::ValueSetter;

/// Response returned from the valueSetter_queryValue endpoint.
#[derive(serde::Serialize, serde::Deserialize, Debug, Eq, PartialEq, Clone)]
pub struct Response {
/// Value saved in the module's state.
pub value: Option<u32>,
}

Expand Down

0 comments on commit 132f98d

Please sign in to comment.