Skip to content

Commit

Permalink
proposal multiple testcases implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek-1857 committed Apr 9, 2024
1 parent 69312b1 commit bcd06eb
Show file tree
Hide file tree
Showing 20 changed files with 1,038 additions and 10,150 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions contracts/proposal/dao-proposal-multiple/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ serde ={ workspace=true }
schemars ={ workspace = true }
secret-cw-controllers ={ workspace = true }
shade-protocol ={ workspace = true }
query_auth ={ workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
Expand All @@ -55,6 +56,7 @@ dao-voting-snip20-staked = { workspace = true }
dao-voting-token-staked = { workspace = true }
dao-voting-snip721-staked = { workspace = true }
cw-denom = { workspace = true }
dao-pre-propose-multiple ={ workspace = true }
# dao-testing = { workspace = true }
snip20-stake = { workspace = true }
cw4 = { workspace = true }
Expand Down
20 changes: 6 additions & 14 deletions contracts/proposal/dao-proposal-multiple/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ pub fn execute(
proposer,
),
ExecuteMsg::Vote {
key,
auth,
proposal_id,
vote,
rationale,
} => execute_vote(deps, env, info, key, proposal_id, vote, rationale),
ExecuteMsg::Execute { key, proposal_id } => {
execute_execute(deps, env, info, key, proposal_id)
} => execute_vote(deps, env, info, auth, proposal_id, vote, rationale),
ExecuteMsg::Execute { auth, proposal_id } => {
execute_execute(deps, env, info, auth, proposal_id)
}
ExecuteMsg::Veto { proposal_id } => execute_veto(deps, env, info, proposal_id),
ExecuteMsg::Close { proposal_id } => execute_close(deps, env, info, proposal_id),
Expand Down Expand Up @@ -377,16 +377,12 @@ pub fn execute_vote(
deps: DepsMut,
env: Env,
info: MessageInfo,
key: String,
auth: Auth,
proposal_id: u64,
vote: MultipleChoiceVote,
rationale: Option<String>,
) -> Result<Response<Empty>, ContractError> {
let dao_info = DAO.load(deps.storage)?;
let auth = Auth::ViewingKey {
key,
address: info.sender.clone().to_string(),
};
let mut prop = PROPOSALS
.get(deps.storage, &proposal_id)
.ok_or(ContractError::NoSuchProposal { id: proposal_id })?;
Expand Down Expand Up @@ -493,7 +489,7 @@ pub fn execute_execute(
deps: DepsMut,
env: Env,
info: MessageInfo,
key: String,
auth: Auth,
proposal_id: u64,
) -> Result<Response, ContractError> {
let mut prop = PROPOSALS
Expand All @@ -502,10 +498,6 @@ pub fn execute_execute(

let config = CONFIG.load(deps.storage)?;
let dao_info = DAO.load(deps.storage)?;
let auth = Auth::ViewingKey {
key,
address: info.sender.clone().to_string(),
};

// determine if this sender can execute
let mut sender_can_execute = true;
Expand Down
4 changes: 2 additions & 2 deletions contracts/proposal/dao-proposal-multiple/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ pub mod query;
pub mod state;
pub use crate::error::ContractError;

// [cfg(test)]
// // pub mod testing;
#[cfg(test)]
pub mod testing;
6 changes: 2 additions & 4 deletions contracts/proposal/dao-proposal-multiple/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ pub enum ExecuteMsg {
/// Votes on a proposal. Voting power is determined by the DAO's
/// voting power module.
Vote {
/// Viewng key of the sender
key: String,
auth: Auth,
/// The ID of the proposal to vote on.
proposal_id: u64,
/// The senders position on the proposal.
Expand All @@ -86,8 +85,7 @@ pub enum ExecuteMsg {
/// Causes the messages associated with a passed proposal to be
/// executed by the DAO.
Execute {
/// Viewng key of the sender
key: String,
auth: Auth,
/// The ID of the proposal to execute.
proposal_id: u64,
},
Expand Down
Loading

0 comments on commit bcd06eb

Please sign in to comment.