Common Types

Defining recurring structs used by our ADOs.

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.



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

pub struct Coin {
    pub denom: String,
    pub amount: Uint128,






The denomination of the funds.



The amount of funds.



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 {
    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.


A point in time in nanosecond precision.

pub struct Timestamp(Uint64)

JSON Implementation

  "at_height": 500




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.

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


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.


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"

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

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

Last updated

Additional Resources