diff --git a/contracts/multisig-prover/src/contract.rs b/contracts/multisig-prover/src/contract.rs index adbae987e..a2bf58512 100644 --- a/contracts/multisig-prover/src/contract.rs +++ b/contracts/multisig-prover/src/contract.rs @@ -19,7 +19,6 @@ pub const START_MULTISIG_REPLY_ID: u64 = 1; const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); -const BASE_VERSION: &str = "1.1.0"; #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( @@ -117,13 +116,20 @@ pub fn query( .map_err(axelar_wasm_std::error::ContractError::from) } +// It is valid to migrate from any of the below versions +const BASE_VERSION: &str = "1.1.0"; +const OLD_BASE_VERSION: &str = "1.0.0"; +const PATCH_VERSION: &str = "1.0.1"; #[cfg_attr(not(feature = "library"), entry_point)] pub fn migrate( deps: DepsMut, _env: Env, _msg: Empty, ) -> Result { - cw2::assert_contract_version(deps.storage, CONTRACT_NAME, BASE_VERSION)?; + cw2::assert_contract_version(deps.storage, CONTRACT_NAME, BASE_VERSION) + .or_else(|_| cw2::assert_contract_version(deps.storage, CONTRACT_NAME, PATCH_VERSION)) + .or_else(|_| cw2::assert_contract_version(deps.storage, CONTRACT_NAME, OLD_BASE_VERSION))?; + cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; Ok(Response::default())