App

Introduction

The App ADO is a smart contract that is used to bundle up ADOs that will be interacting with each other into what we call an "App". It also offers a naming system that allows the contracts to reference each other by their assigned names rather than contract addresses.

An ADO in the App is called an AppComponent. Every App would be composed of many of these components (up to 50). Each component is assigned a name which can be used by other components to reference each other. The App ADO allows us to instantiate all of these components in one go.

To reference a component from the another component when instantiating an App, you would need to speciy "./<component-name>. You will see examples of this in our Andromeda Apps section.

At instantiation, we specify the address of the Kernel ADO . This Kernel will have a reference to the ADODB which has the code Ids of all the Andromeda ADOs saved. The Kernel ADO for each chain is already deployed and the addresses can be found in our deployed contracts section. You can learn to deploy your first app here.

Our Apps support cross-chain components or ADOs, meaning an App can contain several ADOs each located on a different chain. This is specified by using the CrossChain component type.

The App registers all its components in the Virtual File System upon instantiation and assigns to them the names specified by the user upon instantiation of the App.

Crosschain Apps are currently disabled.

Ado_type: app-contract

Version: 1.1.1-beta.1

InstantiateMsg

The maximum number of app components is 50.

You cannot have 2 Apps with the same name instantiated by the same address.

The instantiator address is given ownership over all the components of the App at instantiation.

pub struct InstantiateMsg {
    pub app_components: Vec<AppComponent>,
    pub name: String,
    pub chain_info: Option<Vec<ChainInfo>>,
    pub kernel_address:String,
    pub owner:Option<String>,
}

AppComponent

The ADO to be a part of the App.

The name field is case sensitive and needs to be unique for each component.

Component name characters should be alphanumeric.

Component name cannot be a single dot "."

pub struct AppComponent {
    pub name: String,
    pub ado_type: String,
    pub component_type: ComponentType,
}

ComponentType

An enum containing the different component types that can be instantiated.

In order to create a CrossChain component, chain_infofield (Found in instantiation message of the App ADO) needs be specified for the chain to deploy the component on. For example, if I want to create a NFT component on Stargaze from an App on the Andromeda chain, I need to specify the chain info for the stargaze chain for it to be successfull.

CrossChain Components are currently disabled.

pub enum ComponentType {
    New(Binary),
    Symlink(AndrAddr),
    CrossChain(CrossChainComponent),
}

There are three types of components:

  • New: Provide a base64 encoded binary of the instantiation message of the component to add.

  • Symlink: Provide a valid Symlink that resolves to the address of the component to add.

  • CrossChain: Provide a base64 encoded binary of the instantiation message of the component to add as well as the chain. The component will be instantiated on the specified chain. This option is currently disabled.

CrossChainComponent

The instantiate_msg should be base64 encoded and not raw binary.

pub struct CrossChainComponent {
    pub instantiate_msg: Binary,
    pub chain: String,
}

ChainInfo

Information on the chains that will be part of the App. Need to be specified to be able to use CrossChain components.

#[cw_serde]
pub struct ChainInfo {
    pub chain_name: String,
    pub owner: String,
}

ExecuteMsg

AddAppComponent

Adds an ADO component to the app.

Only available to the contract owner.

pub enum ExecuteMsg {
AddAppComponent{
 component: AppComponent,
   }
}

ClaimOwnership

Sends an ownership request to the specified new_owner for a component owned by the App.

Only available to the contract owner.

pub enum ExecuteMsg {
   ClaimOwnership { 
      name: Option<String>,
      new_owner:Option<Addr>
   }
}

ProxyMessage

Sends a message to the ADO with the specified name. This is used in the case the app contract has specific operation privileges (Is the owner) over a component.

Only available to the contract owner.

  pub enum ExecuteMsg{
  ProxyMessage { 
    name: String,
    msg: Binary 
    }
  }

UpdateAddress

Sets a new contract address for the ADO with the specified name.

Only available to the contract owner or the ADO component with the specified name.

pub enum ExecuteMsg {
  UpdateAddress {
     name: String,
     addr: String
   }
 }

Base Executes

The rest of the execute messages can be found in the ADO Base section.

QueryMsg

GetAddress

Queries the contract address of a component name.

pub enum QueryMsg{
 #[returns(String)]
 GetAddress { name: String }
 }

Returns a String of the component address.

GetAddressesWithNames

Queries all the components returning the name along with the address for each.

pub enum QueryMsg {
    #[returns(Vec<ComponentAddress>)]
    GetAddressesWithNames {}
    }

ComponentAddress

pub struct ComponentAddress {
    pub name: String,
    pub address: String,
}

GetComponents

pub enum QueryMsg{
 #[returns(Vec<AppComponent>)]
 GetComponents {}
}

Returns a Vec<AppComponent> which contains all the components of the app.

Config

Queries the configuration of the app.

pub enum QueryMsg{
    #[returns(ConfigResponse)]
    Config {}
}

ConfigResponse

pub struct ConfigResponse {
    pub owner: String,
    pub name: String,
}

ComponentExists

Checks if a component with the specified name exists.

pub enum QueryMsg {
    #[returns(bool)]
    ComponentExists { name: String },
    }

Returns a bool response.

Base Queries

The rest of the query messages can be found in the ADO Base section.

Additional Resources

GithubWebsite