Skip to content

Commit

Permalink
Merge pull request #103 from neutron-org/chore/remove-redundant-subda…
Browse files Browse the repository at this point in the history
…o-struct

chore: removed duplicate SubDao struct #NTRN-248
  • Loading branch information
pr0n00gler authored Apr 5, 2024
2 parents b7f7a68 + 0a706e4 commit c40a0b8
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 22 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions contracts/dao/cwd-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ neutron-sdk = "0.10.0"
schemars = "0.8.8"
serde = { version = "1.0.175", default-features = false, features = ["derive"] }
thiserror = { version = "1.0" }
neutron-subdao-core = { version = "*", path = "../../../packages/neutron-subdao-core" }
3 changes: 2 additions & 1 deletion contracts/dao/cwd-core/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ use cw_utils::{parse_reply_instantiate_data, Duration};
use cw_paginate::{paginate_map, paginate_map_values};
use cwd_interface::{voting, ModuleInstantiateInfo};
use neutron_sdk::bindings::msg::NeutronMsg;
use neutron_subdao_core::types::SubDao;

use crate::error::ContractError;
use crate::msg::{ExecuteMsg, InitialItem, InstantiateMsg, MigrateMsg, QueryMsg};
use crate::query::{DumpStateResponse, GetItemResponse, PauseInfoResponse, SubDao};
use crate::query::{DumpStateResponse, GetItemResponse, PauseInfoResponse};
use crate::state::{
Config, ProposalModule, ProposalModuleStatus, ACTIVE_PROPOSAL_MODULE_COUNT, CONFIG, ITEMS,
PAUSED, PROPOSAL_MODULES, SUBDAO_LIST, TOTAL_PROPOSAL_MODULE_COUNT, VOTING_REGISTRY_MODULE,
Expand Down
2 changes: 1 addition & 1 deletion contracts/dao/cwd-core/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use cwd_interface::voting::{
use cwd_interface::ModuleInstantiateInfo;
use cwd_macros::{info_query, voting_query};
use neutron_sdk::bindings::msg::NeutronMsg;
use neutron_subdao_core::types::SubDao;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::query::SubDao;
use crate::state::Config;

/// Information about an item to be stored in the items list.
Expand Down
8 changes: 0 additions & 8 deletions contracts/dao/cwd-core/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,3 @@ pub struct AdminNominationResponse {
/// pending.
pub nomination: Option<Addr>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct SubDao {
/// The contract address of the SubDAO
pub addr: String,
/// The purpose/constitution for the SubDAO
pub charter: Option<String>,
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use neutron_dao_pre_propose_overrule::msg::{
};

use crate::state::PROPOSALS;
use cwd_core::{msg::QueryMsg as MainDaoQueryMsg, query::SubDao};
use cwd_core::msg::QueryMsg as MainDaoQueryMsg;
use cwd_proposal_single::{
msg::ExecuteMsg as ProposeMessageInternal, msg::QueryMsg as ProposalSingleQueryMsg,
};
Expand Down Expand Up @@ -190,7 +190,7 @@ fn verify_is_timelock_from_subdao(
fn is_subdao_legit(deps: &DepsMut, subdao_core: &Addr) -> Result<bool, PreProposeOverruleError> {
let main_dao = get_main_dao_address(deps)?;

let subdao: StdResult<SubDao> = deps.querier.query_wasm_smart(
let subdao: StdResult<SubdaoTypes::SubDao> = deps.querier.query_wasm_smart(
main_dao,
&MainDaoQueryMsg::GetSubDao {
address: subdao_core.to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use cosmwasm_std::{
to_json_binary, Addr, Binary, ContractResult, Empty, OwnedDeps, Querier, QuerierResult,
QueryRequest, SystemError, SystemResult, WasmQuery,
};
use cwd_core::{msg::QueryMsg as MainDaoQueryMsg, query::SubDao};
use cwd_core::msg::QueryMsg as MainDaoQueryMsg;
use cwd_proposal_single::msg::QueryMsg as ProposalSingleQueryMsg;

use neutron_subdao_core::{msg::QueryMsg as SubdaoQueryMsg, types as SubdaoTypes};
Expand Down Expand Up @@ -95,10 +95,12 @@ impl ContractQuerier for MockDaoQueries {
let q: MainDaoQueryMsg = from_json(msg).unwrap();
match q {
MainDaoQueryMsg::GetSubDao { address } => match self.sub_dao_set.contains(&address) {
true => SystemResult::Ok(ContractResult::from(to_json_binary(&SubDao {
addr: address.clone(),
charter: None,
}))),
true => {
SystemResult::Ok(ContractResult::from(to_json_binary(&SubdaoTypes::SubDao {
addr: address.clone(),
charter: None,
})))
}
false => SystemResult::Err(SystemError::Unknown {}),
},
_ => SystemResult::Err(SystemError::Unknown {}),
Expand Down
1 change: 1 addition & 0 deletions contracts/dao/proposal/cwd-proposal-single/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ neutron-sdk = "0.10.0"
schemars = "0.8.8"
serde = { version = "1.0.175", default-features = false, features = ["derive"] }
thiserror = { version = "1.0" }
neutron-subdao-core = { version = "*", path = "../../../../packages/neutron-subdao-core" }

cwd-core = { path = "../../cwd-core", features = ["library"] }
cwd-hooks = { path = "../../../../packages/cwd-hooks" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use cw20::Cw20Coin;
use cw_multi_test::{custom_app, BasicApp, Executor, Router};
use cw_utils::Duration;
use cwd_core::msg::{ExecuteMsg as DaoExecuteMsg, QueryMsg as DaoQueryMsg};
use cwd_core::query::SubDao;
use cwd_hooks::{HookError, HooksResponse};
use cwd_interface::voting::InfoResponse;
use cwd_voting::{
Expand All @@ -26,6 +25,7 @@ use cwd_voting::{
voting::{Vote, Votes},
};
use neutron_sdk::bindings::msg::NeutronMsg;
use neutron_subdao_core::types::SubDao;

use crate::testing::execute::{execute_proposal, execute_proposal_should_fail};
use crate::{
Expand Down
3 changes: 1 addition & 2 deletions packages/neutron-subdao-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "Apache-2.0"
name = "neutron-subdao-core"
repository = "https://github.com/neutron/neutron-dao"
version = "0.1.0"
version = "0.1.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -15,7 +15,6 @@ cw-utils = { version = "1.0.1" }
cw2 = "1.1.0"
cwd-interface = { path = "../cwd-interface" }
cwd-macros = { path = "../cwd-macros" }
cwd-voting = { path = "../cwd-voting" }
exec-control = { path = "../exec-control" }
neutron-sdk = "0.10.0"
schemars = "0.8.8"
Expand Down

0 comments on commit c40a0b8

Please sign in to comment.