ADO Database

Introduction

The Database ADO (ADODB) is a smart contract that is primarily used to store the code Ids for Andromeda ADOs. These code Ids are used to instantiate these ADOs in Andromeda Apps. The code Ids are stored within a key value pair where the key is the ADO type and the value is the ADO code Id.

The ADODB is also responsible for managing the economic engine of the Andromeda ecosystem, allowing ADO publishers to set custom fees to be paid when interacting with one of their published ADOs. These fees can be set as native or a CW20 token.

Currently all published ADOs have been done by and through the Andromeda team. This does not mean that ADOs developed by Andromeda are the only ones that can be published to the ADODB. On the contrary, we encourage developers to create new and exciting ADOs to be published that can be submitted to our team to be reviewed. If the quality of the ADO is found to be to standard, the developer is given permission to publish it into the existing library of ADOs. It is important to note that although this process is done currently by the Andromeda team, the process of accepting and publishing ADOs will eventually be handed to the Andromeda DAO to make the process as decentralized as possible.

ADOs instantiated by code Ids found in the ADODB are eligible to communicate with the AMP layer as it ensures that the ADO was created by one of the Andromeda contracts.

Ado_type: adodb

InstantiateMsg

pub struct InstantiateMsg {
    pub kernel_address: String,
    pub owner: Option<String>,
}

ExecuteMsg

Publish

Publishes an ADO to the ADODB by saving the provided code_id under the specified ado_type.

The new version needs to be greater than the old one if using an already published ado_type.

Only available to the ADO owner.

The fee can be either a native or a CW20 asset.

 pub enum ExecuteMsg {
   Publish {
        code_id: u64,
        ado_type: String,
        action_fees: Option<Vec<ActionFee>>,
        version: String,
        publisher: Option<String>,
    },
  }

ActionFee

Ensure asset is in the format "cw20:address" or "native:denom

pub struct ActionFee {
    pub action: String,
    pub asset: String,
    pub amount: Uint128,
    pub receiver: Option<Addr>,
}

Unpublish

Unpublishes a previously published ADO.

Only available to the contract owner.

Once unpublished, the code_id will be removed from the ADODB.

Unplubish is for a specific version of an ADO.

An Unpublished ADO can never be published again.

pub enum ExecuteMsg {
Unpublish {
        ado_type: String,
        version: String,
    },
  }

UpdateActionFees

Update the fees implemented on the specified ado_type.

Only availabe to the contract owner.

Will return an error if the ADO type does not exist.

 pub enum ExecuteMsg {
 UpdateActionFees {
        ado_type: String,
        action_fees: Vec<ActionFee>,
    }
 }

RemoveActionFees

Removes the specified Action Fees for the specified ado_type.

Only available to the contract owner.

Will return an error if the ADO type does not exist.

pub enum ExecuteMsg {
RemoveActionFees {
        ado_type: String,
        actions: Vec<String>,
    },
  }

UpdatePublisher

Assigns a new address as the publisher of an ADO.

Only availabe to the contract owner.

pub enum ExecuteMsg {  
  UpdatePublisher {
        ado_type: String,
        publisher: String,
    }
}

Ownership

The set of ownerhsip messages. These messages are the same as the ones found in the ADO base section.

QueryMsg

CodeId

Query the code_id of the specified key.

pub enum QueryMsg {
    #[returns(u64)]
    CodeId {
      key:String,
    }
}

Returns a u64 which represents the code_id.

IsUnpublishedCodeId

Checks the if the code_id specified has been unpublished.

pub enum QueryMsg {
  #[returns(IsUnpublishedCodeIdResponse)]
  IsUnpublishedCodeId {
   code_id: u64 
   },
  }

Returns true if the code Id has been unpublished and false otherwise.

ADOType

Queries the ADO type and version linked to the specified code_id.

pub enum QueryMsg {
    #[serde(rename = "ado_type")]
    #[returns(Option<ADOVersion>)]
    ADOType {
          code_id: u64 
    }
  }

Returns the ADO type in a string. The type will contain the ADO name along with the version. For example: "[email protected]"

AllADOTypes

Queries all the ADO types available with their latest versions.

pub enum QueryMsg {
    #[returns(Vec<String>)]
    #[serde(rename = "all_ado_types")]
    AllADOTypes {
        start_after: Option<String>,
        limit: Option<u32>,
    }
}

The query will return each ADO type along with its latest version.

ADOVersions

Queries the available versions of the specified ADO type.

pub enum QueryMsg {
#[returns(Vec<String>)]
#[serde(rename = "ado_versions")]
    ADOVersions {
        ado_type: String,
        start_after: Option<String>,
        limit: Option<u32>,
    },
}

Returns a Vec<String> containing all the requested ADO versions.

ADOMetadata

Queries all the metadata related to the specified ADO type.

pub enum QueryMsg {  
  #[serde(rename = "ado_metadata")]
  #[returns(Option<ADOMetadata>)]
  ADOMetadata { ado_type: String },
  }

ADOMetadata

The struct returned containing the ADO metadata.

pub struct ADOMetadata {
    pub publisher: String,
    pub latest_version: String,
}

ActionFee

Queries the fees implemented on the specified Action for the specified ADO type.

pub enum QueryMsg {
    #[returns(Option<ActionFee>)]
    ActionFee { ado_type: String, action: String },
    }

Returns the ActionFee struct with the fee information if found.

ActionFeeByCodeId

Queries the fees implemented on the specified Action for the specified code_id ADO.

pub enum QueryMsg {
    #[returns(Option<ActionFee>)]
    ActionFeeByCodeId { code_id: u64, action: String },
    }

Returns the ActionFee struct with the fee information if found.

Version

Queries the version of the ADO.

pub enum AndromedaQuery {
     #[returns(VersionResponse)]
     Version {}
     }

VersionResponse

pub struct VersionResponse {
    pub version: String,
}

Owner

Queries the owner of the contract.

pub enum AndromedaQuery{
    #[returns(ContractOwnerResponse)]
    Owner{}
}

ContractOwnerResponse

pub struct ContractOwnerResponse {
    pub owner: String
}

Type

Queries the ADO type.

pub enum AndromedaQuery {
    #[returns(TypeResponse)]
    Type {}
}

TypeResponse

pub struct TypeResponse {
    pub ado_type: String,
    }

KernelAddress

Queries the kernel address of the chain the ADO is deployed on.

pub enum AndromedaQuery {
    #[returns(KernelAddressResponse)]
    KernelAddress {},
    }

Returns a String containing the contract address of the Kernel.

Last updated

Additional Resources

GithubWebsite