Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multisig support to abstract deployment #532

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
499 changes: 382 additions & 117 deletions framework/Cargo.lock

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion framework/packages/abstract-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ default = ["integration"]
daemon = ["cw-orch/daemon"]
integration = []
interchain = ["dep:cw-orch-interchain", "dep:cw-orch-polytone"]
multisig = [
"dep:cw-plus-orch",
"dep:cw-utils",
"dep:cw3",
"dep:cw4",
"dep:cw-ownable",
]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
cosmwasm-std = { workspace = true }
Expand Down Expand Up @@ -59,7 +66,16 @@ workspace-hack = { version = "0.1", path = "../../workspace-hack" }

# Predictable abstract addresses
cw-blob = { workspace = true }
cosmrs = { version = "0.19.0" }
cosmrs = { version = "0.20.0", features = ["cosmwasm"] }
prost-types = { version = "0.13.3" }
prost = { version = "0.13.3" }

# Multisig
cw-plus-orch = { version = "0.25.0", optional = true }
cw-utils = { version = "2.0.0", optional = true }
cw3 = { version = "2.0.0", optional = true }
cw4 = { version = "2.0.0", optional = true }
cw-ownable = { workspace = true, optional = true }

[build-dependencies]
serde_json = "1.0.79"
Expand Down
12 changes: 12 additions & 0 deletions framework/packages/abstract-interface/src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use cw_orch::daemon::DeployedChains;

use cw_orch::{mock::MockBase, prelude::*};

#[cfg(feature = "multisig")]
use crate::multisig::AbstractMultisig;
use crate::{
get_ibc_contracts, get_native_contracts, AbstractIbc, AbstractInterfaceError, AccountI,
AnsHost, ModuleFactory, Registry,
Expand All @@ -21,6 +23,8 @@ pub struct Abstract<Chain: CwEnv> {
pub ibc: AbstractIbc<Chain>,
pub(crate) account: AccountI<Chain>,
pub(crate) blob: CwBlob<Chain>,
#[cfg(feature = "multisig")]
pub multisig: AbstractMultisig<Chain>,
}

impl<Chain: CwEnv> Deploy<Chain> for Abstract<Chain> {
Expand Down Expand Up @@ -52,6 +56,8 @@ impl<Chain: CwEnv> Deploy<Chain> for Abstract<Chain> {
account,
ibc: ibc_infra,
blob,
#[cfg(feature = "multisig")]
multisig: AbstractMultisig::new(&chain),
};

Ok(deployment)
Expand Down Expand Up @@ -211,6 +217,8 @@ impl<Chain: CwEnv> Abstract<Chain> {
client: ibc_client,
host: ibc_host,
},
#[cfg(feature = "multisig")]
multisig: AbstractMultisig::new(&chain),
blob: CwBlob::new(CW_BLOB, chain),
}
}
Expand Down Expand Up @@ -287,6 +295,8 @@ impl<Chain: CwEnv> Abstract<Chain> {
ibc,
account,
blob: _,
#[cfg(feature = "multisig")]
multisig: _,
} = self;
ans_host.set_sender(sender);
registry.set_sender(sender);
Expand All @@ -304,6 +314,8 @@ impl<Chain: CwEnv> Abstract<Chain> {
ibc: self.ibc.call_as(sender),
account: self.account.call_as(sender),
blob: self.blob.clone(),
#[cfg(feature = "multisig")]
multisig: self.multisig.clone(),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions framework/packages/abstract-interface/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ pub enum AbstractInterfaceError {

#[error("No matching module deployed {0:?}")]
NoMatchingModule(StaticDependency),

#[error("Multisig error: {0}")]
Multisig(String),
}

impl AbstractInterfaceError {
Expand Down
3 changes: 3 additions & 0 deletions framework/packages/abstract-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ pub use error::AbstractInterfaceError;
pub use crate::{deployers::*, deployment::*};

pub use daemon_state::AbstractDaemonState;

#[cfg(feature = "multisig")]
pub mod multisig;
2 changes: 1 addition & 1 deletion framework/packages/abstract-interface/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl<T: CwEnv> Abstract<T> {
}
}

fn contract_version<Chain: CwEnv, A: ContractInstance<Chain>>(
pub(crate) fn contract_version<Chain: CwEnv, A: ContractInstance<Chain>>(
contract: &A,
) -> Result<ContractVersion, crate::AbstractInterfaceError> {
let wasm_querier = contract.environment().wasm_querier();
Expand Down
Loading
Loading