Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions contracts/cw1-subkeys/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub fn check_staking_permissions(
return Err(ContractError::ReDelegatePerm {});
}
}
s => panic!("Unsupported staking message: {:?}", s),
_ => return Err(ContractError::UnsupportedMessage {}),
}
Ok(true)
}
Expand All @@ -167,7 +167,7 @@ pub fn check_distribution_permissions(
return Err(ContractError::WithdrawPerm {});
}
}
s => panic!("Unsupported distribution message: {:?}", s),
_ => return Err(ContractError::UnsupportedMessage {}),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
Ok(true)
}
Expand Down Expand Up @@ -362,6 +362,15 @@ fn can_execute(deps: Deps, sender: String, msg: CosmosMsg) -> StdResult<bool> {
None => Ok(false),
}
}
CosmosMsg::Distribution(distribution_msg) => {
let perm_opt = PERMISSIONS.may_load(deps.storage, &sender)?;
match perm_opt {
Some(permission) => {
Ok(check_distribution_permissions(&distribution_msg, permission).is_ok())
}
None => Ok(false),
}
}
_ => Ok(false),
}
}
Expand Down
3 changes: 3 additions & 0 deletions contracts/cw1-subkeys/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ pub enum ContractError {

#[error("Set withdraw address is not allowed")]
WithdrawAddrPerm {},

#[error("Unsupported message")]
UnsupportedMessage {},
}

impl From<cw1_whitelist::ContractError> for ContractError {
Expand Down