ADO Base
The ADO Base contains all the common functionality applied on all ADOs upon instantiation.
InstantiateMsg
pub struct InstantiateMsg {
pub ado_type: String,
pub ado_version: String,
pub kernel_address: String,
pub owner: Option<String>,
}Name
Type
Description
Migrate Message
pub fn migrate(
&self,
deps: DepsMut,
contract_name: &str,
contract_version: &str,
) -> Result<Response, ContractError> {
// New version
let version: Version = contract_version.parse().map_err(from_semver)?;
// Old version
let stored = get_contract_version(deps.storage)?;
let storage_version: Version = stored.version.parse().map_err(from_semver)?;
let contract_name = if contract_name.starts_with("crates.io:andromeda-") {
contract_name.strip_prefix("crates.io:andromeda-").unwrap()
} else if contract_name.starts_with("crates.io:") {
contract_name.strip_prefix("crates.io:").unwrap()
} else {
contract_name
};
ensure!(
stored.contract == contract_name,
ContractError::CannotMigrate {
previous_contract: stored.contract,
}
);
// New version has to be newer/greater than the old version
ensure!(
storage_version < version,
ContractError::CannotMigrate {
previous_contract: stored.version,
}
);
set_contract_version(deps.storage, contract_name, contract_version)?;
Ok(Response::default())
}Was this helpful?