Skip to content

Commit

Permalink
Remove Staking::Withdraw support / tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Apr 21, 2021
1 parent c7c58f1 commit dba6152
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions contracts/cw1-subkeys/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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);
}
}

0 comments on commit dba6152

Please sign in to comment.