Skip to content

Commit

Permalink
Update deprecated functions (#764)
Browse files Browse the repository at this point in the history
* Update deprecated function names to_binary and from_binary #761

* bump cosmwasm-std to latest

* replace from_json_binary to from_json

* fmt

* bump cw-multi-test to latest

* replace from_slice to from_json

* replace to_vec with to_json_vec

* clippy fix

* bump osmosis-std and osmosis-test-tube to latest

* bump prost to latest

* revert osmosis-std, osmosis-test-tube & prost bump

* Fix up test tube errors

* cargo fmt

* Fixups from merge

* Clippy

* Another merge fixup

---------

Co-authored-by: Massvdev <[email protected]>
Co-authored-by: Dat-Andre <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2023
1 parent 30337ad commit 6ca751c
Show file tree
Hide file tree
Showing 81 changed files with 1,354 additions and 1,308 deletions.
869 changes: 436 additions & 433 deletions Cargo.lock

Large diffs are not rendered by default.

142 changes: 71 additions & 71 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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-multi-test = "0.18"
cw-storage-plus = {version = "1.1"}
cw-utils = "1.0"
cw2 = "1.1"
cw20 = "1.1"
Expand All @@ -61,68 +61,68 @@ 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"

# One commit ahead of version 0.3.0. Allows initialization with an
# 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"}
8 changes: 4 additions & 4 deletions ci/bootstrap-env/src/main.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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(),
Expand All @@ -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 {},
Expand All @@ -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),
Expand Down
10 changes: 5 additions & 5 deletions ci/integration-tests/src/helpers/helper.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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(),
Expand All @@ -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 {},
Expand All @@ -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,
Expand Down Expand Up @@ -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![],
Expand Down
4 changes: 2 additions & 2 deletions ci/integration-tests/src/tests/cw20_stake_test.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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![],
Expand Down
10 changes: 5 additions & 5 deletions ci/integration-tests/src/tests/cw_core_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
})
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions ci/integration-tests/src/tests/proposal_gas_test.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,7 +15,7 @@ fn mint_mint_mint_mint(cw721: &str, owner: &str, mints: u64) -> Vec<CosmosMsg> {
.map(|mint| {
WasmMsg::Execute {
contract_addr: cw721.to_string(),
msg: to_binary(&cw721_base::msg::ExecuteMsg::Mint::<Empty, Empty>{
msg: to_json_binary(&cw721_base::msg::ExecuteMsg::Mint::<Empty, Empty>{
token_id: mint.to_string(),
owner: owner.to_string(),
token_uri: Some("https://bafkreibufednctf2f2bpduiibgkvpqcw5rtdmhqh2htqx3qbdnji4h55hy.ipfs.nftstorage.link".to_string()),
Expand Down
Loading

0 comments on commit 6ca751c

Please sign in to comment.