diff --git a/ci/bootstrap-env/src/main.rs b/ci/bootstrap-env/src/main.rs index be218793f..62ed900fb 100644 --- a/ci/bootstrap-env/src/main.rs +++ b/ci/bootstrap-env/src/main.rs @@ -121,6 +121,7 @@ fn main() -> Result<()> { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; // Init dao dao dao with an initial treasury of 9000000 tokens diff --git a/ci/integration-tests/src/helpers/helper.rs b/ci/integration-tests/src/helpers/helper.rs index 13b627d4d..018377b48 100644 --- a/ci/integration-tests/src/helpers/helper.rs +++ b/ci/integration-tests/src/helpers/helper.rs @@ -104,6 +104,7 @@ pub fn create_dao( label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; chain diff --git a/contracts/dao-dao-core/src/contract.rs b/contracts/dao-dao-core/src/contract.rs index 1ee52a165..a44d0c2ba 100644 --- a/contracts/dao-dao-core/src/contract.rs +++ b/contracts/dao-dao-core/src/contract.rs @@ -92,11 +92,16 @@ pub fn instantiate( TOTAL_PROPOSAL_MODULE_COUNT.save(deps.storage, &0)?; ACTIVE_PROPOSAL_MODULE_COUNT.save(deps.storage, &0)?; - Ok(Response::new() + let res = Response::new() .add_attribute("action", "instantiate") .add_attribute("sender", info.sender) .add_submessage(vote_module_msg) - .add_submessages(proposal_module_msgs)) + .add_submessages(proposal_module_msgs); + + if let Some(initial_dao_actions) = msg.initial_dao_actions { + return Ok(res.add_messages(initial_dao_actions)); + } + Ok(res) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/dao-dao-core/src/tests.rs b/contracts/dao-dao-core/src/tests.rs index 4c04f8cc3..9e2a379fc 100644 --- a/contracts/dao-dao-core/src/tests.rs +++ b/contracts/dao-dao-core/src/tests.rs @@ -80,6 +80,7 @@ fn test_instantiate_with_n_gov_modules(n: usize) { }) .collect(), initial_items: None, + initial_dao_actions: None, }; let gov_addr = instantiate_gov(&mut app, gov_id, instantiate); @@ -180,6 +181,7 @@ makes wickedness." }, proposal_modules_instantiate_info: governance_modules, initial_items: None, + initial_dao_actions: None, }; instantiate_gov(&mut app, gov_id, instantiate); } @@ -217,6 +219,7 @@ fn test_update_config() { label: "voting module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let gov_addr = app @@ -316,6 +319,7 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) { label: "governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let gov_addr = app @@ -495,6 +499,7 @@ fn test_removed_modules_can_not_execute() { label: "governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let gov_addr = app @@ -658,6 +663,7 @@ fn test_module_already_disabled() { label: "governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let gov_addr = app @@ -760,6 +766,7 @@ fn test_swap_voting_module() { label: "governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let gov_addr = app @@ -866,6 +873,7 @@ fn test_permissions() { initial_items: None, automatically_add_cw20s: true, automatically_add_cw721s: true, + initial_dao_actions: None, }; let gov_addr = app @@ -966,6 +974,7 @@ fn do_standard_instantiate(auto_add: bool, admin: Option) -> (Addr, App) label: "governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let gov_addr = app @@ -1683,6 +1692,7 @@ fn test_list_items() { label: "governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let gov_addr = app @@ -1817,6 +1827,7 @@ fn test_instantiate_with_items() { label: "governance module".to_string(), }], initial_items: Some(initial_items.clone()), + initial_dao_actions: None, }; // Ensure duplicates are dissallowed. @@ -2646,6 +2657,7 @@ fn test_migrate_from_compatible() { label: "governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let core_addr = app @@ -2947,6 +2959,7 @@ fn test_module_prefixes() { }, ], initial_items: None, + initial_dao_actions: None, }; let gov_addr = app diff --git a/contracts/external/btsg-ft-factory/src/testing/tests.rs b/contracts/external/btsg-ft-factory/src/testing/tests.rs index 02d456659..a7b9b6145 100644 --- a/contracts/external/btsg-ft-factory/src/testing/tests.rs +++ b/contracts/external/btsg-ft-factory/src/testing/tests.rs @@ -90,6 +90,7 @@ fn test_issue_fantoken() -> anyhow::Result<()> { label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let dao = app @@ -192,6 +193,7 @@ fn test_initial_fantoken_balances() -> anyhow::Result<()> { label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let dao = app @@ -299,6 +301,7 @@ fn test_fantoken_minter_and_authority_set_to_dao() -> anyhow::Result<()> { label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let dao = app @@ -456,6 +459,7 @@ fn test_fantoken_can_be_staked() -> anyhow::Result<()> { label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let dao = app diff --git a/contracts/external/cw-admin-factory/src/integration_tests.rs b/contracts/external/cw-admin-factory/src/integration_tests.rs index f5533e0bd..a1e694079 100644 --- a/contracts/external/cw-admin-factory/src/integration_tests.rs +++ b/contracts/external/cw-admin-factory/src/integration_tests.rs @@ -98,6 +98,7 @@ fn test_set_self_admin_instantiate2() { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let salt = Binary::from("salt".as_bytes()); diff --git a/contracts/external/cw-admin-factory/src/tests.rs b/contracts/external/cw-admin-factory/src/tests.rs index 45b009979..efd8e4b9c 100644 --- a/contracts/external/cw-admin-factory/src/tests.rs +++ b/contracts/external/cw-admin-factory/src/tests.rs @@ -80,6 +80,7 @@ pub fn test_set_self_admin() { }, ], initial_items: None, + initial_dao_actions: None, }; let res: AppResponse = app @@ -174,6 +175,7 @@ pub fn test_authorized_set_self_admin() { }, ], initial_items: None, + initial_dao_actions: None, }; // Fails when not the admin. diff --git a/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs b/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs index 7ab46d511..ea8753c49 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs @@ -108,6 +108,7 @@ impl SuiteBuilder { label: "condorcet module".to_string(), }], initial_items: None, + initial_dao_actions: None, dao_uri: None, }; let core = app diff --git a/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs b/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs index bb0eacb29..dbe66c5da 100644 --- a/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs +++ b/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs @@ -178,6 +178,7 @@ pub fn _instantiate_with_staked_cw721_governance( label: "DAO DAO governance module.".to_string(), }], initial_items: None, + initial_dao_actions: None, dao_uri: None, }; @@ -297,6 +298,7 @@ pub fn instantiate_with_native_staked_balances_governance( label: "DAO DAO governance module.".to_string(), }], initial_items: None, + initial_dao_actions: None, dao_uri: None, }; @@ -414,6 +416,7 @@ pub fn instantiate_with_cw20_balances_governance( label: "DAO DAO governance module.".to_string(), }], initial_items: None, + initial_dao_actions: None, dao_uri: None, }; @@ -500,6 +503,7 @@ pub fn instantiate_with_staked_balances_governance( label: "DAO DAO governance module.".to_string(), }], initial_items: None, + initial_dao_actions: None, dao_uri: None, }; @@ -639,6 +643,7 @@ pub fn instantiate_with_multiple_staked_balances_governance( label: "DAO DAO governance module.".to_string(), }], initial_items: None, + initial_dao_actions: None, dao_uri: None, }; @@ -754,6 +759,7 @@ pub fn instantiate_with_staking_active_threshold( label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, dao_uri: None, }; @@ -833,6 +839,7 @@ pub fn _instantiate_with_cw4_groups_governance( label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, dao_uri: None, }; diff --git a/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs b/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs index 4f469476f..86944297f 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs @@ -179,6 +179,7 @@ pub(crate) fn instantiate_with_staked_cw721_governance( label: "DAO DAO governance module.".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let core_addr = app @@ -298,6 +299,7 @@ pub(crate) fn instantiate_with_native_staked_balances_governance( label: "DAO DAO governance module.".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let core_addr = app @@ -419,6 +421,7 @@ pub(crate) fn instantiate_with_staked_balances_governance( label: "DAO DAO governance module.".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let core_addr = app @@ -534,6 +537,7 @@ pub(crate) fn instantiate_with_staking_active_threshold( label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; app.instantiate_contract( @@ -613,6 +617,7 @@ pub(crate) fn instantiate_with_cw4_groups_governance( label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let addr = app diff --git a/contracts/test/dao-proposal-hook-counter/src/tests.rs b/contracts/test/dao-proposal-hook-counter/src/tests.rs index e28ed1b34..4d6e6519b 100644 --- a/contracts/test/dao-proposal-hook-counter/src/tests.rs +++ b/contracts/test/dao-proposal-hook-counter/src/tests.rs @@ -87,6 +87,7 @@ fn instantiate_with_default_governance( label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; instantiate_governance(app, governance_id, governance_instantiate) diff --git a/contracts/voting/dao-voting-cw721-staked/src/testing/integration_tests.rs b/contracts/voting/dao-voting-cw721-staked/src/testing/integration_tests.rs index aedf0ca32..f0a316e48 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/testing/integration_tests.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/testing/integration_tests.rs @@ -120,6 +120,7 @@ fn test_full_integration_with_factory() { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; // Instantiating without funds fails diff --git a/contracts/voting/dao-voting-cw721-staked/src/testing/test_tube_env.rs b/contracts/voting/dao-voting-cw721-staked/src/testing/test_tube_env.rs index c9d462213..0d1df6912 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/testing/test_tube_env.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/testing/test_tube_env.rs @@ -144,6 +144,7 @@ impl TestEnvBuilder { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; // Instantiate DAO diff --git a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs index 77effcda6..760bb9cdc 100644 --- a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs +++ b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/integration_tests.rs @@ -404,6 +404,7 @@ fn test_factory() { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; // Instantiate DAO succeeds @@ -514,6 +515,7 @@ fn test_factory_funds_pass_through() { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; // Instantiate DAO fails because no funds to create the token were sent @@ -640,6 +642,7 @@ fn test_factory_no_callback() { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; // Instantiate DAO fails because no callback @@ -721,6 +724,7 @@ fn test_factory_wrong_callback() { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; // Instantiate DAO fails because of wrong callback diff --git a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/test_env.rs b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/test_env.rs index 3c93c9ee6..be8a399e8 100644 --- a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/test_env.rs +++ b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/test_env.rs @@ -255,6 +255,7 @@ impl TestEnvBuilder { label: "DAO DAO Proposal Module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; // Instantiate DAO diff --git a/justfile b/justfile index 59bcd434e..ff52601ee 100644 --- a/justfile +++ b/justfile @@ -59,9 +59,9 @@ workspace-optimize: --mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ --platform linux/arm64 \ - cosmwasm/optimizer-arm64:0.16.0; \ + cosmwasm/optimizer-arm64:0.16.1; \ elif [[ $(uname -m) == 'x86_64' ]]; then docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ --platform linux/amd64 \ - cosmwasm/optimizer:0.16.0; fi + cosmwasm/optimizer:0.16.1; fi diff --git a/packages/dao-interface/src/msg.rs b/packages/dao-interface/src/msg.rs index 969288433..6b50e5043 100644 --- a/packages/dao-interface/src/msg.rs +++ b/packages/dao-interface/src/msg.rs @@ -50,6 +50,8 @@ pub struct InstantiateMsg { pub initial_items: Option>, /// Implements the DAO Star standard: pub dao_uri: Option, + /// Optional initial actions for the DAO + pub initial_dao_actions: Option>, } #[cw_serde] diff --git a/packages/dao-testing/src/helpers.rs b/packages/dao-testing/src/helpers.rs index 0a36640f0..b404281af 100644 --- a/packages/dao-testing/src/helpers.rs +++ b/packages/dao-testing/src/helpers.rs @@ -80,6 +80,7 @@ pub fn instantiate_with_cw20_balances_governance( label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; app.instantiate_contract( @@ -165,6 +166,7 @@ pub fn instantiate_with_staked_balances_governance( funds: vec![], }], initial_items: None, + initial_dao_actions: None, }; let core_addr = app @@ -286,6 +288,7 @@ pub fn instantiate_with_staking_active_threshold( label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; app.instantiate_contract( @@ -360,6 +363,7 @@ pub fn instantiate_with_cw4_groups_governance( label: "DAO DAO governance module".to_string(), }], initial_items: None, + initial_dao_actions: None, }; let addr = app diff --git a/packages/dao-testing/src/suite/base.rs b/packages/dao-testing/src/suite/base.rs index 85ec6d559..7cb2012ce 100644 --- a/packages/dao-testing/src/suite/base.rs +++ b/packages/dao-testing/src/suite/base.rs @@ -278,6 +278,7 @@ impl DaoTestingSuiteBase { proposal_modules_instantiate_info, initial_items: None, dao_uri: None, + initial_dao_actions: None, }; let res = self