Andromeda
Search…
⌃K

ADO Classes

Classes

The ADO classes bundle up ADOs with similar functionality. They provide a sort of filtering for our ADOs which is needed since more and more ADOs are being added frequently. This way, users can quickly find ADOs they are interested in based on the ADO class they belong to.

Architecture Overview

Andromeda Digital Object

Each of our individual contracts is referred to as an ADO. Each ADO has a specific purpose and custom messages.

Modules

Modules are ADOs that can be attached to other ADOs to extend functionality. Modules can be standalone contracts but most of the time are used as additions to other more complex ADOs. An example of a module would be our rates module that can apply rates automatically on any ADO that implements buying/ selling, or the address list module that can whitelist addresses to interact with another ADO. Only ADOs that logically benefit from the addition of modules have the modules feature enabled. If an ADO can attach modules then it would be an optional field in the instantiation message. Modules are implemented using hooks and queries that will be further explained in other sections.

ADO-Base

Upon instantiating any ADO, a ADOContract struct is instantiated that holds key information on the ADO:
pub struct ADOContract<'a> {
pub(crate) owner: Item<'a, Addr>,
pub(crate) original_publisher: Item<'a, Addr>,
pub(crate) block_height: Item<'a, u64>,
pub(crate) operators: Map<'a, &'a str, bool>,
pub(crate) ado_type: Item<'a, String>,
pub(crate) version: Item<'a, String>,
pub(crate) app_contract: Item<'a, Addr>,
#[cfg(feature = "primitive")]
pub(crate) primitive_contract: Item<'a, Addr>,
#[cfg(feature = "primitive")]
pub(crate) cached_addresses: Map<'a, &'a str, String>,
#[cfg(feature = "modules")]
pub(crate) module_info: Map<'a, &'a str, Module>,
#[cfg(feature = "modules")]
pub(crate) module_idx: Item<'a, u64>,
#[cfg(feature = "withdraw")]
pub withdrawable_tokens: Map<'a, &'a str, AssetInfo>,
}
To avoid defining these fields for every single contract, we have decided to bundle them in a struct that can be used by all ADOs. There are also ado-base messages which are the messages that can be called by any ADO (Unless they require a certain feature enabled) that will be further discussed in ADO Base.
As we can see, not all ADOs use all the fields. Some require that the ADO have the modules, primitive, or withdraw feature. This would be specified in that ADO's docs page.