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.
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 | How to instantiate the module. | |
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. 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,
}
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":"juno1..."
},
"is_mutable": false
},
{
"module_type": "rates",
"address": {
"identifier":"my_rates"
},
"is_mutable": true
}
]
}
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 {},
}
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 | Receipt | Rates | Offers |
---|---|---|---|---|
auction | ||||
cw721 | ||||
cw20 | ||||
rate-limiting-withdrawals | ||||
splitter | ||||
timelock | ||||
weighted-distribution-splitter | ||||
crowdfund | ||||
marketplace |
Last modified 14d ago