Skip to content

Commit 31340f2

Browse files
committed
refactor(dataverse): make compilation happy
1 parent c142976 commit 31340f2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

contracts/okp4-dataverse/src/contract.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#[cfg(not(feature = "library"))]
22
use cosmwasm_std::entry_point;
33
use cosmwasm_std::{
4-
instantiate2_address, to_binary, Binary, CodeInfoResponse, Deps, DepsMut, Env, MessageInfo,
5-
Response, StdError, StdResult, WasmMsg,
4+
instantiate2_address, to_json_binary, Binary, CodeInfoResponse, Deps, DepsMut, Env,
5+
MessageInfo, Response, StdError, StdResult, WasmMsg,
66
};
77
use cw2::set_contract_version;
88

@@ -29,9 +29,9 @@ pub fn instantiate(
2929
.query_wasm_code_info(msg.triplestore_config.code_id.u64())?;
3030
let salt = Binary::from(msg.name.as_bytes());
3131

32-
/// Necessary stuff for testing purposes, see: https://github.com/CosmWasm/cosmwasm/issues/1648
33-
#[allow(unused)]
3432
let triplestore_address = instantiate2_address(&checksum, &creator, &salt)?;
33+
34+
// Necessary stuff for testing purposes, see: https://github.com/CosmWasm/cosmwasm/issues/1648
3535
let triplestore_address = {
3636
#[cfg(not(test))]
3737
{
@@ -55,7 +55,7 @@ pub fn instantiate(
5555
admin: Some(env.contract.address.to_string()),
5656
code_id: msg.triplestore_config.code_id.u64(),
5757
label: format!("{}_triplestore", msg.name),
58-
msg: to_binary(&okp4_cognitarium::msg::InstantiateMsg {
58+
msg: to_json_binary(&okp4_cognitarium::msg::InstantiateMsg {
5959
limits: msg.triplestore_config.limits.into(),
6060
})?,
6161
funds: vec![],
@@ -105,7 +105,7 @@ mod tests {
105105
)
106106
.unwrap(),
107107
);
108-
SystemResult::Ok(ContractResult::Ok(to_binary(&resp).unwrap()))
108+
SystemResult::Ok(ContractResult::Ok(to_json_binary(&resp).unwrap()))
109109
}
110110
_ => SystemResult::Err(SystemError::Unknown {}),
111111
});
@@ -123,7 +123,8 @@ mod tests {
123123
},
124124
};
125125

126-
let res = instantiate(deps.as_mut(), mock_env(), mock_info("creator", &[]), msg).unwrap();
126+
let env = mock_env();
127+
let res = instantiate(deps.as_mut(), env.clone(), mock_info("creator", &[]), msg).unwrap();
127128

128129
assert_eq!(
129130
res.attributes,
@@ -132,10 +133,10 @@ mod tests {
132133
assert_eq!(
133134
res.messages,
134135
vec![SubMsg::new(WasmMsg::Instantiate2 {
135-
admin: Some("cosmos2contract".to_string()),
136+
admin: Some(env.contract.address.to_string()),
136137
code_id: 17,
137138
label: "my-dataverse_triplestore".to_string(),
138-
msg: to_binary(&okp4_cognitarium::msg::InstantiateMsg {
139+
msg: to_json_binary(&okp4_cognitarium::msg::InstantiateMsg {
139140
limits: store_limits.into(),
140141
})
141142
.unwrap(),

0 commit comments

Comments
 (0)