Andromeda
Ask or search…
K

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 another component, 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.
Ado_type: app-contract

InstantiateMsg

The maximum number of app components is 50.
Rust
JSON
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>,
}
{
"app_components":[
{
"name":"fundsplitter",
"ado_type":"splitter",
"component_type":{
"new":"eyJtaW50ZXIiOiAianVubzE3OX..."
}
},
{
...
}
],
"name":"some_app",
"kernel_address":"andr1...",
"owner":"andr1..."
}
Name
Type
Description
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.
pub struct AppComponent {
pub name: String,
pub ado_type: String,
pub component_type: ComponentType,
}
Name
Type
Description
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.
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

CrossChainComponent

The instantiate_msg should be base64 encoded and not raw binary.
pub struct CrossChainComponent {
pub instantiate_msg: Binary,
pub chain: String,
}
Name
Type
Description
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,
}
Name
Type
Description
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.
Rust
JSON
pub enum ExecuteMsg {
AddAppComponent{
component: AppComponent,
}
}
{
"add_app_component":{
"component":{
"name":"crowdfund",
"ado_type":"crowdfund",
"component_type":{
"new":"eyJ0b2tlbl9hZGRyZXNzIjp7ImlkZW50aWZpZXIiOiJqdW5vMS4uLiJ9InByaW1pdGl2ZV9hZGRyZXNzIjoianVub..."
}
}
}
Name
Type
Description
component
The ADO component to add to the app.

ClaimOwnership

Gives ownership of a component to the specified new_owner address instead of the app contract.
Only available to the contract owner.
Rust
JSON
pub enum ExecuteMsg{
ClaimOwnership {
name: Option<String>,
new_owner:Option<Addr>
}
}
{
"claim_ownership":{
"name":"mycomponent",
"new_owner":"andr1..."
}
}
Name
Type
Description
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>
The address to get ownership. 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 over a component.
Only available to the contract owner.
Rust
JSON
pub enum ExecuteMsg{
ProxyMessage {
name: String,
msg: Binary
}
}
{
"proxy_message":{
"name":"componentname",
"msg":"eyJtaW50Ijp7InRva2VuX2lkIjo..."
}
}
Name
Type
Description
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.
Rust
JSON
pub enum ExecuteMsg {
UpdateAddress {
name: String,
addr: String
}
}
{
"update_address":{
"name":"roayalties",
"addr":"andr1..."
}
}
Name
Type
Description
name
String
The name of the ADO.
addr
String
The new contract address for the ADO.

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.
Rust
JSON
pub enum QueryMsg{
#[returns(String)]
GetAddress { name: String }
}
{
"get_address":{
"name":"componentname"
}
}
Name
Type
Description
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.
Rust
JSON
pub enum QueryMsg {
#[returns(Vec<ComponentAddress>)]
GetAddressesWithNames {}
}
{
"get_addresses_with_names":{}
}

ComponentAddress

Rust
JSON
pub struct ComponentAddress {
pub name: String,
pub address: String,
}
{
"name":"token",
"address":"andr1..."
}

GetComponents

Rust
JSON
pub enum QueryMsg{
#[returns(Vec<AppComponent>)]
GetComponents {}
}
{
"get_components":{}
}
Returns a Vec<AppComponent> which contains all the components of the app.

Config

Queries the configuration of the app.
Rust
JSON
pub enum QueryMsg{
#[returns(ConfigResponse)]
Config {}
}
{
"config":{}
}

ConfigResponse

Rust
JSON
pub struct ConfigResponse {
pub owner: String,
pub name: String,
}
{
"name":"myapp",
"owner":"andr1..."
}

ComponentExists

Checks if a component with the specified name exists.
Rust
JSON
pub enum QueryMsg {
#[returns(bool)]
ComponentExists { name: String },
}
{
"component_exists":{
"name":"mycomponent"
}
}
Name
Type
Description
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.