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
  • Asset
  • Coin
  • Definition
  • Expiration
  • Definition
  • Expiry and Milliseconds
  • Expiry
  • Milliseconds
  • Recipient
  • AndrAddr

Was this helpful?

  1. Platform and Framework

Common Types

Defining recurring structs used by our ADOs.

PreviousAndromedaQueryNextDeployed Contracts

Last updated 1 month ago

Was this helpful?

This section contains the definitions of structures used by many of our ADOs. To avoid redefining them every time, they will be placed in this section and referenced.

Asset

Enum that specifies the type of asset being used.

#[cw_serde]
pub enum Asset {
    Cw20Token(AndrAddr),
    NativeToken(String),
}
  • Cw20Token: Specifies that the asset being used is a CW20 token. Specify the address of the CW20 contract using the struct.

  • NativeToken: Specifies that the asset being used is a native token. Specify the micro denomination of the token (uandr, ustars etc...).

Coin

Definition

A struct used to store the denom and amount of funds.

pub struct Coin {
    pub denom: String,
    pub amount: Uint128,
}
{
"denom":"uandr",
"amount":"1000000"
}

Name

Type

Description

denom

String

The denomination of the funds.

amount

Uint128

The amount of funds.

Expiration

Definition

Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future).

pub enum Expiration {
    AtHeight(u64),
    AtTime(Timestamp),
    Never {},
}

AtHeight: AtHeight will expire when env.block.height >= height.

AtTime: AtTime will expire when env.block.time >= time.

Never: Never will never expire. Used to express the empty variant.

Timestamp

A point in time in nanosecond precision.

pub struct Timestamp(Uint64)

JSON Implementation

{
"expiration":{
  "at_height": 500
  }

or

{
"expiration":{
  "at_time":"1246593483949835832"
}

Expiry and Milliseconds

Expiry

The Expiry enum is used to define an expiry time using milliseconds. There are two types for Expiry:

pub enum Expiry {
    FromNow(Milliseconds),
    AtTime(Milliseconds),
}
  • FromNow: The expiry time is relative to the current time. For example specifying 60000 means the expiry time is one minute from now.

Milliseconds

Struct that represents time in milliseconds in u64. We have two types that use Milliseconds:

The two type were created to make the usage of the Milliseconds clearer in the different usage cases.

  • MillisecondsDuration: Used for instances that specify a duration in milliseconds.

  • MillisecondsExpiration: Used for instances that spceify a timestamp in milliseconds.

#[cw_serde]
#[derive(Default, Eq, PartialOrd, Copy)]
pub struct Milliseconds(pub u64);
pub type MillisecondsDuration = Milliseconds;
pub type MillisecondsExpiration = Milliseconds;

Recipient

A simple struct used for inter-contract communication:

pub struct Recipient {
    pub address: AndrAddr,
    pub msg: Option<Binary>,
    pub ibc_recovery_address: Option<AndrAddr>,
}

The struct can be used in two ways:

1. Simply just providing an AndrAddr which will treat the communication as a transfer of any related funds.

2. Providing an AndrAddr and a Binary message which will be sent to the contract at the resolved address. The Binary message can be any message that the contract at the resolved address can handle.

The ibc_recovery_address is an address to receive funds in case the IBC message failed. IBC messages are currently disabled and will be enabled soon.

AndrAddr

An address or path that can be used within the Andromeda ecosystem to reference ADOs and users.

pub struct AndrAddr(String);

The address can be one of the following:

  • A valid human readable address e.g. "andr14pmn28jyqgphd5wv0z28ppxe5ryeraqqgqfr2v"

AtTime: The expiry time is an absolute time ( time in milliseconds).

A valid Andromeda (VFS) path e.g. "/home/user/app1/component3"

A valid local path used in Apps e.g. "./<component-name>"

Epoch
Virtual File System
VFS
AndrAddr