diff --git a/contracts/cw1-subkeys/src/contract.rs b/contracts/cw1-subkeys/src/contract.rs index b3ce28ca3..281d2b21e 100644 --- a/contracts/cw1-subkeys/src/contract.rs +++ b/contracts/cw1-subkeys/src/contract.rs @@ -34,21 +34,11 @@ pub fn init( info: MessageInfo, msg: InitMsg, ) -> StdResult { - let result = whitelist_init(dup(&mut deps), env, info, msg)?; + let result = whitelist_init(deps.branch(), env, info, msg)?; set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; Ok(result) } -// TODO: replace this with deps.dup() -// after https://github.com/CosmWasm/cosmwasm/pull/620 is merged -fn dup<'a>(deps: &'a mut DepsMut<'_>) -> DepsMut<'a> { - DepsMut { - storage: deps.storage, - api: deps.api, - querier: deps.querier, - } -} - pub fn handle( deps: DepsMut, env: Env, @@ -447,7 +437,7 @@ mod tests { admins: admins.to_vec(), mutable: true, }; - init(dup(&mut deps), mock_env(), info.clone(), init_msg).unwrap(); + init(deps.branch(), mock_env(), info.clone(), init_msg).unwrap(); // Add subkeys with initial allowances for (spender, expiration) in spenders.iter().zip(expirations) { @@ -457,7 +447,7 @@ mod tests { amount: amount.clone(), expires: Some(expiration.clone()), }; - handle(dup(&mut deps), mock_env(), info.clone(), msg).unwrap(); + handle(deps.branch(), mock_env(), info.clone(), msg).unwrap(); } } } diff --git a/contracts/cw20-base/src/allowances.rs b/contracts/cw20-base/src/allowances.rs index bf1b95c24..9133b4537 100644 --- a/contracts/cw20-base/src/allowances.rs +++ b/contracts/cw20-base/src/allowances.rs @@ -282,20 +282,10 @@ mod tests { }; let info = mock_info(&HumanAddr("creator".to_string()), &[]); let env = mock_env(); - init(dup(&mut deps), env, info, init_msg).unwrap(); + init(deps.branch(), env, info, init_msg).unwrap(); query_token_info(deps.as_ref()).unwrap() } - // TODO: replace this with deps.dup() - // after https://github.com/CosmWasm/cosmwasm/pull/620 is merged - fn dup<'a>(deps: &'a mut DepsMut<'_>) -> DepsMut<'a> { - DepsMut { - storage: deps.storage, - api: deps.api, - querier: deps.querier, - } - } - #[test] fn increase_decrease_allowances() { let mut deps = mock_dependencies(&coins(2, "token")); diff --git a/contracts/cw20-base/src/contract.rs b/contracts/cw20-base/src/contract.rs index c0abc03cf..ba7234b19 100644 --- a/contracts/cw20-base/src/contract.rs +++ b/contracts/cw20-base/src/contract.rs @@ -418,7 +418,7 @@ mod tests { }; let info = mock_info(&HumanAddr("creator".to_string()), &[]); let env = mock_env(); - let res = init(dup(&mut deps), env, info, init_msg).unwrap(); + let res = init(deps.branch(), env, info, init_msg).unwrap(); assert_eq!(0, res.messages.len()); let meta = query_token_info(deps.as_ref()).unwrap(); @@ -436,16 +436,6 @@ mod tests { meta } - // TODO: replace this with deps.dup() - // after https://github.com/CosmWasm/cosmwasm/pull/620 is merged - fn dup<'a>(deps: &'a mut DepsMut<'_>) -> DepsMut<'a> { - DepsMut { - storage: deps.storage, - api: deps.api, - querier: deps.querier, - } - } - #[test] fn proper_initialization() { let mut deps = mock_dependencies(&[]); diff --git a/contracts/cw20-base/src/enumerable.rs b/contracts/cw20-base/src/enumerable.rs index 255909714..41e9aaf49 100644 --- a/contracts/cw20-base/src/enumerable.rs +++ b/contracts/cw20-base/src/enumerable.rs @@ -81,20 +81,10 @@ mod tests { }; let info = mock_info(&HumanAddr("creator".to_string()), &[]); let env = mock_env(); - init(dup(&mut deps), env, info, init_msg).unwrap(); + init(deps.branch(), env, info, init_msg).unwrap(); query_token_info(deps.as_ref()).unwrap() } - // TODO: replace this with deps.dup() - // after https://github.com/CosmWasm/cosmwasm/pull/620 is merged - fn dup<'a>(deps: &'a mut DepsMut<'_>) -> DepsMut<'a> { - DepsMut { - storage: deps.storage, - api: deps.api, - querier: deps.querier, - } - } - #[test] fn query_all_allowances_works() { let mut deps = mock_dependencies(&coins(2, "token")); diff --git a/contracts/cw20-staking/src/contract.rs b/contracts/cw20-staking/src/contract.rs index 148ce3189..b5e36f81d 100644 --- a/contracts/cw20-staking/src/contract.rs +++ b/contracts/cw20-staking/src/contract.rs @@ -220,16 +220,6 @@ pub fn bond(deps: DepsMut, env: Env, info: MessageInfo) -> Result(deps: &'a mut DepsMut<'_>) -> DepsMut<'a> { - DepsMut { - storage: deps.storage, - api: deps.api, - querier: deps.querier, - } -} - pub fn unbond( mut deps: DepsMut, env: Env, @@ -250,7 +240,7 @@ pub fn unbond( let tax = amount * invest.exit_tax; // burn from the original caller - handle_burn(dup(&mut deps), env.clone(), info.clone(), amount)?; + handle_burn(deps.branch(), env.clone(), info.clone(), amount)?; if tax > Uint128(0) { let sub_info = MessageInfo { sender: env.contract.address.clone(), @@ -258,7 +248,7 @@ pub fn unbond( }; // call into cw20-base to mint tokens to owner, call as self as no one else is allowed let human_owner = deps.api.human_address(&invest.owner)?; - handle_mint(dup(&mut deps), env.clone(), sub_info, human_owner, tax)?; + handle_mint(deps.branch(), env.clone(), sub_info, human_owner, tax)?; } // re-calculate bonded to ensure we have real values diff --git a/contracts/cw3-fixed-multisig/src/msg.rs b/contracts/cw3-fixed-multisig/src/msg.rs index c7ad5dd6c..2acbce86e 100644 --- a/contracts/cw3-fixed-multisig/src/msg.rs +++ b/contracts/cw3-fixed-multisig/src/msg.rs @@ -41,7 +41,6 @@ pub enum HandleMsg { }, } -// TODO: add a custom query to return the voter list (all potential voters) // We can also add this as a cw3 extension #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] #[serde(rename_all = "snake_case")] diff --git a/contracts/cw3-fixed-multisig/src/state.rs b/contracts/cw3-fixed-multisig/src/state.rs index 0f0e9939d..f702e52c2 100644 --- a/contracts/cw3-fixed-multisig/src/state.rs +++ b/contracts/cw3-fixed-multisig/src/state.rs @@ -29,7 +29,6 @@ pub struct Proposal { } impl Proposal { - /// TODO: we should get the current BlockInfo and then we can determine this a bit better pub fn current_status(&self, block: &BlockInfo) -> Status { let mut status = self.status; diff --git a/contracts/cw3-flex-multisig/src/msg.rs b/contracts/cw3-flex-multisig/src/msg.rs index 36427f4e8..39f7d33e2 100644 --- a/contracts/cw3-flex-multisig/src/msg.rs +++ b/contracts/cw3-flex-multisig/src/msg.rs @@ -127,7 +127,6 @@ pub enum HandleMsg { MemberChangedHook(MemberChangedHookMsg), } -// TODO: add a custom query to return the voter list (all potential voters) // We can also add this as a cw3 extension #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] #[serde(rename_all = "snake_case")] diff --git a/contracts/cw4-stake/src/contract.rs b/contracts/cw4-stake/src/contract.rs index 0040b260c..69a691aec 100644 --- a/contracts/cw4-stake/src/contract.rs +++ b/contracts/cw4-stake/src/contract.rs @@ -20,7 +20,7 @@ use cw0::claim::{claim_tokens, create_claim, CLAIMS}; use cw0::hooks::prepare_hooks; // version info for migration info -const CONTRACT_NAME: &str = "crates.io:cw4-group"; +const CONTRACT_NAME: &str = "crates.io:cw4-stake"; const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); // Note, you can use StdResult in some functions where you do not diff --git a/packages/cw0/src/expiration.rs b/packages/cw0/src/expiration.rs index 67c169b8e..e6cb1a5f9 100644 --- a/packages/cw0/src/expiration.rs +++ b/packages/cw0/src/expiration.rs @@ -147,7 +147,6 @@ impl Mul for Duration { mod test { use super::*; - // TODO: add tests for the logic #[test] fn compare_expiration() { // matching pairs