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>,
}
Name TypeDescription

app_components

The vector of AppComponent containing all the ADOs of the app.

name

String

The name of the app.

chain_info

Option<Vec<ChainInfo>>

A vector containing the chain information describing the chains that will be used in the App. To be able to deploy a CrossChain component, the chain_info for that chain need to be specified.

kernel_address

String

Contract address of the kernel contract to be used for AMP messaging. Kernel contract address can be found in our deployed contracts.

owner

Option<String>

Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.

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,
}
NameTypeDescription

name

String.

The name of the ADO component. The names can be used later on to reference the coponent.

ado_type

String

The type of the ADO.

component_type

Specifies the type of component. The components types are discussed below.

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,
}
NameTypeDescription

instantiate_msg

Binary

base64 binary representation of the instantiation message of the comopnent.

chain

String

The chain to create the component on.

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,
}
NameTypeDescription

chain_name

String

The name of the chain.

owner

String

The address of the owner of the components that will be created on the specified chain.

ExecuteMsg

AddAppComponent

Adds an ADO component to the app.

Only available to the contract owner.

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

component

The ADO component to add to the app.

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>
   }
}
NameTypeDescription

name

Option<String>

Optional name for the component to claim. If not set, will claim all ADO components in the app.

new_owner

Option<Addr>

Optional address to get the ownership request. Defaults to the sender if not specified.

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 
    }
  }
NameTypeDescription

name

String

The name of the ADO to execute on.

msg

Binary

The msg to excecute. This is a base64 encoded binary of the JSON representation of the message.

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
   }
 }
NameTypeDescription

name

String

The name of the ADO component to update the address for. This needs to be the name of one of the components in the App.

addr

String

The new contract address to be associated with the specified name.

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 }
 }
NameTypeDescription

name

String

The name of the component to get the contract address for.

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 },
    }
NameTypeDescription

name

String

The name of the component to check.

Returns a bool response.

Base Queries

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

Additional Resources

GithubWebsite