generated from okp4/template-rust
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cognitarium): implement store configuration state
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,37 @@ | ||
use crate::msg; | ||
use cosmwasm_std::Uint128; | ||
use cw_storage_plus::Item; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
pub const STORE: Item<Store> = Item::new("store"); | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] | ||
pub struct Store { | ||
pub owner: String, | ||
pub limits: StoreLimits, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] | ||
pub struct StoreLimits { | ||
pub max_triple_count: Option<Uint128>, | ||
pub max_byte_size: Option<Uint128>, | ||
pub max_triple_byte_size: Option<Uint128>, | ||
pub max_query_limit: Option<Uint128>, | ||
pub max_query_variable_count: Option<Uint128>, | ||
pub max_insert_data_byte_size: Option<Uint128>, | ||
pub max_insert_data_triple_count: Option<Uint128>, | ||
} | ||
|
||
impl From<msg::StoreLimits> for StoreLimits { | ||
fn from(value: msg::StoreLimits) -> Self { | ||
StoreLimits { | ||
max_triple_count: value.max_triple_count, | ||
max_byte_size: value.max_byte_size, | ||
max_triple_byte_size: value.max_triple_byte_size, | ||
max_query_limit: value.max_query_limit, | ||
max_query_variable_count: value.max_query_variable_count, | ||
max_insert_data_byte_size: value.max_insert_data_byte_size, | ||
max_insert_data_triple_count: value.max_insert_data_triple_count, | ||
} | ||
} | ||
} |