Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: removed duplicate SubDao struct #NTRN-248 #103

Merged
merged 2 commits into from
Apr 5, 2024
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
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
Loading