Skip to content

Commit

Permalink
Update osmosis-test-tube to match cw-orch
Browse files Browse the repository at this point in the history
  • Loading branch information
ismellike committed Sep 18, 2024
1 parent 85654cf commit b3b2ce7
Show file tree
Hide file tree
Showing 20 changed files with 503 additions and 191 deletions.
599 changes: 457 additions & 142 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ cw721-base = "0.18"
env_logger = "0.10"
once_cell = "1.18"
omniflix-std = "0.1.8"
osmosis-std = "0.20.1"
osmosis-std = "0.25.0"
osmosis-std-derive = "0.20.1"
osmosis-test-tube = "20.1.1"
osmosis-test-tube = "25.0.0"
proc-macro2 = "1.0"
prost = { version = "=0.12.3", features = ["prost-derive"] }
prost-types = { version = "=0.12.3", default-features = false }
prost-derive = "=0.12.3"
prost = { version = "0.12.3", features = ["prost-derive"] }
prost-types = { version = "0.12.3", default-features = false }
prost-derive = "0.12.3"
quote = "1.0"
rand = "0.8"
schemars = "0.8"
Expand All @@ -81,7 +81,7 @@ test-context = "0.1"
thiserror = { version = "1.0" }
wynd-utils = "0.4"
cw-orch = "0.24.1"
tokio = "=1.38.1"
tokio = "1.40.0"

# One commit ahead of version 0.3.0. Allows initialization with an
# optional owner.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ fn burn_more_than_balance_should_fail_and_not_deduct_allowance() {
assert_eq!(
err,
RunnerError::ExecuteError {
msg: format!("failed to execute message; message index: 0: dispatch: submessages: {balance}{denom} is smaller than {burn_amount}{denom}: insufficient funds")
msg: format!("failed to execute message; message index: 0: dispatch: submessages: spendable balance {balance}{denom} is smaller than {burn_amount}{denom}: insufficient funds")
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ fn set_denom_metadata_by_contract_owner_should_work() {
display: "sthb".to_string(),
name: "Stable Thai Baht".to_string(),
symbol: "STHB".to_string(),
uri: String::default(),
uri_hash: String::default(),
};
env.cw_tokenfactory_issuer
.set_denom_metadata(metadata, owner)
Expand Down Expand Up @@ -64,6 +66,8 @@ fn set_denom_metadata_by_contract_non_owner_should_fail() {
display: "sthb".to_string(),
name: "Stable Thai Baht".to_string(),
symbol: "STHB".to_string(),
uri: String::default(),
uri_hash: String::default(),
};

// Set denom metadata
Expand Down Expand Up @@ -108,6 +112,8 @@ fn set_denom_metadata_with_base_denom_unit_should_overides_default_base_denom_un
display: "sthb".to_string(),
name: "Stable Thai Baht".to_string(),
symbol: "STHB".to_string(),
uri: String::default(),
uri_hash: String::default(),
};

// Set denom metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl TokenfactoryIssuer {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("cw_tokenfactory_issuer"),
&[token_creation_fee],
signer,
)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ fn test_full_integration_with_factory() {
// Error is insufficient funds as no funds were sent
assert_eq!(
RunnerError::ExecuteError {
msg: "failed to execute message; message index: 0: dispatch: submessages: 0uosmo is smaller than 1000uosmo: insufficient funds".to_string()
msg: "failed to execute message; message index: 0: dispatch: submessages: spendable balance is smaller than 1000uosmo: insufficient funds".to_string()
},
err
);
Expand Down
5 changes: 4 additions & 1 deletion contracts/voting/dao-voting-token-staked/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result<Response, ContractEr
// If metadata, set it by calling the contract
#[cfg(any(
feature = "osmosis_tokenfactory",
feature = "cosmwasm_tokenfactory"
feature = "cosmwasm_tokenfactory",
feature = "kujira_tokenfactory"
))]
if let Some(metadata) = token.metadata {
// The first denom_unit must be the same as the tf and base denom.
Expand Down Expand Up @@ -663,6 +664,8 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result<Response, ContractEr
display: metadata.display,
name: metadata.name,
symbol: metadata.symbol,
uri: String::default(),
uri_hash: String::default(),
},
})?,
funds: vec![],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl<'a> TokenVotingContract<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("token_voting"),
&[],
signer,
)?
Expand Down Expand Up @@ -398,7 +398,7 @@ impl<'a> TokenVotingContract<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("token_voting_contract"),
&[],
signer,
)?
Expand Down
17 changes: 9 additions & 8 deletions packages/cw-orch/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ use cw_orch::{
};

use crate::{
Cw20Stake, Cw20StakeExternalRewards, Cw20StakeRewardDistributor, DaoDaoCore,
DaoPreProposeApprovalSingle, DaoPreProposeApprover, DaoPreProposeMultiple, DaoPreProposeSingle,
DaoProposalCondorcet, DaoProposalHookCounter, DaoProposalMultiple, DaoProposalSingle,
DaoProposalSudo, DaoTestCustomFactory, DaoVotingCw20Balance, DaoVotingCw20Staked, DaoVotingCw4,
DaoVotingCw721Roles, DaoVotingCw721Staked, DaoVotingTokenStaked,
DaoDaoCore, DaoPreProposeApprovalSingle, DaoPreProposeApprover, DaoPreProposeMultiple,
DaoPreProposeSingle, DaoProposalCondorcet, DaoProposalHookCounter, DaoProposalMultiple,
DaoProposalSingle, DaoProposalSudo, DaoStakingCw20, DaoStakingCw20ExternalRewards,
DaoStakingCw20RewardDistributor, DaoTestCustomFactory, DaoVotingCw20Balance,
DaoVotingCw20Staked, DaoVotingCw4, DaoVotingCw721Roles, DaoVotingCw721Staked,
DaoVotingTokenStaked,
};

pub const DUMMY_CHAIN_INFO: ChainInfo = ChainInfo {
Expand Down Expand Up @@ -44,9 +45,9 @@ fn test_all_wasms_different() {
DaoProposalMultiple::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
DaoProposalSingle::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
// Stake
Cw20Stake::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
Cw20StakeExternalRewards::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
Cw20StakeRewardDistributor::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
DaoStakingCw20::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
DaoStakingCw20ExternalRewards::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
DaoStakingCw20RewardDistributor::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
// Voting
DaoVotingCw4::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
DaoVotingCw20Staked::<Mock>::wasm(&DUMMY_CHAIN_INFO.into()),
Expand Down
2 changes: 2 additions & 0 deletions packages/cw-tokenfactory-types/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ mod tokenfactory_msg {
display: metadata.display,
name: metadata.name,
symbol: metadata.symbol,
uri: metadata.uri,
uri_hash: metadata.uri_hash,
}),
}
}
Expand Down
4 changes: 4 additions & 0 deletions packages/dao-testing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ pub mod contracts;
#[cfg(not(target_arch = "wasm32"))]
pub use tests::*;

// Integration tests using an actual chain binary, requires
// the "test-tube" feature to be enabled
// cargo test --features test-tube
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "test-tube")]
pub mod test_tube;
2 changes: 1 addition & 1 deletion packages/dao-testing/src/test_tube/cw4_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'a> Cw4Group<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("cw4_group"),
&[],
signer,
)?
Expand Down
2 changes: 1 addition & 1 deletion packages/dao-testing/src/test_tube/cw721_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'a> Cw721Base<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("cw721_base"),
&[],
signer,
)?
Expand Down
2 changes: 1 addition & 1 deletion packages/dao-testing/src/test_tube/cw_admin_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'a> CwAdminFactory<'a> {
code_id,
&InstantiateMsg { admin },
Some(&signer.address()),
None,
Some("cw_admin_factory"),
funds,
signer,
)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<'a> TokenfactoryIssuer<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("cw_tokenfactory_issuer"),
&[token_creation_fee],
signer,
)?
Expand Down
2 changes: 1 addition & 1 deletion packages/dao-testing/src/test_tube/dao_dao_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'a> DaoCore<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("dao_dao_core"),
funds,
signer,
)?
Expand Down
2 changes: 1 addition & 1 deletion packages/dao-testing/src/test_tube/dao_proposal_single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<'a> DaoProposalSingle<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("dao_proposal_single"),
&[token_creation_fee],
signer,
)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<'a> CustomFactoryContract<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("dao_test_custom_factory"),
&[token_creation_fee],
signer,
)?
Expand Down
2 changes: 1 addition & 1 deletion packages/dao-testing/src/test_tube/dao_voting_cw4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'a> DaoVotingCw4<'a> {
code_id,
&instantiate_msg,
Some(&signer.address()),
None,
Some("dao_voting_cw4"),
funds,
signer,
)?
Expand Down
23 changes: 2 additions & 21 deletions packages/dao-testing/src/test_tube/mod.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
// Integrationg tests using an actual chain binary, requires
// the "test-tube" feature to be enabled
// cargo test --features test-tube

#[cfg(feature = "test-tube")]
pub mod cw_admin_factory;

#[cfg(feature = "test-tube")]
pub mod cw_tokenfactory_issuer;

#[cfg(feature = "test-tube")]
pub mod cw4_group;

#[cfg(feature = "test-tube")]
pub mod cw721_base;

#[cfg(feature = "test-tube")]
pub mod cw_admin_factory;
pub mod cw_tokenfactory_issuer;
pub mod dao_dao_core;

#[cfg(feature = "test-tube")]
pub mod dao_proposal_single;

#[cfg(feature = "test-tube")]
pub mod dao_test_custom_factory;

#[cfg(feature = "test-tube")]
pub mod dao_voting_cw4;

0 comments on commit b3b2ce7

Please sign in to comment.