From dba6152e8766935acc858d4b4488eec9364ee320 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Tue, 20 Apr 2021 23:31:24 +0200 Subject: [PATCH] Remove Staking::Withdraw support / tests --- contracts/cw1-subkeys/src/contract.rs | 32 --------------------------- 1 file changed, 32 deletions(-) diff --git a/contracts/cw1-subkeys/src/contract.rs b/contracts/cw1-subkeys/src/contract.rs index 2cff00219..d9afa792a 100644 --- a/contracts/cw1-subkeys/src/contract.rs +++ b/contracts/cw1-subkeys/src/contract.rs @@ -147,11 +147,6 @@ pub fn check_staking_permissions( return Err(ContractError::ReDelegatePerm {}); } } - StakingMsg::Withdraw { .. } => { - if !permissions.withdraw { - return Err(ContractError::WithdrawPerm {}); - } - } s => panic!("Unsupported staking message: {:?}", s), } Ok(true) @@ -1262,17 +1257,11 @@ mod tests { amount: coin1, } .into()]; - let msg_withdraw = vec![StakingMsg::Withdraw { - validator: "validator1".into(), - recipient: None, - } - .into()]; let msgs = vec![ msg_delegate.clone(), msg_redelegate.clone(), msg_undelegate.clone(), - msg_withdraw.clone(), ]; // spender1 can execute @@ -1338,13 +1327,6 @@ mod tests { }, ); assert!(res.is_ok()); - let res = execute( - deps.as_mut(), - mock_env(), - info, - ExecuteMsg::Execute { msgs: msg_withdraw }, - ); - assert!(res.is_err()) } // tests permissions and allowances are independent features and does not affect each other @@ -1462,10 +1444,6 @@ mod tests { validator: anyone.to_string(), amount: coin(70000, "ureef"), }); - let staking_withdraw_msg = CosmosMsg::Staking(StakingMsg::Withdraw { - validator: anyone.to_string(), - recipient: None, - }); // owner can send big or small let res = query_can_execute(deps.as_ref(), owner.to_string(), send_msg.clone()).unwrap(); @@ -1497,13 +1475,6 @@ mod tests { ) .unwrap(); assert_eq!(res.can_execute, true); - let res = query_can_execute( - deps.as_ref(), - spender.to_string(), - staking_withdraw_msg.clone(), - ) - .unwrap(); - assert_eq!(res.can_execute, false); // random person cannot do anything let res = query_can_execute(deps.as_ref(), anyone.to_string(), send_msg).unwrap(); @@ -1513,8 +1484,5 @@ mod tests { let res = query_can_execute(deps.as_ref(), anyone.to_string(), staking_delegate_msg).unwrap(); assert_eq!(res.can_execute, false); - let res = - query_can_execute(deps.as_ref(), anyone.to_string(), staking_withdraw_msg).unwrap(); - assert_eq!(res.can_execute, false); } }