Andromeda
Search…
⌃K

ADO Base

The ADO Base contains all the common functionality applied on all ADOs upon instantiation.

InstantiateMsg

The struct used to hold important information about each instantiated ADO. Implemented as BaseInstantiateMsg.
Rust
pub struct InstantiateMsg {
pub ado_type: String,
pub ado_version: String,
pub operators: Option<Vec<String>>,
pub modules: Option<Vec<Module>>,
pub primitive_contract: Option<String>,
}
Name
Type
Description
ado_type
String
The type of the ADO. Usually is the same as the name. Is automatically set when an ADO is instantiated.
ado_version
String
The version of the ADO.
operators
Option<Vec<String>>
The list of addresses to set as operators on the contract.
modules
Option<Vec<Module>>
The list of modules to add to the ADO.
primitive_contract
Option<String>
The address of the primitive contract to use for data retrieval.
Many of the contracts will have repeating functionality. To normalize one struct across all contracts, we use the AndrRecieve and AndrQuery for certain functionalities that will be shown below. This way each contract doesn't have to independently handle the message.

AndrRecieve

All of the contracts have an AndrReceive as an execute.
Rust
pub enum ExecuteMsg {
AndrReceive(AndromedaMsg)
}

AndromedaMsg

An enum lisiting the different types of AndromedaMsg. Not all of these messages can be executed by any contract.
The withdraw feature should be enabled in order to execute:
  • Withdraw
The modules feature should be enabled in order to execute:
  • RegisterModule
  • DeregisterModule
  • AlterModule
The primitive feature should be enabled in order to execute:
  • RefreshAddress
  • RefreshAddresses
To check if an ADO uses a certain feature, check the AndrReceive section in that contract's documentation. If nothing is specified then the feature is not available.
pub enum AndromedaMsg {
Receive(Option<Binary>),
UpdateOwner {
address: String,
},
UpdateOperators {
operators: Vec<String>,
},
Withdraw {
recipient: Option<Recipient>,
tokens_to_withdraw: Option<Vec<Withdrawal>>,
},
RegisterModule {
module: Module,
},
DeregisterModule {
module_idx: Uint64,
},
AlterModule {
module_idx: Uint64,
module: Module,
},
RefreshAddress {
contract: String,
},
RefreshAddresses {
limit: Option<u32>,
start_after: Option<String>,
},
}

UpdateOwner

Updates the owner of the contract.
Only available to the contract owner.
Rust
JSON
pub enum AndromedaMsg{
UpdateOwner {
address:String
}
}
{
"andr_receive":{
"update_owner":{
"address":"juno1..."
}
}
}
Name
Type
Description
address
String
The address of the new owner.

UpdateOperators

Updates the assigned operators of the contract.
Removes previous list of operators.
Only available to the contract owner.
Rust
JSON
pub enum AndromedaMsg{
UpdateOperators {
operators: Vec<String>,
}
}
{
"andr_receive":{
"update_operators":{
"operators":["juno1...","juno1...",...]
}
}
}
Name
Type
Description
operators
Vec<String>
The new addresses of the operators.

Withdraw

Withdraws token to a specified recipient. Not common to all ADOs, but only to the ones with withdraw feature enabled.
Rust
JSON
pub enum AndromedaMsg{
Withdraw {
recipient: Option<Recipient>,
tokens_to_withdraw: Option<Vec<Withdrawal>>,
}
}
{
"andr_receive":{
"withdraw":{
"recipient":{
"addr":"juno1..."
},
"tokens_to_withdraw":[
{
"token":"uusd",
"withdrawal_type":{
"percentage":"0.3"
}
},
...
]
}
}
Name
Type
Description
recipient
Option<Recipient>
The recipient of the funds.
tokens_to_withdraw
Option<Vec<Withdrawal>
The tokens to withdraw. If not specified all tokens are withdrawn.

Withdrawal

pub struct Withdrawal {
pub token: String,
pub withdrawal_type: Option<WithdrawalType>,
}

WithdrawalType

Withdrawal can be a certain amount or a percentage of the tokens.
pub enum WithdrawalType {
Amount(Uint128),
Percentage(Decimal),
}

Modules

The following can be executed by the contracts that implement modules:

RegisterModule

Adds a module to the contract.
Only the owner or an operator can execute RegisterModule.
Each module is assigned a u64 index so as it can be unregistered/altered by the owner.
Only available to the contract owner/operators.
Rust
JSON
pub enum AndromedaMsg {
RegisterModule {
module: Module,
}
}
{
"andr_receive":{
"register_module": {
"module":{
"module_type": "receipt",
"address":{
"identifier":"juno1..."
},
"is_mutable": true
}
}
}
}
Name
Type
Description
module
Module
The module to add.

DeregisterModule

Removes a module from the contract.
Only available to the contract owner/operators.
Rust
JSON
pub enum AndromedaMsg{
DeregisterModule {
module_idx: Uint64,
}
}
{
"andr_receive":{
"deregister_module":{
"module_idx":"3"
}
}
}
Name
Type
Description
module_idx
Uint64
The index of the module to be removed.

AlterModule

Changes a module to a new one specified.
Only available to the contract owner/operators.
Only mutable modules can be altered.
Rust
JSON
pub enum AndromedaMsg{
AlterModule {
module_idx: Uint64,
module: Module,
}
}
{
"andr_receive":{
"alter_module":{
"module_idx":"3",
"module":{
"module_type": "receipt",
"address":{
"identifier":"juno1..."
}
"is_mutable": false
}
}
}
}
Name
Type
Description
module_idx
Uint64
The index of the module to change.
module
Module
The new module implement.

Primitives

The following messages are used by contracts that implement primitives.

RefreshAddress

Used to save the value for the specified contract in the cache to be used later on in the contract. Queries the primitive contract and saves the result in the cache.
Rust
JSON
pub enum AndromedaMsg
RefreshAddress {
contract: String,
}
{
"refresh_address":"anchor"
}
Name
Type
Description
contract
String
The key used in the primitive contract.

RefreshAddresses

Similar to RefreshAddress, but is used to save all the values from the primitive to the cache.
Rust
JSON
pub enum AndromedaMsg{
RefreshAddresses {
limit: Option<u32>,
start_after: Option<String>,
}
}
{
"andr_receive":{
"refresh_addresses":{
"limit": 15
}
}
}
Name
Type
Description
limit
Option<32>
An optional limit to the number of addresses to refresh. Defaults to 10. The max limit is 20.
start_after
Option<String>
An optional address for which to start after, used for pagination.

AndrQuery

pub enum QueryMsg {
AndrQuery(AndromedaQuery),
}

AndromedaQuery

pub enum AndromedaQuery {
Get(Option<Binary>),
Owner {},
Operators {},
Type {},
OriginalPublisher {},
BlockHeightUponCreation {},
IsOperator { address: String },
Module { id: Uint64 },
ModuleIds {},
Version {},
}

Owner

Queries the owner of the contract.
Rust
Json
pub enum AndromedaQuery{
Owner{}
}
{
"andr_query":{
"owner":{}
}
}

ContractOwnerResponse

Rust
JSON
pub struct ContractOwnerResponse {
pub owner: String
}
{
"owner":"juno1..."
}

Operators

Queries the operators of a contract.
Rust
JSON
pub enum AndromedaQuery{
Operators{}
}
{
"andr_query":{
"operators":{}
}
}

OperatorsResponse

Rust
JSON
pub struct OperatorsResponse {
pub operators: Vec<String>,
}
{
"operators":["juno1...","juno1...",...]
}

IsOperator

Checks if the specified address is an operator of the contract.
Rust
JSON
pub enum AndromedaQuery{
IsOperators{
address:String,
}
}
{
"andr_query":{
"is_operators":{
"address":"juno1..."
}
}
}
Name
Type
Description
address
String
The address to check as operator.

IsOperatorResponse

Rust
JSON
pub struct IsOperatorResponse {
pub is_operator: bool,
}
{
"is_operator": true
}

Type

Queries the Ado_type.
Rust
JSON
pub enum AndromedaQuery {
Type {}
}
{
"type":{}
}

TypeResponse

Rust
JSON
pub struct TypeResponse {
pub ado_type: String,
}
{
"ado_type":"gumball"
}
Name
Type
Description
ado_type
String
The type of the ado.

BlockHeightUponCreation

Queries the block height when the ADO was created.
Rust
JSON
pub enum AndromedaQuery{
BlockHeightUponCreation {},
}
{
"block_height_upon_creation":{}
}

BlockHeightResponse

Rust
JSON
pub struct BlockHeightResponse {
pub block_height: u64,
}
{
"block_height": 200134
}
Name
Type
Description
block_height
u64
The block height at the time of creation of the ADO.

Version

Queries the version of the ADO.
Rust
JSON
pub enum AndromedaQuery {
Version {}
}
{
"version":{}
}

VersionResponse

Rust
JSON
pub struct VersionResponse {
pub version: String,
}
{
"version": "0.1.0"
}
Name
Type
Descripton
version
String
The version of the ADO.

OriginalPublisher

Queries the orginal address that published/instantiated the ADO.
Rust
JSON
pub enum AndromedaQuery {
OriginalPublisher {}
}
{
"original_publisher":{}
}

PublisherResponse

Rust
JSON
pub struct PublisherResponse {
pub original_publisher: String,
}
{
"original_publisher":" juno1..."
}
Name
Type
Description
original_publisher
String
The original address that instantiated/published the ADO.

Modules

The following can be executed by the contracts that implement modules:

Module

Queries a module by its Id.
Rust
JSON
pub enum AndromedaQuery{
Module{
id:Uint64,
}
}
{
"andr_query":{
"module":{
"id":"tokenid"
}
}
}
Name
Type
Description
id
Uint64
The Id of the module to query.

ModuleInfoWithAddress

Struct used to represent a module and its currently recorded address.
Rust
JSON
pub struct ModuleInfoWithAddress {
pub module: Module,
pub address: String,
}
{
"module":{
"module_type":"address_list",
"instantiate":{
"address": "juno1..."
},
"address":"juno1..."
}
Name
Type
Description
module
Module
The information of the module are found in a Module struct.
address
String
The contract address of the module.

ModuleIds

Queries all of the module ids.
Rust
JSON
pub enum AndromedaQuery{
ModuleIds{}
}
{
"andr_query":{
"module_ids":{}
}
Returns a Vec<String> containing the module ids.