1
1
#[ cfg( not( feature = "library" ) ) ]
2
2
use cosmwasm_std:: entry_point;
3
3
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 ,
6
6
} ;
7
7
use cw2:: set_contract_version;
8
8
@@ -29,9 +29,9 @@ pub fn instantiate(
29
29
. query_wasm_code_info ( msg. triplestore_config . code_id . u64 ( ) ) ?;
30
30
let salt = Binary :: from ( msg. name . as_bytes ( ) ) ;
31
31
32
- /// Necessary stuff for testing purposes, see: https://github.com/CosmWasm/cosmwasm/issues/1648
33
- #[ allow( unused) ]
34
32
let triplestore_address = instantiate2_address ( & checksum, & creator, & salt) ?;
33
+
34
+ // Necessary stuff for testing purposes, see: https://github.com/CosmWasm/cosmwasm/issues/1648
35
35
let triplestore_address = {
36
36
#[ cfg( not( test) ) ]
37
37
{
@@ -55,7 +55,7 @@ pub fn instantiate(
55
55
admin : Some ( env. contract . address . to_string ( ) ) ,
56
56
code_id : msg. triplestore_config . code_id . u64 ( ) ,
57
57
label : format ! ( "{}_triplestore" , msg. name) ,
58
- msg : to_binary ( & okp4_cognitarium:: msg:: InstantiateMsg {
58
+ msg : to_json_binary ( & okp4_cognitarium:: msg:: InstantiateMsg {
59
59
limits : msg. triplestore_config . limits . into ( ) ,
60
60
} ) ?,
61
61
funds : vec ! [ ] ,
@@ -105,7 +105,7 @@ mod tests {
105
105
)
106
106
. unwrap ( ) ,
107
107
) ;
108
- SystemResult :: Ok ( ContractResult :: Ok ( to_binary ( & resp) . unwrap ( ) ) )
108
+ SystemResult :: Ok ( ContractResult :: Ok ( to_json_binary ( & resp) . unwrap ( ) ) )
109
109
}
110
110
_ => SystemResult :: Err ( SystemError :: Unknown { } ) ,
111
111
} ) ;
@@ -123,7 +123,8 @@ mod tests {
123
123
} ,
124
124
} ;
125
125
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 ( ) ;
127
128
128
129
assert_eq ! (
129
130
res. attributes,
@@ -132,10 +133,10 @@ mod tests {
132
133
assert_eq ! (
133
134
res. messages,
134
135
vec![ SubMsg :: new( WasmMsg :: Instantiate2 {
135
- admin: Some ( "cosmos2contract" . to_string( ) ) ,
136
+ admin: Some ( env . contract . address . to_string( ) ) ,
136
137
code_id: 17 ,
137
138
label: "my-dataverse_triplestore" . to_string( ) ,
138
- msg: to_binary ( & okp4_cognitarium:: msg:: InstantiateMsg {
139
+ msg: to_json_binary ( & okp4_cognitarium:: msg:: InstantiateMsg {
139
140
limits: store_limits. into( ) ,
140
141
} )
141
142
. unwrap( ) ,
0 commit comments