From 8b4e10b423b64ffe24d2fc2456db85ccb3c6ea92 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Tue, 11 Apr 2023 22:54:28 +0200 Subject: [PATCH] feat(cognitarium): implement store configuration state --- contracts/okp4-cognitarium/src/state.rs | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/contracts/okp4-cognitarium/src/state.rs b/contracts/okp4-cognitarium/src/state.rs index 8b137891..528f24c6 100644 --- a/contracts/okp4-cognitarium/src/state.rs +++ b/contracts/okp4-cognitarium/src/state.rs @@ -1 +1,37 @@ +use crate::msg; +use cosmwasm_std::Uint128; +use cw_storage_plus::Item; +use serde::{Deserialize, Serialize}; +pub const STORE: Item = 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, + pub max_byte_size: Option, + pub max_triple_byte_size: Option, + pub max_query_limit: Option, + pub max_query_variable_count: Option, + pub max_insert_data_byte_size: Option, + pub max_insert_data_triple_count: Option, +} + +impl From 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, + } + } +}