Skip to content

Commit

Permalink
feat(cognitarium): implement store configuration state
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Apr 24, 2023
1 parent ce511e7 commit 8b4e10b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions contracts/okp4-cognitarium/src/state.rs
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,
}
}
}

0 comments on commit 8b4e10b

Please sign in to comment.