Andromeda
Ask or search…
K
Comment on page

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.

Coin

Definition

A struct used to store the denom and amount of funds.
Rust
JSON
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).
Rust
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"
}

Recipient

A simple struct used for inter-contract communication:
pub struct Recipient {
pub address: AndrAddr,
pub msg: Option<Binary>,
}
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.

AndrAddr

An address that can be used within the Andromeda ecosystem.
pub struct AndrAddr(String);
The address can be one of two things:
  • A valid human readable address e.g. "andr1..."
  • A valid Andromeda Virtual File System (VFS) path e.g. "/home/user/app/component"
VFS paths can be local in the case of an app and can be done by referencing ./component .
They can also contain protocols for cross chain communication and are structured in the following way:
The chain is required if IBC is to be used.
VFS paths are required in specifying the recipients in IBC messages.
<protocol>://<chain>/<path> e.g. ibc://stargaze/home/user/app/component