diff --git a/contracts/carrot-app/examples/migrate.rs b/contracts/carrot-app/examples/migrate.rs new file mode 100644 index 00000000..8877ca49 --- /dev/null +++ b/contracts/carrot-app/examples/migrate.rs @@ -0,0 +1,41 @@ +use abstract_app::objects::AccountId; +use abstract_interface::{AbstractAccount, InstallConfig, ManagerExecFns}; +use abstract_sdk::core::app::BaseMigrateMsg; +use cosmwasm_std::to_json_binary; +use cw_orch::{ + anyhow, + daemon::{networks::OSMOSIS_1, Daemon, DaemonBuilder}, + tokio::runtime::Runtime, +}; +use dotenv::dotenv; + +use carrot_app::{msg::AppMigrateMsg, AppInterface}; + +fn main() -> anyhow::Result<()> { + dotenv().ok(); + env_logger::init(); + let mut chain = OSMOSIS_1; + chain.grpc_urls = &["https://grpc.osmosis.zone:443"]; + let rt = Runtime::new()?; + let daemon = DaemonBuilder::default() + .chain(chain) + .handle(rt.handle()) + .build()?; + + let abstr = abstract_client::AbstractClient::new(daemon)?; + + // Put your account_id here + let account_id_for_migrate = AccountId::local(0); + + let account_to_migrate = abstr.account_from(account_id_for_migrate)?; + let abstr_account: &AbstractAccount = account_to_migrate.as_ref(); + let module_info = AppInterface::::module_info()?; + abstr_account.manager.upgrade(vec![( + module_info, + Some(to_json_binary(&carrot_app::msg::MigrateMsg { + base: BaseMigrateMsg {}, + module: AppMigrateMsg {}, + })?), + )])?; + Ok(()) +} diff --git a/contracts/carrot-app/src/msg.rs b/contracts/carrot-app/src/msg.rs index dba704ca..2ebef7b9 100644 --- a/contracts/carrot-app/src/msg.rs +++ b/contracts/carrot-app/src/msg.rs @@ -80,7 +80,7 @@ pub enum AppQueryMsg { } #[cosmwasm_schema::cw_serde] -pub enum AppMigrateMsg {} +pub struct AppMigrateMsg {} #[cosmwasm_schema::cw_serde] pub struct BalanceResponse {