Andromeda
ADO LibraryBuild AppsDevelop ADOsCLIWeb Application Docs
Andromeda Archives
Andromeda Archives
  • Platform and Framework
    • Introduction to AndromedaOS
    • ADO Classes
    • Andromeda Messaging Protocol
      • Kernel
      • ADO Database
      • Economics Engine
      • Virtual File System
    • ADO Base
      • AndromedaMsg V1.0.0
      • AndromedaQuery V1.0.0
    • Common Types
    • Deployed Contracts
  • Andromeda Digital Objects
    • Introduction to ADOs
    • Auction V1.0.0
    • App V1.0.1
    • Crowdfund V1.0.0
    • CW20 V1.0.0
    • CW20 Staking V1.0.0
    • CW721 V1.0.0
    • CW20 Exchange V1.0.0
    • Lockdrop V1.0.0
    • Marketplace V1.0.0
    • Merkle-Airdrop V1.0.0
    • Rate Limiting Withdrawals V1.0.0
    • Splitter V1.0.0
    • Timelock V1.0.0
  • Andromeda Apps
    • Introduction to Apps
    • Crowdfunding App
    • Auctioning App
    • Cw20 Staking App
    • Marketplace App
  • Developing an ADO
    • Getting Started
      • Instantiation
      • Execution
      • Queries
      • Testing
    • ADO Example
    • ADO Submissions
  • Andromeda CLI
    • Introduction
    • Help and Shortcuts
    • ADO
    • Bank
    • Chain
    • Env
    • Gql
    • Tx
    • OS
    • Wallet
    • Wasm
    • Clearing CLI Data
    • Clear and Exit
  • Chain
    • Running a Node
    • Staking and Rewards
  • Andromeda Dashboard
    • Tokenomics Dashboard
    • Dashboard API
  • Additional Resources
    • GitHub
    • Website
    • White Paper
Powered by GitBook

Additional Resources

  • Github
  • Website

Community

  • Discord
  • Telegram

Socials

  • Twitter
  • Medium
  • Youtube
On this page
  • InstantiateMsg
  • Migrate Message

Was this helpful?

  1. Platform and Framework

ADO Base

The ADO Base contains all the common functionality applied on all ADOs upon instantiation.

InstantiateMsg

The struct used to hold important information about each instantiated ADO. Implemented as BaseInstantiateMsg.

pub struct InstantiateMsg {
    pub ado_type: String,
    pub ado_version: String,
    pub kernel_address: String,
    pub owner: Option<String>,
}
Name
Type
Description

ado_type

String

The type of the ADO. Usually, it is the same as the name. It is automatically set when an ADO is instantiated.

ado_version

String

The version of the ADO. It is automatically set when an ADO is instantiated.

kernel_address

Option<String>

owner

Option<String>

The address of the ADO owner. Specified by the creator in the instantiation message of an ADO.

Our ADOs have a set of execute and query messages referred to as the "base executes" and "base queries". These messages are common to every ADO in our Andromeda Digital Library (Except AMP ADOs). They are listed in the AndromedaMsg and AndromedaQuery enums which we will discuss next.

Migrate Message

All of our ADOs contain a migrate message to allowing migrating an ADO to a newer version:

 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())
    }
PreviousVirtual File SystemNextAndromedaMsg V1.0.0

Last updated 1 year ago

Was this helpful?

The contract address of the ADO responsible for communication between ADOs. Specified by the creator in the instantiation message of an ADO.

kerne
l