Skip to content

Commit

Permalink
undid unnecessary var change
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Feb 6, 2024
1 parent 801a8bf commit 34622fe
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions contracts/proposal/dao-proposal-single/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn execute(
msg: ExecuteMsg,
) -> Result<Response, ContractError> {
match msg {
ExecuteMsg::Propose(propose_msg) => execute_propose(deps, env, info, propose_msg),
ExecuteMsg::Propose(propose_msg) => execute_propose(deps, env, info.sender, propose_msg),
ExecuteMsg::Vote {
proposal_id,
vote,
Expand Down Expand Up @@ -152,7 +152,7 @@ pub fn execute(
pub fn execute_propose(
deps: DepsMut,
env: Env,
info: MessageInfo,
sender: Addr,
ProposeMsg {
title,
description,
Expand All @@ -165,15 +165,15 @@ pub fn execute_propose(
let proposal_creation_policy = CREATION_POLICY.load(deps.storage)?;

// Check that the sender is permitted to create proposals.
if !proposal_creation_policy.is_permitted(&info.sender) {
if !proposal_creation_policy.is_permitted(&sender) {
return Err(ContractError::Unauthorized {});
}

// Determine the appropriate proposer. If this is coming from our
// pre-propose module, it must be specified. Otherwise, the
// proposer should not be specified.
let proposer = match (proposer, &proposal_creation_policy) {
(None, ProposalCreationPolicy::Anyone {}) => info.sender.clone(),
(None, ProposalCreationPolicy::Anyone {}) => sender.clone(),
// `is_permitted` above checks that an allowed module is
// actually sending the propose message.
(Some(proposer), ProposalCreationPolicy::Module { .. }) => {
Expand Down Expand Up @@ -252,8 +252,6 @@ pub fn execute_propose(

let hooks = new_proposal_hooks(PROPOSAL_HOOKS, deps.storage, id, proposer.as_str())?;

let sender = info.sender.clone();

// Auto cast vote if given.
let (vote_hooks, vote_attributes) = if let Some(vote) = vote {
let response = execute_vote(deps, env, proposer, id, vote.vote, vote.rationale.clone())?;
Expand Down

0 comments on commit 34622fe

Please sign in to comment.