Andromeda
Search
K

Module Definitions

An Andromeda Module is a struct that can be attached using the Instantiate Message to our ADOs and accessed in any standard Execute Message via generic hooks.

Module Definitions

A struct describing a token module, provided with the instantiation message this struct is used to record the info about the module and how/if it should be instantiated.
pub struct Module {
pub module_type: String,
pub address: AndrAddress,
pub is_mutable: bool,
}
Name
Type
Description
module_type
String
The name of the module to add. Can be set one of the following: "rates", "offers", "address-list", "receipt" .
address
The reference to the module ADO. Can be the contract address or the name of the component in an App.
is_mutable
bool
Whether the module can be later modified or not. This means that if is_mutable is set to true, then you can run the base executes deregister_module and alter _module.
Any ADO that can implement modules uses this Module struct in its instantiation to add the modules to the ADO.

AndrAdress

A struct used to reference another ADO contract. Can be either an address, or identifier of an ADO in an app.
pub struct AndrAddress {
pub identifier: String,
}

Defining Modules

When instantiating an Andromeda Digital Object contract the modules can be defined within the modules field of the InstantiateMsg like so:
{
"modules": [
{
"module_type": "address_list",
"address": {
"identifier":"andr1..."
},
"is_mutable": false
},
{
"module_type": "rates",
"address": {
"identifier":"my_rates"
},
"is_mutable": true
}
]
}

Changing/Querying Modules.

Any contract that implements modules may implement the following messages:
pub enum AndromedaMsg {
RegisterModule {
module: Module,
},
DeregisterModule {
module_idx: Uint64,
},
AlterModule {
module_idx: Uint64,
module: Module,
},
}
pub enum AndromedaQuery {
Module { id: Uint64 },
ModuleIds {},
}
More details about each of these messages can be found in AndrReceive/AndrQuery

Module Usage

As we know by now, not all ADOs can have modules added to them. Even the ADOs that accept modules do not necessarily accept all modules. Below is a summary on the modules that can be added to each ADO.
ADO
Address List
Rates
Offers
auction
cw721
cw20
rate-limiting-withdrawals
splitter
timelock
weighted-distribution-splitter
crowdfund
marketplace