Skip to content

Commit

Permalink
Fixed tests and features
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayanski committed Dec 16, 2024
1 parent 94e273c commit c00665b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
13 changes: 11 additions & 2 deletions framework/packages/standards/staking/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@ pub enum CwStakingError {
IbcQueryNotSupported,

#[error("Staking provider {0} is not a known provider on this network.")]
UnknownDex(String),
UnknownStaking(String),

#[error(
"Staking provider {staking} is not a known provider on this network ({:?}).",
chain
)]
UnknownStakingOnThisPlatform {
staking: String,
chain: Option<String>,
},

#[error("Staking provider {0} is not local to this network.")]
ForeignDex(String),
ForeignStaking(String),

#[error("Cw1155 is unsupported.")]
Cw1155Unsupported,
Expand Down
2 changes: 1 addition & 1 deletion modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ semver = "1.0"

cw-orch = { version = "0.27.0" }
cw-orch-interchain = { version = "0.8.0" }
cw-orch-osmosis-test-tube = { version = "0.4.0" }
cw-orch-osmosis-test-tube = { version = "0.5.0" }
cw-orch-neutron-test-tube = { version = "0.2.0" }
tokio = { version = "1.4", features = ["full"] }

Expand Down
2 changes: 1 addition & 1 deletion modules/contracts/adapters/cw-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bip32 = { version = "0.5.2" }
clap = { workspace = true }
cw-orch = { workspace = true, features = ["daemon"] }
cw-staking = { path = ".", package = "abstract-cw-staking", features = [
# "wynd",
"wynd",
"osmosis",
"testing",
] }
Expand Down
9 changes: 6 additions & 3 deletions modules/contracts/adapters/cw-staking/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub(crate) fn identify_provider(value: &str) -> Result<Box<dyn Identify>, CwStak
abstract_astrovault_adapter::ASTROVAULT => {
Ok(Box::<abstract_astrovault_adapter::staking::Astrovault>::default())
}
_ => Err(CwStakingError::UnknownDex(value.to_string())),
_ => Err(CwStakingError::UnknownStaking(value.to_string())),
}
}

Expand Down Expand Up @@ -56,7 +56,7 @@ pub(crate) fn resolve_local_provider(
abstract_astrovault_adapter::ASTROVAULT => {
Ok(Box::<abstract_astrovault_adapter::staking::Astrovault>::default())
}
_ => Err(CwStakingError::ForeignDex(name.to_owned())),
_ => Err(CwStakingError::ForeignStaking(name.to_owned())),
}
}

Expand All @@ -69,7 +69,10 @@ pub fn is_over_ibc(env: &Env, platform_name: &str) -> StakingResult<(String, boo
let platform_id = identify_provider(&local_platform_name)?;
// We verify the adapter is available on the current chain
if !is_available_on(platform_id, env, chain_name.as_deref()) {
return Err(CwStakingError::UnknownDex(platform_name.to_string()));
return Err(CwStakingError::UnknownStakingOnThisPlatform {
staking: platform_name.to_string(),
chain: chain_name,
});
}
Ok((local_platform_name, false))
}
Expand Down
4 changes: 2 additions & 2 deletions modules/contracts/adapters/cw-staking/tests/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn setup_mock() -> anyhow::Result<(
CwStakingAdapter<MockBech32>,
AccountI<MockBech32>,
)> {
let chain = MockBech32::new("mock");
let chain = MockBech32::new_with_chain_id("mock", "cosmos-testnet-6");
let sender = chain.sender_addr();

let deployment = Abstract::deploy_on(chain.clone(), ())?;
Expand Down Expand Up @@ -123,7 +123,7 @@ fn stake_lp() -> anyhow::Result<()> {
}

#[test]
fn stake_lp_wthout_chain() -> anyhow::Result<()> {
fn stake_lp_without_chain() -> anyhow::Result<()> {
let (_, _, staking, account) = setup_mock()?;
let account_addr = account.address()?;

Expand Down

0 comments on commit c00665b

Please sign in to comment.