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

cosmwasm v2 upgrade + abstract 0.24 upgrade #93

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# We set it for tests
# From https://github.com/CosmosContracts/juno/blob/32568dba828ff7783aea8cb5bb4b8b5832888255/docker/test-user.env#L2
[env]
ABSTRACT_CREATOR = "clip hire initial neck maid actor venue client foam budget lock catalog sweet steak waste crater broccoli pipe steak sister coyote moment obvious choose"
Buckram123 marked this conversation as resolved.
Show resolved Hide resolved
27 changes: 21 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ resolver = "2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace.dependencies]
cw-orch = "0.24.0"
abstract-app = { version = "0.23.0" }
abstract-interface = { version = "0.23.0" }
abstract-dex-adapter = { git = "https://github.com/abstractsdk/abstract.git", tag = "v0.23.0-dex-adapter" }
abstract-client = { version = "0.23.0" }
cw-asset = { version = "3.0" }
cw-orch = { version = "0.27.0" }
abstract-app = { version = "0.24.1" }
abstract-adapter = { version = "0.24.1" }
abstract-interface = { version = "0.24.1" }
abstract-dex-adapter = { git = "https://github.com/abstractsdk/abstract.git", branch = "main", default-features = false }
abstract-osmosis-adapter = { git = "https://github.com/abstractsdk/abstract.git", branch = "main" }
abstract-client = { version = "0.24.1" }
cw-asset = { version = "4.0" }
cw-orch-osmosis-test-tube = { version = "0.4.0" }

[profile.release]
rpath = false
Expand All @@ -21,3 +24,15 @@ debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false

[patch.crates-io]
abstract-app = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
abstract-adapter = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
abstract-interface = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
abstract-client = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
abstract-dex-standard = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
abstract-std = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
abstract-sdk = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
abstract-adapter-utils = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
# abstract-osmosis-adapter = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" }
# abstract-dex-adapter = { git = "https://github.com/abstractsdk/abstract.git", branch = "artifacts/0.24.x" } # Replace to tag tag = "v0.25.0" }
Comment on lines +28 to +38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: remove patch

8 changes: 4 additions & 4 deletions bot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ path = "src/bin/local.rs"
cw-orch = { workspace = true, features = ["daemon"] }
abstract-app = { workspace = true }
abstract-client = { workspace = true }
cosmwasm-std = { version = "1.2" }
osmosis-std = { version = "0.21.0" }
cosmos-sdk-proto = { version = "0.20.0" }
cosmwasm-std = { version = "2.0" }
osmosis-std = { version = "0.26.0" }
cosmos-sdk-proto = { version = "0.24.0", features = ["cosmwasm"] }
dotenv = "0.15.0"
env_logger = "0.11.2"
log = "0.4.20"
tonic = "0.10.0"
tonic = "0.12.3"
carrot-app = { path = "../contracts/carrot-app", features = ["interface"] }
clap = { version = "4", features = ["derive"] }
humantime = "2.1.0"
Expand Down
14 changes: 7 additions & 7 deletions bot/src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ use std::{
use tonic::transport::Channel;

use abstract_app::{
abstract_interface::VCQueryFns,
abstract_interface::RegistryQueryFns,
objects::module::{ModuleInfo, ModuleStatus},
std::{ans_host, version_control::ModuleFilter},
std::{ans_host, registry::ModuleFilter},
};

const LAST_INCOMPATIBLE_VERSION: &str = "0.3.1";
Expand Down Expand Up @@ -330,7 +330,7 @@ fn autocompound_instance(
}

mod utils {
use abstract_app::std::version_control::ModulesListResponse;
use abstract_app::std::registry::ModulesListResponse;
use cosmos_sdk_proto::{
cosmos::base::query::v1beta1::{PageRequest, PageResponse},
cosmwasm::wasm::v1::QueryContractsByCodeResponse,
Expand Down Expand Up @@ -395,7 +395,7 @@ mod utils {
) -> anyhow::Result<bool> {
let daemon = abstr.environment();

let account = abstr.account_from(AccountSource::App(Addr::unchecked(contract_addr)))?;
let account = abstr.fetch_account(AccountSource::App(Addr::unchecked(contract_addr)))?;
let granter = account.owner()?;

// Check if authz is indeed given
Expand All @@ -407,8 +407,8 @@ mod utils {
.block_on(async {
authz_querier
._grants(
granter.to_string(),
authz_grantee.clone(),
&granter,
&Addr::unchecked(authz_grantee),
// Get every authorization
"".to_owned(),
None,
Expand Down Expand Up @@ -496,7 +496,7 @@ mod utils {
});
let mut module_list = ModulesListResponse { modules: vec![] };
loop {
let saving_modules = abstr.version_control().module_list(
let saving_modules = abstr.registry().module_list(
Some(ModuleFilter {
namespace: Some(module_info.namespace.to_string()),
name: Some(module_info.name.clone()),
Expand Down
33 changes: 15 additions & 18 deletions contracts/carrot-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "carrot-app"
version = "0.5.1"
version = "0.6.0"
authors = [
"CyberHoward <[email protected]>",
"Adair <[email protected]>",
Expand Down Expand Up @@ -33,38 +33,35 @@ interface = ["export", "dep:cw-orch"]
schema = ["abstract-app/schema"]

[dependencies]
cw-utils = { version = "1.0.3" }
cosmwasm-std = { version = "1.2" }
cosmwasm-schema = { version = "1.2" }
cw-controllers = { version = "1.0.1" }
cw-storage-plus = "1.2.0"
cw-utils = { version = "2.0.0" }
cosmwasm-std = { version = "2.0" }
cosmwasm-schema = { version = "2.0" }
cw-controllers = { version = "2.0.0" }
cw-storage-plus = { version = "2.0.0" }
thiserror = { version = "1.0.50" }
schemars = "0.8"
cw-asset = { workspace = true }

abstract-app = { workspace = true }
abstract-app = { workspace = true, features = ["stargate"] }
# Dependencies for interface
abstract-dex-adapter = { workspace = true, features = ["osmosis"] }
abstract-dex-adapter = { workspace = true, features = [
], default-features = false }
cw-orch = { workspace = true, optional = true }

osmosis-std = { version = "0.25.0" }
prost = { version = "0.12.3" }
# TODO: just to enable "stargate" on abstract-app remove, see ABS-480
abstract-sdk = { version = "0.23.0", features = ["stargate"] }
osmosis-std = { version = "0.26.0" }
prost = { version = "0.13.1" }

[dev-dependencies]
abstract-interface = { workspace = true, features = ["daemon"] }

prost = { version = "0.12.3" }
prost-types = { version = "0.12.3" }
prost-types = { version = "0.13.1" }
log = { version = "0.4.20" }
carrot-app = { path = ".", features = ["interface"] }
abstract-client = { workspace = true }
abstract-app = { workspace = true, features = ["test-utils"] }
speculoos = "0.11.0"
abstract-app = { workspace = true, features = ["test-utils", "stargate"] }
semver = "1.0"
dotenv = "0.15.0"
env_logger = "0.10.0"
cw-orch = { workspace = true }
cw-orch-osmosis-test-tube = "0.3.0"
cw-orch = { workspace = true, features = ["daemon"] }
cw-orch-osmosis-test-tube = { workspace = true }
clap = { version = "4.3.7", features = ["derive"] }
8 changes: 5 additions & 3 deletions contracts/carrot-app/examples/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ fn main() -> anyhow::Result<()> {
let abstr = abstract_client::AbstractClient::new(daemon)?;

let publisher = abstr
.publisher_builder(Namespace::new(ABSTRACT_NAMESPACE)?)
.build()?;
.fetch_or_build_account(Namespace::new(ABSTRACT_NAMESPACE)?, |builder| {
builder.namespace(Namespace::new(ABSTRACT_NAMESPACE).unwrap())
})?
.publisher()?;

publisher.publish_app::<AppInterface<Daemon>>()?;
abstr.version_control().approve_any_abstract_modules()?;
abstr.registry().approve_any_abstract_modules()?;
Ok(())
}
109 changes: 62 additions & 47 deletions contracts/carrot-app/examples/install_savings_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use cw_orch::{
anyhow,
daemon::{networks::OSMOSIS_1, Daemon, DaemonBuilder},
prelude::Stargate,
tokio::runtime::Runtime,
};
use cw_orch_osmosis_test_tube::osmosis_test_tube::osmosis_std::types::cosmos::authz::v1beta1::MsgGrantResponse;
use dotenv::dotenv;
Expand Down Expand Up @@ -34,8 +33,7 @@ fn main() -> anyhow::Result<()> {
dotenv().ok();
env_logger::init();
let chain = OSMOSIS_1;
let rt = Runtime::new()?;
let daemon = DaemonBuilder::new(chain).handle(rt.handle()).build()?;
let daemon = DaemonBuilder::new(chain).build()?;

let client = AbstractClient::new(daemon.clone())?;
let random_account_id = client.random_account_id()?;
Expand Down Expand Up @@ -78,7 +76,7 @@ fn main() -> anyhow::Result<()> {
let create_sub_account_message = utils::create_account_message(&client, init_msg)?;

msgs.push(create_sub_account_message);
let _ = daemon.commit_any::<MsgGrantResponse>(msgs, None)?;
let _ = daemon.commit_any(msgs, None)?;

Ok(())
}
Expand Down Expand Up @@ -168,11 +166,14 @@ mod utils {
pub const LOTS: u128 = 100_000_000_000_000;
pub const REWARD_ASSET: &str = "osmosis>osmo";

use abstract_app::objects::{
module::{ModuleInfo, ModuleVersion},
AccountId,
use abstract_app::std::account::ModuleInstallConfig;
use abstract_app::{
objects::{
module::{ModuleInfo, ModuleVersion},
salt, AccountId,
},
std::account,
};
use abstract_app::std::{account_factory, manager::ModuleInstallConfig};
use abstract_client::*;
use abstract_dex_adapter::DEX_ADAPTER_ID;
use abstract_interface::Abstract;
Expand All @@ -184,7 +185,7 @@ mod utils {
authz::v1beta1::{GenericAuthorization, Grant, MsgGrant},
bank::v1beta1::SendAuthorization,
},
cosmwasm::wasm::v1::MsgExecuteContract,
cosmwasm::wasm::v1::{MsgExecuteContract, MsgInstantiateContract2},
osmosis::{
concentratedliquidity::v1beta1::{
MsgAddToPosition, MsgCollectIncentives, MsgCollectSpreadRewards, MsgCreatePosition,
Expand All @@ -202,8 +203,8 @@ mod utils {
savings_app_addr: impl Into<String>,
app_data: &CarrotAppInitData,
) -> Result<Vec<Any>, anyhow::Error> {
let dex_fee_account = client.account_from(AccountId::local(0))?;
let dex_fee_addr = dex_fee_account.proxy()?.to_string();
let dex_fee_account = client.fetch_account(AccountId::local(0))?;
let dex_fee_addr = dex_fee_account.address()?.to_string();
let chain = client.environment().clone();

let authorization_urls = [
Expand Down Expand Up @@ -281,22 +282,32 @@ mod utils {
) -> anyhow::Result<Any> {
let chain = client.environment();
let abstr = Abstract::load_from(chain.clone())?;
let account_factory_addr = abstr.account_factory.addr_str()?;
let random_account_id = client.random_account_id()?;
let salt = salt::generate_instantiate_salt(&AccountId::local(random_account_id));
let code_id = abstr.account_code_id()?;
let creator = chain.sender_addr().to_string();

let account_address = chain.wasm_querier().instantiate2_addr(
code_id,
&Addr::unchecked(creator.clone()),
salt.clone(),
)?;

let msg = Any {
type_url: MsgExecuteContract::TYPE_URL.to_owned(),
value: MsgExecuteContract {
sender: chain.sender_addr().to_string(),
contract: account_factory_addr.to_string(),
msg: to_json_vec(&account_factory::ExecuteMsg::CreateAccount {
governance: GovernanceDetails::Monarchy {
type_url: MsgInstantiateContract2::TYPE_URL.to_owned(),
value: MsgInstantiateContract2 {
sender: creator,
admin: account_address,
code_id,
label: "Abstract Account".to_owned(),
msg: to_json_vec(&account::InstantiateMsg::<Empty> {
code_id,
owner: GovernanceDetails::Monarchy {
monarch: chain.sender_addr().to_string(),
},
name: "bob".to_owned(),
name: Some("bob".to_owned()),
description: None,
link: None,
base_asset: None,
namespace: None,
install_modules: vec![
ModuleInstallConfig::new(
Expand All @@ -317,8 +328,11 @@ mod utils {
),
],
account_id: Some(AccountId::local(random_account_id)),
authenticator: None,
})?,
funds: vec![],
salt: salt.to_vec(),
fix_msg: false,
}
.to_proto_bytes(),
};
Expand All @@ -337,33 +351,34 @@ mod utils {
type_url: MsgExecuteContract::TYPE_URL.to_owned(),
value: MsgExecuteContract {
sender: chain.sender_addr().to_string(),
contract: account.manager()?.to_string(),
msg: to_json_vec(&abstract_app::std::manager::ExecuteMsg::CreateSubAccount {
name: "deep-adventurous-afternoon".to_owned(),
description: None,
link: None,
base_asset: None,
namespace: None,
install_modules: vec![
ModuleInstallConfig::new(
ModuleInfo::from_id(
DEX_ADAPTER_ID,
ModuleVersion::Version(
abstract_dex_adapter::contract::CONTRACT_VERSION.to_owned(),
),
)?,
None,
),
ModuleInstallConfig::new(
ModuleInfo::from_id(
APP_ID,
ModuleVersion::Version(APP_VERSION.to_owned()),
)?,
Some(to_json_binary(&init_msg)?),
),
],
account_id: Some(random_account_id),
})?,
contract: account.address()?.to_string(),
msg: to_json_vec(
&abstract_app::std::account::ExecuteMsg::<Empty>::CreateSubAccount {
name: Some("deep-adventurous-afternoon".to_owned()),
description: None,
link: None,
namespace: None,
install_modules: vec![
ModuleInstallConfig::new(
ModuleInfo::from_id(
DEX_ADAPTER_ID,
ModuleVersion::Version(
abstract_dex_adapter::contract::CONTRACT_VERSION.to_owned(),
),
)?,
None,
),
ModuleInstallConfig::new(
ModuleInfo::from_id(
APP_ID,
ModuleVersion::Version(APP_VERSION.to_owned()),
)?,
Some(to_json_binary(&init_msg)?),
),
],
account_id: Some(random_account_id),
},
)?,
funds: vec![],
}
.to_proto_bytes(),
Expand Down
6 changes: 3 additions & 3 deletions contracts/carrot-app/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ impl<Chain: cw_orch::environment::CwEnv> abstract_app::abstract_interface::Depen
fn dependency_install_configs(
_configuration: Self::DependenciesConfig,
) -> Result<
Vec<abstract_app::std::manager::ModuleInstallConfig>,
Vec<abstract_app::std::account::ModuleInstallConfig>,
abstract_app::abstract_interface::AbstractInterfaceError,
> {
let dex_dependency_install_configs: Vec<abstract_app::std::manager::ModuleInstallConfig> =
let dex_dependency_install_configs: Vec<abstract_app::std::account::ModuleInstallConfig> =
<abstract_dex_adapter::interface::DexAdapter<Chain> as abstract_app::abstract_interface::DependencyCreation>::dependency_install_configs(
cosmwasm_std::Empty {},
)?;

let adapter_install_config = abstract_app::std::manager::ModuleInstallConfig::new(
let adapter_install_config = abstract_app::std::account::ModuleInstallConfig::new(
abstract_app::std::objects::module::ModuleInfo::from_id(
abstract_dex_adapter::DEX_ADAPTER_ID,
abstract_dex_adapter::contract::CONTRACT_VERSION.into(),
Expand Down
Loading
Loading