use std::marker::PhantomData;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::Addr;
use cw_hooks::Hooks;
use cw_storage_plus::{Item, Map};
use dao_voting::deposit::CheckedDepositInfo;
#[cw_serde]
pub struct Config {
pub deposit_info: Option<CheckedDepositInfo>,
pub open_proposal_submission: bool,
}
pub struct PreProposeContract<InstantiateExt, ExecuteExt, QueryExt, ProposalMessage> {
pub proposal_module: Item<'static, Addr>,
pub dao: Item<'static, Addr>,
pub config: Item<'static, Config>,
pub deposits: Map<'static, u64, (Option<CheckedDepositInfo>, Addr)>,
pub proposal_submitted_hooks: Hooks<'static>,
instantiate_type: PhantomData<InstantiateExt>,
execute_type: PhantomData<ExecuteExt>,
query_type: PhantomData<QueryExt>,
proposal_type: PhantomData<ProposalMessage>,
}
impl<InstantiateExt, ExecuteExt, QueryExt, ProposalMessage>
PreProposeContract<InstantiateExt, ExecuteExt, QueryExt, ProposalMessage>
{
const fn new(
proposal_key: &'static str,
dao_key: &'static str,
config_key: &'static str,
deposits_key: &'static str,
proposal_submitted_hooks_key: &'static str,
) -> Self {
Self {
proposal_module: Item::new(proposal_key),
dao: Item::new(dao_key),
config: Item::new(config_key),
deposits: Map::new(deposits_key),
proposal_submitted_hooks: Hooks::new(proposal_submitted_hooks_key),
execute_type: PhantomData,
instantiate_type: PhantomData,
query_type: PhantomData,
proposal_type: PhantomData,
}
}
}
impl<InstantiateExt, ExecuteExt, QueryExt, ProposalMessage> Default
for PreProposeContract<InstantiateExt, ExecuteExt, QueryExt, ProposalMessage>
{
fn default() -> Self {
Self::new(
"proposal_module",
"dao",
"config",
"deposits",
"proposal_submitted_hooks",
)
}
}