Skip to content

Commit 35a2bd5

Browse files
authored
Merge pull request #1604 from CosmWasm/fix-virus-instantiate
Fix virus instantiation
2 parents 9ee304c + 9c76900 commit 35a2bd5

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

contracts/virus/src/contract.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use cosmwasm_std::{
22
entry_point, instantiate2_address, to_binary, Attribute, Binary, CodeInfoResponse,
3-
ContractInfoResponse, DepsMut, Env, MessageInfo, Response, StdError, StdResult, WasmMsg,
3+
ContractInfoResponse, DepsMut, Env, MessageInfo, Response, StdResult, WasmMsg,
44
};
55

66
use crate::errors::ContractError;
@@ -13,9 +13,7 @@ pub fn instantiate(
1313
_info: MessageInfo,
1414
_msg: InstantiateMsg,
1515
) -> StdResult<Response> {
16-
Err(StdError::generic_err(
17-
"You can only use this contract for migrations",
18-
))
16+
Ok(Response::new())
1917
}
2018

2119
#[entry_point]
@@ -96,4 +94,18 @@ pub fn execute_spread(
9694
}
9795

9896
#[cfg(test)]
99-
mod tests {}
97+
mod tests {
98+
use super::*;
99+
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
100+
101+
const CREATOR: &str = "creator";
102+
103+
#[test]
104+
fn instantiate_works() {
105+
let mut deps = mock_dependencies();
106+
let msg = InstantiateMsg {};
107+
let info = mock_info(CREATOR, &[]);
108+
let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap();
109+
assert_eq!(0, res.messages.len());
110+
}
111+
}

0 commit comments

Comments
 (0)