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
  • Introduction
  • InstantiateMsg
  • ExecuteMsg
  • SetValue
  • DeleteValue
  • UpdateRestriction
  • Rates
  • Base Executes
  • QueryMsg
  • GetValue
  • AllKeys
  • OwnerKeys
  • Base Queries

Was this helpful?

  1. Andromeda Digital Objects

Primitive

Introduction

The Primitive ADO is a smart contract that is used to store data. It is a simple contract that allows us to store key/value pairs acting like a database.

The Primitive ADO can be set to one of the following:

  • Private: Only accessible by the contract owner of the ADO.

  • Public: Accessible by anyone.

  • Restricted: Only accessible to the key owner.

You can add a fee for setting keys using our rates.

Ado_type: primitive

Version: 2.1.0

InstantiateMsg

pub struct InstantiateMsg {
    pub restriction:PrimitiveRestriction,
    pub kernel_address: String,
    pub owner: Option<String>
}
{
"restriction":"public",
"kernel_address":"andr1..."
}
Name
Type
Description

restriction

Specifies who has access to add/delete data into the primitive ADO.

kernel_address

String

owner

Option<String>

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

PrimitiveRestriction

An enum defining the different types of restrictions that can be set.

pub enum PrimitiveRestriction {
    Private,
    Public,
    Restricted,
}
  • Private: Only accessible by the contract owner of the ADO.

  • Public: Accessible by anyone.

  • Restricted: Only accessible to the key owner (The address that first set the key).

ExecuteMsg

SetValue

Sets a value for the named key. When we need to extract the value that has been saved we would use the key.

If keyis not specified the default key ("default") will be used.

If SetValue uses a name that is already in use, the old value is overwritten by the latest value.

pub enum ExecuteMsg {
  SetValue {
        key: Option<String>,
        value: Primitive,
     }
  }
{
  "set_value": {
    "key": "rate_name",
    "value": {
      "coin": {
        "denom": "uandr",
        "amount": "100"
      }
    }
  }
}
Name
Type
Description

key

Option<String>

The key for the data. The default key "default" will be used if it is not specified.

value

The value of the data.

Primitive

An enum to specify the type of data you are saving.

pub enum Primitive {
    Uint128(Uint128),
    Decimal(Decimal),
    Coin(Coin),
    Addr(Addr),
    String(String),
    Bool(bool),
    Binary(Binary),
}

DeleteValue

Deletes the data attached to the specified key.

If key is not specified the default key ("default") will be used.

   pub enum ExecuteMsg{
   DeleteValue {
        key: Option<String>,
    }
 }
{
"delete_value":{
 "key":"rate_name"
    }
 }
Name
Type
Description

key

Option<String>

Thel key for the data to delete. If not specified, the default key "default" will be used.

UpdateRestriction

Changes the restriction set on the primitive.

Only available to the contract owner.

pub enum ExecuteMsg {
 UpdateRestriction {
        restriction: PrimitiveRestriction,
    },
}
{
"update_restriction":{
    "restriction":"private"
    }
}
Name
Type
Description

restriction

The new restriction type to use for the primitve ADO.

Rates

Sets a fee on adding values to the primitive.

Only available to the contract owner.

Only a Flat rate type is accepted.

Base Executes

QueryMsg

GetValue

Gets the value asociated to the specified key.

pub enum QueryMsg { 
 #[returns(GetValueResponse)]
    GetValue { key: Option<String> },
    }
{
"get_value":{
    "key":"funds"
    }
}
Name
Type
Description

key

Option<String>

The key to get the value for. The default key is used if it is not specified.

GetValueResponse

pub struct GetValueResponse {
    pub key: String,
    pub value: Primitive,
}
{
"key":"funds",
"value": {
      "coin": {
        "denom": "uandr",
        "amount": "100"
      }
    }
}
Name
Type
Description

key

String

The key you are getting the value for.

value

The value for the specified key.

AllKeys

Gets all the keys that are currently saved in the primitive ADO.

pub enum QueryMsg {
 #[returns(Vec<String>)]
    AllKeys {},
    }
{
"all_keys":{}
}

Returns a Vec<String> containing all the available keys.

OwnerKeys

Gets all the keys that belong to the specified owner address.

pub enum QueryMsg {
    #[returns(Vec<String>)]
    OwnerKeys { owner: AndrAddr },
    }
{
"owner_keys":{
    "owner":"andr1..."
    }
}
Name
Type
Description

owner

The address to get the keys for.

Returns a Vec<String> containing all the keys belonging to the specified owner.

Base Queries

PreviousPointNextRates

Last updated 3 months ago

Was this helpful?

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

You can read more about setting rates.

The rest of the execute messages can be found in the section.

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

ADO Base
ADO Base
kernel contract
AMP
deployed contracts
PrimitiveRestriction
Primitive
PrimitiveRestriction
Primitive
AndrAddr
here