Skip to content

Commit

Permalink
feat(cognitarium): implement instantiate msg
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Apr 24, 2023
1 parent 8b4e10b commit 05e6319
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 13 additions & 3 deletions contracts/okp4-cognitarium/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use cw2::set_contract_version;

use crate::error::ContractError;
use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
use crate::state::{Store, STORE};

// version info for migration info
const CONTRACT_NAME: &str = "crates.io:storage";
Expand All @@ -14,11 +15,20 @@ const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn instantiate(
deps: DepsMut,
_env: Env,
_info: MessageInfo,
_msg: InstantiateMsg,
info: MessageInfo,
msg: InstantiateMsg,
) -> Result<Response, ContractError> {
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
Err(ContractError::NotImplemented)

STORE.save(
deps.storage,
&Store {
owner: info.sender,
limits: msg.limits.into(),
},
)?;

Ok(Response::default())
}

#[cfg_attr(not(feature = "library"), entry_point)]
Expand Down
4 changes: 2 additions & 2 deletions contracts/okp4-cognitarium/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::msg;
use cosmwasm_std::Uint128;
use cosmwasm_std::{Addr, 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 owner: Addr,
pub limits: StoreLimits,
}

Expand Down

0 comments on commit 05e6319

Please sign in to comment.