Kernel

Introduction

The Andromeda Kernel acts as the core of the operating system.

The Kernel receives and handles packets from ADOs to be relayed to a specified recipient. The Kernel keeps track of the original sender of the message. It also verifies that the packet is sent by an Andromeda certified ADO before relaying the message.

The Kernel is also responsible for:

  • Relaying any IBC messages across any two chains that have an Andromeda Kernel deployed and a channel set up.

  • Keeping track of the other AMP ADOs such as the ADODB, VFS, and Economics.

All of our ADOs have an AMPReceive execute message to handle receiving packets from the Kernel.

The Kernels are set up by the Andromeda team on each chain. This means that as a regular user, you will not need to interact with this ADO yourself in most cases. This page serves as additional information on how it works for people that are interested into getting a deep understanding of our system.

The only only message that users will be calling is the Recover execute message that will recover IBC funds sent in case the IBC message fails.

InstantiateMsg

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

ExecuteMsg

AMPReceive

Receives an AMP packet from another ADO. The packet is received, unpacked and the messages are relayed to their intended destination.

Only an AMPPkt sent from one of the Andromeda ADOs is accepted.

pub enum ExecuteMsg {
    AMPReceive(AMPPkt),
    }

Information about the AMPPkt struct can be found here.

Send

Constructs an AMPPkt with a given AMPMsg and sends it to the recipient.

pub enum ExecuteMsg {
       Send {
        message: AMPMsg,
    },
}

Create

Creates an ADO with the given type and message.

pub enum ExecuteMsg {
Create {
        ado_type: String,
        msg: Binary,
        owner: Option<AndrAddr>,
        chain: Option<String>,
    },
 }

UpsertKeyAddress

Used to save the addresses of the AMP ADOs that the Kernel will be interacting with such as the ADODB, Economics, and VFS.

Only available to the owner of the Kernel.

pub enum ExecuteMsg {
    UpsertKeyAddress {
        key: String,
        value: String,
    }
}

AssignChannels

Assigns a given channel between the current chain and the specified target chain. For a successfull channel to be set up, both the channel ids need to be specified.

Only available to the owner of the Kernel.

Calling this message again, will override any previously set channels.

pub enum ExecuteMsg {
 AssignChannels {
        ics20_channel_id: Option<String>,
        direct_channel_id: Option<String>,
        chain: String,
        kernel_address: String,
    },
  }

Recover

Recovers sent IBC funds to the user in case an IBC message fails.

pub enum ExecuteMsg {
    Recover {},
}

UpdateChainName

Update the name of the chain the kernel is deployed on. This name is initially specified at instantiation.

Only available to the owner of the Kernel ADO.

pub enum ExecuteMsg {
   UpdateChainName {
        chain_name: String,
    },
}

RegisterUserCrossChain

Used to register a VFS username cross-chain.

This message can only be called by the VFS.

pub enum ExecuteMsg {
 RegisterUserCrossChain {
        username: String,
        address: String,
        chain: String,
    },
  }

Ownership

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

QueryMsg

KeyAddress

Queries the address of the specified key.

Currently there are three keys that can be used: vfs : Gets the address of the VFS ADO used by the kernel.

adodb: Gets the address of the ADODB ADO used by the kernel.

economics: Gets the address of the Economics ADO used by the kernel.

pub enum QueryMsg{  
   #[returns(Addr)]
    KeyAddress { key: String }
    }

Returns the address in a string.

VerifyAddress

Checks if the specified address was created by an Andromeda ADO by checking and comparing the code_Id of the address with the code_Ids stored in the ADODB.

pub enum QueryMsg{
    #[returns(bool)]
    VerifyAddress { address: String },
    }

Returns true if the address was created by an Andromeda ADO and false otherwise.

ChannelInfo

Gets the saved channel information such as channel ids for the specified chain.

pub enum QueryMsg {
    #[returns(Option<ChannelInfoResponse>)]
    ChannelInfo { chain: String }
    }

ChannelInfoResponse

pub struct ChannelInfoResponse {
    pub ics20: Option<String>,
    pub direct: Option<String>,
    pub kernel_address: String,
    pub supported_modules: Vec<String>,
}

Recoveries

Gets any fund recoveries available for the specified address.

pub enum QueryMsg {   
    #[returns(Vec<::cosmwasm_std::Coin>)]
    Recoveries { addr: Addr },
    }
}

Returns a Vec<Coin> containing the recoverable funds.

ChainName

Returns the saved chain name specified at instantiation.

pub enum QueryMsg {
    #[returns(ChainNameResponse)]
    ChainName {},
    }

ChainNameResponse

The struct containing the chain name.

pub struct ChainNameResponse {
    pub chain_name: String,
}

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

Additional Resources

GithubWebsite