Andromeda
ADO LibraryBuild AppsDevelop ADOsCLIWeb Application Docs
Andromeda
Andromeda
  • Platform and Framework
    • Introduction to AndromedaOS
    • ADO Classes
    • Andromeda Messaging Protocol
      • Kernel
      • ADO Database
      • Economics Engine
      • Virtual File System
    • ADO Base
      • AndromedaMsg
      • AndromedaQuery
    • Common Types
    • Deployed Contracts
    • ADO Versions
  • Andromeda Digital Objects
    • Introduction to ADOs
    • Address List
    • Auction
    • App
    • Curve
    • CW20
    • CW20 Staking
    • CW721
    • CW20 Exchange
    • Fixed Amount Splitter
    • Graph
    • Lockdrop
    • Marketplace
    • Merkle-Airdrop
    • Point
    • Primitive
    • Rates
    • Splitter
    • Timelock
    • Validator Staking
    • Vesting
  • Andromeda Apps
    • Introduction to Apps
    • Auctioning App
    • Cw20 Staking App
    • Marketplace App
  • Developing an ADO
    • Getting Started
      • Instantiation
      • Execution
      • Queries
      • Testing
    • Error Handling and Migrate Function
    • CW3 EXAMPLE
      • InstantiateMsg
      • ExecuteMsg
      • QueryMsg
      • Testing
    • ADO Submissions
  • Andromeda CLI
    • Introduction
    • Help and Shortcuts
    • ADO
    • Bank
    • Chain
    • Env
    • Gql
    • Tx
    • OS
    • Wallet
    • Wasm
    • Clearing CLI Data
    • Clear and Exit
  • Chain
    • Running a Node
    • Staking and Rewards
  • Andromeda Dashboard
    • Tokenomics Dashboard
    • Dashboard API
  • Andromeda Changelog
    • Newest Releases
  • Additional Resources
    • GitHub
    • Website
    • White Paper
Powered by GitBook

Additional Resources

  • Github
  • Website

Community

  • Discord
  • Telegram

Socials

  • Twitter
  • Medium
  • Youtube
On this page
  • Template
  • Andromeda Standard Crate
  • Contract Messages
  • ADOContract

Was this helpful?

  1. Developing an ADO

Getting Started

Getting started with your own ADO. This document will show you how to create/transform your smart contract into an ADO.

PreviousMarketplace AppNextInstantiation

Last updated 3 months ago

Was this helpful?

Template

If you're starting from scratch the best way to begin is to use the Andromeda smart contract template. This can be found on our Github .

Andromeda Standard Crate

Our crate can be found .

Contract Messages

The message definitions for an ADO can be added to any existing message definitions using our andromeda-macros crate (this is also available via the andromeda-std crate, so if you're using our full suite you don't need to install this crate explicitly). There are three macros for instantiation, execute and query messages.

msg.rs
use andromeda_std::{andr_exec, andr_instantiate, andr_query};

#[andr_instantiate]
#[cw_serde]
pub struct InstantiateMsg {
    // ... Your instantiation variables
}

#[andr_exec]
#[cw_serde]
pub enum ExecuteMsg {
    // ... Your execute messages
}

#[andr_query]
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    // ... Your query messages
}

ADOContract

All interactions with the Andromeda ecosystem can be done via the ADOContract interface. To use this interface you must first import it from the andromeda-std crate.

This is included in the template.

contract.rs
use andromeda_std::ado_contract::ADOContract;

Once imported you can create an instance of the contract in your code execution like so:

contract.rs
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn instantiate(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    msg: InstantiateMsg,
) -> Result<Response, ContractError> {

    let contract = ADOContract::default();
    ...
pub struct ADOContract<'a> {
    pub(crate) owner: Item<'a, Addr>,
    pub(crate) original_publisher: Item<'a, Addr>,
    pub(crate) block_height: Item<'a, u64>,
    pub(crate) ado_type: Item<'a, String>,
    pub(crate) app_contract: Item<'a, Addr>,
    pub(crate) kernel_address: Item<'a, Addr>,
    pub(crate) permissioned_actions: Map<'a, String, bool>,
    #[cfg(feature = "rates")]
    /// Mapping of action to rate
    pub rates: Map<'a, &'a str, Rate>,
}

From this struct we can access all of the state variables and various cross-contract calls that are needed by an ADO.

These macros work by merging your existing message types with the available Andromeda message types. If you'd like to take a look at these messages you can see them .

here
here
here