InstantiateMsg

First, we will take a look at the InstantiateMsg. There are two adjustments we make:

  1. Adding #[andr_instantiate]

We added the #[andr_instantiate] attribute to the InstantiateMsg struct. This macro automatically includes fields common to all ADOs, such as ADO owner and kernel address.

  1. Using AndrAddr Instead of String for Addresses

We replaced the standard String type for voter addresses with AndrAddr. In ADOs, you will almost always see AndrAddr used instead of String addresses. This means addresses can point to both:

Human-readable addresses: e.g., cosmos1...

VFS paths: e.g., /home/user/app/component

msg.rs
use andromeda_std::amp::AndrAddr;

#[andr_instantiate]
#[cw_serde]
pub struct InstantiateMsg {
    pub voters: Vec<Voter>,
    pub threshold: Threshold,
    pub max_voting_period: Duration,
}
#[cw_serde]
pub struct Voter {
    pub addr: AndrAddr,
    pub weight: u64,
}

The rest of the logic remains the same:

Last updated

Was this helpful?