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

Was this helpful?

  1. Developing an ADO
  2. Getting Started

Instantiation

Instantiation

To initialize the data required by an ADO we must call the instantiate function from within our instantiation entry point for our contract.

contract.rs
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn instantiate(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    msg: InstantiateMsg,
) -> Result<Response, ContractError> {
    // ... ADO instantiation code
    
    let contract = ADOContract::default();
    let resp = contract.instantiate(
        deps.storage,
        env,
        deps.api,
        &deps.querier,
        info.clone(),
        BaseInstantiateMsg {
            ado_type: CONTRACT_NAME.to_string(),
            ado_version: CONTRACT_VERSION.to_string(),
            kernel_address: msg.kernel_address,
            owner: msg.owner,
        },
    )?;

    Ok(resp
        .add_attribute("method", "instantiate")
        .add_attribute("owner", info.sender)
        )
}

This will create an ado with type ADO_NAME and a current version of CONTRACT_VERSION. This is used by the ADO database on chain to verify that the current contract is an ADO so make sure this is correct.

PreviousGetting StartedNextExecution

Last updated 3 months ago

Was this helpful?