From fc1126054fcaacde0f6364bde8c03cf1e105ed52 Mon Sep 17 00:00:00 2001 From: Massvdev Date: Thu, 9 Nov 2023 09:59:22 -0600 Subject: [PATCH 01/16] Update deprecated function names to_binary and from_binary #761 --- ci/bootstrap-env/src/main.rs | 8 +- ci/integration-tests/src/helpers/helper.rs | 10 +- .../src/tests/cw20_stake_test.rs | 4 +- .../src/tests/cw_core_test.rs | 10 +- .../src/tests/proposal_gas_test.rs | 4 +- contracts/dao-dao-core/src/contract.rs | 48 +++---- contracts/dao-dao-core/src/tests.rs | 134 +++++++++--------- .../external/cw-admin-factory/src/tests.rs | 10 +- .../cw-fund-distributor/src/contract.rs | 20 +-- .../src/testing/adversarial_tests.rs | 4 +- .../cw-fund-distributor/src/testing/tests.rs | 8 +- .../cw-payroll-factory/src/contract.rs | 26 ++-- .../external/cw-payroll-factory/src/tests.rs | 8 +- .../external/cw-token-swap/src/contract.rs | 4 +- contracts/external/cw-token-swap/src/state.rs | 6 +- contracts/external/cw-token-swap/src/tests.rs | 20 +-- .../cw-tokenfactory-issuer/src/contract.rs | 26 ++-- contracts/external/cw-vesting/src/contract.rs | 16 +-- contracts/external/cw-vesting/src/tests.rs | 10 +- .../external/cw721-roles/src/contract.rs | 14 +- contracts/external/cw721-roles/src/tests.rs | 4 +- .../external/dao-migrator/src/contract.rs | 20 +-- .../dao-migrator/src/testing/helpers.rs | 8 +- .../dao-migrator/src/testing/setup.rs | 28 ++-- .../src/contract.rs | 16 +-- .../src/tests.rs | 14 +- .../dao-pre-propose-approver/src/contract.rs | 16 +-- .../dao-pre-propose-approver/src/tests.rs | 10 +- .../dao-pre-propose-multiple/src/tests.rs | 14 +- .../dao-pre-propose-single/src/tests.rs | 14 +- .../dao-proposal-condorcet/src/contract.rs | 12 +- .../dao-proposal-condorcet/src/proposal.rs | 4 +- .../src/testing/proposals.rs | 6 +- .../src/testing/suite.rs | 6 +- .../dao-proposal-multiple/src/contract.rs | 34 ++--- .../src/testing/adversarial_tests.rs | 4 +- .../src/testing/instantiate.rs | 38 ++--- .../src/testing/tests.rs | 24 ++-- .../dao-proposal-single/src/contract.rs | 34 ++--- .../src/testing/adversarial_tests.rs | 4 +- .../src/testing/instantiate.rs | 28 ++-- .../src/testing/migration_tests.rs | 18 +-- .../dao-proposal-single/src/testing/tests.rs | 34 ++--- .../src/contract.rs | 26 ++-- .../src/contract.rs | 12 +- .../src/tests.rs | 6 +- contracts/staking/cw20-stake/src/contract.rs | 26 ++-- contracts/staking/cw20-stake/src/tests.rs | 12 +- .../dao-proposal-hook-counter/src/contract.rs | 10 +- .../dao-proposal-hook-counter/src/tests.rs | 6 +- .../test/dao-proposal-sudo/src/contract.rs | 10 +- .../dao-test-custom-factory/src/contract.rs | 28 ++-- .../dao-voting-cw20-balance/src/contract.rs | 14 +- .../dao-voting-cw20-staked/src/contract.rs | 28 ++-- .../dao-voting-cw20-staked/src/tests.rs | 6 +- .../voting/dao-voting-cw4/src/contract.rs | 14 +- contracts/voting/dao-voting-cw4/src/tests.rs | 4 +- .../dao-voting-cw721-roles/src/contract.rs | 18 +-- .../dao-voting-cw721-staked/src/contract.rs | 52 +++---- .../src/testing/integration_tests.rs | 12 +- .../src/testing/test_tube_env.rs | 12 +- .../src/testing/tests.rs | 98 ++++++------- .../dao-voting-token-staked/src/contract.rs | 52 +++---- .../src/tests/test_tube/integration_tests.rs | 40 +++--- .../src/tests/test_tube/test_env.rs | 6 +- packages/cw-denom/src/lib.rs | 8 +- packages/cw-paginate-storage/README.md | 4 +- packages/cw-stake-tracker/src/lib.rs | 8 +- packages/cw-stake-tracker/src/tests.rs | 10 +- packages/dao-hooks/src/nft_stake.rs | 6 +- packages/dao-hooks/src/proposal.rs | 6 +- packages/dao-hooks/src/stake.rs | 6 +- packages/dao-hooks/src/vote.rs | 4 +- packages/dao-interface/src/state.rs | 14 +- packages/dao-pre-propose-base/src/execute.rs | 18 +-- packages/dao-pre-propose-base/src/tests.rs | 12 +- packages/dao-testing/src/helpers.rs | 12 +- packages/dao-voting/src/deposit.rs | 8 +- packages/dao-voting/src/pre_propose.rs | 6 +- 79 files changed, 697 insertions(+), 697 deletions(-) diff --git a/ci/bootstrap-env/src/main.rs b/ci/bootstrap-env/src/main.rs index 85fd119a5..d8117c8f5 100644 --- a/ci/bootstrap-env/src/main.rs +++ b/ci/bootstrap-env/src/main.rs @@ -1,7 +1,7 @@ use anyhow::Result; use cosm_orc::orchestrator::{Coin, Key, SigningKey}; use cosm_orc::{config::cfg::Config, orchestrator::cosm_orc::CosmOrc}; -use cosmwasm_std::{to_binary, Decimal, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Decimal, Empty, Uint128}; use cw20::Cw20Coin; use dao_interface::state::{Admin, ModuleInstantiateInfo}; use dao_voting::{ @@ -55,7 +55,7 @@ fn main() -> Result<()> { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: orc.contract_map.code_id("dao_voting_cw20_staked")?, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: orc.contract_map.code_id("cw20_base")?, label: "DAO DAO Gov token".to_string(), @@ -79,7 +79,7 @@ fn main() -> Result<()> { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: orc.contract_map.code_id("dao_proposal_single")?, - msg: to_binary(&dao_proposal_single::msg::InstantiateMsg { + msg: to_json_binary(&dao_proposal_single::msg::InstantiateMsg { min_voting_period: None, threshold: Threshold::ThresholdQuorum { threshold: PercentageThreshold::Majority {}, @@ -91,7 +91,7 @@ fn main() -> Result<()> { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: orc.contract_map.code_id("dao_pre_propose_single")?, - msg: to_binary(&dao_pre_propose_single::InstantiateMsg { + msg: to_json_binary(&dao_pre_propose_single::InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::VotingModuleToken {}, amount: Uint128::new(1000000000), diff --git a/ci/integration-tests/src/helpers/helper.rs b/ci/integration-tests/src/helpers/helper.rs index bcfd0e26d..e4f4678cf 100644 --- a/ci/integration-tests/src/helpers/helper.rs +++ b/ci/integration-tests/src/helpers/helper.rs @@ -1,7 +1,7 @@ use super::chain::Chain; use anyhow::Result; use cosm_orc::orchestrator::SigningKey; -use cosmwasm_std::{to_binary, CosmosMsg, Decimal, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, CosmosMsg, Decimal, Empty, Uint128}; use cw20::Cw20Coin; use cw_utils::Duration; use dao_interface::query::DumpStateResponse; @@ -39,7 +39,7 @@ pub fn create_dao( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: chain.orc.contract_map.code_id("dao_voting_cw20_staked")?, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: chain.orc.contract_map.code_id("cw20_base")?, label: "DAO DAO Gov token".to_string(), @@ -63,7 +63,7 @@ pub fn create_dao( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: chain.orc.contract_map.code_id("dao_proposal_single")?, - msg: to_binary(&dao_proposal_single::msg::InstantiateMsg { + msg: to_json_binary(&dao_proposal_single::msg::InstantiateMsg { min_voting_period: None, threshold: Threshold::ThresholdQuorum { threshold: PercentageThreshold::Majority {}, @@ -76,7 +76,7 @@ pub fn create_dao( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: chain.orc.contract_map.code_id("dao_pre_propose_single")?, - msg: to_binary(&dao_pre_propose_single::InstantiateMsg { + msg: to_json_binary(&dao_pre_propose_single::InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::VotingModuleToken {}, amount: DEPOSIT_AMOUNT, @@ -187,7 +187,7 @@ pub fn stake_tokens(chain: &mut Chain, how_many: u128, key: &SigningKey) { &cw20::Cw20ExecuteMsg::Send { contract: chain.orc.contract_map.address("cw20_stake").unwrap(), amount: Uint128::new(how_many), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, key, vec![], diff --git a/ci/integration-tests/src/tests/cw20_stake_test.rs b/ci/integration-tests/src/tests/cw20_stake_test.rs index 13cb0d226..4250441d5 100644 --- a/ci/integration-tests/src/tests/cw20_stake_test.rs +++ b/ci/integration-tests/src/tests/cw20_stake_test.rs @@ -1,5 +1,5 @@ use crate::helpers::{chain::Chain, helper::create_dao}; -use cosmwasm_std::{to_binary, Uint128}; +use cosmwasm_std::{to_json_binary, Uint128}; use cw20_stake::{msg::StakedValueResponse, state::Config}; use dao_interface::voting::VotingPowerAtHeightResponse; use std::time::Duration; @@ -79,7 +79,7 @@ fn execute_stake_tokens(chain: &mut Chain) { &cw20_base::msg::ExecuteMsg::Send { contract: staking_addr, amount: Uint128::new(100), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &user_key, vec![], diff --git a/ci/integration-tests/src/tests/cw_core_test.rs b/ci/integration-tests/src/tests/cw_core_test.rs index 348ac3925..904003d4e 100644 --- a/ci/integration-tests/src/tests/cw_core_test.rs +++ b/ci/integration-tests/src/tests/cw_core_test.rs @@ -3,7 +3,7 @@ use crate::helpers::helper::create_dao; use assert_matches::assert_matches; use cosm_orc::orchestrator::error::CosmwasmError::TxError; use cosm_orc::orchestrator::error::ProcessError; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, Decimal, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, Decimal, Uint128}; use cw20_stake::msg::{StakedValueResponse, TotalValueResponse}; use cw_utils::Duration; @@ -40,7 +40,7 @@ fn execute_execute_admin_msgs(chain: &mut Chain) { &dao_interface::msg::ExecuteMsg::ExecuteAdminMsgs { msgs: vec![CosmosMsg::Wasm(cosmwasm_std::WasmMsg::Execute { contract_addr: dao.addr, - msg: to_binary(&dao_interface::msg::ExecuteMsg::Pause { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::Pause { duration: Duration::Time(100), }) .unwrap(), @@ -79,7 +79,7 @@ fn execute_execute_admin_msgs(chain: &mut Chain) { &dao_interface::msg::ExecuteMsg::ExecuteAdminMsgs { msgs: vec![CosmosMsg::Wasm(cosmwasm_std::WasmMsg::Execute { contract_addr: dao.addr, - msg: to_binary(&dao_interface::msg::ExecuteMsg::Pause { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::Pause { duration: Duration::Height(100), }) .unwrap(), @@ -139,7 +139,7 @@ fn execute_items(chain: &mut Chain) { &dao_interface::msg::ExecuteMsg::ExecuteAdminMsgs { msgs: vec![CosmosMsg::Wasm(cosmwasm_std::WasmMsg::Execute { contract_addr: dao.addr.clone(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::SetItem { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::SetItem { key: "meme".to_string(), value: "foobar".to_string(), }) @@ -174,7 +174,7 @@ fn execute_items(chain: &mut Chain) { &dao_interface::msg::ExecuteMsg::ExecuteAdminMsgs { msgs: vec![CosmosMsg::Wasm(cosmwasm_std::WasmMsg::Execute { contract_addr: dao.addr, - msg: to_binary(&dao_interface::msg::ExecuteMsg::RemoveItem { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::RemoveItem { key: "meme".to_string(), }) .unwrap(), diff --git a/ci/integration-tests/src/tests/proposal_gas_test.rs b/ci/integration-tests/src/tests/proposal_gas_test.rs index e6fa015a9..3c19c559a 100644 --- a/ci/integration-tests/src/tests/proposal_gas_test.rs +++ b/ci/integration-tests/src/tests/proposal_gas_test.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, CosmosMsg, Empty, WasmMsg}; +use cosmwasm_std::{to_json_binary, CosmosMsg, Empty, WasmMsg}; use dao_proposal_single::query::ProposalResponse; use dao_voting::voting::Vote; use test_context::test_context; @@ -15,7 +15,7 @@ fn mint_mint_mint_mint(cw721: &str, owner: &str, mints: u64) -> Vec { .map(|mint| { WasmMsg::Execute { contract_addr: cw721.to_string(), - msg: to_binary(&cw721_base::msg::ExecuteMsg::Mint::{ + msg: to_json_binary(&cw721_base::msg::ExecuteMsg::Mint::{ token_id: mint.to_string(), owner: owner.to_string(), token_uri: Some("https://bafkreibufednctf2f2bpduiibgkvpqcw5rtdmhqh2htqx3qbdnji4h55hy.ipfs.nftstorage.link".to_string()), diff --git a/contracts/dao-dao-core/src/contract.rs b/contracts/dao-dao-core/src/contract.rs index 21e38784e..a4eb2d9dc 100644 --- a/contracts/dao-dao-core/src/contract.rs +++ b/contracts/dao-dao-core/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Order, + from_json_binary, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Order, Reply, Response, StdError, StdResult, SubMsg, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -579,22 +579,22 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { pub fn query_admin(deps: Deps) -> StdResult { let admin = ADMIN.load(deps.storage)?; - to_binary(&admin) + to_json_binary(&admin) } pub fn query_admin_nomination(deps: Deps) -> StdResult { let nomination = NOMINATED_ADMIN.may_load(deps.storage)?; - to_binary(&AdminNominationResponse { nomination }) + to_json_binary(&AdminNominationResponse { nomination }) } pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_voting_module(deps: Deps) -> StdResult { let voting_module = VOTING_MODULE.load(deps.storage)?; - to_binary(&voting_module) + to_json_binary(&voting_module) } pub fn query_proposal_modules( @@ -615,7 +615,7 @@ pub fn query_proposal_modules( // // Even if this does lock up one can determine the existing // proposal modules by looking at past transactions on chain. - to_binary(&paginate_map_values( + to_json_binary(&paginate_map_values( deps, &PROPOSAL_MODULES, start_after @@ -645,7 +645,7 @@ pub fn query_active_proposal_modules( let limit = limit.unwrap_or(values.len() as u32); - to_binary::>( + to_json_binary::>( &values .into_iter() .filter(|module: &ProposalModule| module.status == ProposalModuleStatus::Enabled) @@ -668,7 +668,7 @@ fn get_pause_info(deps: Deps, env: Env) -> StdResult { } pub fn query_paused(deps: Deps, env: Env) -> StdResult { - to_binary(&get_pause_info(deps, env)?) + to_json_binary(&get_pause_info(deps, env)?) } pub fn query_dump_state(deps: Deps, env: Env) -> StdResult { @@ -683,7 +683,7 @@ pub fn query_dump_state(deps: Deps, env: Env) -> StdResult { let version = get_contract_version(deps.storage)?; let active_proposal_module_count = ACTIVE_PROPOSAL_MODULE_COUNT.load(deps.storage)?; let total_proposal_module_count = TOTAL_PROPOSAL_MODULE_COUNT.load(deps.storage)?; - to_binary(&DumpStateResponse { + to_json_binary(&DumpStateResponse { admin, config, version, @@ -705,7 +705,7 @@ pub fn query_voting_power_at_height( voting_module, &voting::Query::VotingPowerAtHeight { height, address }, )?; - to_binary(&voting_power) + to_json_binary(&voting_power) } pub fn query_total_power_at_height(deps: Deps, height: Option) -> StdResult { @@ -713,17 +713,17 @@ pub fn query_total_power_at_height(deps: Deps, height: Option) -> StdResult let total_power: voting::TotalPowerAtHeightResponse = deps .querier .query_wasm_smart(voting_module, &voting::Query::TotalPowerAtHeight { height })?; - to_binary(&total_power) + to_json_binary(&total_power) } pub fn query_get_item(deps: Deps, item: String) -> StdResult { let item = ITEMS.may_load(deps.storage, item)?; - to_binary(&GetItemResponse { item }) + to_json_binary(&GetItemResponse { item }) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } pub fn query_list_items( @@ -731,7 +731,7 @@ pub fn query_list_items( start_after: Option, limit: Option, ) -> StdResult { - to_binary(&paginate_map( + to_json_binary(&paginate_map( deps, &ITEMS, start_after, @@ -745,7 +745,7 @@ pub fn query_cw20_list( start_after: Option, limit: Option, ) -> StdResult { - to_binary(&paginate_map_keys( + to_json_binary(&paginate_map_keys( deps, &CW20_LIST, start_after @@ -761,7 +761,7 @@ pub fn query_cw721_list( start_after: Option, limit: Option, ) -> StdResult { - to_binary(&paginate_map_keys( + to_json_binary(&paginate_map_keys( deps, &CW721_LIST, start_after @@ -802,7 +802,7 @@ pub fn query_cw20_balances( }) }) .collect::>>()?; - to_binary(&balances) + to_json_binary(&balances) } pub fn query_list_sub_daos( @@ -830,18 +830,18 @@ pub fn query_list_sub_daos( }) .collect(); - to_binary(&subdaos) + to_json_binary(&subdaos) } pub fn query_dao_uri(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&DaoURIResponse { + to_json_binary(&DaoURIResponse { dao_uri: config.dao_uri, }) } pub fn query_proposal_module_count(deps: Deps) -> StdResult { - to_binary(&ProposalModuleCountResponse { + to_json_binary(&ProposalModuleCountResponse { active_proposal_module_count: ACTIVE_PROPOSAL_MODULE_COUNT.load(deps.storage)?, total_proposal_module_count: TOTAL_PROPOSAL_MODULE_COUNT.load(deps.storage)?, }) @@ -904,10 +904,10 @@ pub fn migrate(deps: DepsMut, env: Env, msg: MigrateMsg) -> Result Result from_binary::(&data) + Some(data) => from_json_binary::(&data) .map(|m| m.msgs) .unwrap_or_else(|_| vec![]), None => vec![], @@ -978,7 +978,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result from_binary::(&data) + Some(data) => from_json_binary::(&data) .map(|m| m.msgs) .unwrap_or_else(|_| vec![]), None => vec![], diff --git a/contracts/dao-dao-core/src/tests.rs b/contracts/dao-dao-core/src/tests.rs index 577552e85..3ab01632e 100644 --- a/contracts/dao-dao-core/src/tests.rs +++ b/contracts/dao-dao-core/src/tests.rs @@ -2,7 +2,7 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::{ from_slice, testing::{mock_dependencies, mock_env}, - to_binary, Addr, CosmosMsg, Empty, Storage, Uint128, WasmMsg, + to_json_binary, Addr, CosmosMsg, Empty, Storage, Uint128, WasmMsg, }; use cw2::{set_contract_version, ContractVersion}; use cw_multi_test::{App, Contract, ContractWrapper, Executor}; @@ -117,7 +117,7 @@ fn test_instantiate_with_n_gov_modules(n: usize) { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -125,7 +125,7 @@ fn test_instantiate_with_n_gov_modules(n: usize) { proposal_modules_instantiate_info: (0..n) .map(|n| ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: format!("governance module {n}"), @@ -191,7 +191,7 @@ fn test_instantiate_with_submessage_failure() { let mut governance_modules = (0..3) .map(|n| ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: format!("governance module {n}"), @@ -199,14 +199,14 @@ fn test_instantiate_with_submessage_failure() { .collect::>(); governance_modules.push(ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary("bad").unwrap(), + msg: to_json_binary("bad").unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "I have a bad instantiate message".to_string(), }); governance_modules.push(ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "Everybody knowing @@ -225,7 +225,7 @@ makes wickedness." automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw20_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -256,14 +256,14 @@ fn test_update_config() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -311,7 +311,7 @@ fn test_update_config() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateConfig { + msg: to_json_binary(&ExecuteMsg::UpdateConfig { config: expected_config.clone(), }) .unwrap(), @@ -355,14 +355,14 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: propmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: propmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -426,7 +426,7 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) { let to_add: Vec<_> = (0..add) .map(|n| ModuleInstantiateInfo { code_id: propmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: format!("governance module {n}"), @@ -447,7 +447,7 @@ fn test_swap_governance(swaps: Vec<(u32, u32)>) { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }) + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }) .unwrap(), } .into()], @@ -534,14 +534,14 @@ fn test_removed_modules_can_not_execute() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -577,7 +577,7 @@ fn test_removed_modules_can_not_execute() { let to_add = vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "new governance module".to_string(), @@ -593,7 +593,7 @@ fn test_removed_modules_can_not_execute() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }).unwrap(), + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }).unwrap(), } .into()], }, @@ -609,7 +609,7 @@ fn test_removed_modules_can_not_execute() { // earlier. This should fail as we have been removed. let to_add = vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "new governance module".to_string(), @@ -624,7 +624,7 @@ fn test_removed_modules_can_not_execute() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add: to_add.clone(), to_disable: to_disable.clone(), }) @@ -666,7 +666,7 @@ fn test_removed_modules_can_not_execute() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }).unwrap(), + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }).unwrap(), } .into()], }, @@ -695,14 +695,14 @@ fn test_module_already_disabled() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -749,10 +749,10 @@ fn test_module_already_disabled() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateProposalModules { + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -797,14 +797,14 @@ fn test_swap_voting_module() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -848,10 +848,10 @@ fn test_swap_voting_module() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_binary(&ExecuteMsg::UpdateVotingModule { + msg: to_json_binary(&ExecuteMsg::UpdateVotingModule { module: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -901,14 +901,14 @@ fn test_permissions() { image_url: None, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -935,7 +935,7 @@ fn test_permissions() { ExecuteMsg::UpdateVotingModule { module: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -1003,14 +1003,14 @@ fn do_standard_instantiate(auto_add: bool, admin: Option) -> (Addr, App) automatically_add_cw721s: auto_add, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -1058,7 +1058,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1077,7 +1077,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1108,7 +1108,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::NominateAdmin { + msg: to_json_binary(&ExecuteMsg::NominateAdmin { admin: Some("meow".to_string()), }) .unwrap(), @@ -1131,7 +1131,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_with_admin_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1150,7 +1150,7 @@ fn test_admin_permissions() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_with_admin_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1395,7 +1395,7 @@ fn test_admin_nomination() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1416,7 +1416,7 @@ fn test_admin_nomination() { &ExecuteMsg::ExecuteAdminMsgs { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -1637,14 +1637,14 @@ fn test_list_items() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -1771,14 +1771,14 @@ fn test_instantiate_with_items() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -1893,7 +1893,7 @@ fn test_cw20_receive_auto_add() { &cw20::Cw20ExecuteMsg::Send { contract: gov_addr.to_string(), amount: Uint128::new(1), - msg: to_binary(&"").unwrap(), + msg: to_json_binary(&"").unwrap(), }, &[], ) @@ -2028,7 +2028,7 @@ fn test_cw20_receive_no_auto_add() { &cw20::Cw20ExecuteMsg::Send { contract: gov_addr.to_string(), amount: Uint128::new(1), - msg: to_binary(&"").unwrap(), + msg: to_json_binary(&"").unwrap(), }, &[], ) @@ -2125,7 +2125,7 @@ fn test_cw721_receive() { &cw721_base::msg::ExecuteMsg::, Empty>::SendNft { contract: gov_addr.to_string(), token_id: "ekez".to_string(), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -2255,7 +2255,7 @@ fn test_cw721_receive_no_auto_add() { &cw721_base::msg::ExecuteMsg::, Empty>::SendNft { contract: gov_addr.to_string(), token_id: "ekez".to_string(), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -2380,7 +2380,7 @@ fn test_pause() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -2442,7 +2442,7 @@ fn test_pause() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -2468,7 +2468,7 @@ fn test_pause() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -2504,7 +2504,7 @@ fn test_pause() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![WasmMsg::Execute { contract_addr: core_addr.to_string(), - msg: to_binary(&ExecuteMsg::Pause { + msg: to_json_binary(&ExecuteMsg::Pause { duration: Duration::Height(10), }) .unwrap(), @@ -2604,14 +2604,14 @@ fn test_migrate_from_compatible() { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "governance module".to_string(), @@ -2640,7 +2640,7 @@ fn test_migrate_from_compatible() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: core_addr.to_string(), new_code_id: gov_id, - msg: to_binary(&MigrateMsg::FromCompatible {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromCompatible {}).unwrap(), }), ) .unwrap(); @@ -2692,20 +2692,20 @@ fn test_migrate_from_beta() { automatically_add_cw721s: false, voting_module_instantiate_info: v1::msg::ModuleInstantiateInfo { code_id: voting_id, - msg: to_binary(&voting_instantiate).unwrap(), + msg: to_json_binary(&voting_instantiate).unwrap(), admin: v1::msg::Admin::CoreContract {}, label: "voting module".to_string(), }, proposal_modules_instantiate_info: vec![ v1::msg::ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&proposal_instantiate).unwrap(), + msg: to_json_binary(&proposal_instantiate).unwrap(), admin: v1::msg::Admin::CoreContract {}, label: "governance module 1".to_string(), }, v1::msg::ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&proposal_instantiate).unwrap(), + msg: to_json_binary(&proposal_instantiate).unwrap(), admin: v1::msg::Admin::CoreContract {}, label: "governance module 2".to_string(), }, @@ -2729,7 +2729,7 @@ fn test_migrate_from_beta() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: core_addr.to_string(), new_code_id: core_id, - msg: to_binary(&MigrateMsg::FromV1 { + msg: to_json_binary(&MigrateMsg::FromV1 { dao_uri: None, params: None, }) @@ -2758,7 +2758,7 @@ fn test_migrate_from_beta() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: core_addr.to_string(), new_code_id: core_id, - msg: to_binary(&MigrateMsg::FromV1 { + msg: to_json_binary(&MigrateMsg::FromV1 { dao_uri: None, params: None, }) @@ -2788,7 +2788,7 @@ fn test_migrate_mock() { let proposal_modules_key = Addr::unchecked("addr"); let old_map: Map = Map::new("proposal_modules"); let path = old_map.key(proposal_modules_key.clone()); - deps.storage.set(&path, &to_binary(&Empty {}).unwrap()); + deps.storage.set(&path, &to_json_binary(&Empty {}).unwrap()); // Write to storage in old config format #[cw_serde] @@ -2860,7 +2860,7 @@ fn test_execute_stargate_msg() { &ExecuteMsg::ExecuteProposalHook { msgs: vec![CosmosMsg::Stargate { type_url: "foo_type".to_string(), - value: to_binary("foo_bin").unwrap(), + value: to_json_binary("foo_bin").unwrap(), }], }, &[], @@ -2889,7 +2889,7 @@ fn test_module_prefixes() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -2897,21 +2897,21 @@ fn test_module_prefixes() { proposal_modules_instantiate_info: vec![ ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "proposal module 1".to_string(), }, ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "proposal module 2".to_string(), }, ModuleInstantiateInfo { code_id: govmod_id, - msg: to_binary(&govmod_instantiate).unwrap(), + msg: to_json_binary(&govmod_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "proposal module 2".to_string(), diff --git a/contracts/external/cw-admin-factory/src/tests.rs b/contracts/external/cw-admin-factory/src/tests.rs index 27221cb31..3bee180ee 100644 --- a/contracts/external/cw-admin-factory/src/tests.rs +++ b/contracts/external/cw-admin-factory/src/tests.rs @@ -2,7 +2,7 @@ use std::vec; use cosmwasm_std::{ testing::{mock_dependencies, mock_env, mock_info}, - to_binary, Addr, Binary, Empty, Reply, SubMsg, SubMsgResponse, SubMsgResult, WasmMsg, + to_json_binary, Addr, Binary, Empty, Reply, SubMsg, SubMsgResponse, SubMsgResult, WasmMsg, }; use cw_multi_test::{App, AppResponse, Contract, ContractWrapper, Executor}; @@ -82,7 +82,7 @@ pub fn test_set_admin() { automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw20_code_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "voting module".to_string(), @@ -90,14 +90,14 @@ pub fn test_set_admin() { proposal_modules_instantiate_info: vec![ ModuleInstantiateInfo { code_id: cw20_code_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "prop module".to_string(), }, ModuleInstantiateInfo { code_id: cw20_code_id, - msg: to_binary(&cw20_instantiate).unwrap(), + msg: to_json_binary(&cw20_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "prop module 2".to_string(), @@ -111,7 +111,7 @@ pub fn test_set_admin() { Addr::unchecked("CREATOR"), factory_addr, &ExecuteMsg::InstantiateContractWithSelfAdmin { - instantiate_msg: to_binary(&instantiate_core).unwrap(), + instantiate_msg: to_json_binary(&instantiate_core).unwrap(), code_id: cw_core_code_id, label: "my contract".to_string(), }, diff --git a/contracts/external/cw-fund-distributor/src/contract.rs b/contracts/external/cw-fund-distributor/src/contract.rs index 2e5d4b2d1..8e658905a 100644 --- a/contracts/external/cw-fund-distributor/src/contract.rs +++ b/contracts/external/cw-fund-distributor/src/contract.rs @@ -10,7 +10,7 @@ use crate::state::{ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, Fraction, MessageInfo, + to_json_binary, Addr, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, Fraction, MessageInfo, Order, Response, StdError, StdResult, Uint128, WasmMsg, }; use cw2::set_contract_version; @@ -247,7 +247,7 @@ fn get_cw20_claim_wasm_messages( messages.push(WasmMsg::Execute { contract_addr: addr, - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: sender.to_string(), amount: entitlement, })?, @@ -406,7 +406,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { pub fn query_voting_contract(deps: Deps) -> StdResult { let contract = VOTING_CONTRACT.load(deps.storage)?; let distribution_height = DISTRIBUTION_HEIGHT.load(deps.storage)?; - to_binary(&VotingContractResponse { + to_json_binary(&VotingContractResponse { contract, distribution_height, }) @@ -414,7 +414,7 @@ pub fn query_voting_contract(deps: Deps) -> StdResult { pub fn query_total_power(deps: Deps) -> StdResult { let total_power: Uint128 = TOTAL_POWER.may_load(deps.storage)?.unwrap_or_default(); - to_binary(&TotalPowerResponse { total_power }) + to_json_binary(&TotalPowerResponse { total_power }) } pub fn query_native_denoms(deps: Deps) -> StdResult { @@ -429,7 +429,7 @@ pub fn query_native_denoms(deps: Deps) -> StdResult { }); } - to_binary(&denom_responses) + to_json_binary(&denom_responses) } pub fn query_cw20_tokens(deps: Deps) -> StdResult { @@ -444,7 +444,7 @@ pub fn query_cw20_tokens(deps: Deps) -> StdResult { }); } - to_binary(&cw20_responses) + to_json_binary(&cw20_responses) } pub fn query_native_entitlement(deps: Deps, sender: Addr, denom: String) -> StdResult { @@ -461,7 +461,7 @@ pub fn query_native_entitlement(deps: Deps, sender: Addr, denom: String) -> StdR total_bal.multiply_ratio(relative_share.numerator(), relative_share.denominator()); let entitlement = total_share.checked_sub(prev_claim)?; - to_binary(&NativeEntitlementResponse { + to_json_binary(&NativeEntitlementResponse { amount: entitlement, denom, }) @@ -483,7 +483,7 @@ pub fn query_cw20_entitlement(deps: Deps, sender: Addr, token: String) -> StdRes total_bal.multiply_ratio(relative_share.numerator(), relative_share.denominator()); let entitlement = total_share.checked_sub(prev_claim)?; - to_binary(&CW20EntitlementResponse { + to_json_binary(&CW20EntitlementResponse { amount: entitlement, token_contract: token, }) @@ -514,7 +514,7 @@ pub fn query_native_entitlements( }); } - to_binary(&entitlements) + to_json_binary(&entitlements) } pub fn query_cw20_entitlements( @@ -544,7 +544,7 @@ pub fn query_cw20_entitlements( }); } - to_binary(&entitlements) + to_json_binary(&entitlements) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/external/cw-fund-distributor/src/testing/adversarial_tests.rs b/contracts/external/cw-fund-distributor/src/testing/adversarial_tests.rs index ff07edbff..8df033529 100644 --- a/contracts/external/cw-fund-distributor/src/testing/adversarial_tests.rs +++ b/contracts/external/cw-fund-distributor/src/testing/adversarial_tests.rs @@ -1,6 +1,6 @@ use crate::msg::ExecuteMsg::ClaimAll; use crate::msg::{ExecuteMsg, InstantiateMsg}; -use cosmwasm_std::{to_binary, Addr, Binary, Coin, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Binary, Coin, Empty, Uint128}; use cw20::{BalanceResponse, Cw20Coin}; use cw_multi_test::{next_block, App, BankSudo, Contract, ContractWrapper, Executor, SudoMsg}; use cw_utils::Duration; @@ -127,7 +127,7 @@ fn setup_test(initial_balances: Vec) -> BaseTest { &cw20_base::msg::ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) diff --git a/contracts/external/cw-fund-distributor/src/testing/tests.rs b/contracts/external/cw-fund-distributor/src/testing/tests.rs index 6c3f2a254..544856b81 100644 --- a/contracts/external/cw-fund-distributor/src/testing/tests.rs +++ b/contracts/external/cw-fund-distributor/src/testing/tests.rs @@ -3,7 +3,7 @@ use crate::msg::{ NativeEntitlementResponse, QueryMsg, TotalPowerResponse, VotingContractResponse, }; use crate::ContractError; -use cosmwasm_std::{to_binary, Addr, Binary, Coin, Empty, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Binary, Coin, Empty, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, BankSudo, Contract, ContractWrapper, Executor, SudoMsg}; @@ -114,7 +114,7 @@ fn setup_test(initial_balances: Vec) -> BaseTest { &cw20_base::msg::ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -1044,7 +1044,7 @@ pub fn test_redistribute_unclaimed_funds() { WasmMsg::Migrate { contract_addr: distributor_address.to_string(), new_code_id: distributor_id, - msg: to_binary(migrate_msg).unwrap(), + msg: to_json_binary(migrate_msg).unwrap(), } .into(), ) @@ -1121,7 +1121,7 @@ pub fn test_unauthorized_redistribute_unclaimed_funds() { WasmMsg::Migrate { contract_addr: distributor_address.to_string(), new_code_id: distributor_id, - msg: to_binary(migrate_msg).unwrap(), + msg: to_json_binary(migrate_msg).unwrap(), } .into(), ) diff --git a/contracts/external/cw-payroll-factory/src/contract.rs b/contracts/external/cw-payroll-factory/src/contract.rs index aa7af2b65..aad8d44dc 100644 --- a/contracts/external/cw-payroll-factory/src/contract.rs +++ b/contracts/external/cw-payroll-factory/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Order, Reply, + from_json_binary, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Order, Reply, Response, StdResult, SubMsg, WasmMsg, }; use cosmwasm_std::{Addr, Coin}; @@ -72,7 +72,7 @@ pub fn execute_receive_cw20( // Only accepts cw20 tokens nonpayable(&info)?; - let msg: ReceiveMsg = from_binary(&receive_msg.msg)?; + let msg: ReceiveMsg = from_json_binary(&receive_msg.msg)?; if TMP_INSTANTIATOR_INFO.may_load(deps.storage)?.is_some() { return Err(ContractError::Reentrancy); @@ -147,7 +147,7 @@ pub fn instantiate_contract( let instantiate = WasmMsg::Instantiate { admin: instantiate_msg.owner.clone(), code_id, - msg: to_binary(&instantiate_msg)?, + msg: to_json_binary(&instantiate_msg)?, funds: funds.unwrap_or_default(), label, }; @@ -194,7 +194,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsReverse { start_before, @@ -209,7 +209,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsByInstantiator { instantiator, @@ -231,7 +231,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsByInstantiatorReverse { instantiator, @@ -253,7 +253,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsByRecipient { recipient, @@ -275,7 +275,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } QueryMsg::ListVestingContractsByRecipientReverse { recipient, @@ -297,10 +297,10 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { .flat_map(|vc| Ok::(vc?.1)) .collect(); - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), - QueryMsg::CodeId {} => to_binary(&VESTING_CODE_ID.load(deps.storage)?), + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::CodeId {} => to_json_binary(&VESTING_CODE_ID.load(deps.storage)?), } } @@ -339,10 +339,10 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result StdResult { let counterparty_one = COUNTERPARTY_ONE.load(deps.storage)?; let counterparty_two = COUNTERPARTY_TWO.load(deps.storage)?; - to_binary(&StatusResponse { + to_json_binary(&StatusResponse { counterparty_one, counterparty_two, }) diff --git a/contracts/external/cw-token-swap/src/state.rs b/contracts/external/cw-token-swap/src/state.rs index 7ea5cd1a5..6f971629b 100644 --- a/contracts/external/cw-token-swap/src/state.rs +++ b/contracts/external/cw-token-swap/src/state.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, Addr, BankMsg, Coin, CosmosMsg, Deps, StdError, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, BankMsg, Coin, CosmosMsg, Deps, StdError, Uint128, WasmMsg}; use cw_storage_plus::Item; use crate::{ @@ -85,7 +85,7 @@ impl CheckedTokenInfo { amount, } => WasmMsg::Execute { contract_addr: contract_addr.into_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: recipient.to_string(), amount, })?, @@ -133,7 +133,7 @@ mod tests { CosmosMsg::Wasm(WasmMsg::Execute { funds: vec![], contract_addr: "ekez_token".to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: "ekez".to_string(), amount: Uint128::new(100) }) diff --git a/contracts/external/cw-token-swap/src/tests.rs b/contracts/external/cw-token-swap/src/tests.rs index 7e6073f20..e2d2a9913 100644 --- a/contracts/external/cw-token-swap/src/tests.rs +++ b/contracts/external/cw-token-swap/src/tests.rs @@ -1,6 +1,6 @@ use cosmwasm_std::{ testing::{mock_dependencies, mock_env}, - to_binary, Addr, Coin, Empty, Uint128, + to_json_binary, Addr, Coin, Empty, Uint128, }; use cw20::Cw20Coin; use cw_multi_test::{App, BankSudo, Contract, ContractWrapper, Executor, SudoMsg}; @@ -95,7 +95,7 @@ fn test_simple_escrow() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -209,7 +209,7 @@ fn test_withdraw() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -380,7 +380,7 @@ fn test_withdraw_post_completion() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -618,7 +618,7 @@ fn test_fund_non_counterparty() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -714,7 +714,7 @@ fn test_fund_twice() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -763,7 +763,7 @@ fn test_fund_twice() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.into_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -835,7 +835,7 @@ fn test_fund_invalid_amount() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(10), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -1022,7 +1022,7 @@ fn test_fund_invalid_cw20() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -1041,7 +1041,7 @@ fn test_fund_invalid_cw20() { &cw20::Cw20ExecuteMsg::Send { contract: escrow.to_string(), amount: Uint128::new(100), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) diff --git a/contracts/external/cw-tokenfactory-issuer/src/contract.rs b/contracts/external/cw-tokenfactory-issuer/src/contract.rs index 2883087c6..2a5039afe 100644 --- a/contracts/external/cw-tokenfactory-issuer/src/contract.rs +++ b/contracts/external/cw-tokenfactory-issuer/src/contract.rs @@ -3,7 +3,7 @@ use std::convert::TryInto; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, + to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, }; use cosmwasm_std::{CosmosMsg, Reply}; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -133,30 +133,30 @@ pub fn sudo(deps: DepsMut, _env: Env, msg: SudoMsg) -> Result StdResult { match msg { QueryMsg::Allowlist { start_after, limit } => { - to_binary(&queries::query_allowlist(deps, start_after, limit)?) + to_json_binary(&queries::query_allowlist(deps, start_after, limit)?) } QueryMsg::BeforeSendHookInfo {} => { - to_binary(&queries::query_before_send_hook_features(deps)?) + to_json_binary(&queries::query_before_send_hook_features(deps)?) } QueryMsg::BurnAllowance { address } => { - to_binary(&queries::query_burn_allowance(deps, address)?) + to_json_binary(&queries::query_burn_allowance(deps, address)?) } QueryMsg::BurnAllowances { start_after, limit } => { - to_binary(&queries::query_burn_allowances(deps, start_after, limit)?) + to_json_binary(&queries::query_burn_allowances(deps, start_after, limit)?) } - QueryMsg::Denom {} => to_binary(&queries::query_denom(deps)?), + QueryMsg::Denom {} => to_json_binary(&queries::query_denom(deps)?), QueryMsg::Denylist { start_after, limit } => { - to_binary(&queries::query_denylist(deps, start_after, limit)?) + to_json_binary(&queries::query_denylist(deps, start_after, limit)?) } - QueryMsg::IsAllowed { address } => to_binary(&queries::query_is_allowed(deps, address)?), - QueryMsg::IsDenied { address } => to_binary(&queries::query_is_denied(deps, address)?), - QueryMsg::IsFrozen {} => to_binary(&queries::query_is_frozen(deps)?), - QueryMsg::Ownership {} => to_binary(&queries::query_owner(deps)?), + QueryMsg::IsAllowed { address } => to_json_binary(&queries::query_is_allowed(deps, address)?), + QueryMsg::IsDenied { address } => to_json_binary(&queries::query_is_denied(deps, address)?), + QueryMsg::IsFrozen {} => to_json_binary(&queries::query_is_frozen(deps)?), + QueryMsg::Ownership {} => to_json_binary(&queries::query_owner(deps)?), QueryMsg::MintAllowance { address } => { - to_binary(&queries::query_mint_allowance(deps, address)?) + to_json_binary(&queries::query_mint_allowance(deps, address)?) } QueryMsg::MintAllowances { start_after, limit } => { - to_binary(&queries::query_mint_allowances(deps, start_after, limit)?) + to_json_binary(&queries::query_mint_allowances(deps, start_after, limit)?) } } } diff --git a/contracts/external/cw-vesting/src/contract.rs b/contracts/external/cw-vesting/src/contract.rs index 70c0cea96..eddfe51bc 100644 --- a/contracts/external/cw-vesting/src/contract.rs +++ b/contracts/external/cw-vesting/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Binary, Coin, CosmosMsg, DelegationResponse, Deps, DepsMut, + from_json_binary, to_json_binary, Binary, Coin, CosmosMsg, DelegationResponse, Deps, DepsMut, DistributionMsg, Env, MessageInfo, Response, StakingMsg, StakingQuery, StdResult, Timestamp, Uint128, }; @@ -137,7 +137,7 @@ pub fn execute_receive_cw20( // Only accepts cw20 tokens nonpayable(&info)?; - let msg: ReceiveMsg = from_binary(&receive_msg.msg)?; + let msg: ReceiveMsg = from_json_binary(&receive_msg.msg)?; match msg { ReceiveMsg::Fund {} => { @@ -446,20 +446,20 @@ pub fn execute_register_slash( #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), - QueryMsg::Info {} => to_binary(&PAYMENT.get_vest(deps.storage)?), - QueryMsg::Distributable { t } => to_binary(&PAYMENT.distributable( + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::Info {} => to_json_binary(&PAYMENT.get_vest(deps.storage)?), + QueryMsg::Distributable { t } => to_json_binary(&PAYMENT.distributable( deps.storage, &PAYMENT.get_vest(deps.storage)?, t.unwrap_or(env.block.time), )?), QueryMsg::Stake(q) => PAYMENT.query_stake(deps.storage, q), - QueryMsg::Vested { t } => to_binary( + QueryMsg::Vested { t } => to_json_binary( &PAYMENT .get_vest(deps.storage)? .vested(t.unwrap_or(env.block.time)), ), - QueryMsg::TotalToVest {} => to_binary(&PAYMENT.get_vest(deps.storage)?.total()), - QueryMsg::VestDuration {} => to_binary(&PAYMENT.duration(deps.storage)?), + QueryMsg::TotalToVest {} => to_json_binary(&PAYMENT.get_vest(deps.storage)?.total()), + QueryMsg::VestDuration {} => to_json_binary(&PAYMENT.duration(deps.storage)?), } } diff --git a/contracts/external/cw-vesting/src/tests.rs b/contracts/external/cw-vesting/src/tests.rs index c9f78099c..bff5f8f11 100644 --- a/contracts/external/cw-vesting/src/tests.rs +++ b/contracts/external/cw-vesting/src/tests.rs @@ -1,5 +1,5 @@ use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; -use cosmwasm_std::{coins, to_binary, Addr, Coin, Decimal, Empty, Uint128, Validator}; +use cosmwasm_std::{coins, to_json_binary, Addr, Coin, Decimal, Empty, Uint128, Validator}; use cw20::{Cw20Coin, Cw20ExecuteMsg, Cw20ReceiveMsg}; use cw_denom::{CheckedDenom, UncheckedDenom}; use cw_multi_test::{ @@ -170,7 +170,7 @@ fn setup_test_case(app: &mut App, msg: InstantiateMsg, funds: &[Coin]) -> TestCa let msg = Cw20ExecuteMsg::Send { contract: cw_vesting_addr.to_string(), amount: msg.total, - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }; app.execute_contract( Addr::unchecked(OWNER), @@ -509,7 +509,7 @@ fn test_catch_imposter_cw20() { let msg = Cw20ExecuteMsg::Send { contract: cw_vesting_addr.to_string(), amount: Uint128::new(TOTAL_VEST), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }; // Errors that cw20 does not match what was expected @@ -595,7 +595,7 @@ fn test_execution_rejection_recv() { Cw20ReceiveMsg { sender: "random".to_string(), amount: Uint128::new(100), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }, ) .unwrap_err(); @@ -608,7 +608,7 @@ fn test_execution_rejection_recv() { Cw20ReceiveMsg { sender: "random".to_string(), amount: Uint128::new(101), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }, ) .unwrap_err(); diff --git a/contracts/external/cw721-roles/src/contract.rs b/contracts/external/cw721-roles/src/contract.rs index 2fc13bc37..6d087c578 100644 --- a/contracts/external/cw721-roles/src/contract.rs +++ b/contracts/external/cw721-roles/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, + from_json_binary, to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, StdResult, SubMsg, Uint64, }; use cw4::{ @@ -154,7 +154,7 @@ pub fn execute_burn( token_id: String, ) -> Result { // Lookup the owner of the NFT - let owner: OwnerOfResponse = from_binary(&Cw721Roles::default().query( + let owner: OwnerOfResponse = from_json_binary(&Cw721Roles::default().query( deps.as_ref(), env.clone(), QueryMsg::OwnerOf { @@ -164,7 +164,7 @@ pub fn execute_burn( )?)?; // Get the weight of the token - let nft_info: NftInfoResponse = from_binary(&Cw721Roles::default().query( + let nft_info: NftInfoResponse = from_json_binary(&Cw721Roles::default().query( deps.as_ref(), env.clone(), QueryMsg::NftInfo { @@ -438,14 +438,14 @@ pub fn execute_update_token_weight( pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::Extension { msg } => match msg { - QueryExt::Hooks {} => to_binary(&HOOKS.query_hooks(deps)?), + QueryExt::Hooks {} => to_json_binary(&HOOKS.query_hooks(deps)?), QueryExt::ListMembers { start_after, limit } => { - to_binary(&query_list_members(deps, start_after, limit)?) + to_json_binary(&query_list_members(deps, start_after, limit)?) } QueryExt::Member { addr, at_height } => { - to_binary(&query_member(deps, addr, at_height)?) + to_json_binary(&query_member(deps, addr, at_height)?) } - QueryExt::TotalWeight { at_height } => to_binary(&query_total_weight(deps, at_height)?), + QueryExt::TotalWeight { at_height } => to_json_binary(&query_total_weight(deps, at_height)?), }, _ => Cw721Roles::default().query(deps, env, msg), } diff --git a/contracts/external/cw721-roles/src/tests.rs b/contracts/external/cw721-roles/src/tests.rs index 0783af57a..005c2e61f 100644 --- a/contracts/external/cw721-roles/src/tests.rs +++ b/contracts/external/cw721-roles/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Binary}; +use cosmwasm_std::{to_json_binary, Addr, Binary}; use cw4::{HooksResponse, Member, MemberListResponse, MemberResponse, TotalWeightResponse}; use cw721::{NftInfoResponse, OwnerOfResponse}; use cw_multi_test::{App, Executor}; @@ -276,7 +276,7 @@ fn test_send_permissions() { let msg = ExecuteMsg::SendNft { contract: cw721_staked_addr.to_string(), token_id: "1".to_string(), - msg: to_binary(&Binary::default()).unwrap(), + msg: to_json_binary(&Binary::default()).unwrap(), }; app.execute_contract(Addr::unchecked(ALICE), cw721_addr.clone(), &msg, &[]) .unwrap_err(); diff --git a/contracts/external/dao-migrator/src/contract.rs b/contracts/external/dao-migrator/src/contract.rs index ae91152d5..55c6beb5f 100644 --- a/contracts/external/dao-migrator/src/contract.rs +++ b/contracts/external/dao-migrator/src/contract.rs @@ -3,7 +3,7 @@ use std::{collections::HashSet, env}; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -42,10 +42,10 @@ pub fn instantiate( CORE_ADDR.save(deps.storage, &info.sender)?; Ok( - Response::default().set_data(to_binary(&ModuleInstantiateCallback { + Response::default().set_data(to_json_binary(&ModuleInstantiateCallback { msgs: vec![WasmMsg::Execute { contract_addr: env.contract.address.to_string(), - msg: to_binary(&MigrateV1ToV2 { + msg: to_json_binary(&MigrateV1ToV2 { sub_daos: msg.sub_daos, migration_params: msg.migration_params, v1_code_ids: msg.v1_code_ids, @@ -168,7 +168,7 @@ fn execute_migration_v1_v2( WasmMsg::Migrate { contract_addr: voting_module.to_string(), new_code_id: voting_pair.v2_code_id, - msg: to_binary(&voting_pair.migrate_msg).unwrap(), + msg: to_json_binary(&voting_pair.migrate_msg).unwrap(), } .into(), ); @@ -212,7 +212,7 @@ fn execute_migration_v1_v2( WasmMsg::Migrate { contract_addr: cw20_staked_addr.to_string(), new_code_id: staking_pair.v2_code_id, - msg: to_binary(&staking_pair.migrate_msg).unwrap(), + msg: to_json_binary(&staking_pair.migrate_msg).unwrap(), } .into(), ); @@ -276,7 +276,7 @@ fn execute_migration_v1_v2( WasmMsg::Migrate { contract_addr: module.address.to_string(), new_code_id: proposal_pair.v2_code_id, - msg: to_binary(&proposal_pair.migrate_msg).unwrap(), + msg: to_json_binary(&proposal_pair.migrate_msg).unwrap(), } .into(), ); @@ -305,7 +305,7 @@ fn execute_migration_v1_v2( msgs.push( WasmMsg::Execute { contract_addr: info.sender.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::UpdateSubDaos { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::UpdateSubDaos { to_add: sub_daos, to_remove: vec![], })?, @@ -318,7 +318,7 @@ fn execute_migration_v1_v2( let proposal_hook_msg = SubMsg::reply_on_success( WasmMsg::Execute { contract_addr: info.sender.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, funds: vec![], }, V1_V2_REPLY_ID, @@ -345,10 +345,10 @@ pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> Result (Addr, V let (voting_code_id, msg) = match voting_type { VotingType::Cw4 => ( code_ids.cw4_voting, - to_binary(&get_cw4_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw4_init_msg(code_ids.clone())).unwrap(), ), VotingType::Cw20 => ( code_ids.cw20_voting, - to_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), ), VotingType::Cw20V03 => { // The simple change we need to do is to swap the cw20_stake with the one in v0.3.0 @@ -35,7 +35,7 @@ pub fn init_v1(app: &mut App, sender: Addr, voting_type: VotingType) -> (Addr, V ( code_ids.cw20_voting, - to_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), ) } }; @@ -59,7 +59,7 @@ pub fn init_v1(app: &mut App, sender: Addr, voting_type: VotingType) -> (Addr, V }, proposal_modules_instantiate_info: vec![cw_core_v1::msg::ModuleInstantiateInfo { code_id: code_ids.proposal_single, - msg: to_binary(&cw_proposal_single_v1::msg::InstantiateMsg { + msg: to_json_binary(&cw_proposal_single_v1::msg::InstantiateMsg { threshold: voting_v1::Threshold::AbsolutePercentage { percentage: voting_v1::PercentageThreshold::Majority {}, }, @@ -109,11 +109,11 @@ pub fn init_v1_with_multiple_proposals( let (voting_code_id, msg) = match voting_type { VotingType::Cw4 => ( code_ids.cw4_voting, - to_binary(&get_cw4_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw4_init_msg(code_ids.clone())).unwrap(), ), VotingType::Cw20 => ( code_ids.cw20_voting, - to_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), ), VotingType::Cw20V03 => { let v03_cw20_stake = app.store_code(stake_cw20_v03_contract()); @@ -122,7 +122,7 @@ pub fn init_v1_with_multiple_proposals( ( code_ids.cw20_voting, - to_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), + to_json_binary(&get_cw20_init_msg(code_ids.clone())).unwrap(), ) } }; @@ -147,7 +147,7 @@ pub fn init_v1_with_multiple_proposals( proposal_modules_instantiate_info: vec![ cw_core_v1::msg::ModuleInstantiateInfo { code_id: code_ids.proposal_single, - msg: to_binary(&cw_proposal_single_v1::msg::InstantiateMsg { + msg: to_json_binary(&cw_proposal_single_v1::msg::InstantiateMsg { threshold: voting_v1::Threshold::AbsolutePercentage { percentage: voting_v1::PercentageThreshold::Majority {}, }, @@ -163,7 +163,7 @@ pub fn init_v1_with_multiple_proposals( }, cw_core_v1::msg::ModuleInstantiateInfo { code_id: code_ids.proposal_single, - msg: to_binary(&cw_proposal_single_v1::msg::InstantiateMsg { + msg: to_json_binary(&cw_proposal_single_v1::msg::InstantiateMsg { threshold: voting_v1::Threshold::AbsolutePercentage { percentage: voting_v1::PercentageThreshold::Majority {}, }, @@ -291,7 +291,7 @@ pub fn execute_migration( WasmMsg::Migrate { contract_addr: module_addrs.core.to_string(), new_code_id: new_code_ids.core, - msg: to_binary(&dao_interface::msg::MigrateMsg::FromV1 { + msg: to_json_binary(&dao_interface::msg::MigrateMsg::FromV1 { dao_uri: None, params: None, }) @@ -300,10 +300,10 @@ pub fn execute_migration( .into(), WasmMsg::Execute { contract_addr: module_addrs.core.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::UpdateProposalModules { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::UpdateProposalModules { to_add: vec![ModuleInstantiateInfo { code_id: migrator_code_id, - msg: to_binary(&crate::msg::InstantiateMsg { + msg: to_json_binary(&crate::msg::InstantiateMsg { sub_daos: params.sub_daos.unwrap(), migration_params: MigrationParams { migrate_stake_cw20_manager: params.migrate_cw20, @@ -398,7 +398,7 @@ pub fn execute_migration_from_core( msgs: vec![WasmMsg::Migrate { contract_addr: module_addrs.core.to_string(), new_code_id: new_code_ids.core, - msg: to_binary(&dao_interface::msg::MigrateMsg::FromV1 { + msg: to_json_binary(&dao_interface::msg::MigrateMsg::FromV1 { dao_uri: None, params: Some(dao_interface::migrate_msg::MigrateParams { migrator_code_id, diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs index a0ad2b764..9de5f586f 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, StdResult, SubMsg, + to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, StdResult, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -107,7 +107,7 @@ pub fn execute_propose( .prepare_hooks(deps.storage, |a| { let execute_msg = WasmMsg::Execute { contract_addr: a.into_string(), - msg: to_binary(&ExecuteBase::::Propose { + msg: to_json_binary(&ExecuteBase::::Propose { msg: ApproverProposeMessage::Propose { title: propose_msg_internal.title.clone(), description: propose_msg_internal.description.clone(), @@ -169,7 +169,7 @@ pub fn execute_approve( let propose_messsage = WasmMsg::Execute { contract_addr: proposal_module.into_string(), - msg: to_binary(&ProposeMessageInternal::Propose(proposal.msg))?, + msg: to_json_binary(&ProposeMessageInternal::Propose(proposal.msg))?, funds: vec![], }; PENDING_PROPOSALS.remove(deps.storage, id); @@ -221,7 +221,7 @@ pub fn execute_reject( Ok(Response::default() .add_attribute("method", "proposal_rejected") .add_attribute("proposal", id.to_string()) - .add_attribute("deposit_info", to_binary(&deposit)?.to_string()) + .add_attribute("deposit_info", to_json_binary(&deposit)?.to_string()) .add_messages(messages)) } @@ -296,11 +296,11 @@ pub fn execute_remove_approver_hook( pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::QueryExtension { msg } => match msg { - QueryExt::Approver {} => to_binary(&APPROVER.load(deps.storage)?), + QueryExt::Approver {} => to_json_binary(&APPROVER.load(deps.storage)?), QueryExt::PendingProposal { id } => { - to_binary(&PENDING_PROPOSALS.load(deps.storage, id)?) + to_json_binary(&PENDING_PROPOSALS.load(deps.storage, id)?) } - QueryExt::PendingProposals { start_after, limit } => to_binary(&paginate_map_values( + QueryExt::PendingProposals { start_after, limit } => to_json_binary(&paginate_map_values( deps, &PENDING_PROPOSALS, start_after, @@ -310,7 +310,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryExt::ReversePendingProposals { start_before, limit, - } => to_binary(&paginate_map_values( + } => to_json_binary(&paginate_map_values( deps, &PENDING_PROPOSALS, start_before, diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs index cf6eaf5ca..a53aeddd8 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_slice, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -62,7 +62,7 @@ fn get_default_proposal_module_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info, open_proposal_submission, extension: InstantiateExt { @@ -122,7 +122,7 @@ fn setup_default_test( let core_addr = instantiate_with_cw4_groups_governance( app, dao_proposal_single_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1186,7 +1186,7 @@ fn test_instantiate_with_zero_native_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Native("ujuno".to_string()), @@ -1213,7 +1213,7 @@ fn test_instantiate_with_zero_native_deposit() { instantiate_with_cw4_groups_governance( &mut app, dao_proposal_single_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1250,7 +1250,7 @@ fn test_instantiate_with_zero_cw20_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Cw20(cw20_addr.into_string()), @@ -1277,7 +1277,7 @@ fn test_instantiate_with_zero_cw20_deposit() { instantiate_with_cw4_groups_governance( &mut app, dao_proposal_single_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs b/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs index c1e52ecd3..193a63216 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdResult, + to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdResult, WasmMsg, }; use cw2::set_contract_version; @@ -50,18 +50,18 @@ pub fn instantiate( let addr = deps.api.addr_validate(&msg.pre_propose_approval_contract)?; PRE_PROPOSE_APPROVAL_CONTRACT.save(deps.storage, &addr)?; - Ok(resp.set_data(to_binary(&ModuleInstantiateCallback { + Ok(resp.set_data(to_json_binary(&ModuleInstantiateCallback { msgs: vec![ CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: addr.to_string(), - msg: to_binary(&PreProposeApprovalExecuteMsg::AddProposalSubmittedHook { + msg: to_json_binary(&PreProposeApprovalExecuteMsg::AddProposalSubmittedHook { address: env.contract.address.to_string(), })?, funds: vec![], }), CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: addr.to_string(), - msg: to_binary(&PreProposeApprovalExecuteMsg::Extension { + msg: to_json_binary(&PreProposeApprovalExecuteMsg::Extension { msg: ApprovalExt::UpdateApprover { address: env.contract.address.to_string(), }, @@ -128,7 +128,7 @@ pub fn execute_propose( let propose_messsage = WasmMsg::Execute { contract_addr: proposal_module.into_string(), - msg: to_binary(&sanitized_msg)?, + msg: to_json_binary(&sanitized_msg)?, funds: vec![], }; Ok(Response::default().add_message(propose_messsage)) @@ -156,14 +156,14 @@ pub fn execute_proposal_completed( let msg = match new_status { Status::Closed => Some(WasmMsg::Execute { contract_addr: approval_contract.into_string(), - msg: to_binary(&PreProposeApprovalExecuteMsg::Extension { + msg: to_json_binary(&PreProposeApprovalExecuteMsg::Extension { msg: ApprovalExt::Reject { id: pre_propose_id }, })?, funds: vec![], }), Status::Executed => Some(WasmMsg::Execute { contract_addr: approval_contract.into_string(), - msg: to_binary(&PreProposeApprovalExecuteMsg::Extension { + msg: to_json_binary(&PreProposeApprovalExecuteMsg::Extension { msg: ApprovalExt::Approve { id: pre_propose_id }, })?, funds: vec![], @@ -186,7 +186,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::QueryExtension { msg } => match msg { QueryExt::PreProposeApprovalContract {} => { - to_binary(&PRE_PROPOSE_APPROVAL_CONTRACT.load(deps.storage)?) + to_json_binary(&PRE_PROPOSE_APPROVAL_CONTRACT.load(deps.storage)?) } }, _ => PrePropose::default().query(deps, env, msg), diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs index a52c91042..f36996207 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_slice, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -86,7 +86,7 @@ fn get_proposal_module_approval_single_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info, open_proposal_submission, extension: InstantiateExt { @@ -122,7 +122,7 @@ fn get_proposal_module_approver_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&ApproverInstantiateMsg { + msg: to_json_binary(&ApproverInstantiateMsg { pre_propose_approval_contract, }) .unwrap(), @@ -184,7 +184,7 @@ fn setup_default_test( let core_addr = instantiate_with_cw4_groups_governance( app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -238,7 +238,7 @@ fn setup_default_test( let _approver_core_addr = instantiate_with_cw4_groups_governance( app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), diff --git a/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs b/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs index 2de6ee79c..e70816c3a 100644 --- a/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Decimal, Empty, Uint128}; +use cosmwasm_std::{coins, from_slice, to_json_binary, Addr, Coin, Decimal, Empty, Uint128}; use cpm::query::ProposalResponse; use cw2::ContractVersion; use cw20::Cw20Coin; @@ -65,7 +65,7 @@ fn get_default_proposal_module_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -122,7 +122,7 @@ fn setup_default_test( let core_addr = instantiate_with_cw4_groups_governance( app, cpm_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1047,7 +1047,7 @@ fn test_instantiate_with_zero_native_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Native("ujuno".to_string()), @@ -1072,7 +1072,7 @@ fn test_instantiate_with_zero_native_deposit() { instantiate_with_cw4_groups_governance( &mut app, cpm_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1109,7 +1109,7 @@ fn test_instantiate_with_zero_cw20_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Cw20(cw20_addr.into_string()), @@ -1134,7 +1134,7 @@ fn test_instantiate_with_zero_cw20_deposit() { instantiate_with_cw4_groups_governance( &mut app, cpm_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), diff --git a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs index fefc69fc3..5927603af 100644 --- a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_slice, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -63,7 +63,7 @@ fn get_default_proposal_module_instantiate( pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -120,7 +120,7 @@ fn setup_default_test( let core_addr = instantiate_with_cw4_groups_governance( app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -983,7 +983,7 @@ fn test_instantiate_with_zero_native_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Native("ujuno".to_string()), @@ -1008,7 +1008,7 @@ fn test_instantiate_with_zero_native_deposit() { instantiate_with_cw4_groups_governance( &mut app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), @@ -1045,7 +1045,7 @@ fn test_instantiate_with_zero_cw20_deposit() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: DepositToken::Token { denom: UncheckedDenom::Cw20(cw20_addr.into_string()), @@ -1070,7 +1070,7 @@ fn test_instantiate_with_zero_cw20_deposit() { instantiate_with_cw4_groups_governance( &mut app, dps_id, - to_binary(&proposal_module_instantiate).unwrap(), + to_json_binary(&proposal_module_instantiate).unwrap(), Some(vec![ cw20::Cw20Coin { address: "ekez".to_string(), diff --git a/contracts/proposal/dao-proposal-condorcet/src/contract.rs b/contracts/proposal/dao-proposal-condorcet/src/contract.rs index a29603609..f6b5406f3 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/contract.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, + to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, }; use cw2::set_contract_version; @@ -252,12 +252,12 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { let mut proposal = PROPOSAL.load(deps.storage, id)?; let tally = TALLY.load(deps.storage, id)?; proposal.update_status(&env.block, &tally); - to_binary(&ProposalResponse { proposal, tally }) + to_json_binary(&ProposalResponse { proposal, tally }) } - QueryMsg::Config {} => to_binary(&CONFIG.load(deps.storage)?), - QueryMsg::NextProposalId {} => to_binary(&next_proposal_id(deps.storage)?), - QueryMsg::Dao {} => to_binary(&DAO.load(deps.storage)?), - QueryMsg::Info {} => to_binary(&dao_interface::voting::InfoResponse { + QueryMsg::Config {} => to_json_binary(&CONFIG.load(deps.storage)?), + QueryMsg::NextProposalId {} => to_json_binary(&next_proposal_id(deps.storage)?), + QueryMsg::Dao {} => to_json_binary(&DAO.load(deps.storage)?), + QueryMsg::Info {} => to_json_binary(&dao_interface::voting::InfoResponse { info: cw2::get_contract_version(deps.storage)?, }), } diff --git a/contracts/proposal/dao-proposal-condorcet/src/proposal.rs b/contracts/proposal/dao-proposal-condorcet/src/proposal.rs index 155b90cc2..bd2f82486 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/proposal.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/proposal.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, Addr, BlockInfo, StdResult, SubMsg, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, BlockInfo, StdResult, SubMsg, Uint128, WasmMsg}; use cw_utils::Expiration; use dao_voting::{ reply::mask_proposal_execution_proposal_id, threshold::PercentageThreshold, @@ -161,7 +161,7 @@ impl Proposal { let msgs = self.choices[winner as usize].msgs.clone(); let core_exec = WasmMsg::Execute { contract_addr: dao.into_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, funds: vec![], }; Ok(if self.close_on_execution_failure { diff --git a/contracts/proposal/dao-proposal-condorcet/src/testing/proposals.rs b/contracts/proposal/dao-proposal-condorcet/src/testing/proposals.rs index 151790ef8..6c39f4b6e 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/testing/proposals.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/testing/proposals.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, WasmMsg}; +use cosmwasm_std::{to_json_binary, WasmMsg}; use cw_utils::Duration; use crate::{ @@ -171,7 +171,7 @@ fn test_proposal_set_config() { suite.sender(), vec![vec![WasmMsg::Execute { contract_addr: suite.condorcet.to_string(), - msg: to_binary(&ExecuteMsg::SetConfig(UncheckedConfig { + msg: to_json_binary(&ExecuteMsg::SetConfig(UncheckedConfig { quorum: config.quorum, voting_period: config.voting_period, min_voting_period: None, @@ -194,7 +194,7 @@ fn test_proposal_set_config() { suite.sender(), vec![vec![WasmMsg::Execute { contract_addr: suite.condorcet.to_string(), - msg: to_binary(&ExecuteMsg::SetConfig(UncheckedConfig { + msg: to_json_binary(&ExecuteMsg::SetConfig(UncheckedConfig { quorum: config.quorum, voting_period: config.voting_period, min_voting_period: Some(Duration::Height(10)), diff --git a/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs b/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs index 9f9f945be..79d18154f 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, to_binary, Addr, BankMsg, CosmosMsg, Decimal}; +use cosmwasm_std::{coins, to_json_binary, Addr, BankMsg, CosmosMsg, Decimal}; use cw_multi_test::{next_block, App, Executor}; use cw_utils::Duration; use dao_interface::{ @@ -88,7 +88,7 @@ impl SuiteBuilder { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw4_voting_id, - msg: to_binary(&dao_voting_cw4::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw4::msg::InstantiateMsg { group_contract: GroupContract::New { cw4_group_code_id: cw4_id, initial_members, @@ -101,7 +101,7 @@ impl SuiteBuilder { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: condorcet_id, - msg: to_binary(&self.instantiate).unwrap(), + msg: to_json_binary(&self.instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "condorcet module".to_string(), diff --git a/contracts/proposal/dao-proposal-multiple/src/contract.rs b/contracts/proposal/dao-proposal-multiple/src/contract.rs index 2308858d3..96097ebc2 100644 --- a/contracts/proposal/dao-proposal-multiple/src/contract.rs +++ b/contracts/proposal/dao-proposal-multiple/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, + to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, Storage, SubMsg, WasmMsg, }; @@ -400,7 +400,7 @@ pub fn execute_execute( let response = if !winning_choice.msgs.is_empty() { let execute_message = WasmMsg::Execute { contract_addr: config.dao.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs: winning_choice.msgs, })?, funds: vec![], @@ -432,7 +432,7 @@ pub fn execute_execute( let hooks = match proposal_creation_policy { ProposalCreationPolicy::Anyone {} => hooks, ProposalCreationPolicy::Module { addr } => { - let msg = to_binary(&PreProposeMsg::ProposalCompletedHook { + let msg = to_json_binary(&PreProposeMsg::ProposalCompletedHook { proposal_id, new_status: prop.status, })?; @@ -491,7 +491,7 @@ pub fn execute_close( let hooks = match proposal_creation_policy { ProposalCreationPolicy::Anyone {} => hooks, ProposalCreationPolicy::Module { addr } => { - let msg = to_binary(&PreProposeMsg::ProposalCompletedHook { + let msg = to_json_binary(&PreProposeMsg::ProposalCompletedHook { proposal_id, new_status: prop.status, })?; @@ -746,30 +746,30 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { limit, } => query_reverse_proposals(deps, env, start_before, limit), QueryMsg::ProposalCreationPolicy {} => query_creation_policy(deps), - QueryMsg::ProposalHooks {} => to_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), - QueryMsg::VoteHooks {} => to_binary(&VOTE_HOOKS.query_hooks(deps)?), + QueryMsg::ProposalHooks {} => to_json_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), + QueryMsg::VoteHooks {} => to_json_binary(&VOTE_HOOKS.query_hooks(deps)?), QueryMsg::Dao {} => query_dao(deps), } } pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_dao(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config.dao) + to_json_binary(&config.dao) } pub fn query_proposal(deps: Deps, env: Env, id: u64) -> StdResult { let proposal = PROPOSALS.load(deps.storage, id)?; - to_binary(&proposal.into_response(&env.block, id)?) + to_json_binary(&proposal.into_response(&env.block, id)?) } pub fn query_creation_policy(deps: Deps) -> StdResult { let policy = CREATION_POLICY.load(deps.storage)?; - to_binary(&policy) + to_json_binary(&policy) } pub fn query_list_proposals( @@ -788,7 +788,7 @@ pub fn query_list_proposals( .map(|(id, proposal)| proposal.into_response(&env.block, id)) .collect::>>()?; - to_binary(&ProposalListResponse { proposals: props }) + to_json_binary(&ProposalListResponse { proposals: props }) } pub fn query_reverse_proposals( @@ -807,16 +807,16 @@ pub fn query_reverse_proposals( .map(|(id, proposal)| proposal.into_response(&env.block, id)) .collect::>>()?; - to_binary(&ProposalListResponse { proposals: props }) + to_json_binary(&ProposalListResponse { proposals: props }) } pub fn query_next_proposal_id(deps: Deps) -> StdResult { - to_binary(&next_proposal_id(deps.storage)?) + to_json_binary(&next_proposal_id(deps.storage)?) } pub fn query_proposal_count(deps: Deps) -> StdResult { let proposal_count = PROPOSAL_COUNT.load(deps.storage)?; - to_binary(&proposal_count) + to_json_binary(&proposal_count) } pub fn query_vote(deps: Deps, proposal_id: u64, voter: String) -> StdResult { @@ -828,7 +828,7 @@ pub fn query_vote(deps: Deps, proposal_id: u64, voter: String) -> StdResult>>()?; - to_binary(&VoteListResponse { votes }) + to_json_binary(&VoteListResponse { votes }) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/proposal/dao-proposal-multiple/src/testing/adversarial_tests.rs b/contracts/proposal/dao-proposal-multiple/src/testing/adversarial_tests.rs index fe09e69d1..11f052cd6 100644 --- a/contracts/proposal/dao-proposal-multiple/src/testing/adversarial_tests.rs +++ b/contracts/proposal/dao-proposal-multiple/src/testing/adversarial_tests.rs @@ -9,7 +9,7 @@ use crate::testing::queries::{ }; use crate::testing::tests::{get_pre_propose_info, ALTERNATIVE_ADDR, CREATOR_ADDR}; use crate::ContractError; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, Decimal, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, Decimal, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, Executor}; use cw_utils::Duration; @@ -307,7 +307,7 @@ pub fn test_allow_voting_after_proposal_execution_pre_expiration_cw20() { recipient: CREATOR_ADDR.to_string(), amount: Uint128::new(100_000_000), }; - let binary_msg = to_binary(&msg).unwrap(); + let binary_msg = to_json_binary(&msg).unwrap(); let options = vec![ MultipleChoiceOption { diff --git a/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs b/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs index f6188a6f0..3a0dc89e2 100644 --- a/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs +++ b/contracts/proposal/dao-proposal-multiple/src/testing/instantiate.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Coin, Empty, Uint128}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, BankSudo, ContractWrapper, Executor, SudoMsg}; use cw_utils::Duration; @@ -32,7 +32,7 @@ fn get_pre_propose_info( PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_contract, - msg: to_binary(&cppm::InstantiateMsg { + msg: to_json_binary(&cppm::InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -148,7 +148,7 @@ pub fn _instantiate_with_staked_cw721_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw721_stake_id, - msg: to_binary(&dao_voting_cw721_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw721_staked::msg::InstantiateMsg { unstaking_duration: None, nft_contract: dao_voting_cw721_staked::msg::NftContract::Existing { address: nft_address.to_string(), @@ -162,7 +162,7 @@ pub fn _instantiate_with_staked_cw721_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -211,7 +211,7 @@ pub fn _instantiate_with_staked_cw721_governance( &cw721_base::msg::ExecuteMsg::, Empty>::SendNft { contract: staking_addr.to_string(), token_id: format!("{address}_{i}"), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -267,7 +267,7 @@ pub fn _instantiate_with_native_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: native_stake_id, - msg: to_binary(&dao_voting_token_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_token_staked::msg::InstantiateMsg { token_info: dao_voting_token_staked::msg::TokenInfo::Existing { denom: "ujuno".to_string(), }, @@ -281,7 +281,7 @@ pub fn _instantiate_with_native_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -379,7 +379,7 @@ pub fn instantiate_with_cw20_balances_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { token_info: dao_voting_cw20_balance::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -397,7 +397,7 @@ pub fn instantiate_with_cw20_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -461,7 +461,7 @@ pub fn instantiate_with_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, @@ -483,7 +483,7 @@ pub fn instantiate_with_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -535,7 +535,7 @@ pub fn instantiate_with_staked_balances_governance( &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -598,7 +598,7 @@ pub fn instantiate_with_multiple_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: Some(AbsoluteCount { count: Uint128::one(), }), @@ -622,7 +622,7 @@ pub fn instantiate_with_multiple_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -674,7 +674,7 @@ pub fn instantiate_with_multiple_staked_balances_governance( &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -715,7 +715,7 @@ pub fn instantiate_with_staking_active_threshold( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -737,7 +737,7 @@ pub fn instantiate_with_staking_active_threshold( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), @@ -803,7 +803,7 @@ pub fn _instantiate_with_cw4_groups_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw4::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw4::msg::InstantiateMsg { group_contract: GroupContract::New { cw4_group_code_id: cw4_id, initial_members: initial_weights, @@ -816,7 +816,7 @@ pub fn _instantiate_with_cw4_groups_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), diff --git a/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs b/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs index 9f1749423..4f649beec 100644 --- a/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs +++ b/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Coin, CosmosMsg, Decimal, Empty, Timestamp, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Coin, CosmosMsg, Decimal, Empty, Timestamp, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_denom::{CheckedDenom, UncheckedDenom}; use cw_hooks::HooksResponse; @@ -89,7 +89,7 @@ pub fn get_pre_propose_info( PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_contract, - msg: to_binary(&cppm::InstantiateMsg { + msg: to_json_binary(&cppm::InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -443,7 +443,7 @@ fn test_propose_with_messages() { let wasm_msg = WasmMsg::Execute { contract_addr: govmod.to_string(), - msg: to_binary(&config_msg).unwrap(), + msg: to_json_binary(&config_msg).unwrap(), funds: vec![], }; @@ -1728,7 +1728,7 @@ fn test_cant_execute_not_member_when_proposal_created() { &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(10), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -2682,7 +2682,7 @@ fn test_active_threshold_absolute() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(100), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), token_contract, &msg, &[]) .unwrap(); @@ -2810,7 +2810,7 @@ fn test_active_threshold_percent() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(20000000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), token_contract, &msg, &[]) .unwrap(); @@ -2901,7 +2901,7 @@ fn test_active_threshold_none() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(2000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), token_contract, &msg, &[]) .unwrap(); @@ -3578,7 +3578,7 @@ fn test_close_failed_proposal() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(2000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract( Addr::unchecked(CREATOR_ADDR), @@ -3592,7 +3592,7 @@ fn test_close_failed_proposal() { let msg = cw20::Cw20ExecuteMsg::Burn { amount: Uint128::new(2000), }; - let binary_msg = to_binary(&msg).unwrap(); + let binary_msg = to_json_binary(&msg).unwrap(); let options = vec![ MultipleChoiceOption { @@ -3674,7 +3674,7 @@ fn test_close_failed_proposal() { description: "Disable closing failed proposals".to_string(), msgs: vec![WasmMsg::Execute { contract_addr: govmod.to_string(), - msg: to_binary(&ExecuteMsg::UpdateConfig { + msg: to_json_binary(&ExecuteMsg::UpdateConfig { voting_strategy: VotingStrategy::SingleChoice { quorum }, max_voting_period: original.max_voting_period, min_voting_period: original.min_voting_period, @@ -3836,7 +3836,7 @@ fn test_no_double_refund_on_execute_fail_and_close() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(1), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract( Addr::unchecked(CREATOR_ADDR), @@ -3864,7 +3864,7 @@ fn test_no_double_refund_on_execute_fail_and_close() { let msg = cw20::Cw20ExecuteMsg::Burn { amount: Uint128::new(2000), }; - let binary_msg = to_binary(&msg).unwrap(); + let binary_msg = to_json_binary(&msg).unwrap(); // Increase allowance to pay the proposal deposit. app.execute_contract( diff --git a/contracts/proposal/dao-proposal-single/src/contract.rs b/contracts/proposal/dao-proposal-single/src/contract.rs index cf3ecf33d..dc255fbe8 100644 --- a/contracts/proposal/dao-proposal-single/src/contract.rs +++ b/contracts/proposal/dao-proposal-single/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Order, Reply, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Order, Reply, Response, StdResult, Storage, SubMsg, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -295,7 +295,7 @@ pub fn execute_execute( if !prop.msgs.is_empty() { let execute_message = WasmMsg::Execute { contract_addr: config.dao.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs: prop.msgs, })?, funds: vec![], @@ -326,7 +326,7 @@ pub fn execute_execute( let hooks = match proposal_creation_policy { ProposalCreationPolicy::Anyone {} => hooks, ProposalCreationPolicy::Module { addr } => { - let msg = to_binary(&PreProposeHookMsg::ProposalCompletedHook { + let msg = to_json_binary(&PreProposeHookMsg::ProposalCompletedHook { proposal_id, new_status: prop.status, })?; @@ -515,7 +515,7 @@ pub fn execute_close( let hooks = match proposal_creation_policy { ProposalCreationPolicy::Anyone {} => hooks, ProposalCreationPolicy::Module { addr } => { - let msg = to_binary(&PreProposeHookMsg::ProposalCompletedHook { + let msg = to_json_binary(&PreProposeHookMsg::ProposalCompletedHook { proposal_id, new_status: prop.status, })?; @@ -730,29 +730,29 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { limit, } => query_reverse_proposals(deps, env, start_before, limit), QueryMsg::ProposalCreationPolicy {} => query_creation_policy(deps), - QueryMsg::ProposalHooks {} => to_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), - QueryMsg::VoteHooks {} => to_binary(&VOTE_HOOKS.query_hooks(deps)?), + QueryMsg::ProposalHooks {} => to_json_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), + QueryMsg::VoteHooks {} => to_json_binary(&VOTE_HOOKS.query_hooks(deps)?), } } pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_dao(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config.dao) + to_json_binary(&config.dao) } pub fn query_proposal(deps: Deps, env: Env, id: u64) -> StdResult { let proposal = PROPOSALS.load(deps.storage, id)?; - to_binary(&proposal.into_response(&env.block, id)) + to_json_binary(&proposal.into_response(&env.block, id)) } pub fn query_creation_policy(deps: Deps) -> StdResult { let policy = CREATION_POLICY.load(deps.storage)?; - to_binary(&policy) + to_json_binary(&policy) } pub fn query_list_proposals( @@ -771,7 +771,7 @@ pub fn query_list_proposals( .map(|(id, proposal)| proposal.into_response(&env.block, id)) .collect(); - to_binary(&ProposalListResponse { proposals: props }) + to_json_binary(&ProposalListResponse { proposals: props }) } pub fn query_reverse_proposals( @@ -790,16 +790,16 @@ pub fn query_reverse_proposals( .map(|(id, proposal)| proposal.into_response(&env.block, id)) .collect(); - to_binary(&ProposalListResponse { proposals: props }) + to_json_binary(&ProposalListResponse { proposals: props }) } pub fn query_proposal_count(deps: Deps) -> StdResult { let proposal_count = PROPOSAL_COUNT.load(deps.storage)?; - to_binary(&proposal_count) + to_json_binary(&proposal_count) } pub fn query_next_proposal_id(deps: Deps) -> StdResult { - to_binary(&next_proposal_id(deps.storage)?) + to_json_binary(&next_proposal_id(deps.storage)?) } pub fn query_vote(deps: Deps, proposal_id: u64, voter: String) -> StdResult { @@ -811,7 +811,7 @@ pub fn query_vote(deps: Deps, proposal_id: u64, voter: String) -> StdResult>>()?; - to_binary(&VoteListResponse { votes }) + to_json_binary(&VoteListResponse { votes }) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/proposal/dao-proposal-single/src/testing/adversarial_tests.rs b/contracts/proposal/dao-proposal-single/src/testing/adversarial_tests.rs index 5d32804b9..19d3900e9 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/adversarial_tests.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/adversarial_tests.rs @@ -11,7 +11,7 @@ use crate::testing::{ }, queries::{query_balance_cw20, query_dao_token, query_proposal, query_single_proposal_module}, }; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, Decimal, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, Decimal, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App}; use cw_utils::Duration; @@ -301,7 +301,7 @@ pub fn test_passed_prop_state_remains_after_vote_swing() { recipient: "threshold".to_string(), amount: Uint128::new(100_000_000), }; - let binary_msg = to_binary(&msg).unwrap(); + let binary_msg = to_json_binary(&msg).unwrap(); mint_cw20s(&mut app, &gov_token, &core_addr, CREATOR_ADDR, 10_000_000); let proposal_id = make_proposal( diff --git a/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs b/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs index b9e9d74de..3fd485f62 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/instantiate.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Coin, Decimal, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Coin, Decimal, Empty, Uint128}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, BankSudo, Executor, SudoMsg}; @@ -34,7 +34,7 @@ pub(crate) fn get_pre_propose_info( PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_contract, - msg: to_binary(&cppbps::InstantiateMsg { + msg: to_json_binary(&cppbps::InstantiateMsg { deposit_info, open_proposal_submission, extension: Empty::default(), @@ -146,7 +146,7 @@ pub(crate) fn instantiate_with_staked_cw721_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: cw721_stake_id, - msg: to_binary(&dao_voting_cw721_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw721_staked::msg::InstantiateMsg { unstaking_duration: None, nft_contract: dao_voting_cw721_staked::msg::NftContract::Existing { address: nft_address.to_string(), @@ -160,7 +160,7 @@ pub(crate) fn instantiate_with_staked_cw721_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -208,7 +208,7 @@ pub(crate) fn instantiate_with_staked_cw721_governance( &cw721_base::msg::ExecuteMsg::SendNft::, Empty> { contract: staking_addr.to_string(), token_id: format!("{address}_{i}"), - msg: to_binary("").unwrap(), + msg: to_json_binary("").unwrap(), }, &[], ) @@ -265,7 +265,7 @@ pub(crate) fn instantiate_with_native_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: native_stake_id, - msg: to_binary(&dao_voting_token_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_token_staked::msg::InstantiateMsg { token_info: dao_voting_token_staked::msg::TokenInfo::Existing { denom: "ujuno".to_string(), }, @@ -279,7 +279,7 @@ pub(crate) fn instantiate_with_native_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -378,7 +378,7 @@ pub(crate) fn instantiate_with_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, @@ -400,7 +400,7 @@ pub(crate) fn instantiate_with_staked_balances_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -451,7 +451,7 @@ pub(crate) fn instantiate_with_staked_balances_governance( &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -493,7 +493,7 @@ pub(crate) fn instantiate_with_staking_active_threshold( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -515,7 +515,7 @@ pub(crate) fn instantiate_with_staking_active_threshold( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), @@ -581,7 +581,7 @@ pub(crate) fn instantiate_with_cw4_groups_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw4::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw4::msg::InstantiateMsg { group_contract: GroupContract::New { cw4_group_code_id: cw4_id, initial_members: initial_weights, @@ -594,7 +594,7 @@ pub(crate) fn instantiate_with_cw4_groups_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_module_code_id, - msg: to_binary(&proposal_module_instantiate).unwrap(), + msg: to_json_binary(&proposal_module_instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), diff --git a/contracts/proposal/dao-proposal-single/src/testing/migration_tests.rs b/contracts/proposal/dao-proposal-single/src/testing/migration_tests.rs index 1e3aa7c0c..3d68ffb7a 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/migration_tests.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/migration_tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, Executor}; use dao_interface::query::{GetItemResponse, ProposalModuleCountResponse}; @@ -68,7 +68,7 @@ fn test_v1_v2_full_migration() { automatically_add_cw721s: true, voting_module_instantiate_info: cw_core_v1::msg::ModuleInstantiateInfo { code_id: voting_code, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_code, @@ -89,7 +89,7 @@ fn test_v1_v2_full_migration() { }, proposal_modules_instantiate_info: vec![cw_core_v1::msg::ModuleInstantiateInfo { code_id: proposal_code, - msg: to_binary(&cw_proposal_single_v1::msg::InstantiateMsg { + msg: to_json_binary(&cw_proposal_single_v1::msg::InstantiateMsg { threshold: voting_v1::Threshold::AbsolutePercentage { percentage: voting_v1::PercentageThreshold::Majority {}, }, @@ -152,7 +152,7 @@ fn test_v1_v2_full_migration() { &cw20::Cw20ExecuteMsg::Send { contract: staking.into_string(), amount: Uint128::new(1), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -188,7 +188,7 @@ fn test_v1_v2_full_migration() { description: "d".to_string(), msgs: vec![WasmMsg::Execute { contract_addr: core.to_string(), - msg: to_binary(&cw_core_v1::msg::ExecuteMsg::UpdateCw20List { + msg: to_json_binary(&cw_core_v1::msg::ExecuteMsg::UpdateCw20List { to_add: vec![token.to_string()], to_remove: vec![], }) @@ -247,7 +247,7 @@ fn test_v1_v2_full_migration() { description: "d".to_string(), msgs: vec![WasmMsg::Execute { contract_addr: token.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: sender.to_string(), // more tokens than the DAO posseses. amount: Uint128::new(101), @@ -316,7 +316,7 @@ fn test_v1_v2_full_migration() { WasmMsg::Migrate { contract_addr: core.to_string(), new_code_id: v2_core_code, - msg: to_binary(&dao_interface::msg::MigrateMsg::FromV1 { + msg: to_json_binary(&dao_interface::msg::MigrateMsg::FromV1 { dao_uri: Some("dao-uri".to_string()), params: None, }) @@ -326,7 +326,7 @@ fn test_v1_v2_full_migration() { WasmMsg::Migrate { contract_addr: proposal.to_string(), new_code_id: v2_proposal_code, - msg: to_binary(&crate::msg::MigrateMsg::FromV1 { + msg: to_json_binary(&crate::msg::MigrateMsg::FromV1 { close_proposal_on_execution_failure: true, pre_propose_info, }) @@ -413,7 +413,7 @@ fn test_v1_v2_full_migration() { sender.as_str(), vec![WasmMsg::Execute { contract_addr: core.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::UpdateCw20List { + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::UpdateCw20List { to_add: vec![], to_remove: vec![token.into_string()], }) diff --git a/contracts/proposal/dao-proposal-single/src/testing/tests.rs b/contracts/proposal/dao-proposal-single/src/testing/tests.rs index 8634243dd..f42464097 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/tests.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/tests.rs @@ -1,7 +1,7 @@ use cosmwasm_std::{ coins, testing::{mock_dependencies, mock_env}, - to_binary, Addr, Attribute, BankMsg, Binary, ContractInfoResponse, CosmosMsg, Decimal, Empty, + to_json_binary, Addr, Attribute, BankMsg, Binary, ContractInfoResponse, CosmosMsg, Decimal, Empty, Reply, StdError, SubMsgResult, Uint128, WasmMsg, WasmQuery, }; use cw2::ContractVersion; @@ -321,7 +321,7 @@ fn test_proposal_message_execution() { vec![ WasmMsg::Execute { contract_addr: gov_token.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Mint { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Mint { recipient: CREATOR_ADDR.to_string(), amount: Uint128::new(10_000_000), }) @@ -540,7 +540,7 @@ fn test_cant_execute_not_member_when_proposal_created() { &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(10_000_000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -578,7 +578,7 @@ fn test_update_config() { CREATOR_ADDR, vec![WasmMsg::Execute { contract_addr: proposal_module.to_string(), - msg: to_binary(&ExecuteMsg::UpdateConfig { + msg: to_json_binary(&ExecuteMsg::UpdateConfig { threshold: Threshold::AbsoluteCount { threshold: Uint128::new(10_000), }, @@ -890,7 +890,7 @@ fn test_active_threshold_absolute() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(100), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), gov_token, &msg, &[]) .unwrap(); @@ -971,7 +971,7 @@ fn test_active_threshold_percent() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount: Uint128::new(20_000_000), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(CREATOR_ADDR), gov_token, &msg, &[]) .unwrap(); @@ -1545,7 +1545,7 @@ fn test_migrate_from_compatible() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: proposal_module.to_string(), new_code_id, - msg: to_binary(&MigrateMsg::FromCompatible {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromCompatible {}).unwrap(), }), ) .unwrap(); @@ -1609,7 +1609,7 @@ fn test_migrate_from_v1() { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, @@ -1631,7 +1631,7 @@ fn test_migrate_from_v1() { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: v1_proposal_single_code, - msg: to_binary(&instantiate).unwrap(), + msg: to_json_binary(&instantiate).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module.".to_string(), @@ -1682,7 +1682,7 @@ fn test_migrate_from_v1() { &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -1730,7 +1730,7 @@ fn test_migrate_from_v1() { pre_propose_info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_single, - msg: to_binary(&dao_pre_propose_single::InstantiateMsg { + msg: to_json_binary(&dao_pre_propose_single::InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: dao_voting::deposit::DepositToken::VotingModuleToken {}, amount: Uint128::new(1), @@ -1752,7 +1752,7 @@ fn test_migrate_from_v1() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: proposal_module.to_string(), new_code_id: v2_proposal_single, - msg: to_binary(&migrate_msg).unwrap(), + msg: to_json_binary(&migrate_msg).unwrap(), }), ) .unwrap_err() @@ -1770,7 +1770,7 @@ fn test_migrate_from_v1() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: proposal_module.to_string(), new_code_id: v2_proposal_single, - msg: to_binary(&migrate_msg).unwrap(), + msg: to_json_binary(&migrate_msg).unwrap(), }), ) .unwrap(); @@ -1798,7 +1798,7 @@ fn test_migrate_from_v1() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: proposal_module.to_string(), new_code_id: v2_proposal_single, - msg: to_binary(&migrate_msg).unwrap(), + msg: to_json_binary(&migrate_msg).unwrap(), }), ) .unwrap_err() @@ -2397,11 +2397,11 @@ fn test_update_pre_propose_module() { CREATOR_ADDR, vec![WasmMsg::Execute { contract_addr: proposal_module.to_string(), - msg: to_binary(&ExecuteMsg::UpdatePreProposeInfo { + msg: to_json_binary(&ExecuteMsg::UpdatePreProposeInfo { info: PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: pre_propose_id, - msg: to_binary(&dao_pre_propose_single::InstantiateMsg { + msg: to_json_binary(&dao_pre_propose_single::InstantiateMsg { deposit_info: Some(UncheckedDepositInfo { denom: dao_voting::deposit::DepositToken::VotingModuleToken {}, amount: Uint128::new(1), @@ -2495,7 +2495,7 @@ fn test_update_pre_propose_module() { CREATOR_ADDR, vec![WasmMsg::Execute { contract_addr: pre_propose_start.into_string(), - msg: to_binary(&dao_pre_propose_single::ExecuteMsg::Withdraw { denom: None }).unwrap(), + msg: to_json_binary(&dao_pre_propose_single::ExecuteMsg::Withdraw { denom: None }).unwrap(), funds: vec![], } .into()], diff --git a/contracts/staking/cw20-stake-external-rewards/src/contract.rs b/contracts/staking/cw20-stake-external-rewards/src/contract.rs index b1774414f..63486915b 100644 --- a/contracts/staking/cw20-stake-external-rewards/src/contract.rs +++ b/contracts/staking/cw20-stake-external-rewards/src/contract.rs @@ -14,7 +14,7 @@ use crate::ContractError::{ use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, + from_json_binary, to_json_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -143,7 +143,7 @@ pub fn execute_receive( info: MessageInfo, wrapper: Cw20ReceiveMsg, ) -> Result, ContractError> { - let msg: ReceiveMsg = from_binary(&wrapper.msg)?; + let msg: ReceiveMsg = from_json_binary(&wrapper.msg)?; let config = CONFIG.load(deps.storage)?; let sender = deps.api.addr_validate(&wrapper.sender)?; if config.reward_token != Denom::Cw20(info.sender) { @@ -280,7 +280,7 @@ pub fn get_transfer_msg(recipient: Addr, amount: Uint128, denom: Denom) -> StdRe } .into()), Denom::Cw20(addr) => { - let cw20_msg = to_binary(&cw20::Cw20ExecuteMsg::Transfer { + let cw20_msg = to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: recipient.into_string(), amount, })?; @@ -414,11 +414,11 @@ fn scale_factor() -> Uint256 { #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::Info {} => Ok(to_binary(&query_info(deps, env)?)?), + QueryMsg::Info {} => Ok(to_json_binary(&query_info(deps, env)?)?), QueryMsg::GetPendingRewards { address } => { - Ok(to_binary(&query_pending_rewards(deps, env, address)?)?) + Ok(to_json_binary(&query_pending_rewards(deps, env, address)?)?) } - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), } } @@ -462,7 +462,7 @@ mod tests { use crate::{msg::MigrateMsg, ContractError}; - use cosmwasm_std::{coin, to_binary, Addr, Empty, Uint128, WasmMsg}; + use cosmwasm_std::{coin, to_json_binary, Addr, Empty, Uint128, WasmMsg}; use cw20::{Cw20Coin, Cw20ExecuteMsg, Denom}; use cw_ownable::{Action, Ownership, OwnershipError}; use cw_utils::Duration; @@ -566,7 +566,7 @@ mod tests { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_addr.to_string(), amount: Uint128::new(amount), - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(Addr::unchecked(sender), cw20_addr.clone(), &msg, &[]) .unwrap(); @@ -679,7 +679,7 @@ mod tests { reward_addr: &Addr, amount: u128, ) { - let fund_sub_msg = to_binary(&ReceiveMsg::Fund {}).unwrap(); + let fund_sub_msg = to_json_binary(&ReceiveMsg::Fund {}).unwrap(); let fund_msg = Cw20ExecuteMsg::Send { contract: reward_addr.clone().into_string(), amount: Uint128::new(amount), @@ -1680,7 +1680,7 @@ mod tests { amount: Uint128::new(500000000), }], ); - let fund_sub_msg = to_binary(&ReceiveMsg::Fund {}).unwrap(); + let fund_sub_msg = to_json_binary(&ReceiveMsg::Fund {}).unwrap(); let fund_msg = Cw20ExecuteMsg::Send { contract: reward_addr.into_string(), amount: Uint128::new(100), @@ -1733,7 +1733,7 @@ mod tests { app.borrow_mut().update_block(|b| b.height = 1000); // Test with invalid token - let fund_sub_msg = to_binary(&ReceiveMsg::Fund {}).unwrap(); + let fund_sub_msg = to_json_binary(&ReceiveMsg::Fund {}).unwrap(); let fund_msg = Cw20ExecuteMsg::Send { contract: reward_addr.clone().into_string(), amount: Uint128::new(100), @@ -2003,7 +2003,7 @@ mod tests { WasmMsg::Migrate { contract_addr: rewards_addr.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) @@ -2025,7 +2025,7 @@ mod tests { WasmMsg::Migrate { contract_addr: rewards_addr.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) diff --git a/contracts/staking/cw20-stake-reward-distributor/src/contract.rs b/contracts/staking/cw20-stake-reward-distributor/src/contract.rs index d4108d88c..66636add1 100644 --- a/contracts/staking/cw20-stake-reward-distributor/src/contract.rs +++ b/contracts/staking/cw20-stake-reward-distributor/src/contract.rs @@ -2,7 +2,7 @@ use std::cmp::min; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; -use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdError, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, StdError, Uint128, WasmMsg}; use crate::error::ContractError; use crate::msg::{ExecuteMsg, InfoResponse, InstantiateMsg, MigrateMsg, QueryMsg}; @@ -162,10 +162,10 @@ fn get_distribution_msg(deps: Deps, env: &Env) -> Result StdResult { match msg { - QueryMsg::Info {} => to_binary(&query_info(deps, env)?), - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::Info {} => to_json_binary(&query_info(deps, env)?), + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), } } diff --git a/contracts/staking/cw20-stake-reward-distributor/src/tests.rs b/contracts/staking/cw20-stake-reward-distributor/src/tests.rs index 829fafaf4..7b6bde529 100644 --- a/contracts/staking/cw20-stake-reward-distributor/src/tests.rs +++ b/contracts/staking/cw20-stake-reward-distributor/src/tests.rs @@ -6,7 +6,7 @@ use crate::{ use cw20_stake_reward_distributor_v1 as v1; -use cosmwasm_std::{to_binary, Addr, Empty, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Empty, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, Contract, ContractWrapper, Executor}; use cw_ownable::{Action, Expiration, Ownership, OwnershipError}; @@ -711,7 +711,7 @@ fn test_migrate_from_v1() { WasmMsg::Migrate { contract_addr: distributor.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) @@ -747,7 +747,7 @@ fn test_migrate_from_v1() { WasmMsg::Migrate { contract_addr: distributor.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) diff --git a/contracts/staking/cw20-stake/src/contract.rs b/contracts/staking/cw20-stake/src/contract.rs index f200b3737..24ee73d88 100644 --- a/contracts/staking/cw20-stake/src/contract.rs +++ b/contracts/staking/cw20-stake/src/contract.rs @@ -2,7 +2,7 @@ use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, + from_json_binary, to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Uint128, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -129,7 +129,7 @@ pub fn execute_receive( expected: config.token_address, }); } - let msg: ReceiveMsg = from_binary(&wrapper.msg)?; + let msg: ReceiveMsg = from_json_binary(&wrapper.msg)?; let sender = deps.api.addr_validate(&wrapper.sender)?; match msg { ReceiveMsg::Stake {} => execute_stake(deps, env, sender, wrapper.amount), @@ -221,7 +221,7 @@ pub fn execute_unstake( }; let wasm_msg = cosmwasm_std::WasmMsg::Execute { contract_addr: config.token_address.to_string(), - msg: to_binary(&cw_send_msg)?, + msg: to_json_binary(&cw_send_msg)?, funds: vec![], }; Ok(Response::new() @@ -270,7 +270,7 @@ pub fn execute_claim( }; let wasm_msg = cosmwasm_std::WasmMsg::Execute { contract_addr: config.token_address.to_string(), - msg: to_binary(&cw_send_msg)?, + msg: to_json_binary(&cw_send_msg)?, funds: vec![], }; Ok(Response::new() @@ -336,21 +336,21 @@ pub fn execute_update_owner( #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::GetConfig {} => to_binary(&query_config(deps)?), + QueryMsg::GetConfig {} => to_json_binary(&query_config(deps)?), QueryMsg::StakedBalanceAtHeight { address, height } => { - to_binary(&query_staked_balance_at_height(deps, env, address, height)?) + to_json_binary(&query_staked_balance_at_height(deps, env, address, height)?) } QueryMsg::TotalStakedAtHeight { height } => { - to_binary(&query_total_staked_at_height(deps, env, height)?) + to_json_binary(&query_total_staked_at_height(deps, env, height)?) } - QueryMsg::StakedValue { address } => to_binary(&query_staked_value(deps, env, address)?), - QueryMsg::TotalValue {} => to_binary(&query_total_value(deps, env)?), - QueryMsg::Claims { address } => to_binary(&query_claims(deps, address)?), - QueryMsg::GetHooks {} => to_binary(&query_hooks(deps)?), + QueryMsg::StakedValue { address } => to_json_binary(&query_staked_value(deps, env, address)?), + QueryMsg::TotalValue {} => to_json_binary(&query_total_value(deps, env)?), + QueryMsg::Claims { address } => to_json_binary(&query_claims(deps, address)?), + QueryMsg::GetHooks {} => to_json_binary(&query_hooks(deps)?), QueryMsg::ListStakers { start_after, limit } => { query_list_stakers(deps, start_after, limit) } - QueryMsg::Ownership {} => to_binary(&cw_ownable::get_ownership(deps.storage)?), + QueryMsg::Ownership {} => to_json_binary(&cw_ownable::get_ownership(deps.storage)?), } } @@ -450,7 +450,7 @@ pub fn query_list_stakers( }) .collect(); - to_binary(&ListStakersResponse { stakers }) + to_json_binary(&ListStakersResponse { stakers }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/staking/cw20-stake/src/tests.rs b/contracts/staking/cw20-stake/src/tests.rs index 1838265a5..147bd806f 100644 --- a/contracts/staking/cw20-stake/src/tests.rs +++ b/contracts/staking/cw20-stake/src/tests.rs @@ -1,6 +1,6 @@ use anyhow::Result as AnyResult; use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; -use cosmwasm_std::{to_binary, Addr, Empty, MessageInfo, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Empty, MessageInfo, Uint128, WasmMsg}; use cw20::Cw20Coin; use cw_controllers::{Claim, ClaimsResponse}; use cw_multi_test::{next_block, App, AppResponse, Contract, ContractWrapper, Executor}; @@ -190,7 +190,7 @@ fn stake_tokens( let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_addr.to_string(), amount, - msg: to_binary(&ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Stake {}).unwrap(), }; app.execute_contract(info.sender, cw20_addr.clone(), &msg, &[]) } @@ -653,7 +653,7 @@ fn test_auto_compounding_staking() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_addr.to_string(), amount: Uint128::from(100u128), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }; let _res = app .borrow_mut() @@ -725,7 +725,7 @@ fn test_auto_compounding_staking() { let msg = cw20::Cw20ExecuteMsg::Send { contract: staking_addr.to_string(), amount: Uint128::from(90u128), - msg: to_binary(&ReceiveMsg::Fund {}).unwrap(), + msg: to_json_binary(&ReceiveMsg::Fund {}).unwrap(), }; let _res = app .borrow_mut() @@ -1151,7 +1151,7 @@ fn test_migrate_from_v1() { WasmMsg::Migrate { contract_addr: staking.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) @@ -1164,7 +1164,7 @@ fn test_migrate_from_v1() { WasmMsg::Migrate { contract_addr: staking.to_string(), new_code_id: v2_code, - msg: to_binary(&MigrateMsg::FromV1 {}).unwrap(), + msg: to_json_binary(&MigrateMsg::FromV1 {}).unwrap(), } .into(), ) diff --git a/contracts/test/dao-proposal-hook-counter/src/contract.rs b/contracts/test/dao-proposal-hook-counter/src/contract.rs index 0f2a36fd3..3aaefca3d 100644 --- a/contracts/test/dao-proposal-hook-counter/src/contract.rs +++ b/contracts/test/dao-proposal-hook-counter/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, Uint128, + to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, Uint128, }; use cw2::set_contract_version; use dao_hooks::stake::StakeChangedHookMsg; @@ -121,14 +121,14 @@ pub fn execute_vote_hook( #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::ProposalCounter {} => to_binary(&CountResponse { + QueryMsg::ProposalCounter {} => to_json_binary(&CountResponse { count: PROPOSAL_COUNTER.load(deps.storage)?, }), - QueryMsg::StakeCounter {} => to_binary(&STAKE_COUNTER.load(deps.storage)?), - QueryMsg::StatusChangedCounter {} => to_binary(&CountResponse { + QueryMsg::StakeCounter {} => to_json_binary(&STAKE_COUNTER.load(deps.storage)?), + QueryMsg::StatusChangedCounter {} => to_json_binary(&CountResponse { count: STATUS_CHANGED_COUNTER.load(deps.storage)?, }), - QueryMsg::VoteCounter {} => to_binary(&CountResponse { + QueryMsg::VoteCounter {} => to_json_binary(&CountResponse { count: VOTE_COUNTER.load(deps.storage)?, }), } diff --git a/contracts/test/dao-proposal-hook-counter/src/tests.rs b/contracts/test/dao-proposal-hook-counter/src/tests.rs index 728baba65..fddc0f104 100644 --- a/contracts/test/dao-proposal-hook-counter/src/tests.rs +++ b/contracts/test/dao-proposal-hook-counter/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Empty, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Empty, Uint128}; use cw20::Cw20Coin; use cw_hooks::HooksResponse; use cw_multi_test::{App, Contract, ContractWrapper, Executor}; @@ -108,7 +108,7 @@ fn instantiate_with_default_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { token_info: dao_voting_cw20_balance::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -126,7 +126,7 @@ fn instantiate_with_default_governance( }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id, - msg: to_binary(&msg).unwrap(), + msg: to_json_binary(&msg).unwrap(), admin: Some(Admin::CoreModule {}), funds: vec![], label: "DAO DAO governance module".to_string(), diff --git a/contracts/test/dao-proposal-sudo/src/contract.rs b/contracts/test/dao-proposal-sudo/src/contract.rs index 82df228e3..902a0ee34 100644 --- a/contracts/test/dao-proposal-sudo/src/contract.rs +++ b/contracts/test/dao-proposal-sudo/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult, WasmMsg, }; use cw2::set_contract_version; @@ -59,7 +59,7 @@ pub fn execute_execute( let msg = WasmMsg::Execute { contract_addr: dao.to_string(), - msg: to_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, + msg: to_json_binary(&dao_interface::msg::ExecuteMsg::ExecuteProposalHook { msgs })?, funds: vec![], }; @@ -78,14 +78,14 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { } pub fn query_admin(deps: Deps) -> StdResult { - to_binary(&ROOT.load(deps.storage)?) + to_json_binary(&ROOT.load(deps.storage)?) } pub fn query_dao(deps: Deps) -> StdResult { - to_binary(&DAO.load(deps.storage)?) + to_json_binary(&DAO.load(deps.storage)?) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } diff --git a/contracts/test/dao-test-custom-factory/src/contract.rs b/contracts/test/dao-test-custom-factory/src/contract.rs index 7091c027a..b7f8159b8 100644 --- a/contracts/test/dao-test-custom-factory/src/contract.rs +++ b/contracts/test/dao-test-custom-factory/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, SubMsg, Uint128, WasmMsg, }; use cw2::set_contract_version; @@ -131,7 +131,7 @@ pub fn execute_nft_factory( INITIAL_NFTS.save(deps.storage, &initial_nfts)?; // Override minter to be the DAO address - let msg = to_binary(&Cw721InstantiateMsg { + let msg = to_json_binary(&Cw721InstantiateMsg { name: cw721_instantiate_msg.name, symbol: cw721_instantiate_msg.symbol, minter: dao.to_string(), @@ -190,7 +190,7 @@ pub fn execute_nft_factory_wrong_callback( _env: Env, _info: MessageInfo, ) -> Result { - Ok(Response::new().set_data(to_binary(&TokenFactoryCallback { + Ok(Response::new().set_data(to_json_binary(&TokenFactoryCallback { denom: "wrong".to_string(), token_contract: None, module_instantiate_callback: None, @@ -224,7 +224,7 @@ pub fn execute_token_factory_factory( WasmMsg::Instantiate { admin: Some(dao.to_string()), code_id: token.token_issuer_code_id, - msg: to_binary(&IssuerInstantiateMsg::NewToken { + msg: to_json_binary(&IssuerInstantiateMsg::NewToken { subdenom: token.subdenom, })?, funds: vec![], @@ -264,7 +264,7 @@ pub fn execute_token_factory_factory_wrong_callback( _env: Env, _info: MessageInfo, ) -> Result { - Ok(Response::new().set_data(to_binary(&NftFactoryCallback { + Ok(Response::new().set_data(to_json_binary(&NftFactoryCallback { nft_contract: "nope".to_string(), module_instantiate_callback: None, })?)) @@ -328,7 +328,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -377,7 +377,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result Result Result Result Result Result Result StdResult { pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_token_contract(deps: Deps) -> StdResult { let token = TOKEN.load(deps.storage)?; - to_binary(&token) + to_json_binary(&token) } pub fn query_voting_power_at_height(deps: Deps, env: Env, address: String) -> StdResult { @@ -121,7 +121,7 @@ pub fn query_voting_power_at_height(deps: Deps, env: Env, address: String) -> St address: address.to_string(), }, )?; - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power: balance.balance, height: env.block.height, }) @@ -132,7 +132,7 @@ pub fn query_total_power_at_height(deps: Deps, env: Env) -> StdResult { let info: cw20::TokenInfoResponse = deps .querier .query_wasm_smart(token, &cw20::Cw20QueryMsg::TokenInfo {})?; - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power: info.total_supply, height: env.block.height, }) @@ -140,7 +140,7 @@ pub fn query_total_power_at_height(deps: Deps, env: Env) -> StdResult { pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/voting/dao-voting-cw20-staked/src/contract.rs b/contracts/voting/dao-voting-cw20-staked/src/contract.rs index 28ed26836..0ce06700c 100644 --- a/contracts/voting/dao-voting-cw20-staked/src/contract.rs +++ b/contracts/voting/dao-voting-cw20-staked/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, + to_json_binary, Addr, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, SubMsg, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -89,7 +89,7 @@ pub fn instantiate( funds: vec![], admin: Some(info.sender.to_string()), label: env.contract.address.to_string(), - msg: to_binary(&cw20_stake::msg::InstantiateMsg { + msg: to_json_binary(&cw20_stake::msg::InstantiateMsg { owner: Some(info.sender.to_string()), unstaking_duration, token_address: address.to_string(), @@ -141,7 +141,7 @@ pub fn instantiate( let msg = WasmMsg::Instantiate { admin: Some(info.sender.to_string()), code_id, - msg: to_binary(&cw20_base::msg::InstantiateMsg { + msg: to_json_binary(&cw20_base::msg::InstantiateMsg { name, symbol, decimals, @@ -245,12 +245,12 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { pub fn query_token_contract(deps: Deps) -> StdResult { let token = TOKEN.load(deps.storage)?; - to_binary(&token) + to_json_binary(&token) } pub fn query_staking_contract(deps: Deps) -> StdResult { let staking_contract = STAKING_CONTRACT.load(deps.storage)?; - to_binary(&staking_contract) + to_json_binary(&staking_contract) } pub fn query_voting_power_at_height( @@ -268,7 +268,7 @@ pub fn query_voting_power_at_height( height, }, )?; - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power: res.balance, height: res.height, }) @@ -284,7 +284,7 @@ pub fn query_total_power_at_height( staking_contract, &cw20_stake::msg::QueryMsg::TotalStakedAtHeight { height }, )?; - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power: res.total, height: res.height, }) @@ -292,12 +292,12 @@ pub fn query_total_power_at_height( pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_is_active(deps: Deps) -> StdResult { @@ -311,7 +311,7 @@ pub fn query_is_active(deps: Deps) -> StdResult { &cw20_stake::msg::QueryMsg::TotalStakedAtHeight { height: None }, )?; match threshold { - ActiveThreshold::AbsoluteCount { count } => to_binary(&IsActiveResponse { + ActiveThreshold::AbsoluteCount { count } => to_json_binary(&IsActiveResponse { active: actual_power.total >= count, }), ActiveThreshold::Percentage { percent } => { @@ -354,18 +354,18 @@ pub fn query_is_active(deps: Deps) -> StdResult { let rounded = (applied + Uint256::from(PRECISION_FACTOR) - Uint256::from(1u128)) / Uint256::from(PRECISION_FACTOR); let count: Uint128 = rounded.try_into().unwrap(); - to_binary(&IsActiveResponse { + to_json_binary(&IsActiveResponse { active: actual_power.total >= count, }) } } } else { - to_binary(&IsActiveResponse { active: true }) + to_json_binary(&IsActiveResponse { active: true }) } } pub fn query_active_threshold(deps: Deps) -> StdResult { - to_binary(&ActiveThresholdResponse { + to_json_binary(&ActiveThresholdResponse { active_threshold: ACTIVE_THRESHOLD.may_load(deps.storage)?, }) } @@ -413,7 +413,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result StdResult { } QueryMsg::TotalPowerAtHeight { height } => query_total_power_at_height(deps, env, height), QueryMsg::Info {} => query_info(deps), - QueryMsg::GroupContract {} => to_binary(&GROUP_CONTRACT.load(deps.storage)?), - QueryMsg::Dao {} => to_binary(&DAO.load(deps.storage)?), + QueryMsg::GroupContract {} => to_json_binary(&GROUP_CONTRACT.load(deps.storage)?), + QueryMsg::Dao {} => to_json_binary(&DAO.load(deps.storage)?), } } @@ -145,7 +145,7 @@ pub fn query_voting_power_at_height( }, )?; - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power: res.weight.unwrap_or(0).into(), height: height.unwrap_or(env.block.height), }) @@ -157,7 +157,7 @@ pub fn query_total_power_at_height(deps: Deps, env: Env, height: Option) -> group_contract, &cw4_group::msg::QueryMsg::TotalWeight { at_height: height }, )?; - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power: res.weight.into(), height: height.unwrap_or(env.block.height), }) @@ -165,7 +165,7 @@ pub fn query_total_power_at_height(deps: Deps, env: Env, height: Option) -> pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/voting/dao-voting-cw4/src/tests.rs b/contracts/voting/dao-voting-cw4/src/tests.rs index 69ca443ef..769c53c4c 100644 --- a/contracts/voting/dao-voting-cw4/src/tests.rs +++ b/contracts/voting/dao-voting-cw4/src/tests.rs @@ -1,6 +1,6 @@ use cosmwasm_std::{ testing::{mock_dependencies, mock_env}, - to_binary, Addr, CosmosMsg, Empty, Uint128, WasmMsg, + to_json_binary, Addr, CosmosMsg, Empty, Uint128, WasmMsg, }; use cw2::ContractVersion; use cw_multi_test::{next_block, App, Contract, ContractWrapper, Executor}; @@ -608,7 +608,7 @@ fn test_migrate() { CosmosMsg::Wasm(WasmMsg::Migrate { contract_addr: voting_addr.to_string(), new_code_id: voting_id, - msg: to_binary(&MigrateMsg {}).unwrap(), + msg: to_json_binary(&MigrateMsg {}).unwrap(), }), ) .unwrap(); diff --git a/contracts/voting/dao-voting-cw721-roles/src/contract.rs b/contracts/voting/dao-voting-cw721-roles/src/contract.rs index 9d0f8852d..e2a696d2d 100644 --- a/contracts/voting/dao-voting-cw721-roles/src/contract.rs +++ b/contracts/voting/dao-voting-cw721-roles/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, SubMsg, + to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -66,7 +66,7 @@ pub fn instantiate( funds: vec![], admin: Some(info.sender.to_string()), label, - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name, symbol, // Admin must be set to contract to mint initial NFTs @@ -121,7 +121,7 @@ pub fn query_voting_power_at_height( }, )?; - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power: member.weight.unwrap_or(0).into(), height: at_height.unwrap_or(env.block.height), }) @@ -140,7 +140,7 @@ pub fn query_total_power_at_height( }, )?; - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power: total.weight.into(), height: at_height.unwrap_or(env.block.height), }) @@ -148,17 +148,17 @@ pub fn query_total_power_at_height( pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -186,7 +186,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result::Mint { token_id: nft.token_id.clone(), owner: nft.owner.clone(), @@ -207,7 +207,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result::UpdateOwnership( Action::TransferOwnership { new_owner: dao.to_string(), diff --git a/contracts/voting/dao-voting-cw721-staked/src/contract.rs b/contracts/voting/dao-voting-cw721-staked/src/contract.rs index 982d40e78..29e48b896 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/contract.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, + from_json_binary, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -48,9 +48,9 @@ impl NftInstantiateMsg { } } - fn to_binary(&self) -> Result { + fn to_json_binary(&self) -> Result { match self { - NftInstantiateMsg::Cw721(msg) => to_binary(&msg), + NftInstantiateMsg::Cw721(msg) => to_json_binary(&msg), } } } @@ -58,7 +58,7 @@ impl NftInstantiateMsg { pub fn try_deserialize_nft_instantiate_msg( instantiate_msg: Binary, ) -> Result { - if let Ok(cw721_msg) = from_binary::(&instantiate_msg) { + if let Ok(cw721_msg) = from_json_binary::(&instantiate_msg) { return Ok(NftInstantiateMsg::Cw721(cw721_msg)); } @@ -153,7 +153,7 @@ pub fn instantiate( funds: vec![], admin: Some(info.sender.to_string()), label, - msg: instantiate_msg.to_binary()?, + msg: instantiate_msg.to_json_binary()?, }, INSTANTIATE_NFT_CONTRACT_REPLY_ID, ); @@ -162,7 +162,7 @@ pub fn instantiate( .add_attribute("method", "instantiate") .add_submessage(instantiate_msg)) } - NftContract::Factory(binary) => match from_binary(&binary)? { + NftContract::Factory(binary) => match from_json_binary(&binary)? { WasmMsg::Execute { msg: wasm_msg, contract_addr, @@ -296,7 +296,7 @@ pub fn execute_unstake( .map(|token_id| -> StdResult { Ok(cosmwasm_std::WasmMsg::Execute { contract_addr: config.nft_address.to_string(), - msg: to_binary(&cw721::Cw721ExecuteMsg::TransferNft { + msg: to_json_binary(&cw721::Cw721ExecuteMsg::TransferNft { recipient: info.sender.to_string(), token_id, })?, @@ -356,7 +356,7 @@ pub fn execute_claim_nfts( .map(|nft| -> StdResult { Ok(WasmMsg::Execute { contract_addr: config.nft_address.to_string(), - msg: to_binary(&cw721::Cw721ExecuteMsg::TransferNft { + msg: to_json_binary(&cw721::Cw721ExecuteMsg::TransferNft { recipient: info.sender.to_string(), token_id: nft, })?, @@ -500,7 +500,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { } pub fn query_active_threshold(deps: Deps) -> StdResult { - to_binary(&ActiveThresholdResponse { + to_json_binary(&ActiveThresholdResponse { active_threshold: ACTIVE_THRESHOLD.may_load(deps.storage)?, }) } @@ -518,13 +518,13 @@ pub fn query_is_active(deps: Deps, env: Env) -> StdResult { )?; match threshold { - ActiveThreshold::AbsoluteCount { count } => to_binary(&IsActiveResponse { + ActiveThreshold::AbsoluteCount { count } => to_json_binary(&IsActiveResponse { active: staked_nfts >= count, }), ActiveThreshold::Percentage { percent } => { // Check if there are any staked NFTs if staked_nfts.is_zero() { - return to_binary(&IsActiveResponse { active: false }); + return to_json_binary(&IsActiveResponse { active: false }); } // percent is bounded between [0, 100]. decimal @@ -564,13 +564,13 @@ pub fn query_is_active(deps: Deps, env: Env) -> StdResult { let count: Uint128 = rounded.try_into().unwrap(); // staked_nfts >= total_nfts * percent - to_binary(&IsActiveResponse { + to_json_binary(&IsActiveResponse { active: staked_nfts >= count, }) } } } else { - to_binary(&IsActiveResponse { active: true }) + to_json_binary(&IsActiveResponse { active: true }) } } @@ -585,7 +585,7 @@ pub fn query_voting_power_at_height( let power = NFT_BALANCES .may_load_at_height(deps.storage, &address, height)? .unwrap_or_default(); - to_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power, height }) + to_json_binary(&dao_interface::voting::VotingPowerAtHeightResponse { power, height }) } pub fn query_total_power_at_height(deps: Deps, env: Env, height: Option) -> StdResult { @@ -593,30 +593,30 @@ pub fn query_total_power_at_height(deps: Deps, env: Env, height: Option) -> let power = TOTAL_STAKED_NFTS .may_load_at_height(deps.storage, height)? .unwrap_or_default(); - to_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power, height }) + to_json_binary(&dao_interface::voting::TotalPowerAtHeightResponse { power, height }) } pub fn query_config(deps: Deps) -> StdResult { let config = CONFIG.load(deps.storage)?; - to_binary(&config) + to_json_binary(&config) } pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_nft_claims(deps: Deps, address: String) -> StdResult { - to_binary(&NFT_CLAIMS.query_claims(deps, &deps.api.addr_validate(&address)?)?) + to_json_binary(&NFT_CLAIMS.query_claims(deps, &deps.api.addr_validate(&address)?)?) } pub fn query_hooks(deps: Deps) -> StdResult { - to_binary(&HOOKS.query_hooks(deps)?) + to_json_binary(&HOOKS.query_hooks(deps)?) } pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } pub fn query_staked_nfts( @@ -639,7 +639,7 @@ pub fn query_staked_nfts( Some(l) => range.take(l as usize).collect(), None => range.collect(), }; - to_binary(&range?) + to_json_binary(&range?) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -692,7 +692,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result::UpdateOwnership( cw721_base::Action::TransferOwnership { new_owner: dao.to_string(), @@ -744,10 +744,10 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result::UpdateOwnership( cw721_base::Action::AcceptOwnership {}, ), @@ -767,7 +767,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Result::Mint { owner: accounts[0].address(), token_uri: Some("https://example.com".to_string()), @@ -100,7 +100,7 @@ fn test_full_integration_with_factory() { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_single.code_id, - msg: to_binary(&dao_proposal_single::msg::InstantiateMsg { + msg: to_json_binary(&dao_proposal_single::msg::InstantiateMsg { min_voting_period: None, threshold: Threshold::ThresholdQuorum { threshold: PercentageThreshold::Majority {}, 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 cea9d24a1..26d5c4abc 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 @@ -7,7 +7,7 @@ use crate::{ state::Config, }; -use cosmwasm_std::{to_binary, Addr, Coin, Decimal, Empty, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Coin, Decimal, Empty, WasmMsg}; use cw_utils::Duration; use dao_interface::{ msg::QueryMsg as DaoQueryMsg, @@ -86,18 +86,18 @@ impl TestEnvBuilder { automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: vp_contract_id, - msg: to_binary(&InstantiateMsg { + msg: to_json_binary(&InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: custom_factory.contract_addr.clone(), - msg: to_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { + msg: to_json_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: accounts[0].address(), }, - initial_nfts: vec![to_binary( + initial_nfts: vec![to_json_binary( &Cw721ExecuteMsg::::Mint { owner: accounts[0].address(), token_uri: Some("https://example.com".to_string()), @@ -124,7 +124,7 @@ impl TestEnvBuilder { }, proposal_modules_instantiate_info: vec![ModuleInstantiateInfo { code_id: proposal_single_id, - msg: to_binary(&dao_proposal_single::msg::InstantiateMsg { + msg: to_json_binary(&dao_proposal_single::msg::InstantiateMsg { min_voting_period: None, threshold: Threshold::ThresholdQuorum { threshold: PercentageThreshold::Majority {}, diff --git a/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs b/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs index 2f2ada85d..adb68ff04 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs @@ -1,5 +1,5 @@ use cosmwasm_std::testing::{mock_dependencies, mock_env}; -use cosmwasm_std::{to_binary, Addr, Coin, Decimal, Empty, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, Coin, Decimal, Empty, Uint128, WasmMsg}; use cw721_base::msg::{ExecuteMsg as Cw721ExecuteMsg, InstantiateMsg as Cw721InstantiateMsg}; use cw721_controllers::{NftClaim, NftClaimsResponse}; use cw_multi_test::{next_block, App, BankSudo, Executor, SudoMsg}; @@ -45,12 +45,12 @@ fn test_instantiate_with_new_cw721_collection() -> anyhow::Result<()> { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), })?, - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -432,13 +432,13 @@ fn test_instantiate_with_invalid_duration_fails() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Extension { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Extension { msg: Empty {}, }) .unwrap()], @@ -471,13 +471,13 @@ fn test_instantiate_zero_active_threshold_count() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -511,13 +511,13 @@ fn test_instantiate_invalid_active_threshold_count_new_nft() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -577,28 +577,28 @@ fn test_active_threshold_absolute_count() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), initial_nfts: vec![ - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "2".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "3".to_string(), @@ -657,13 +657,13 @@ fn test_active_threshold_percent() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -718,42 +718,42 @@ fn test_active_threshold_percent_rounds_up() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), initial_nfts: vec![ - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "2".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "3".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "4".to_string(), extension: Empty {}, }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "5".to_string(), @@ -820,13 +820,13 @@ fn test_update_active_threshold() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -896,13 +896,13 @@ fn test_active_threshold_percentage_gt_100() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -938,13 +938,13 @@ fn test_active_threshold_percentage_lte_0() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -978,8 +978,8 @@ fn test_invalid_instantiate_msg() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Empty {}).unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + msg: to_json_binary(&Empty {}).unwrap(), + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -1017,13 +1017,13 @@ fn test_invalid_initial_nft_msg() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Extension { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Extension { msg: Empty {}, }) .unwrap()], @@ -1056,16 +1056,16 @@ fn test_invalid_initial_nft_msg_wrong_absolute_count() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }) .unwrap(), initial_nfts: vec![ - to_binary(&Cw721ExecuteMsg::::Extension { msg: Empty {} }) + to_json_binary(&Cw721ExecuteMsg::::Extension { msg: Empty {} }) .unwrap(), - to_binary(&Cw721ExecuteMsg::::Mint { + to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -1104,7 +1104,7 @@ fn test_no_initial_nfts_fails() { nft_contract: NftContract::New { code_id: cw721_id, label: "Test NFT".to_string(), - msg: to_binary(&Cw721InstantiateMsg { + msg: to_json_binary(&Cw721InstantiateMsg { name: "Test NFT".to_string(), symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), @@ -1153,9 +1153,9 @@ fn test_factory() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { + msg: to_json_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { name: "Test NFT".to_string(), @@ -1216,9 +1216,9 @@ fn test_factory_with_funds_pass_through() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary( + msg: to_json_binary( &dao_test_custom_factory::msg::ExecuteMsg::NftFactoryWithFunds { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { @@ -1226,7 +1226,7 @@ fn test_factory_with_funds_pass_through() { symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }, - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -1261,9 +1261,9 @@ fn test_factory_with_funds_pass_through() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary( + msg: to_json_binary( &dao_test_custom_factory::msg::ExecuteMsg::NftFactoryWithFunds { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { @@ -1271,7 +1271,7 @@ fn test_factory_with_funds_pass_through() { symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }, - initial_nfts: vec![to_binary(&Cw721ExecuteMsg::::Mint { + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), @@ -1310,9 +1310,9 @@ fn test_unsupported_factory_msg() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Instantiate { + to_json_binary(&WasmMsg::Instantiate { code_id: cw721_id, - msg: to_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { + msg: to_json_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { code_id: cw721_id, cw721_instantiate_msg: Cw721InstantiateMsg { name: "Test NFT".to_string(), @@ -1368,9 +1368,9 @@ fn test_factory_wrong_callback() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary( + msg: to_json_binary( &dao_test_custom_factory::msg::ExecuteMsg::NftFactoryWrongCallback {}, ) .unwrap(), @@ -1416,9 +1416,9 @@ fn test_factory_no_callback() { Addr::unchecked(CREATOR_ADDR), &InstantiateMsg { nft_contract: NftContract::Factory( - to_binary(&WasmMsg::Execute { + to_json_binary(&WasmMsg::Execute { contract_addr: factory_addr.to_string(), - msg: to_binary( + msg: to_json_binary( &dao_test_custom_factory::msg::ExecuteMsg::NftFactoryNoCallback {}, ) .unwrap(), diff --git a/contracts/voting/dao-voting-token-staked/src/contract.rs b/contracts/voting/dao-voting-token-staked/src/contract.rs index 93bb5c8e3..979dafcb8 100644 --- a/contracts/voting/dao-voting-token-staked/src/contract.rs +++ b/contracts/voting/dao-voting-token-staked/src/contract.rs @@ -2,7 +2,7 @@ use cosmwasm_std::entry_point; use cosmwasm_std::{ - coins, from_binary, to_binary, BankMsg, BankQuery, Binary, Coin, CosmosMsg, Deps, DepsMut, Env, + coins, from_json_binary, to_json_binary, BankMsg, BankQuery, Binary, Coin, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Order, Reply, Response, StdResult, SubMsg, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -112,7 +112,7 @@ pub fn instantiate( WasmMsg::Instantiate { admin: Some(info.sender.to_string()), code_id: *token_issuer_code_id, - msg: to_binary(&IssuerInstantiateMsg::NewToken { + msg: to_json_binary(&IssuerInstantiateMsg::NewToken { subdenom: subdenom.to_string(), })?, funds: info.funds, @@ -126,7 +126,7 @@ pub fn instantiate( .add_attribute("token", "new_token") .add_submessage(issuer_instantiate_msg)) } - TokenInfo::Factory(binary) => match from_binary(&binary)? { + TokenInfo::Factory(binary) => match from_json_binary(&binary)? { WasmMsg::Execute { msg, contract_addr, @@ -389,16 +389,16 @@ pub fn execute_remove_hook( pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::VotingPowerAtHeight { address, height } => { - to_binary(&query_voting_power_at_height(deps, env, address, height)?) + to_json_binary(&query_voting_power_at_height(deps, env, address, height)?) } QueryMsg::TotalPowerAtHeight { height } => { - to_binary(&query_total_power_at_height(deps, env, height)?) + to_json_binary(&query_total_power_at_height(deps, env, height)?) } QueryMsg::Info {} => query_info(deps), QueryMsg::Dao {} => query_dao(deps), - QueryMsg::Claims { address } => to_binary(&query_claims(deps, address)?), - QueryMsg::GetConfig {} => to_binary(&CONFIG.load(deps.storage)?), - QueryMsg::Denom {} => to_binary(&DenomResponse { + QueryMsg::Claims { address } => to_json_binary(&query_claims(deps, address)?), + QueryMsg::GetConfig {} => to_json_binary(&CONFIG.load(deps.storage)?), + QueryMsg::Denom {} => to_json_binary(&DenomResponse { denom: DENOM.load(deps.storage)?, }), QueryMsg::ListStakers { start_after, limit } => { @@ -406,8 +406,8 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { } QueryMsg::IsActive {} => query_is_active(deps), QueryMsg::ActiveThreshold {} => query_active_threshold(deps), - QueryMsg::GetHooks {} => to_binary(&query_hooks(deps)?), - QueryMsg::TokenContract {} => to_binary(&TOKEN_ISSUER_CONTRACT.may_load(deps.storage)?), + QueryMsg::GetHooks {} => to_json_binary(&query_hooks(deps)?), + QueryMsg::TokenContract {} => to_json_binary(&TOKEN_ISSUER_CONTRACT.may_load(deps.storage)?), } } @@ -439,12 +439,12 @@ pub fn query_total_power_at_height( pub fn query_info(deps: Deps) -> StdResult { let info = cw2::get_contract_version(deps.storage)?; - to_binary(&dao_interface::voting::InfoResponse { info }) + to_json_binary(&dao_interface::voting::InfoResponse { info }) } pub fn query_dao(deps: Deps) -> StdResult { let dao = DAO.load(deps.storage)?; - to_binary(&dao) + to_json_binary(&dao) } pub fn query_claims(deps: Deps, address: String) -> StdResult { @@ -471,7 +471,7 @@ pub fn query_list_stakers( }) .collect::>()?; - to_binary(&ListStakersResponse { stakers }) + to_json_binary(&ListStakersResponse { stakers }) } pub fn query_is_active(deps: Deps) -> StdResult { @@ -480,7 +480,7 @@ pub fn query_is_active(deps: Deps) -> StdResult { let denom = DENOM.load(deps.storage)?; let actual_power = STAKED_TOTAL.may_load(deps.storage)?.unwrap_or_default(); match threshold { - ActiveThreshold::AbsoluteCount { count } => to_binary(&IsActiveResponse { + ActiveThreshold::AbsoluteCount { count } => to_json_binary(&IsActiveResponse { active: actual_power >= count, }), ActiveThreshold::Percentage { percent } => { @@ -526,18 +526,18 @@ pub fn query_is_active(deps: Deps) -> StdResult { let rounded = (applied + Uint256::from(PRECISION_FACTOR) - Uint256::from(1u128)) / Uint256::from(PRECISION_FACTOR); let count: Uint128 = rounded.try_into().unwrap(); - to_binary(&IsActiveResponse { + to_json_binary(&IsActiveResponse { active: actual_power >= count, }) } } } else { - to_binary(&IsActiveResponse { active: true }) + to_json_binary(&IsActiveResponse { active: true }) } } pub fn query_active_threshold(deps: Deps) -> StdResult { - to_binary(&ActiveThresholdResponse { + to_json_binary(&ActiveThresholdResponse { active_threshold: ACTIVE_THRESHOLD.may_load(deps.storage)?, }) } @@ -615,7 +615,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result Result Result Result Result Result Result { // Parse info from the callback, this will fail // if incorrectly formatted. - let info: TokenFactoryCallback = from_binary(&data)?; + let info: TokenFactoryCallback = from_json_binary(&data)?; // Save Denom DENOM.save(deps.storage, &info.denom)?; @@ -748,7 +748,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result WasmMsg::Execute { contract_addr: address.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: who.to_string(), amount, })?, @@ -203,7 +203,7 @@ impl fmt::Display for CheckedDenom { mod tests { use cosmwasm_std::{ testing::{mock_dependencies, MockQuerier}, - to_binary, Addr, ContractResult, QuerierResult, StdError, SystemError, Uint128, WasmQuery, + to_json_binary, Addr, ContractResult, QuerierResult, StdError, SystemError, Uint128, WasmQuery, }; use super::*; @@ -217,7 +217,7 @@ mod tests { if *contract_addr == CW20_ADDR { if works { QuerierResult::Ok(ContractResult::Ok( - to_binary(&cw20::TokenInfoResponse { + to_json_binary(&cw20::TokenInfoResponse { name: "coin".to_string(), symbol: "symbol".to_string(), decimals: 6, diff --git a/packages/cw-paginate-storage/README.md b/packages/cw-paginate-storage/README.md index 03a9d03eb..8ab92c658 100644 --- a/packages/cw-paginate-storage/README.md +++ b/packages/cw-paginate-storage/README.md @@ -18,7 +18,7 @@ pub const ITEMS: Map = Map::new("items"); You can use this package to write a query to list it's contents like: ```rust -use cosmwasm_std::{Deps, Binary, to_binary, StdResult}; +use cosmwasm_std::{Deps, Binary, to_json_binary, StdResult}; use cw_storage_plus::Map; use cw_paginate_storage::paginate_map; @@ -29,7 +29,7 @@ pub fn query_list_items( start_after: Option, limit: Option, ) -> StdResult { - to_binary(&paginate_map( + to_json_binary(&paginate_map( deps, &ITEMS, start_after, diff --git a/packages/cw-stake-tracker/src/lib.rs b/packages/cw-stake-tracker/src/lib.rs index fc9a774cf..b9c633966 100644 --- a/packages/cw-stake-tracker/src/lib.rs +++ b/packages/cw-stake-tracker/src/lib.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::{to_binary, Binary, StdResult, Storage, Timestamp, Uint128}; +use cosmwasm_std::{to_json_binary, Binary, StdResult, Storage, Timestamp, Uint128}; use cw_wormhole::Wormhole; #[cfg(test)] @@ -261,12 +261,12 @@ impl<'a> StakeTracker<'a> { /// API. pub fn query(&self, storage: &dyn Storage, msg: StakeTrackerQuery) -> StdResult { match msg { - StakeTrackerQuery::Cardinality { t } => to_binary(&Uint128::new( + StakeTrackerQuery::Cardinality { t } => to_json_binary(&Uint128::new( self.validator_cardinality(storage, t)?.into(), )), - StakeTrackerQuery::TotalStaked { t } => to_binary(&self.total_staked(storage, t)?), + StakeTrackerQuery::TotalStaked { t } => to_json_binary(&self.total_staked(storage, t)?), StakeTrackerQuery::ValidatorStaked { validator, t } => { - to_binary(&self.validator_staked(storage, t, validator)?) + to_json_binary(&self.validator_staked(storage, t, validator)?) } } } diff --git a/packages/cw-stake-tracker/src/tests.rs b/packages/cw-stake-tracker/src/tests.rs index 3d0c46b37..417b64375 100644 --- a/packages/cw-stake-tracker/src/tests.rs +++ b/packages/cw-stake-tracker/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{from_binary, testing::mock_dependencies, Timestamp, Uint128}; +use cosmwasm_std::{from_json_binary, testing::mock_dependencies, Timestamp, Uint128}; use crate::{StakeTracker, StakeTrackerQuery}; @@ -431,7 +431,7 @@ fn test_queries() { ) .unwrap(); - let cardinality: Uint128 = from_binary( + let cardinality: Uint128 = from_json_binary( &st.query( storage, StakeTrackerQuery::Cardinality { @@ -443,7 +443,7 @@ fn test_queries() { .unwrap(); assert_eq!(cardinality, Uint128::one()); - let total_staked: Uint128 = from_binary( + let total_staked: Uint128 = from_json_binary( &st.query( storage, StakeTrackerQuery::TotalStaked { @@ -455,7 +455,7 @@ fn test_queries() { .unwrap(); assert_eq!(total_staked, Uint128::new(42)); - let val_staked: Uint128 = from_binary( + let val_staked: Uint128 = from_json_binary( &st.query( storage, StakeTrackerQuery::ValidatorStaked { @@ -468,7 +468,7 @@ fn test_queries() { .unwrap(); assert_eq!(val_staked, Uint128::new(42)); - let val_staked_before_staking: Uint128 = from_binary( + let val_staked_before_staking: Uint128 = from_json_binary( &st.query( storage, StakeTrackerQuery::ValidatorStaked { diff --git a/packages/dao-hooks/src/nft_stake.rs b/packages/dao-hooks/src/nft_stake.rs index 9cebad29b..adae78ca7 100644 --- a/packages/dao-hooks/src/nft_stake.rs +++ b/packages/dao-hooks/src/nft_stake.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, Addr, StdResult, Storage, SubMsg, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, StdResult, Storage, SubMsg, WasmMsg}; use cw_hooks::Hooks; /// An enum representing NFT staking hooks. @@ -17,7 +17,7 @@ pub fn stake_nft_hook_msgs( addr: Addr, token_id: String, ) -> StdResult> { - let msg = to_binary(&NftStakeChangedExecuteMsg::NftStakeChangeHook( + let msg = to_json_binary(&NftStakeChangedExecuteMsg::NftStakeChangeHook( NftStakeChangedHookMsg::Stake { addr, token_id }, ))?; hooks.prepare_hooks(storage, |a| { @@ -38,7 +38,7 @@ pub fn unstake_nft_hook_msgs( addr: Addr, token_ids: Vec, ) -> StdResult> { - let msg = to_binary(&NftStakeChangedExecuteMsg::NftStakeChangeHook( + let msg = to_json_binary(&NftStakeChangedExecuteMsg::NftStakeChangeHook( NftStakeChangedHookMsg::Unstake { addr, token_ids }, ))?; diff --git a/packages/dao-hooks/src/proposal.rs b/packages/dao-hooks/src/proposal.rs index 0b95758ad..6ccc7bd34 100644 --- a/packages/dao-hooks/src/proposal.rs +++ b/packages/dao-hooks/src/proposal.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, StdResult, Storage, SubMsg, WasmMsg}; +use cosmwasm_std::{to_json_binary, StdResult, Storage, SubMsg, WasmMsg}; use cw_hooks::Hooks; use dao_voting::reply::mask_proposal_hook_index; @@ -28,7 +28,7 @@ pub fn new_proposal_hooks( id: u64, proposer: &str, ) -> StdResult> { - let msg = to_binary(&ProposalHookExecuteMsg::ProposalHook( + let msg = to_json_binary(&ProposalHookExecuteMsg::ProposalHook( ProposalHookMsg::NewProposal { id, proposer: proposer.to_string(), @@ -65,7 +65,7 @@ pub fn proposal_status_changed_hooks( return Ok(vec![]); } - let msg = to_binary(&ProposalHookExecuteMsg::ProposalHook( + let msg = to_json_binary(&ProposalHookExecuteMsg::ProposalHook( ProposalHookMsg::ProposalStatusChanged { id, old_status, diff --git a/packages/dao-hooks/src/stake.rs b/packages/dao-hooks/src/stake.rs index 6161bf2c9..f74203173 100644 --- a/packages/dao-hooks/src/stake.rs +++ b/packages/dao-hooks/src/stake.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, Addr, StdResult, Storage, SubMsg, Uint128, WasmMsg}; +use cosmwasm_std::{to_json_binary, Addr, StdResult, Storage, SubMsg, Uint128, WasmMsg}; use cw_hooks::Hooks; /// An enum representing staking hooks. @@ -17,7 +17,7 @@ pub fn stake_hook_msgs( addr: Addr, amount: Uint128, ) -> StdResult> { - let msg = to_binary(&StakeChangedExecuteMsg::StakeChangeHook( + let msg = to_json_binary(&StakeChangedExecuteMsg::StakeChangeHook( StakeChangedHookMsg::Stake { addr, amount }, ))?; hooks.prepare_hooks(storage, |a| { @@ -38,7 +38,7 @@ pub fn unstake_hook_msgs( addr: Addr, amount: Uint128, ) -> StdResult> { - let msg = to_binary(&StakeChangedExecuteMsg::StakeChangeHook( + let msg = to_json_binary(&StakeChangedExecuteMsg::StakeChangeHook( StakeChangedHookMsg::Unstake { addr, amount }, ))?; hooks.prepare_hooks(storage, |a| { diff --git a/packages/dao-hooks/src/vote.rs b/packages/dao-hooks/src/vote.rs index b8a0dd772..9d5dedf3e 100644 --- a/packages/dao-hooks/src/vote.rs +++ b/packages/dao-hooks/src/vote.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_binary, StdResult, Storage, SubMsg, WasmMsg}; +use cosmwasm_std::{to_json_binary, StdResult, Storage, SubMsg, WasmMsg}; use cw_hooks::Hooks; use dao_voting::reply::mask_vote_hook_index; @@ -23,7 +23,7 @@ pub fn new_vote_hooks( voter: String, vote: String, ) -> StdResult> { - let msg = to_binary(&VoteHookExecuteMsg::VoteHook(VoteHookMsg::NewVote { + let msg = to_json_binary(&VoteHookExecuteMsg::VoteHook(VoteHookMsg::NewVote { proposal_id, voter, vote, diff --git a/packages/dao-interface/src/state.rs b/packages/dao-interface/src/state.rs index 0bd445de3..2022640eb 100644 --- a/packages/dao-interface/src/state.rs +++ b/packages/dao-interface/src/state.rs @@ -91,13 +91,13 @@ pub struct ModuleInstantiateCallback { mod tests { use super::*; - use cosmwasm_std::{to_binary, Addr, WasmMsg}; + use cosmwasm_std::{to_json_binary, Addr, WasmMsg}; #[test] fn test_module_instantiate_admin_none() { let no_admin = ModuleInstantiateInfo { code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), admin: None, label: "bar".to_string(), funds: vec![], @@ -107,7 +107,7 @@ mod tests { WasmMsg::Instantiate { admin: None, code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), funds: vec![], label: "bar".to_string() } @@ -118,7 +118,7 @@ mod tests { fn test_module_instantiate_admin_addr() { let no_admin = ModuleInstantiateInfo { code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), admin: Some(Admin::Address { addr: "core".to_string(), }), @@ -130,7 +130,7 @@ mod tests { WasmMsg::Instantiate { admin: Some("core".to_string()), code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), funds: vec![], label: "bar".to_string() } @@ -141,7 +141,7 @@ mod tests { fn test_module_instantiate_instantiator_addr() { let no_admin = ModuleInstantiateInfo { code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), admin: Some(Admin::CoreModule {}), label: "bar".to_string(), funds: vec![], @@ -151,7 +151,7 @@ mod tests { WasmMsg::Instantiate { admin: Some("ekez".to_string()), code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), funds: vec![], label: "bar".to_string() } diff --git a/packages/dao-pre-propose-base/src/execute.rs b/packages/dao-pre-propose-base/src/execute.rs index 225a465fe..50949d476 100644 --- a/packages/dao-pre-propose-base/src/execute.rs +++ b/packages/dao-pre-propose-base/src/execute.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::schemars::JsonSchema; use cosmwasm_std::{ - to_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, WasmMsg, + to_json_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -138,7 +138,7 @@ where let propose_messsage = WasmMsg::Execute { contract_addr: proposal_module.into_string(), - msg: to_binary(&msg)?, + msg: to_json_binary(&msg)?, funds: vec![], }; @@ -147,7 +147,7 @@ where .prepare_hooks(deps.storage, |a| { let execute = WasmMsg::Execute { contract_addr: a.into_string(), - msg: to_binary(&msg)?, + msg: to_json_binary(&msg)?, funds: vec![], }; Ok(SubMsg::new(execute)) @@ -314,7 +314,7 @@ where Ok(Response::default() .add_attribute("method", "execute_proposal_completed_hook") .add_attribute("proposal", id.to_string()) - .add_attribute("deposit_info", to_binary(&deposit_info)?.to_string()) + .add_attribute("deposit_info", to_json_binary(&deposit_info)?.to_string()) .add_messages(messages)) } @@ -349,18 +349,18 @@ where pub fn query(&self, deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::ProposalModule {} => to_binary(&self.proposal_module.load(deps.storage)?), - QueryMsg::Dao {} => to_binary(&self.dao.load(deps.storage)?), - QueryMsg::Config {} => to_binary(&self.config.load(deps.storage)?), + QueryMsg::ProposalModule {} => to_json_binary(&self.proposal_module.load(deps.storage)?), + QueryMsg::Dao {} => to_json_binary(&self.dao.load(deps.storage)?), + QueryMsg::Config {} => to_json_binary(&self.config.load(deps.storage)?), QueryMsg::DepositInfo { proposal_id } => { let (deposit_info, proposer) = self.deposits.load(deps.storage, proposal_id)?; - to_binary(&DepositInfoResponse { + to_json_binary(&DepositInfoResponse { deposit_info, proposer, }) } QueryMsg::ProposalSubmittedHooks {} => { - to_binary(&self.proposal_submitted_hooks.query_hooks(deps)?) + to_json_binary(&self.proposal_submitted_hooks.query_hooks(deps)?) } QueryMsg::QueryExtension { .. } => Ok(Binary::default()), } diff --git a/packages/dao-pre-propose-base/src/tests.rs b/packages/dao-pre-propose-base/src/tests.rs index f04c6ed5a..7c868a74f 100644 --- a/packages/dao-pre-propose-base/src/tests.rs +++ b/packages/dao-pre-propose-base/src/tests.rs @@ -1,7 +1,7 @@ use cosmwasm_std::{ - from_binary, + from_json_binary, testing::{mock_dependencies, mock_env, mock_info}, - to_binary, Addr, Binary, ContractResult, Empty, Response, SubMsg, WasmMsg, + to_json_binary, Addr, Binary, ContractResult, Empty, Response, SubMsg, WasmMsg, }; use cw_hooks::HooksResponse; use dao_voting::status::Status; @@ -97,7 +97,7 @@ fn test_proposal_submitted_hooks() { module .execute_add_proposal_submitted_hook(deps.as_mut(), info, "one".to_string()) .unwrap(); - let hooks: HooksResponse = from_binary( + let hooks: HooksResponse = from_json_binary( &module .query( deps.as_ref(), @@ -118,7 +118,7 @@ fn test_proposal_submitted_hooks() { deps.querier.update_wasm(|_| { // for responding to the next proposal ID query that gets fired by propose. - cosmwasm_std::SystemResult::Ok(ContractResult::Ok(to_binary(&1u64).unwrap())) + cosmwasm_std::SystemResult::Ok(ContractResult::Ok(to_json_binary(&1u64).unwrap())) }); // The hooks fire when a proposal is created. @@ -136,7 +136,7 @@ fn test_proposal_submitted_hooks() { res.messages[1], SubMsg::new(WasmMsg::Execute { contract_addr: "one".to_string(), - msg: to_binary(&Empty::default()).unwrap(), + msg: to_json_binary(&Empty::default()).unwrap(), funds: vec![], }) ); @@ -153,7 +153,7 @@ fn test_proposal_submitted_hooks() { module .execute_remove_proposal_submitted_hook(deps.as_mut(), info, "one".to_string()) .unwrap(); - let hooks: HooksResponse = from_binary( + let hooks: HooksResponse = from_json_binary( &module .query( deps.as_ref(), diff --git a/packages/dao-testing/src/helpers.rs b/packages/dao-testing/src/helpers.rs index 9bccd53c7..b629e7ba0 100644 --- a/packages/dao-testing/src/helpers.rs +++ b/packages/dao-testing/src/helpers.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{to_binary, Addr, Binary, Uint128}; +use cosmwasm_std::{to_json_binary, Addr, Binary, Uint128}; use cw20::Cw20Coin; use cw_multi_test::{App, Executor}; use cw_utils::Duration; @@ -57,7 +57,7 @@ pub fn instantiate_with_cw20_balances_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_balance::msg::InstantiateMsg { token_info: dao_voting_cw20_balance::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -138,7 +138,7 @@ pub fn instantiate_with_staked_balances_governance( automatically_add_cw721s: false, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: staked_balances_voting_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { active_threshold: None, token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, @@ -211,7 +211,7 @@ pub fn instantiate_with_staked_balances_governance( &cw20::Cw20ExecuteMsg::Send { contract: staking_contract.to_string(), amount, - msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), }, &[], ) @@ -259,7 +259,7 @@ pub fn instantiate_with_staking_active_threshold( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg { token_info: dao_voting_cw20_staked::msg::TokenInfo::New { code_id: cw20_id, label: "DAO DAO governance token".to_string(), @@ -342,7 +342,7 @@ pub fn instantiate_with_cw4_groups_governance( automatically_add_cw721s: true, voting_module_instantiate_info: ModuleInstantiateInfo { code_id: votemod_id, - msg: to_binary(&dao_voting_cw4::msg::InstantiateMsg { + msg: to_json_binary(&dao_voting_cw4::msg::InstantiateMsg { group_contract: GroupContract::New { cw4_group_code_id: cw4_id, initial_members: initial_weights, diff --git a/packages/dao-voting/src/deposit.rs b/packages/dao-voting/src/deposit.rs index bf0852ea8..33fbb832c 100644 --- a/packages/dao-voting/src/deposit.rs +++ b/packages/dao-voting/src/deposit.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - to_binary, Addr, CosmosMsg, Deps, MessageInfo, StdError, StdResult, Uint128, WasmMsg, + to_json_binary, Addr, CosmosMsg, Deps, MessageInfo, StdError, StdResult, Uint128, WasmMsg, }; use cw_utils::{must_pay, PaymentError}; @@ -170,7 +170,7 @@ impl CheckedDepositInfo { vec![WasmMsg::Execute { contract_addr: address.to_string(), funds: vec![], - msg: to_binary(&cw20::Cw20ExecuteMsg::TransferFrom { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::TransferFrom { owner: depositor.to_string(), recipient: contract.to_string(), amount: *amount, @@ -312,7 +312,7 @@ pub mod tests { messages, vec![CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: CW20.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::TransferFrom { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::TransferFrom { owner: "ekez".to_string(), recipient: "contract".to_string(), amount: Uint128::new(10) @@ -371,7 +371,7 @@ pub mod tests { messages, vec![CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: CW20.to_string(), - msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { + msg: to_json_binary(&cw20::Cw20ExecuteMsg::Transfer { recipient: "ekez".to_string(), amount: Uint128::new(10) }) diff --git a/packages/dao-voting/src/pre_propose.rs b/packages/dao-voting/src/pre_propose.rs index 7671425a3..482bf9260 100644 --- a/packages/dao-voting/src/pre_propose.rs +++ b/packages/dao-voting/src/pre_propose.rs @@ -60,7 +60,7 @@ impl PreProposeInfo { #[cfg(test)] mod tests { - use cosmwasm_std::{to_binary, WasmMsg}; + use cosmwasm_std::{to_json_binary, WasmMsg}; use super::*; @@ -114,7 +114,7 @@ mod tests { let info = PreProposeInfo::ModuleMayPropose { info: ModuleInstantiateInfo { code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), admin: None, funds: vec![], label: "pre-propose-9000".to_string(), @@ -136,7 +136,7 @@ mod tests { WasmMsg::Instantiate { admin: None, code_id: 42, - msg: to_binary("foo").unwrap(), + msg: to_json_binary("foo").unwrap(), funds: vec![], label: "pre-propose-9000".to_string() }, From 2a0f7e8adbdce970496e53d852b5a5a1bf7bd149 Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 14:35:41 +0000 Subject: [PATCH 02/16] bump cosmwasm-std to latest --- Cargo.lock | 29 ++++++++--- Cargo.toml | 140 ++++++++++++++++++++++++++--------------------------- 2 files changed, 92 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f99a96546..d721b2bfa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -189,6 +189,12 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bindgen" version = "0.60.1" @@ -539,11 +545,12 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca101fbf2f76723711a30ea3771ef312ec3ec254ad021b237871ed802f9f175" +checksum = "d8bb3c77c3b7ce472056968c745eb501c440fbc07be5004eba02782c35bfbbe3" dependencies = [ "digest 0.10.7", + "ecdsa 0.16.8", "ed25519-zebra", "k256 0.13.1", "rand_core 0.6.4", @@ -552,9 +559,9 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c73d2dd292f60e42849d2b07c03d809cf31e128a4299a805abd6d24553bcaaf5" +checksum = "fea73e9162e6efde00018d55ed0061e93a108b5d6ec4548b4f8ce3c706249687" dependencies = [ "syn 1.0.109", ] @@ -585,11 +592,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a44d3f9c25b2f864737c6605a98f2e4675d53fd8bbc7cf4d7c02475661a793d" +checksum = "04d6864742e3a7662d024b51a94ea81c9af21db6faea2f9a6d2232bb97c6e53e" dependencies = [ "base64 0.21.4", + "bech32", "bnum", "cosmwasm-crypto", "cosmwasm-derive", @@ -600,6 +608,7 @@ dependencies = [ "serde", "serde-json-wasm", "sha2 0.10.7", + "static_assertions", "thiserror", ] @@ -3478,7 +3487,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.11.0", "proc-macro2", "quote", "syn 2.0.34", @@ -4092,6 +4101,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.10.0" diff --git a/Cargo.toml b/Cargo.toml index 3bfd13b1d..4ac35b4dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,16 @@ [workspace] +exclude = ["ci/configs/", "wasmvm/libwasmvm"] members = [ - "contracts/dao-dao-core", - "contracts/external/*", - "contracts/proposal/*", - "contracts/pre-propose/*", - "contracts/staking/*", - "contracts/test/*", - "contracts/voting/*", - "packages/*", - "ci/*", + "contracts/dao-dao-core", + "contracts/external/*", + "contracts/proposal/*", + "contracts/pre-propose/*", + "contracts/staking/*", + "contracts/test/*", + "contracts/voting/*", + "packages/*", + "ci/*", ] -exclude = ["ci/configs/", "wasmvm/libwasmvm"] [workspace.package] edition = "2021" @@ -20,29 +20,29 @@ version = "2.3.0" [profile.release] codegen-units = 1 -opt-level = 3 debug = false -rpath = false -lto = true debug-assertions = false -panic = 'abort' incremental = false +lto = true +opt-level = 3 +panic = 'abort' +rpath = false # Please do not disable these. Doing so will cause overflow checks in # all workspace members to stop working. Overflows should be errors. overflow-checks = true [workspace.dependencies] -anyhow = { version = "1.0" } +anyhow = {version = "1.0"} assert_matches = "1.5" -cosm-orc = { version = "4.0" } +cosm-orc = {version = "4.0"} cosm-tome = "0.2" cosmos-sdk-proto = "0.19" -cosmwasm-schema = { version = "1.2" } -cosmwasm-std = { version = "1.2", features = ["ibc3"] } -cosmwasm-storage = { version = "1.2" } +cosmwasm-schema = {version = "1.2"} +cosmwasm-std = {version = "1.5.0", features = ["ibc3"]} +cosmwasm-storage = {version = "1.2"} cw-controllers = "1.1" cw-multi-test = "0.17" -cw-storage-plus = { version = "1.1" } +cw-storage-plus = {version = "1.1"} cw-utils = "1.0" cw2 = "1.1" cw20 = "1.1" @@ -61,16 +61,16 @@ prost = "0.11" quote = "1.0" rand = "0.8" schemars = "0.8" -serde = { version = "1.0", default-features = false, features = ["derive"] } +serde = {version = "1.0", default-features = false, features = ["derive"]} serde_json = "1.0" serde_yaml = "0.9" +sg-multi-test = "3.1.0" sg-std = "3.1.0" sg721 = "3.1.0" sg721-base = "3.1.0" -sg-multi-test = "3.1.0" -syn = { version = "1.0", features = ["derive"] } +syn = {version = "1.0", features = ["derive"]} test-context = "0.1" -thiserror = { version = "1.0" } +thiserror = {version = "1.0"} token-bindings = "0.11.0" wynd-utils = "0.4" @@ -78,51 +78,51 @@ wynd-utils = "0.4" # optional owner. cw-ownable = "0.5" -cw-admin-factory = { path = "./contracts/external/cw-admin-factory", version = "2.3.0" } -cw-denom = { path = "./packages/cw-denom", version = "2.3.0" } -cw-hooks = { path = "./packages/cw-hooks", version = "2.3.0" } -cw-wormhole = { path = "./packages/cw-wormhole", version = "2.3.0" } -cw-paginate-storage = { path = "./packages/cw-paginate-storage", version = "2.3.0" } -cw-payroll-factory = { path = "./contracts/external/cw-payroll-factory", version = "2.3.0" } -cw-tokenfactory-issuer = { path = "./contracts/external/cw-tokenfactory-issuer", version = "2.3.0" } -cw-vesting = { path = "./contracts/external/cw-vesting", version = "2.3.0" } -cw20-stake = { path = "./contracts/staking/cw20-stake", version = "2.3.0" } -cw-stake-tracker = { path = "./packages/cw-stake-tracker", version = "2.3.0" } -cw721-controllers = { path = "./packages/cw721-controllers", version = "2.3.0" } -cw721-roles = { path = "./contracts/external/cw721-roles", version = "2.3.0" } -dao-cw721-extensions = { path = "./packages/dao-cw721-extensions", version = "2.3.0" } -dao-dao-core = { path = "./contracts/dao-dao-core", version = "2.3.0" } -dao-dao-macros = { path = "./packages/dao-dao-macros", version = "2.3.0" } -dao-hooks = { path = "./packages/dao-hooks", version = "2.3.0" } -dao-interface = { path = "./packages/dao-interface", version = "2.3.0" } -dao-pre-propose-approval-single = { path = "./contracts/pre-propose/dao-pre-propose-approval-single", version = "2.3.0" } -dao-pre-propose-approver = { path = "./contracts/pre-propose/dao-pre-propose-approver", version = "2.3.0" } -dao-pre-propose-base = { path = "./packages/dao-pre-propose-base", version = "2.3.0" } -dao-pre-propose-multiple = { path = "./contracts/pre-propose/dao-pre-propose-multiple", version = "2.3.0" } -dao-pre-propose-single = { path = "./contracts/pre-propose/dao-pre-propose-single", version = "2.3.0" } -dao-proposal-condorcet = { path = "./contracts/proposal/dao-proposal-condorcet", version = "2.3.0" } -dao-proposal-multiple = { path = "./contracts/proposal/dao-proposal-multiple", version = "2.3.0" } -dao-proposal-single = { path = "./contracts/proposal/dao-proposal-single", version = "2.3.0" } -dao-proposal-sudo = { path = "./contracts/test/dao-proposal-sudo", version = "2.3.0" } -dao-proposal-hook-counter = { path = "./contracts/test/dao-proposal-hook-counter", version = "2.3.0" } -dao-test-custom-factory = { path = "./contracts/test/dao-test-custom-factory", version = "2.3.0" } -dao-testing = { path = "./packages/dao-testing", version = "2.3.0" } -dao-voting = { path = "./packages/dao-voting", version = "2.3.0" } -dao-voting-cw20-balance = { path = "./contracts/test/dao-voting-cw20-balance", version = "2.3.0" } -dao-voting-cw20-staked = { path = "./contracts/voting/dao-voting-cw20-staked", version = "2.3.0" } -dao-voting-cw4 = { path = "./contracts/voting/dao-voting-cw4", version = "2.3.0" } -dao-voting-cw721-roles = { path = "./contracts/voting/dao-voting-cw721-roles", version = "2.3.0" } -dao-voting-cw721-staked = { path = "./contracts/voting/dao-voting-cw721-staked", version = "2.3.0" } -dao-voting-token-staked = { path = "./contracts/voting/dao-voting-token-staked", version = "2.3.0" } +cw-admin-factory = {path = "./contracts/external/cw-admin-factory", version = "2.3.0"} +cw-denom = {path = "./packages/cw-denom", version = "2.3.0"} +cw-hooks = {path = "./packages/cw-hooks", version = "2.3.0"} +cw-paginate-storage = {path = "./packages/cw-paginate-storage", version = "2.3.0"} +cw-payroll-factory = {path = "./contracts/external/cw-payroll-factory", version = "2.3.0"} +cw-stake-tracker = {path = "./packages/cw-stake-tracker", version = "2.3.0"} +cw-tokenfactory-issuer = {path = "./contracts/external/cw-tokenfactory-issuer", version = "2.3.0"} +cw-vesting = {path = "./contracts/external/cw-vesting", version = "2.3.0"} +cw-wormhole = {path = "./packages/cw-wormhole", version = "2.3.0"} +cw20-stake = {path = "./contracts/staking/cw20-stake", version = "2.3.0"} +cw721-controllers = {path = "./packages/cw721-controllers", version = "2.3.0"} +cw721-roles = {path = "./contracts/external/cw721-roles", version = "2.3.0"} +dao-cw721-extensions = {path = "./packages/dao-cw721-extensions", version = "2.3.0"} +dao-dao-core = {path = "./contracts/dao-dao-core", version = "2.3.0"} +dao-dao-macros = {path = "./packages/dao-dao-macros", version = "2.3.0"} +dao-hooks = {path = "./packages/dao-hooks", version = "2.3.0"} +dao-interface = {path = "./packages/dao-interface", version = "2.3.0"} +dao-pre-propose-approval-single = {path = "./contracts/pre-propose/dao-pre-propose-approval-single", version = "2.3.0"} +dao-pre-propose-approver = {path = "./contracts/pre-propose/dao-pre-propose-approver", version = "2.3.0"} +dao-pre-propose-base = {path = "./packages/dao-pre-propose-base", version = "2.3.0"} +dao-pre-propose-multiple = {path = "./contracts/pre-propose/dao-pre-propose-multiple", version = "2.3.0"} +dao-pre-propose-single = {path = "./contracts/pre-propose/dao-pre-propose-single", version = "2.3.0"} +dao-proposal-condorcet = {path = "./contracts/proposal/dao-proposal-condorcet", version = "2.3.0"} +dao-proposal-hook-counter = {path = "./contracts/test/dao-proposal-hook-counter", version = "2.3.0"} +dao-proposal-multiple = {path = "./contracts/proposal/dao-proposal-multiple", version = "2.3.0"} +dao-proposal-single = {path = "./contracts/proposal/dao-proposal-single", version = "2.3.0"} +dao-proposal-sudo = {path = "./contracts/test/dao-proposal-sudo", version = "2.3.0"} +dao-test-custom-factory = {path = "./contracts/test/dao-test-custom-factory", version = "2.3.0"} +dao-testing = {path = "./packages/dao-testing", version = "2.3.0"} +dao-voting = {path = "./packages/dao-voting", version = "2.3.0"} +dao-voting-cw20-balance = {path = "./contracts/test/dao-voting-cw20-balance", version = "2.3.0"} +dao-voting-cw20-staked = {path = "./contracts/voting/dao-voting-cw20-staked", version = "2.3.0"} +dao-voting-cw4 = {path = "./contracts/voting/dao-voting-cw4", version = "2.3.0"} +dao-voting-cw721-roles = {path = "./contracts/voting/dao-voting-cw721-roles", version = "2.3.0"} +dao-voting-cw721-staked = {path = "./contracts/voting/dao-voting-cw721-staked", version = "2.3.0"} +dao-voting-token-staked = {path = "./contracts/voting/dao-voting-token-staked", version = "2.3.0"} # v1 dependencies. used for state migrations. -cw-core-v1 = { package = "cw-core", version = "0.1.0" } -cw-proposal-single-v1 = { package = "cw-proposal-single", version = "0.1.0" } -cw-utils-v1 = { package = "cw-utils", version = "0.13" } -cw20-stake-external-rewards-v1 = { package = "stake-cw20-external-rewards", version = "0.2.6" } -cw20-stake-reward-distributor-v1 = { package = "stake-cw20-reward-distributor", version = "0.1.0" } -cw20-stake-v1 = { package = "cw20-stake", version = "0.2.6" } -cw20-staked-balance-voting-v1 = { package = "cw20-staked-balance-voting", version = "0.1.0" } -cw4-voting-v1 = { package = "cw4-voting", version = "0.1.0" } -voting-v1 = { package = "dao-voting", version = "0.1.0" } -stake-cw20-v03 = { package = "stake-cw20", version = "0.2.6" } +cw-core-v1 = {package = "cw-core", version = "0.1.0"} +cw-proposal-single-v1 = {package = "cw-proposal-single", version = "0.1.0"} +cw-utils-v1 = {package = "cw-utils", version = "0.13"} +cw20-stake-external-rewards-v1 = {package = "stake-cw20-external-rewards", version = "0.2.6"} +cw20-stake-reward-distributor-v1 = {package = "stake-cw20-reward-distributor", version = "0.1.0"} +cw20-stake-v1 = {package = "cw20-stake", version = "0.2.6"} +cw20-staked-balance-voting-v1 = {package = "cw20-staked-balance-voting", version = "0.1.0"} +cw4-voting-v1 = {package = "cw4-voting", version = "0.1.0"} +stake-cw20-v03 = {package = "stake-cw20", version = "0.2.6"} +voting-v1 = {package = "dao-voting", version = "0.1.0"} From 7db30300920c0c47f36fa281b71cfdf7d244e041 Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 14:51:28 +0000 Subject: [PATCH 03/16] replace from_json_binary to from_json --- contracts/dao-dao-core/src/contract.rs | 8 ++++---- .../external/cw-payroll-factory/src/contract.rs | 4 ++-- contracts/external/cw-vesting/src/contract.rs | 4 ++-- contracts/external/cw721-roles/src/contract.rs | 10 ++++++---- .../cw20-stake-external-rewards/src/contract.rs | 4 ++-- contracts/staking/cw20-stake/src/contract.rs | 8 +++++--- .../voting/dao-voting-cw721-staked/src/contract.rs | 10 +++++----- .../voting/dao-voting-token-staked/src/contract.rs | 12 +++++++----- packages/cw-stake-tracker/src/tests.rs | 10 +++++----- packages/dao-pre-propose-base/src/tests.rs | 6 +++--- 10 files changed, 41 insertions(+), 35 deletions(-) diff --git a/contracts/dao-dao-core/src/contract.rs b/contracts/dao-dao-core/src/contract.rs index a4eb2d9dc..56cd5c526 100644 --- a/contracts/dao-dao-core/src/contract.rs +++ b/contracts/dao-dao-core/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_json_binary, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Order, - Reply, Response, StdError, StdResult, SubMsg, WasmMsg, + from_json, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, + Order, Reply, Response, StdError, StdResult, SubMsg, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; use cw_paginate_storage::{paginate_map, paginate_map_keys, paginate_map_values}; @@ -952,7 +952,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result from_json_binary::(&data) + Some(data) => from_json::(&data) .map(|m| m.msgs) .unwrap_or_else(|_| vec![]), None => vec![], @@ -978,7 +978,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result from_json_binary::(&data) + Some(data) => from_json::(&data) .map(|m| m.msgs) .unwrap_or_else(|_| vec![]), None => vec![], diff --git a/contracts/external/cw-payroll-factory/src/contract.rs b/contracts/external/cw-payroll-factory/src/contract.rs index aad8d44dc..73de7713c 100644 --- a/contracts/external/cw-payroll-factory/src/contract.rs +++ b/contracts/external/cw-payroll-factory/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_json_binary, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Order, Reply, + from_json, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Order, Reply, Response, StdResult, SubMsg, WasmMsg, }; use cosmwasm_std::{Addr, Coin}; @@ -72,7 +72,7 @@ pub fn execute_receive_cw20( // Only accepts cw20 tokens nonpayable(&info)?; - let msg: ReceiveMsg = from_json_binary(&receive_msg.msg)?; + let msg: ReceiveMsg = from_json(&receive_msg.msg)?; if TMP_INSTANTIATOR_INFO.may_load(deps.storage)?.is_some() { return Err(ContractError::Reentrancy); diff --git a/contracts/external/cw-vesting/src/contract.rs b/contracts/external/cw-vesting/src/contract.rs index eddfe51bc..264a062e0 100644 --- a/contracts/external/cw-vesting/src/contract.rs +++ b/contracts/external/cw-vesting/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_json_binary, to_json_binary, Binary, Coin, CosmosMsg, DelegationResponse, Deps, DepsMut, + from_json, to_json_binary, Binary, Coin, CosmosMsg, DelegationResponse, Deps, DepsMut, DistributionMsg, Env, MessageInfo, Response, StakingMsg, StakingQuery, StdResult, Timestamp, Uint128, }; @@ -137,7 +137,7 @@ pub fn execute_receive_cw20( // Only accepts cw20 tokens nonpayable(&info)?; - let msg: ReceiveMsg = from_json_binary(&receive_msg.msg)?; + let msg: ReceiveMsg = from_json(&receive_msg.msg)?; match msg { ReceiveMsg::Fund {} => { diff --git a/contracts/external/cw721-roles/src/contract.rs b/contracts/external/cw721-roles/src/contract.rs index 6d087c578..d181b4e28 100644 --- a/contracts/external/cw721-roles/src/contract.rs +++ b/contracts/external/cw721-roles/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_json_binary, to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, + from_json, to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, StdResult, SubMsg, Uint64, }; use cw4::{ @@ -154,7 +154,7 @@ pub fn execute_burn( token_id: String, ) -> Result { // Lookup the owner of the NFT - let owner: OwnerOfResponse = from_json_binary(&Cw721Roles::default().query( + let owner: OwnerOfResponse = from_json(&Cw721Roles::default().query( deps.as_ref(), env.clone(), QueryMsg::OwnerOf { @@ -164,7 +164,7 @@ pub fn execute_burn( )?)?; // Get the weight of the token - let nft_info: NftInfoResponse = from_json_binary(&Cw721Roles::default().query( + let nft_info: NftInfoResponse = from_json(&Cw721Roles::default().query( deps.as_ref(), env.clone(), QueryMsg::NftInfo { @@ -445,7 +445,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryExt::Member { addr, at_height } => { to_json_binary(&query_member(deps, addr, at_height)?) } - QueryExt::TotalWeight { at_height } => to_json_binary(&query_total_weight(deps, at_height)?), + QueryExt::TotalWeight { at_height } => { + to_json_binary(&query_total_weight(deps, at_height)?) + } }, _ => Cw721Roles::default().query(deps, env, msg), } diff --git a/contracts/staking/cw20-stake-external-rewards/src/contract.rs b/contracts/staking/cw20-stake-external-rewards/src/contract.rs index 63486915b..e92b0b6d9 100644 --- a/contracts/staking/cw20-stake-external-rewards/src/contract.rs +++ b/contracts/staking/cw20-stake-external-rewards/src/contract.rs @@ -14,7 +14,7 @@ use crate::ContractError::{ use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_json_binary, to_json_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, + from_json, to_json_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -143,7 +143,7 @@ pub fn execute_receive( info: MessageInfo, wrapper: Cw20ReceiveMsg, ) -> Result, ContractError> { - let msg: ReceiveMsg = from_json_binary(&wrapper.msg)?; + let msg: ReceiveMsg = from_json(&wrapper.msg)?; let config = CONFIG.load(deps.storage)?; let sender = deps.api.addr_validate(&wrapper.sender)?; if config.reward_token != Denom::Cw20(info.sender) { diff --git a/contracts/staking/cw20-stake/src/contract.rs b/contracts/staking/cw20-stake/src/contract.rs index 24ee73d88..64af7482a 100644 --- a/contracts/staking/cw20-stake/src/contract.rs +++ b/contracts/staking/cw20-stake/src/contract.rs @@ -2,7 +2,7 @@ use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_json_binary, to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, + from_json, to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdError, StdResult, Uint128, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; @@ -129,7 +129,7 @@ pub fn execute_receive( expected: config.token_address, }); } - let msg: ReceiveMsg = from_json_binary(&wrapper.msg)?; + let msg: ReceiveMsg = from_json(&wrapper.msg)?; let sender = deps.api.addr_validate(&wrapper.sender)?; match msg { ReceiveMsg::Stake {} => execute_stake(deps, env, sender, wrapper.amount), @@ -343,7 +343,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::TotalStakedAtHeight { height } => { to_json_binary(&query_total_staked_at_height(deps, env, height)?) } - QueryMsg::StakedValue { address } => to_json_binary(&query_staked_value(deps, env, address)?), + QueryMsg::StakedValue { address } => { + to_json_binary(&query_staked_value(deps, env, address)?) + } QueryMsg::TotalValue {} => to_json_binary(&query_total_value(deps, env)?), QueryMsg::Claims { address } => to_json_binary(&query_claims(deps, address)?), QueryMsg::GetHooks {} => to_json_binary(&query_hooks(deps)?), diff --git a/contracts/voting/dao-voting-cw721-staked/src/contract.rs b/contracts/voting/dao-voting-cw721-staked/src/contract.rs index 29e48b896..8572d1ac5 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/contract.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_json_binary, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, - Response, StdError, StdResult, SubMsg, Uint128, Uint256, WasmMsg, + from_json, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, + Reply, Response, StdError, StdResult, SubMsg, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; use cw721::{Cw721QueryMsg, Cw721ReceiveMsg, NumTokensResponse}; @@ -58,7 +58,7 @@ impl NftInstantiateMsg { pub fn try_deserialize_nft_instantiate_msg( instantiate_msg: Binary, ) -> Result { - if let Ok(cw721_msg) = from_json_binary::(&instantiate_msg) { + if let Ok(cw721_msg) = from_json::(&instantiate_msg) { return Ok(NftInstantiateMsg::Cw721(cw721_msg)); } @@ -162,7 +162,7 @@ pub fn instantiate( .add_attribute("method", "instantiate") .add_submessage(instantiate_msg)) } - NftContract::Factory(binary) => match from_json_binary(&binary)? { + NftContract::Factory(binary) => match from_json(&binary)? { WasmMsg::Execute { msg: wasm_msg, contract_addr, @@ -767,7 +767,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result match from_json_binary(&binary)? { + TokenInfo::Factory(binary) => match from_json(&binary)? { WasmMsg::Execute { msg, contract_addr, @@ -407,7 +407,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::IsActive {} => query_is_active(deps), QueryMsg::ActiveThreshold {} => query_active_threshold(deps), QueryMsg::GetHooks {} => to_json_binary(&query_hooks(deps)?), - QueryMsg::TokenContract {} => to_json_binary(&TOKEN_ISSUER_CONTRACT.may_load(deps.storage)?), + QueryMsg::TokenContract {} => { + to_json_binary(&TOKEN_ISSUER_CONTRACT.may_load(deps.storage)?) + } } } @@ -729,7 +731,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { // Parse info from the callback, this will fail // if incorrectly formatted. - let info: TokenFactoryCallback = from_json_binary(&data)?; + let info: TokenFactoryCallback = from_json(&data)?; // Save Denom DENOM.save(deps.storage, &info.denom)?; diff --git a/packages/cw-stake-tracker/src/tests.rs b/packages/cw-stake-tracker/src/tests.rs index 417b64375..355d4e7bf 100644 --- a/packages/cw-stake-tracker/src/tests.rs +++ b/packages/cw-stake-tracker/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{from_json_binary, testing::mock_dependencies, Timestamp, Uint128}; +use cosmwasm_std::{from_json, testing::mock_dependencies, Timestamp, Uint128}; use crate::{StakeTracker, StakeTrackerQuery}; @@ -431,7 +431,7 @@ fn test_queries() { ) .unwrap(); - let cardinality: Uint128 = from_json_binary( + let cardinality: Uint128 = from_json( &st.query( storage, StakeTrackerQuery::Cardinality { @@ -443,7 +443,7 @@ fn test_queries() { .unwrap(); assert_eq!(cardinality, Uint128::one()); - let total_staked: Uint128 = from_json_binary( + let total_staked: Uint128 = from_json( &st.query( storage, StakeTrackerQuery::TotalStaked { @@ -455,7 +455,7 @@ fn test_queries() { .unwrap(); assert_eq!(total_staked, Uint128::new(42)); - let val_staked: Uint128 = from_json_binary( + let val_staked: Uint128 = from_json( &st.query( storage, StakeTrackerQuery::ValidatorStaked { @@ -468,7 +468,7 @@ fn test_queries() { .unwrap(); assert_eq!(val_staked, Uint128::new(42)); - let val_staked_before_staking: Uint128 = from_json_binary( + let val_staked_before_staking: Uint128 = from_json( &st.query( storage, StakeTrackerQuery::ValidatorStaked { diff --git a/packages/dao-pre-propose-base/src/tests.rs b/packages/dao-pre-propose-base/src/tests.rs index 7c868a74f..2e73c729a 100644 --- a/packages/dao-pre-propose-base/src/tests.rs +++ b/packages/dao-pre-propose-base/src/tests.rs @@ -1,5 +1,5 @@ use cosmwasm_std::{ - from_json_binary, + from_json, testing::{mock_dependencies, mock_env, mock_info}, to_json_binary, Addr, Binary, ContractResult, Empty, Response, SubMsg, WasmMsg, }; @@ -97,7 +97,7 @@ fn test_proposal_submitted_hooks() { module .execute_add_proposal_submitted_hook(deps.as_mut(), info, "one".to_string()) .unwrap(); - let hooks: HooksResponse = from_json_binary( + let hooks: HooksResponse = from_json( &module .query( deps.as_ref(), @@ -153,7 +153,7 @@ fn test_proposal_submitted_hooks() { module .execute_remove_proposal_submitted_hook(deps.as_mut(), info, "one".to_string()) .unwrap(); - let hooks: HooksResponse = from_json_binary( + let hooks: HooksResponse = from_json( &module .query( deps.as_ref(), From 9f269a7fdc1cb43c82a26da92aa5de85ab9941d0 Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 14:52:36 +0000 Subject: [PATCH 04/16] fmt --- contracts/dao-dao-core/src/tests.rs | 6 ++- .../cw-fund-distributor/src/contract.rs | 4 +- contracts/external/cw-token-swap/src/state.rs | 4 +- .../cw-tokenfactory-issuer/src/contract.rs | 4 +- .../external/dao-migrator/src/contract.rs | 10 ++-- .../dao-migrator/src/testing/helpers.rs | 4 +- .../src/contract.rs | 20 ++++---- .../dao-proposal-multiple/src/contract.rs | 4 +- .../src/testing/tests.rs | 4 +- .../dao-proposal-single/src/testing/tests.rs | 7 +-- .../dao-test-custom-factory/src/contract.rs | 44 ++++++++++-------- .../dao-voting-cw20-staked/src/contract.rs | 4 +- .../dao-voting-cw721-roles/src/contract.rs | 4 +- .../src/testing/integration_tests.rs | 17 +++---- .../src/testing/test_tube_env.rs | 29 ++++++------ .../src/testing/tests.rs | 46 +++++++++++-------- packages/cw-denom/src/lib.rs | 3 +- packages/dao-pre-propose-base/src/execute.rs | 7 ++- 18 files changed, 127 insertions(+), 94 deletions(-) diff --git a/contracts/dao-dao-core/src/tests.rs b/contracts/dao-dao-core/src/tests.rs index 3ab01632e..09aa70590 100644 --- a/contracts/dao-dao-core/src/tests.rs +++ b/contracts/dao-dao-core/src/tests.rs @@ -593,7 +593,8 @@ fn test_removed_modules_can_not_execute() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }).unwrap(), + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }) + .unwrap(), } .into()], }, @@ -666,7 +667,8 @@ fn test_removed_modules_can_not_execute() { msgs: vec![WasmMsg::Execute { contract_addr: gov_addr.to_string(), funds: vec![], - msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }).unwrap(), + msg: to_json_binary(&ExecuteMsg::UpdateProposalModules { to_add, to_disable }) + .unwrap(), } .into()], }, diff --git a/contracts/external/cw-fund-distributor/src/contract.rs b/contracts/external/cw-fund-distributor/src/contract.rs index 8e658905a..c5539d1ef 100644 --- a/contracts/external/cw-fund-distributor/src/contract.rs +++ b/contracts/external/cw-fund-distributor/src/contract.rs @@ -10,8 +10,8 @@ use crate::state::{ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_json_binary, Addr, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, Fraction, MessageInfo, - Order, Response, StdError, StdResult, Uint128, WasmMsg, + to_json_binary, Addr, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, Fraction, + MessageInfo, Order, Response, StdError, StdResult, Uint128, WasmMsg, }; use cw2::set_contract_version; use cw_paginate_storage::paginate_map; diff --git a/contracts/external/cw-token-swap/src/state.rs b/contracts/external/cw-token-swap/src/state.rs index 6f971629b..5a7071567 100644 --- a/contracts/external/cw-token-swap/src/state.rs +++ b/contracts/external/cw-token-swap/src/state.rs @@ -1,5 +1,7 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_json_binary, Addr, BankMsg, Coin, CosmosMsg, Deps, StdError, Uint128, WasmMsg}; +use cosmwasm_std::{ + to_json_binary, Addr, BankMsg, Coin, CosmosMsg, Deps, StdError, Uint128, WasmMsg, +}; use cw_storage_plus::Item; use crate::{ diff --git a/contracts/external/cw-tokenfactory-issuer/src/contract.rs b/contracts/external/cw-tokenfactory-issuer/src/contract.rs index 2a5039afe..1879a52a6 100644 --- a/contracts/external/cw-tokenfactory-issuer/src/contract.rs +++ b/contracts/external/cw-tokenfactory-issuer/src/contract.rs @@ -148,7 +148,9 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { QueryMsg::Denylist { start_after, limit } => { to_json_binary(&queries::query_denylist(deps, start_after, limit)?) } - QueryMsg::IsAllowed { address } => to_json_binary(&queries::query_is_allowed(deps, address)?), + QueryMsg::IsAllowed { address } => { + to_json_binary(&queries::query_is_allowed(deps, address)?) + } QueryMsg::IsDenied { address } => to_json_binary(&queries::query_is_denied(deps, address)?), QueryMsg::IsFrozen {} => to_json_binary(&queries::query_is_frozen(deps)?), QueryMsg::Ownership {} => to_json_binary(&queries::query_owner(deps)?), diff --git a/contracts/external/dao-migrator/src/contract.rs b/contracts/external/dao-migrator/src/contract.rs index 55c6beb5f..3610ab9be 100644 --- a/contracts/external/dao-migrator/src/contract.rs +++ b/contracts/external/dao-migrator/src/contract.rs @@ -348,10 +348,12 @@ pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> Result StdResult { QueryExt::PendingProposal { id } => { to_json_binary(&PENDING_PROPOSALS.load(deps.storage, id)?) } - QueryExt::PendingProposals { start_after, limit } => to_json_binary(&paginate_map_values( - deps, - &PENDING_PROPOSALS, - start_after, - limit, - Order::Descending, - )?), + QueryExt::PendingProposals { start_after, limit } => { + to_json_binary(&paginate_map_values( + deps, + &PENDING_PROPOSALS, + start_after, + limit, + Order::Descending, + )?) + } QueryExt::ReversePendingProposals { start_before, limit, diff --git a/contracts/proposal/dao-proposal-multiple/src/contract.rs b/contracts/proposal/dao-proposal-multiple/src/contract.rs index 96097ebc2..a2a3c58d6 100644 --- a/contracts/proposal/dao-proposal-multiple/src/contract.rs +++ b/contracts/proposal/dao-proposal-multiple/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, - Storage, SubMsg, WasmMsg, + to_json_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, + StdResult, Storage, SubMsg, WasmMsg, }; use cw2::set_contract_version; diff --git a/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs b/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs index 4f649beec..e1b8dddde 100644 --- a/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs +++ b/contracts/proposal/dao-proposal-multiple/src/testing/tests.rs @@ -1,4 +1,6 @@ -use cosmwasm_std::{to_json_binary, Addr, Coin, CosmosMsg, Decimal, Empty, Timestamp, Uint128, WasmMsg}; +use cosmwasm_std::{ + to_json_binary, Addr, Coin, CosmosMsg, Decimal, Empty, Timestamp, Uint128, WasmMsg, +}; use cw20::Cw20Coin; use cw_denom::{CheckedDenom, UncheckedDenom}; use cw_hooks::HooksResponse; diff --git a/contracts/proposal/dao-proposal-single/src/testing/tests.rs b/contracts/proposal/dao-proposal-single/src/testing/tests.rs index f42464097..a5cc7aa01 100644 --- a/contracts/proposal/dao-proposal-single/src/testing/tests.rs +++ b/contracts/proposal/dao-proposal-single/src/testing/tests.rs @@ -1,8 +1,8 @@ use cosmwasm_std::{ coins, testing::{mock_dependencies, mock_env}, - to_json_binary, Addr, Attribute, BankMsg, Binary, ContractInfoResponse, CosmosMsg, Decimal, Empty, - Reply, StdError, SubMsgResult, Uint128, WasmMsg, WasmQuery, + to_json_binary, Addr, Attribute, BankMsg, Binary, ContractInfoResponse, CosmosMsg, Decimal, + Empty, Reply, StdError, SubMsgResult, Uint128, WasmMsg, WasmQuery, }; use cw2::ContractVersion; use cw20::Cw20Coin; @@ -2495,7 +2495,8 @@ fn test_update_pre_propose_module() { CREATOR_ADDR, vec![WasmMsg::Execute { contract_addr: pre_propose_start.into_string(), - msg: to_json_binary(&dao_pre_propose_single::ExecuteMsg::Withdraw { denom: None }).unwrap(), + msg: to_json_binary(&dao_pre_propose_single::ExecuteMsg::Withdraw { denom: None }) + .unwrap(), funds: vec![], } .into()], diff --git a/contracts/test/dao-test-custom-factory/src/contract.rs b/contracts/test/dao-test-custom-factory/src/contract.rs index b7f8159b8..67ad19686 100644 --- a/contracts/test/dao-test-custom-factory/src/contract.rs +++ b/contracts/test/dao-test-custom-factory/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, - StdResult, SubMsg, Uint128, WasmMsg, + to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, Reply, + Response, StdResult, SubMsg, Uint128, WasmMsg, }; use cw2::set_contract_version; use cw721::{Cw721QueryMsg, NumTokensResponse}; @@ -190,11 +190,13 @@ pub fn execute_nft_factory_wrong_callback( _env: Env, _info: MessageInfo, ) -> Result { - Ok(Response::new().set_data(to_json_binary(&TokenFactoryCallback { - denom: "wrong".to_string(), - token_contract: None, - module_instantiate_callback: None, - })?)) + Ok( + Response::new().set_data(to_json_binary(&TokenFactoryCallback { + denom: "wrong".to_string(), + token_contract: None, + module_instantiate_callback: None, + })?), + ) } /// An example factory that instantiates a cw_tokenfactory_issuer contract @@ -264,10 +266,12 @@ pub fn execute_token_factory_factory_wrong_callback( _env: Env, _info: MessageInfo, ) -> Result { - Ok(Response::new().set_data(to_json_binary(&NftFactoryCallback { - nft_contract: "nope".to_string(), - module_instantiate_callback: None, - })?)) + Ok( + Response::new().set_data(to_json_binary(&NftFactoryCallback { + nft_contract: "nope".to_string(), + module_instantiate_callback: None, + })?), + ) } /// Example method called in the ModuleInstantiateCallback providing @@ -443,13 +447,13 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { // Parse nft address from instantiate reply @@ -487,10 +491,12 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result Err(ContractError::UnknownReplyId { id: msg.id }), } diff --git a/contracts/voting/dao-voting-cw20-staked/src/contract.rs b/contracts/voting/dao-voting-cw20-staked/src/contract.rs index 0ce06700c..47913a57c 100644 --- a/contracts/voting/dao-voting-cw20-staked/src/contract.rs +++ b/contracts/voting/dao-voting-cw20-staked/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_json_binary, Addr, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, - SubMsg, Uint128, Uint256, WasmMsg, + to_json_binary, Addr, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Reply, Response, + StdResult, SubMsg, Uint128, Uint256, WasmMsg, }; use cw2::{get_contract_version, set_contract_version, ContractVersion}; use cw20::{Cw20Coin, TokenInfoResponse}; diff --git a/contracts/voting/dao-voting-cw721-roles/src/contract.rs b/contracts/voting/dao-voting-cw721-roles/src/contract.rs index e2a696d2d..d44bf10ab 100644 --- a/contracts/voting/dao-voting-cw721-roles/src/contract.rs +++ b/contracts/voting/dao-voting-cw721-roles/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, SubMsg, - WasmMsg, + to_json_binary, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, + SubMsg, WasmMsg, }; use cw2::set_contract_version; use cw4::{MemberResponse, TotalWeightResponse}; 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 2f84fa708..c85c2559d 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 @@ -66,14 +66,15 @@ fn test_full_integration_with_factory() { symbol: "TEST".to_string(), minter: accounts[0].address(), }, - initial_nfts: vec![to_json_binary( - &Cw721ExecuteMsg::::Mint { - owner: accounts[0].address(), - token_uri: Some("https://example.com".to_string()), - token_id: "1".to_string(), - extension: Empty {}, - }, - ) + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::< + Empty, + Empty, + >::Mint { + owner: accounts[0].address(), + token_uri: Some("https://example.com".to_string()), + token_id: "1".to_string(), + extension: Empty {}, + }) .unwrap()], }, ) 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 26d5c4abc..b6421b6a6 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 @@ -90,23 +90,26 @@ impl TestEnvBuilder { nft_contract: NftContract::Factory( to_json_binary(&WasmMsg::Execute { contract_addr: custom_factory.contract_addr.clone(), - msg: to_json_binary(&dao_test_custom_factory::msg::ExecuteMsg::NftFactory { - code_id: cw721_id, - cw721_instantiate_msg: Cw721InstantiateMsg { - name: "Test NFT".to_string(), - symbol: "TEST".to_string(), - minter: accounts[0].address(), - }, - initial_nfts: vec![to_json_binary( - &Cw721ExecuteMsg::::Mint { + msg: to_json_binary( + &dao_test_custom_factory::msg::ExecuteMsg::NftFactory { + code_id: cw721_id, + cw721_instantiate_msg: Cw721InstantiateMsg { + name: "Test NFT".to_string(), + symbol: "TEST".to_string(), + minter: accounts[0].address(), + }, + initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::< + Empty, + Empty, + >::Mint { owner: accounts[0].address(), token_uri: Some("https://example.com".to_string()), token_id: "1".to_string(), extension: Empty {}, - }, - ) - .unwrap()], - }) + }) + .unwrap()], + }, + ) .unwrap(), funds: vec![], }) diff --git a/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs b/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs index adb68ff04..cdc057bb7 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/testing/tests.rs @@ -438,9 +438,9 @@ fn test_instantiate_with_invalid_duration_fails() { minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Extension { - msg: Empty {}, - }) + initial_nfts: vec![to_json_binary( + &Cw721ExecuteMsg::::Extension { msg: Empty {} }, + ) .unwrap()], }, unstaking_duration: None, @@ -1023,9 +1023,9 @@ fn test_invalid_initial_nft_msg() { minter: CREATOR_ADDR.to_string(), }) .unwrap(), - initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Extension { - msg: Empty {}, - }) + initial_nfts: vec![to_json_binary( + &Cw721ExecuteMsg::::Extension { msg: Empty {} }, + ) .unwrap()], }, unstaking_duration: None, @@ -1063,8 +1063,10 @@ fn test_invalid_initial_nft_msg_wrong_absolute_count() { }) .unwrap(), initial_nfts: vec![ - to_json_binary(&Cw721ExecuteMsg::::Extension { msg: Empty {} }) - .unwrap(), + to_json_binary(&Cw721ExecuteMsg::::Extension { + msg: Empty {}, + }) + .unwrap(), to_json_binary(&Cw721ExecuteMsg::::Mint { owner: CREATOR_ADDR.to_string(), token_uri: Some("https://example.com".to_string()), @@ -1226,12 +1228,14 @@ fn test_factory_with_funds_pass_through() { symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }, - initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { - owner: CREATOR_ADDR.to_string(), - token_uri: Some("https://example.com".to_string()), - token_id: "1".to_string(), - extension: Empty {}, - }) + initial_nfts: vec![to_json_binary( + &Cw721ExecuteMsg::::Mint { + owner: CREATOR_ADDR.to_string(), + token_uri: Some("https://example.com".to_string()), + token_id: "1".to_string(), + extension: Empty {}, + }, + ) .unwrap()], }, ) @@ -1271,12 +1275,14 @@ fn test_factory_with_funds_pass_through() { symbol: "TEST".to_string(), minter: CREATOR_ADDR.to_string(), }, - initial_nfts: vec![to_json_binary(&Cw721ExecuteMsg::::Mint { - owner: CREATOR_ADDR.to_string(), - token_uri: Some("https://example.com".to_string()), - token_id: "1".to_string(), - extension: Empty {}, - }) + initial_nfts: vec![to_json_binary( + &Cw721ExecuteMsg::::Mint { + owner: CREATOR_ADDR.to_string(), + token_uri: Some("https://example.com".to_string()), + token_id: "1".to_string(), + extension: Empty {}, + }, + ) .unwrap()], }, ) diff --git a/packages/cw-denom/src/lib.rs b/packages/cw-denom/src/lib.rs index a7c28bcd8..1babe5a21 100644 --- a/packages/cw-denom/src/lib.rs +++ b/packages/cw-denom/src/lib.rs @@ -203,7 +203,8 @@ impl fmt::Display for CheckedDenom { mod tests { use cosmwasm_std::{ testing::{mock_dependencies, MockQuerier}, - to_json_binary, Addr, ContractResult, QuerierResult, StdError, SystemError, Uint128, WasmQuery, + to_json_binary, Addr, ContractResult, QuerierResult, StdError, SystemError, Uint128, + WasmQuery, }; use super::*; diff --git a/packages/dao-pre-propose-base/src/execute.rs b/packages/dao-pre-propose-base/src/execute.rs index 50949d476..8bbb51929 100644 --- a/packages/dao-pre-propose-base/src/execute.rs +++ b/packages/dao-pre-propose-base/src/execute.rs @@ -1,6 +1,7 @@ use cosmwasm_schema::schemars::JsonSchema; use cosmwasm_std::{ - to_json_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, WasmMsg, + to_json_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, SubMsg, + WasmMsg, }; use cw2::set_contract_version; @@ -349,7 +350,9 @@ where pub fn query(&self, deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::ProposalModule {} => to_json_binary(&self.proposal_module.load(deps.storage)?), + QueryMsg::ProposalModule {} => { + to_json_binary(&self.proposal_module.load(deps.storage)?) + } QueryMsg::Dao {} => to_json_binary(&self.dao.load(deps.storage)?), QueryMsg::Config {} => to_json_binary(&self.config.load(deps.storage)?), QueryMsg::DepositInfo { proposal_id } => { From 2936d29f686bd31e35c80b3f44ecc57ef2f45d28 Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 15:10:46 +0000 Subject: [PATCH 05/16] bump cw-multi-test to latest --- Cargo.lock | 198 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 100 insertions(+), 100 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d721b2bfa..8a06e7b61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,7 +231,7 @@ dependencies = [ "pbkdf2", "rand_core 0.6.4", "ripemd", - "sha2 0.10.7", + "sha2 0.10.8", "subtle", "zeroize", ] @@ -280,7 +280,7 @@ dependencies = [ "cosm-orc", "cosmwasm-std", "cw-admin-factory", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw20 1.1.0", "cw20-stake 2.3.0", "dao-dao-core", @@ -607,7 +607,7 @@ dependencies = [ "schemars", "serde", "serde-json-wasm", - "sha2 0.10.7", + "sha2 0.10.8", "static_assertions", "thiserror", ] @@ -705,8 +705,8 @@ dependencies = [ "cosmwasm-storage", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20-base 1.1.0", "dao-dao-core", "dao-interface", @@ -750,7 +750,7 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "schemars", "serde", "thiserror", @@ -844,8 +844,8 @@ dependencies = [ "cw-multi-test", "cw-paginate-storage 2.3.0", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw20-stake 2.3.0", @@ -867,20 +867,20 @@ dependencies = [ [[package]] name = "cw-multi-test" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d818f5323c80ed4890db7f89d65eda3f0261fe21878e628c27ea2d8de4b7ba4" +checksum = "579e2c2f2c0877b839c5cad85e67811074e854a50c1ff3085eb8290b1c27809c" dependencies = [ "anyhow", "cosmwasm-std", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "derivative", "itertools 0.11.0", "prost 0.12.1", "schemars", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", ] @@ -895,7 +895,7 @@ dependencies = [ "cw-address-like", "cw-ownable-derive", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "thiserror", ] @@ -943,9 +943,9 @@ dependencies = [ "cw-multi-test", "cw-ownable", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw-vesting", - "cw2 1.1.0", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "thiserror", @@ -1038,8 +1038,8 @@ dependencies = [ "cosmwasm-std", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "thiserror", @@ -1055,7 +1055,7 @@ dependencies = [ "cw-multi-test", "cw-ownable", "cw-storage-plus 1.1.0", - "cw2 1.1.0", + "cw2 1.1.1", "osmosis-std", "osmosis-test-tube", "prost 0.11.9", @@ -1107,13 +1107,13 @@ dependencies = [ [[package]] name = "cw-utils" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c80e93d1deccb8588db03945016a292c3c631e6325d349ebb35d2db6f4f946f7" +checksum = "1b9f351a4e4d81ef7c890e44d903f8c0bdcdc00f094fd3a181eaf70c0eec7a3a" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw2 1.1.0", + "cw2 1.1.1", "schemars", "semver", "serde", @@ -1133,9 +1133,9 @@ dependencies = [ "cw-paginate-storage 2.3.0", "cw-stake-tracker", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw-wormhole", - "cw2 1.1.0", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "dao-testing", @@ -1193,9 +1193,9 @@ dependencies = [ [[package]] name = "cw2" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ac2dc7a55ad64173ca1e0a46697c31b7a5c51342f55a1e84a724da4eb99908" +checksum = "9431d14f64f49e41c6ef5561ed11a5391c417d0cb16455dea8cdcb9037a8d197" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1237,7 +1237,7 @@ checksum = "011c45920f8200bd5d32d4fe52502506f64f2f75651ab408054d4cfc75ca3a9b" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "schemars", "serde", ] @@ -1283,8 +1283,8 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "schemars", "semver", @@ -1326,8 +1326,8 @@ dependencies = [ "cw-paginate-storage 2.3.0", "cw-storage-plus 1.1.0", "cw-utils 0.13.4", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw20-stake 0.2.6", @@ -1348,8 +1348,8 @@ dependencies = [ "cw-multi-test", "cw-ownable", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 0.13.4", "cw20 1.1.0", "cw20-base 1.1.0", @@ -1368,8 +1368,8 @@ dependencies = [ "cw-multi-test", "cw-ownable", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw20-stake 2.3.0", @@ -1418,7 +1418,7 @@ checksum = "171af3d9127de6805a7dd819fb070c7d2f6c3ea85f4193f42cef259f0a7f33d5" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw20 1.1.0", "schemars", "serde", @@ -1477,8 +1477,8 @@ dependencies = [ "cosmwasm-std", "cw-controllers 1.1.0", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw4 1.1.0", "schemars", "serde", @@ -1537,7 +1537,7 @@ checksum = "e3c4d286625ccadc957fe480dd3bdc54ada19e0e6b5b9325379db3130569e914" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "schemars", "serde", ] @@ -1569,8 +1569,8 @@ dependencies = [ "cosmwasm-std", "cw-ownable", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw721 0.18.0", "cw721-base 0.16.0", "schemars", @@ -1585,7 +1585,7 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "thiserror", ] @@ -1599,8 +1599,8 @@ dependencies = [ "cw-multi-test", "cw-ownable", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw4 1.1.0", "cw721 0.18.0", "cw721-base 0.18.0", @@ -1631,8 +1631,8 @@ dependencies = [ "cw-multi-test", "cw-paginate-storage 2.3.0", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw721 0.18.0", @@ -1676,8 +1676,8 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-hooks", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw721 0.18.0", "osmosis-std", @@ -1696,8 +1696,8 @@ dependencies = [ "cw-proposal-single", "cw-storage-plus 1.1.0", "cw-utils 0.13.4", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 0.13.4", "cw20 1.1.0", "cw20-base 1.1.0", @@ -1727,8 +1727,8 @@ dependencies = [ "cw-multi-test", "cw-paginate-storage 2.3.0", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw4-group 1.1.0", @@ -1753,8 +1753,8 @@ dependencies = [ "cw-denom", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw4-group 1.1.0", @@ -1780,8 +1780,8 @@ dependencies = [ "cw-hooks", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "dao-hooks", "dao-interface", "dao-voting 2.3.0", @@ -1797,8 +1797,8 @@ dependencies = [ "cosmwasm-std", "cw-denom", "cw-multi-test", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw4-group 1.1.0", @@ -1822,8 +1822,8 @@ dependencies = [ "cw-denom", "cw-hooks", "cw-multi-test", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw4-group 1.1.0", @@ -1847,8 +1847,8 @@ dependencies = [ "cosmwasm-std", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw4 1.1.0", "cw4-group 1.1.0", "dao-dao-core", @@ -1869,8 +1869,8 @@ dependencies = [ "cw-hooks", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "dao-dao-core", @@ -1893,8 +1893,8 @@ dependencies = [ "cw-hooks", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw20-stake 2.3.0", @@ -1933,8 +1933,8 @@ dependencies = [ "cw-proposal-single", "cw-storage-plus 1.1.0", "cw-utils 0.13.4", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw20-stake 2.3.0", @@ -1968,7 +1968,7 @@ dependencies = [ "cosmwasm-storage", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw2 1.1.0", + "cw2 1.1.1", "dao-dao-macros", "dao-interface", "thiserror", @@ -1985,8 +1985,8 @@ dependencies = [ "cw-ownable", "cw-storage-plus 1.1.0", "cw-tokenfactory-issuer", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw721 0.18.0", "cw721-base 0.18.0", "dao-dao-macros", @@ -2006,9 +2006,9 @@ dependencies = [ "cw-multi-test", "cw-proposal-single", "cw-tokenfactory-issuer", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw-vesting", - "cw2 1.1.0", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw20-stake 2.3.0", @@ -2060,7 +2060,7 @@ dependencies = [ "cosmwasm-std", "cw-denom", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw20 1.1.0", "dao-dao-macros", "dao-interface", @@ -2075,8 +2075,8 @@ dependencies = [ "cosmwasm-std", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "dao-dao-macros", @@ -2093,8 +2093,8 @@ dependencies = [ "cosmwasm-storage", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw20 1.1.0", "cw20-base 1.1.0", "cw20-stake 2.3.0", @@ -2113,8 +2113,8 @@ dependencies = [ "cosmwasm-storage", "cw-multi-test", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw4 1.1.0", "cw4-group 1.1.0", "dao-dao-macros", @@ -2133,8 +2133,8 @@ dependencies = [ "cw-ownable", "cw-paginate-storage 2.3.0", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw4 1.1.0", "cw721 0.18.0", "cw721-base 0.18.0", @@ -2159,8 +2159,8 @@ dependencies = [ "cw-multi-test", "cw-paginate-storage 2.3.0", "cw-storage-plus 1.1.0", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "cw721 0.18.0", "cw721-base 0.18.0", "cw721-controllers", @@ -2193,8 +2193,8 @@ dependencies = [ "cw-paginate-storage 2.3.0", "cw-storage-plus 1.1.0", "cw-tokenfactory-issuer", - "cw-utils 1.0.1", - "cw2 1.1.0", + "cw-utils 1.0.2", + "cw2 1.1.1", "dao-dao-macros", "dao-hooks", "dao-interface", @@ -2919,7 +2919,7 @@ dependencies = [ "cosm-tome", "cosmos-sdk-proto 0.19.0", "cosmwasm-std", - "cw-utils 1.0.1", + "cw-utils 1.0.2", "cw-vesting", "cw20 1.1.0", "cw20-base 1.1.0", @@ -3007,7 +3007,7 @@ dependencies = [ "cfg-if", "ecdsa 0.14.8", "elliptic-curve 0.12.3", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", ] @@ -3021,7 +3021,7 @@ dependencies = [ "ecdsa 0.16.8", "elliptic-curve 0.13.5", "once_cell", - "sha2 0.10.7", + "sha2 0.10.8", "signature 2.1.0", ] @@ -3365,7 +3365,7 @@ checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" dependencies = [ "once_cell", "pest", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -3735,9 +3735,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.13" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763f8cd0d4c71ed8389c90cb8100cba87e763bd01a8e614d4f0af97bcd50a161" +checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" dependencies = [ "dyn-clone", "schemars_derive", @@ -3747,9 +3747,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.13" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f696e21e10fa546b7ffb1c9672c6de8fbc7a81acf59524386d8639bf12737" +checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" dependencies = [ "proc-macro2", "quote", @@ -3943,9 +3943,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -4421,18 +4421,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 4ac35b4dc..e70ae7244 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ cosmwasm-schema = {version = "1.2"} cosmwasm-std = {version = "1.5.0", features = ["ibc3"]} cosmwasm-storage = {version = "1.2"} cw-controllers = "1.1" -cw-multi-test = "0.17" +cw-multi-test = "0.18.0" cw-storage-plus = {version = "1.1"} cw-utils = "1.0" cw2 = "1.1" From 8c942120b8afe15701cbd76e61b0f5e2fd96c5e2 Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 15:13:09 +0000 Subject: [PATCH 06/16] replace from_slice to from_json --- contracts/dao-dao-core/src/tests.rs | 4 ++-- .../pre-propose/dao-pre-propose-approval-single/src/tests.rs | 4 ++-- contracts/pre-propose/dao-pre-propose-approver/src/tests.rs | 4 ++-- contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs | 4 ++-- contracts/pre-propose/dao-pre-propose-single/src/tests.rs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contracts/dao-dao-core/src/tests.rs b/contracts/dao-dao-core/src/tests.rs index 09aa70590..f9b355068 100644 --- a/contracts/dao-dao-core/src/tests.rs +++ b/contracts/dao-dao-core/src/tests.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - from_slice, + from_json, testing::{mock_dependencies, mock_env}, to_json_binary, Addr, CosmosMsg, Empty, Storage, Uint128, WasmMsg, }; @@ -2818,7 +2818,7 @@ fn test_migrate_mock() { let new_path = PROPOSAL_MODULES.key(proposal_modules_key); let prop_module_bytes = deps.storage.get(&new_path).unwrap(); - let module: ProposalModule = from_slice(&prop_module_bytes).unwrap(); + let module: ProposalModule = from_json(&prop_module_bytes).unwrap(); assert_eq!(module.address, Addr::unchecked("addr")); assert_eq!(module.prefix, derive_proposal_module_prefix(0).unwrap()); assert_eq!(module.status, ProposalModuleStatus::Enabled {}); diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs index a53aeddd8..0080a5089 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_json_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_json, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -937,7 +937,7 @@ fn test_set_version() { false, ); - let info: ContractVersion = from_slice( + let info: ContractVersion = from_json( &app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs index f36996207..f715c5e71 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_json_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_json, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -1077,7 +1077,7 @@ fn test_set_version() { false, ); - let info: ContractVersion = from_slice( + let info: ContractVersion = from_json( &app.wrap() .query_wasm_raw(pre_propose_approver, "contract_info".as_bytes()) .unwrap() diff --git a/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs b/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs index e70816c3a..54b4d9f5e 100644 --- a/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_json_binary, Addr, Coin, Decimal, Empty, Uint128}; +use cosmwasm_std::{coins, from_json, to_json_binary, Addr, Coin, Decimal, Empty, Uint128}; use cpm::query::ProposalResponse; use cw2::ContractVersion; use cw20::Cw20Coin; @@ -800,7 +800,7 @@ fn test_set_version() { false, ); - let info: ContractVersion = from_slice( + let info: ContractVersion = from_json( &app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() diff --git a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs index 5927603af..19ce3c8e0 100644 --- a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{coins, from_slice, to_json_binary, Addr, Coin, Empty, Uint128}; +use cosmwasm_std::{coins, from_json, to_json_binary, Addr, Coin, Empty, Uint128}; use cw2::ContractVersion; use cw20::Cw20Coin; use cw_denom::UncheckedDenom; @@ -766,7 +766,7 @@ fn test_set_version() { false, ); - let info: ContractVersion = from_slice( + let info: ContractVersion = from_json( &app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() From 4becd9dcb0467fe501d6abb3d25f20574258fdb4 Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 15:17:23 +0000 Subject: [PATCH 07/16] replace to_vec with to_json_vec --- contracts/proposal/dao-proposal-multiple/src/contract.rs | 2 +- contracts/proposal/dao-proposal-single/src/contract.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/proposal/dao-proposal-multiple/src/contract.rs b/contracts/proposal/dao-proposal-multiple/src/contract.rs index a2a3c58d6..c1af47ced 100644 --- a/contracts/proposal/dao-proposal-multiple/src/contract.rs +++ b/contracts/proposal/dao-proposal-multiple/src/contract.rs @@ -239,7 +239,7 @@ pub fn execute_propose( // // `to_vec` is the method used by cosmwasm to convert a struct // into it's byte representation in storage. - let proposal_size = cosmwasm_std::to_vec(&proposal)?.len() as u64; + let proposal_size = cosmwasm_std::to_json_vec(&proposal)?.len() as u64; if proposal_size > MAX_PROPOSAL_SIZE { return Err(ContractError::ProposalTooLarge { size: proposal_size, diff --git a/contracts/proposal/dao-proposal-single/src/contract.rs b/contracts/proposal/dao-proposal-single/src/contract.rs index dc255fbe8..93e73eb76 100644 --- a/contracts/proposal/dao-proposal-single/src/contract.rs +++ b/contracts/proposal/dao-proposal-single/src/contract.rs @@ -235,7 +235,7 @@ pub fn execute_propose( // // `to_vec` is the method used by cosmwasm to convert a struct // into it's byte representation in storage. - let proposal_size = cosmwasm_std::to_vec(&proposal)?.len() as u64; + let proposal_size = cosmwasm_std::to_json_vec(&proposal)?.len() as u64; if proposal_size > MAX_PROPOSAL_SIZE { return Err(ContractError::ProposalTooLarge { size: proposal_size, From aaf7f3ecf637d17ee36f74365de4e0c35919906b Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 15:58:16 +0000 Subject: [PATCH 08/16] clippy fix --- contracts/dao-dao-core/src/tests.rs | 2 +- contracts/external/cw721-roles/src/contract.rs | 4 ++-- .../dao-pre-propose-approval-single/src/tests.rs | 2 +- .../pre-propose/dao-pre-propose-approver/src/tests.rs | 2 +- .../pre-propose/dao-pre-propose-multiple/src/tests.rs | 2 +- contracts/pre-propose/dao-pre-propose-single/src/tests.rs | 2 +- contracts/voting/dao-voting-cw721-staked/src/contract.rs | 4 ++-- contracts/voting/dao-voting-token-staked/src/contract.rs | 4 ++-- packages/cw-stake-tracker/src/tests.rs | 8 ++++---- packages/dao-pre-propose-base/src/tests.rs | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/contracts/dao-dao-core/src/tests.rs b/contracts/dao-dao-core/src/tests.rs index f9b355068..88574113c 100644 --- a/contracts/dao-dao-core/src/tests.rs +++ b/contracts/dao-dao-core/src/tests.rs @@ -2818,7 +2818,7 @@ fn test_migrate_mock() { let new_path = PROPOSAL_MODULES.key(proposal_modules_key); let prop_module_bytes = deps.storage.get(&new_path).unwrap(); - let module: ProposalModule = from_json(&prop_module_bytes).unwrap(); + let module: ProposalModule = from_json(prop_module_bytes).unwrap(); assert_eq!(module.address, Addr::unchecked("addr")); assert_eq!(module.prefix, derive_proposal_module_prefix(0).unwrap()); assert_eq!(module.status, ProposalModuleStatus::Enabled {}); diff --git a/contracts/external/cw721-roles/src/contract.rs b/contracts/external/cw721-roles/src/contract.rs index d181b4e28..833007e46 100644 --- a/contracts/external/cw721-roles/src/contract.rs +++ b/contracts/external/cw721-roles/src/contract.rs @@ -154,7 +154,7 @@ pub fn execute_burn( token_id: String, ) -> Result { // Lookup the owner of the NFT - let owner: OwnerOfResponse = from_json(&Cw721Roles::default().query( + let owner: OwnerOfResponse = from_json(Cw721Roles::default().query( deps.as_ref(), env.clone(), QueryMsg::OwnerOf { @@ -164,7 +164,7 @@ pub fn execute_burn( )?)?; // Get the weight of the token - let nft_info: NftInfoResponse = from_json(&Cw721Roles::default().query( + let nft_info: NftInfoResponse = from_json(Cw721Roles::default().query( deps.as_ref(), env.clone(), QueryMsg::NftInfo { diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs index 0080a5089..d58c67dc4 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs @@ -938,7 +938,7 @@ fn test_set_version() { ); let info: ContractVersion = from_json( - &app.wrap() + app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() .unwrap(), diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs index f715c5e71..bd70c79c9 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/tests.rs @@ -1078,7 +1078,7 @@ fn test_set_version() { ); let info: ContractVersion = from_json( - &app.wrap() + app.wrap() .query_wasm_raw(pre_propose_approver, "contract_info".as_bytes()) .unwrap() .unwrap(), diff --git a/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs b/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs index 54b4d9f5e..241bb039f 100644 --- a/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs @@ -801,7 +801,7 @@ fn test_set_version() { ); let info: ContractVersion = from_json( - &app.wrap() + app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() .unwrap(), diff --git a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs index 19ce3c8e0..0cd459811 100644 --- a/contracts/pre-propose/dao-pre-propose-single/src/tests.rs +++ b/contracts/pre-propose/dao-pre-propose-single/src/tests.rs @@ -767,7 +767,7 @@ fn test_set_version() { ); let info: ContractVersion = from_json( - &app.wrap() + app.wrap() .query_wasm_raw(pre_propose, "contract_info".as_bytes()) .unwrap() .unwrap(), diff --git a/contracts/voting/dao-voting-cw721-staked/src/contract.rs b/contracts/voting/dao-voting-cw721-staked/src/contract.rs index 8572d1ac5..fc83cce13 100644 --- a/contracts/voting/dao-voting-cw721-staked/src/contract.rs +++ b/contracts/voting/dao-voting-cw721-staked/src/contract.rs @@ -162,7 +162,7 @@ pub fn instantiate( .add_attribute("method", "instantiate") .add_submessage(instantiate_msg)) } - NftContract::Factory(binary) => match from_json(&binary)? { + NftContract::Factory(binary) => match from_json(binary)? { WasmMsg::Execute { msg: wasm_msg, contract_addr, @@ -767,7 +767,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result match from_json(&binary)? { + TokenInfo::Factory(binary) => match from_json(binary)? { WasmMsg::Execute { msg, contract_addr, @@ -731,7 +731,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { // Parse info from the callback, this will fail // if incorrectly formatted. - let info: TokenFactoryCallback = from_json(&data)?; + let info: TokenFactoryCallback = from_json(data)?; // Save Denom DENOM.save(deps.storage, &info.denom)?; diff --git a/packages/cw-stake-tracker/src/tests.rs b/packages/cw-stake-tracker/src/tests.rs index 355d4e7bf..2454f9af7 100644 --- a/packages/cw-stake-tracker/src/tests.rs +++ b/packages/cw-stake-tracker/src/tests.rs @@ -432,7 +432,7 @@ fn test_queries() { .unwrap(); let cardinality: Uint128 = from_json( - &st.query( + st.query( storage, StakeTrackerQuery::Cardinality { t: Timestamp::from_seconds(11), @@ -444,7 +444,7 @@ fn test_queries() { assert_eq!(cardinality, Uint128::one()); let total_staked: Uint128 = from_json( - &st.query( + st.query( storage, StakeTrackerQuery::TotalStaked { t: Timestamp::from_seconds(10), @@ -456,7 +456,7 @@ fn test_queries() { assert_eq!(total_staked, Uint128::new(42)); let val_staked: Uint128 = from_json( - &st.query( + st.query( storage, StakeTrackerQuery::ValidatorStaked { t: Timestamp::from_seconds(10), @@ -469,7 +469,7 @@ fn test_queries() { assert_eq!(val_staked, Uint128::new(42)); let val_staked_before_staking: Uint128 = from_json( - &st.query( + st.query( storage, StakeTrackerQuery::ValidatorStaked { t: Timestamp::from_seconds(9), diff --git a/packages/dao-pre-propose-base/src/tests.rs b/packages/dao-pre-propose-base/src/tests.rs index 2e73c729a..c2f29284e 100644 --- a/packages/dao-pre-propose-base/src/tests.rs +++ b/packages/dao-pre-propose-base/src/tests.rs @@ -98,7 +98,7 @@ fn test_proposal_submitted_hooks() { .execute_add_proposal_submitted_hook(deps.as_mut(), info, "one".to_string()) .unwrap(); let hooks: HooksResponse = from_json( - &module + module .query( deps.as_ref(), mock_env(), @@ -154,7 +154,7 @@ fn test_proposal_submitted_hooks() { .execute_remove_proposal_submitted_hook(deps.as_mut(), info, "one".to_string()) .unwrap(); let hooks: HooksResponse = from_json( - &module + module .query( deps.as_ref(), mock_env(), From 735445007ea197934e9b99b8e8af45e5256053fc Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 17:42:41 +0000 Subject: [PATCH 09/16] bump osmosis-std and osmosis-test-tube to latest --- Cargo.lock | 166 +++++++++++++++++++++-------------------------------- Cargo.toml | 4 +- 2 files changed, 67 insertions(+), 103 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a06e7b61..68c72dc3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,17 +82,6 @@ dependencies = [ "syn 2.0.34", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -179,9 +168,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -197,24 +186,24 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bindgen" -version = "0.60.1" +version = "0.68.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" +checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cexpr", "clang-sys", - "clap", - "env_logger 0.9.3", "lazy_static", "lazycell", "log", "peeking_take_while", + "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", + "syn 2.0.34", "which", ] @@ -289,7 +278,7 @@ dependencies = [ "dao-proposal-single", "dao-voting 2.3.0", "dao-voting-cw20-staked", - "env_logger 0.10.0", + "env_logger", "serde", "serde_json", "serde_yaml", @@ -369,30 +358,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_lex", - "indexmap 1.9.3", - "strsim", - "termcolor", - "textwrap", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - [[package]] name = "config" version = "0.13.3" @@ -596,7 +561,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04d6864742e3a7662d024b51a94ea81c9af21db6faea2f9a6d2232bb97c6e53e" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bech32", "bnum", "cosmwasm-crypto", @@ -1056,7 +1021,7 @@ dependencies = [ "cw-ownable", "cw-storage-plus 1.1.0", "cw2 1.1.1", - "osmosis-std", + "osmosis-std 0.20.1", "osmosis-test-tube", "prost 0.11.9", "schemars", @@ -1680,7 +1645,7 @@ dependencies = [ "cw2 1.1.1", "cw20 1.1.0", "cw721 0.18.0", - "osmosis-std", + "osmosis-std 0.20.1", ] [[package]] @@ -2031,7 +1996,7 @@ dependencies = [ "dao-voting-cw721-roles", "dao-voting-cw721-staked", "dao-voting-token-staked", - "osmosis-std", + "osmosis-std 0.20.1", "osmosis-test-tube", "rand", "serde", @@ -2172,7 +2137,7 @@ dependencies = [ "dao-test-custom-factory", "dao-testing", "dao-voting 2.3.0", - "osmosis-std", + "osmosis-std 0.19.1", "osmosis-test-tube", "serde", "thiserror", @@ -2203,7 +2168,7 @@ dependencies = [ "dao-test-custom-factory", "dao-testing", "dao-voting 2.3.0", - "osmosis-std", + "osmosis-std 0.19.1", "osmosis-test-tube", "serde", "thiserror", @@ -2380,19 +2345,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.10.0" @@ -2690,7 +2642,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "headers-core", "http", @@ -2708,15 +2660,6 @@ dependencies = [ "http", ] -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.2" @@ -2935,7 +2878,7 @@ dependencies = [ "dao-voting 2.3.0", "dao-voting-cw20-staked", "dao-voting-cw721-staked", - "env_logger 0.10.0", + "env_logger", "once_cell", "rand", "serde", @@ -2949,7 +2892,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "rustix", "windows-sys", ] @@ -3160,7 +3103,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "libc", ] @@ -3211,20 +3154,30 @@ dependencies = [ ] [[package]] -name = "os_str_bytes" -version = "6.5.1" +name = "osmosis-std" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" +checksum = "088997c4da871db9edb9e090a4e164d1cb12498781491ccb8030246287400300" +dependencies = [ + "chrono", + "cosmwasm-std", + "osmosis-std-derive 0.16.2", + "prost 0.11.9", + "prost-types", + "schemars", + "serde", + "serde-cw-value", +] [[package]] name = "osmosis-std" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088997c4da871db9edb9e090a4e164d1cb12498781491ccb8030246287400300" +checksum = "47d7aa053bc3fad557ac90a0377688b400c395e2537f0f1de3293a15cad2e970" dependencies = [ "chrono", "cosmwasm-std", - "osmosis-std-derive", + "osmosis-std-derive 0.20.1", "prost 0.11.9", "prost-types", "schemars", @@ -3245,17 +3198,30 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "osmosis-std-derive" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5ebdfd1bc8ed04db596e110c6baa9b174b04f6ed1ec22c666ddc5cb3fa91bd7" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "prost-types", + "quote", + "syn 1.0.109", +] + [[package]] name = "osmosis-test-tube" -version = "19.0.0" +version = "20.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d176b76c0142f7a047d4c4f12a553b10de557aa60304077ca88532249924da0f" +checksum = "2c1534a419d9e2c27b0b4869e68496b92abca93464b82efbdd1f1b43467f2938" dependencies = [ - "base64 0.13.1", + "base64 0.21.5", "bindgen", "cosmrs 0.9.0", "cosmwasm-std", - "osmosis-std", + "osmosis-std 0.20.1", "prost 0.11.9", "serde", "serde_json", @@ -3426,6 +3392,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2", + "syn 2.0.34", +] + [[package]] name = "proc-macro2" version = "1.0.67" @@ -4107,12 +4083,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "subtle" version = "2.5.0" @@ -4399,26 +4369,20 @@ dependencies = [ [[package]] name = "test-tube" -version = "0.1.7" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04de0d85f2438f0b64a5c135a1524564f2b89263cfbce011542446b6681d006f" +checksum = "65e79c7af10967dd3383ee5aae3810637cc3f2fd040f87f862c02151db060628" dependencies = [ "base64 0.13.1", "cosmrs 0.9.0", "cosmwasm-std", - "osmosis-std", + "osmosis-std 0.20.1", "prost 0.11.9", "serde", "serde_json", "thiserror", ] -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thiserror" version = "1.0.50" @@ -4606,7 +4570,7 @@ checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" dependencies = [ "async-trait", "axum", - "base64 0.21.4", + "base64 0.21.5", "bytes", "futures-core", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index e70ae7244..1b38126fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,8 +54,8 @@ cw721 = "0.18" cw721-base = "0.18" env_logger = "0.10" once_cell = "1.18" -osmosis-std = "0.19.0" -osmosis-test-tube = "19.0.0" +osmosis-std = "0.20.1" +osmosis-test-tube = "20.1.2" proc-macro2 = "1.0" prost = "0.11" quote = "1.0" From 32850089552c33b340acafeff82c322e8af3c302 Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 18:26:39 +0000 Subject: [PATCH 10/16] bump prost to latest --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68c72dc3c..58b7bacad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1023,7 +1023,7 @@ dependencies = [ "cw2 1.1.1", "osmosis-std 0.20.1", "osmosis-test-tube", - "prost 0.11.9", + "prost 0.12.1", "schemars", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 1b38126fa..ab3ce6b80 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ once_cell = "1.18" osmosis-std = "0.20.1" osmosis-test-tube = "20.1.2" proc-macro2 = "1.0" -prost = "0.11" +prost = "0.12" quote = "1.0" rand = "0.8" schemars = "0.8" From 580758f355dfa34812fe1bb52b380e3cd1cbd2ba Mon Sep 17 00:00:00 2001 From: Dat-Andre Date: Fri, 10 Nov 2023 20:16:12 +0000 Subject: [PATCH 11/16] revert osmosis-std, osmosis-test-tube & prost bump --- Cargo.lock | 129 ++++++++++++++++++++++++++++++++++++++++------------- Cargo.toml | 6 +-- 2 files changed, 100 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 58b7bacad..0c443888a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,6 +82,17 @@ dependencies = [ "syn 2.0.34", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -186,24 +197,24 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bindgen" -version = "0.68.1" +version = "0.60.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" +checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" dependencies = [ - "bitflags 2.4.0", + "bitflags 1.3.2", "cexpr", "clang-sys", + "clap", + "env_logger 0.9.3", "lazy_static", "lazycell", "log", "peeking_take_while", - "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.34", "which", ] @@ -278,7 +289,7 @@ dependencies = [ "dao-proposal-single", "dao-voting 2.3.0", "dao-voting-cw20-staked", - "env_logger", + "env_logger 0.10.0", "serde", "serde_json", "serde_yaml", @@ -358,6 +369,30 @@ dependencies = [ "libloading", ] +[[package]] +name = "clap" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +dependencies = [ + "atty", + "bitflags 1.3.2", + "clap_lex", + "indexmap 1.9.3", + "strsim", + "termcolor", + "textwrap", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "config" version = "0.13.3" @@ -1021,9 +1056,9 @@ dependencies = [ "cw-ownable", "cw-storage-plus 1.1.0", "cw2 1.1.1", - "osmosis-std 0.20.1", + "osmosis-std 0.19.1", "osmosis-test-tube", - "prost 0.12.1", + "prost 0.11.9", "schemars", "serde", "serde_json", @@ -1645,7 +1680,7 @@ dependencies = [ "cw2 1.1.1", "cw20 1.1.0", "cw721 0.18.0", - "osmosis-std 0.20.1", + "osmosis-std 0.19.1", ] [[package]] @@ -1996,7 +2031,7 @@ dependencies = [ "dao-voting-cw721-roles", "dao-voting-cw721-staked", "dao-voting-token-staked", - "osmosis-std 0.20.1", + "osmosis-std 0.19.1", "osmosis-test-tube", "rand", "serde", @@ -2137,7 +2172,7 @@ dependencies = [ "dao-test-custom-factory", "dao-testing", "dao-voting 2.3.0", - "osmosis-std 0.19.1", + "osmosis-std 0.20.1", "osmosis-test-tube", "serde", "thiserror", @@ -2168,7 +2203,7 @@ dependencies = [ "dao-test-custom-factory", "dao-testing", "dao-voting 2.3.0", - "osmosis-std 0.19.1", + "osmosis-std 0.20.1", "osmosis-test-tube", "serde", "thiserror", @@ -2345,6 +2380,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "env_logger" version = "0.10.0" @@ -2660,6 +2708,15 @@ dependencies = [ "http", ] +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.2" @@ -2878,7 +2935,7 @@ dependencies = [ "dao-voting 2.3.0", "dao-voting-cw20-staked", "dao-voting-cw721-staked", - "env_logger", + "env_logger 0.10.0", "once_cell", "rand", "serde", @@ -2892,7 +2949,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.2", "rustix", "windows-sys", ] @@ -3103,7 +3160,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.2", "libc", ] @@ -3153,6 +3210,12 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + [[package]] name = "osmosis-std" version = "0.19.1" @@ -3213,15 +3276,15 @@ dependencies = [ [[package]] name = "osmosis-test-tube" -version = "20.1.2" +version = "19.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1534a419d9e2c27b0b4869e68496b92abca93464b82efbdd1f1b43467f2938" +checksum = "b0dde0a21f1323e7c78f46da4bd0b24149d26483785fb5b39f74016f3f524aad" dependencies = [ - "base64 0.21.5", + "base64 0.13.1", "bindgen", "cosmrs 0.9.0", "cosmwasm-std", - "osmosis-std 0.20.1", + "osmosis-std 0.19.1", "prost 0.11.9", "serde", "serde_json", @@ -3392,16 +3455,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "prettyplease" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" -dependencies = [ - "proc-macro2", - "syn 2.0.34", -] - [[package]] name = "proc-macro2" version = "1.0.67" @@ -4083,6 +4136,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "subtle" version = "2.5.0" @@ -4369,20 +4428,26 @@ dependencies = [ [[package]] name = "test-tube" -version = "0.2.0" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e79c7af10967dd3383ee5aae3810637cc3f2fd040f87f862c02151db060628" +checksum = "04de0d85f2438f0b64a5c135a1524564f2b89263cfbce011542446b6681d006f" dependencies = [ "base64 0.13.1", "cosmrs 0.9.0", "cosmwasm-std", - "osmosis-std 0.20.1", + "osmosis-std 0.19.1", "prost 0.11.9", "serde", "serde_json", "thiserror", ] +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + [[package]] name = "thiserror" version = "1.0.50" diff --git a/Cargo.toml b/Cargo.toml index ab3ce6b80..e70ae7244 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,10 +54,10 @@ cw721 = "0.18" cw721-base = "0.18" env_logger = "0.10" once_cell = "1.18" -osmosis-std = "0.20.1" -osmosis-test-tube = "20.1.2" +osmosis-std = "0.19.0" +osmosis-test-tube = "19.0.0" proc-macro2 = "1.0" -prost = "0.12" +prost = "0.11" quote = "1.0" rand = "0.8" schemars = "0.8" From bad313ef67556f7e5bd0b6dac0c67e821a30b383 Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Sat, 11 Nov 2023 16:21:58 +0100 Subject: [PATCH 12/16] Fix up test tube errors --- Cargo.toml | 2 +- .../dao-voting-cw721-staked/src/testing/test_tube_env.rs | 5 ++--- .../src/tests/test_tube/integration_tests.rs | 6 ++++-- .../src/tests/test_tube/test_env.rs | 7 ++++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e70ae7244..493aa2c6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ cosmwasm-schema = {version = "1.2"} cosmwasm-std = {version = "1.5.0", features = ["ibc3"]} cosmwasm-storage = {version = "1.2"} cw-controllers = "1.1" -cw-multi-test = "0.18.0" +cw-multi-test = "0.18" cw-storage-plus = {version = "1.1"} cw-utils = "1.0" cw2 = "1.1" 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 b6421b6a6..b3dcae089 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 @@ -23,10 +23,9 @@ use dao_testing::test_tube::{ dao_test_custom_factory::CustomFactoryContract, }; use dao_voting::threshold::ActiveThreshold; -use osmosis_std::types::cosmwasm::wasm::v1::MsgExecuteContractResponse; use osmosis_test_tube::{ - Account, Bank, Module, OsmosisTestApp, RunnerError, RunnerExecuteResult, RunnerResult, - SigningAccount, Wasm, + osmosis_std::types::cosmwasm::wasm::v1::MsgExecuteContractResponse, Account, Bank, Module, + OsmosisTestApp, RunnerError, RunnerExecuteResult, RunnerResult, SigningAccount, Wasm, }; use serde::de::DeserializeOwned; use std::path::PathBuf; 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 da2ead5a2..e98def001 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 @@ -12,8 +12,10 @@ use dao_voting::{ pre_propose::PreProposeInfo, threshold::{ActiveThreshold, ActiveThresholdError, PercentageThreshold, Threshold}, }; -use osmosis_std::types::cosmos::bank::v1beta1::QueryBalanceRequest; -use osmosis_test_tube::{Account, OsmosisTestApp, RunnerError}; +use osmosis_test_tube::{ + osmosis_std::types::cosmos::bank::v1beta1::QueryBalanceRequest, Account, OsmosisTestApp, + RunnerError, +}; use crate::{ msg::{ExecuteMsg, InstantiateMsg, QueryMsg, TokenInfo}, 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 85ab56f79..20569490f 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 @@ -25,10 +25,11 @@ use dao_testing::test_tube::{ dao_proposal_single::DaoProposalSingle, dao_test_custom_factory::CustomFactoryContract, }; use dao_voting::threshold::ActiveThreshold; -use osmosis_std::types::{ - cosmos::bank::v1beta1::QueryAllBalancesRequest, cosmwasm::wasm::v1::MsgExecuteContractResponse, -}; use osmosis_test_tube::{ + osmosis_std::types::{ + cosmos::bank::v1beta1::QueryAllBalancesRequest, + cosmwasm::wasm::v1::MsgExecuteContractResponse, + }, Account, Bank, Module, OsmosisTestApp, RunnerError, RunnerExecuteResult, RunnerResult, SigningAccount, Wasm, }; From fa75e0e316e969375ec5c6bf2f301098c4339d81 Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Mon, 20 Nov 2023 16:07:45 +0100 Subject: [PATCH 13/16] cargo fmt --- .../src/contract.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs index 406ef848b..c6c666af7 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs @@ -350,13 +350,15 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { to_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) } } - QueryExt::PendingProposals { start_after, limit } => to_json_binary(&paginate_map_values( - deps, - &PENDING_PROPOSALS, - start_after, - limit, - Order::Ascending, - )?), + QueryExt::PendingProposals { start_after, limit } => { + to_json_binary(&paginate_map_values( + deps, + &PENDING_PROPOSALS, + start_after, + limit, + Order::Ascending, + )?) + } QueryExt::ReversePendingProposals { start_before, limit, From 8fce084c1a67b2898be561a5a53244709e34fe74 Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Mon, 20 Nov 2023 16:23:26 +0100 Subject: [PATCH 14/16] Fixups from merge --- .../src/contract.rs | 31 +++++++++++-------- .../dao-pre-propose-approver/src/contract.rs | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs b/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs index c6c666af7..215335d83 100644 --- a/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs +++ b/contracts/pre-propose/dao-pre-propose-approval-single/src/contract.rs @@ -339,17 +339,20 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { COMPLETED_PROPOSALS.load(deps.storage, id)?; } - to_binary(&pending) + to_json_binary(&pending) } QueryExt::Proposal { id } => { if let Some(pending) = PENDING_PROPOSALS.may_load(deps.storage, id)? { - to_binary(&pending) + to_json_binary(&pending) } else { // Force load completed proposal if not pending, throwing // error if not found. - to_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) + to_json_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) } } + QueryExt::PendingProposal { id } => { + to_json_binary(&PENDING_PROPOSALS.load(deps.storage, id)?) + } QueryExt::PendingProposals { start_after, limit } => { to_json_binary(&paginate_map_values( deps, @@ -370,19 +373,21 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { Order::Descending, )?), QueryExt::CompletedProposal { id } => { - to_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) + to_json_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?) + } + QueryExt::CompletedProposals { start_after, limit } => { + to_json_binary(&paginate_map_values( + deps, + &COMPLETED_PROPOSALS, + start_after, + limit, + Order::Ascending, + )?) } - QueryExt::CompletedProposals { start_after, limit } => to_binary(&paginate_map_values( - deps, - &COMPLETED_PROPOSALS, - start_after, - limit, - Order::Ascending, - )?), QueryExt::ReverseCompletedProposals { start_before, limit, - } => to_binary(&paginate_map_values( + } => to_json_binary(&paginate_map_values( deps, &COMPLETED_PROPOSALS, start_before, @@ -390,7 +395,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { Order::Descending, )?), QueryExt::CompletedProposalIdForCreatedProposalId { id } => { - to_binary(&CREATED_PROPOSAL_TO_COMPLETED_PROPOSAL.may_load(deps.storage, id)?) + to_json_binary(&CREATED_PROPOSAL_TO_COMPLETED_PROPOSAL.may_load(deps.storage, id)?) } }, _ => PrePropose::default().query(deps, env, msg), diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs b/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs index 6624a0fe4..d477b6372 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs @@ -189,7 +189,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { to_json_binary(&PRE_PROPOSE_APPROVAL_CONTRACT.load(deps.storage)?) } QueryExt::PreProposeApprovalIdForApproverProposalId { id } => { - to_binary(&PROPOSAL_ID_TO_PRE_PROPOSE_ID.may_load(deps.storage, id)?) + to_json_binary(&PROPOSAL_ID_TO_PRE_PROPOSE_ID.may_load(deps.storage, id)?) } }, _ => PrePropose::default().query(deps, env, msg), From 136ae785d6bcaf5c90f3575c0beba9ede989666f Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Mon, 20 Nov 2023 16:43:15 +0100 Subject: [PATCH 15/16] Clippy --- contracts/external/cw-vesting/src/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/external/cw-vesting/src/tests.rs b/contracts/external/cw-vesting/src/tests.rs index bff5f8f11..9a55807b5 100644 --- a/contracts/external/cw-vesting/src/tests.rs +++ b/contracts/external/cw-vesting/src/tests.rs @@ -344,7 +344,7 @@ fn test_staking_rewards_go_to_receiver() { StakingInfo { bonded_denom: NATIVE_DENOM.to_string(), unbonding_time: 60, - /// Interest rate per year (60 * 60 * 24 * 365 seconds) + // Interest rate per year (60 * 60 * 24 * 365 seconds) apr: Decimal::percent(10), }, ) From 2ce30b5b11f7910d59b713065ba9c6c615071626 Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Mon, 20 Nov 2023 17:00:39 +0100 Subject: [PATCH 16/16] Another merge fixup --- contracts/pre-propose/dao-pre-propose-approver/src/contract.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs b/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs index 2d404ba3f..4dddbb545 100644 --- a/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs +++ b/contracts/pre-propose/dao-pre-propose-approver/src/contract.rs @@ -195,7 +195,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { to_json_binary(&PROPOSAL_ID_TO_PRE_PROPOSE_ID.may_load(deps.storage, id)?) } QueryExt::ApproverProposalIdForPreProposeApprovalId { id } => { - to_binary(&PRE_PROPOSE_ID_TO_PROPOSAL_ID.may_load(deps.storage, id)?) + to_json_binary(&PRE_PROPOSE_ID_TO_PROPOSAL_ID.may_load(deps.storage, id)?) } }, _ => PrePropose::default().query(deps, env, msg),