Skip to content

Commit

Permalink
Tests upload the dex adapter now
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayanski committed Nov 27, 2024
1 parent dab2123 commit 02a8439
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
16 changes: 13 additions & 3 deletions framework/packages/abstract-interface/src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl<Chain: CwEnv> Deploy<Chain> for Abstract<Chain> {

fn load_from(chain: Chain) -> Result<Self, Self::Error> {
#[allow(unused_mut)]
let mut abstr = Self::new(chain);
let mut abstr = Self::new(chain.clone());
#[cfg(feature = "daemon")]
{
// We register all the contracts default state
Expand All @@ -164,9 +164,19 @@ impl<Chain: CwEnv> Deploy<Chain> for Abstract<Chain> {
}
// Check if abstract deployed, for successful load
if let Err(CwOrchError::AddrNotInStore(_)) = abstr.registry.address() {
return Err(AbstractInterfaceError::NotDeployed {});
return Err(AbstractInterfaceError::NotDeployed(
chain
.block_info()
.map(|b| b.chain_id)
.unwrap_or("chain id not available".to_string()),
));
} else if abstr.registry.item_query(cw2::CONTRACT).is_err() {
return Err(AbstractInterfaceError::NotDeployed {});
return Err(AbstractInterfaceError::NotDeployed(
chain
.block_info()
.map(|b| b.chain_id)
.unwrap_or("chain id not available".to_string()),
));
}
Ok(abstr)
}
Expand Down
4 changes: 2 additions & 2 deletions framework/packages/abstract-interface/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ pub enum AbstractInterfaceError {
#[error(transparent)]
Instantiate2(#[from] cosmwasm_std::Instantiate2AddressError),

#[error("Abstract is not deployed on this chain")]
NotDeployed {},
#[error("Abstract is not deployed on this chain {0}")]
NotDeployed(String),

#[error(transparent)]
Semver(#[from] semver::Error),
Expand Down
13 changes: 13 additions & 0 deletions interchain/modules-clone-testing/tests/dex/astrovault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,23 @@ mod standard_pool_tests {
"archway1j5vevvsrm5ayqmfvhng7rkkgjqad37pk35j3nanzmevlq4ntwpfqayv6z4";

use super::*;
use abstract_dex_adapter::{interface::DexAdapter, msg::DexInstantiateMsg, DEX_ADAPTER_ID};
use abstract_interface::AdapterDeployer;
use abstract_interface::DeployStrategy;
use cosmwasm_std::Decimal;

fn setup_standard_pool() -> anyhow::Result<DexTester<CloneTesting, AstrovaultDex>> {
let chain_info = ARCHWAY_1;
let abstr_deployment = load_abstr(chain_info)?;
// Deploy the dex adapter
DexAdapter::new(DEX_ADAPTER_ID, abstr_deployment.environment()).deploy(
abstract_dex_adapter::contract::CONTRACT_VERSION.parse()?,
DexInstantiateMsg {
recipient_account: 0,
swap_fee: Decimal::permille(3),
},
DeployStrategy::Try,
)?;
let chain = abstr_deployment.environment();

let asset_a = (
Expand Down

0 comments on commit 02a8439

Please sign in to comment.