use andromeda_std::{
amp::recipient::Recipient, andr_exec, andr_instantiate, andr_instantiate_modules, andr_query,
};
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::Uint128;
use cw_utils::Expiration;
#[cw_serde]
pub struct AddressWeight {
pub recipient: Recipient,
pub weight: Uint128,
}
#[cw_serde]
pub struct Splitter {
pub recipients: Vec<AddressWeight>,
pub lock: Expiration,
}
#[andr_instantiate]
#[andr_instantiate_modules]
#[cw_serde]
pub struct InstantiateMsg {
pub recipients: Vec<AddressWeight>,
pub lock_time: Option<u64>,
}
#[andr_exec]
#[cw_serde]
pub enum ExecuteMsg {
UpdateRecipients { recipients: Vec<AddressWeight> },
UpdateRecipientWeight { recipient: AddressWeight },
AddRecipient { recipient: AddressWeight },
RemoveRecipient { recipient: Recipient },
UpdateLock { lock_time: u64 },
Send {},
}
#[andr_query]
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(GetSplitterConfigResponse)]
GetSplitterConfig {},
#[returns(GetUserWeightResponse)]
GetUserWeight { user: Recipient },
}
#[cw_serde]
pub struct GetSplitterConfigResponse {
pub config: Splitter,
}
#[cw_serde]
pub struct GetUserWeightResponse {
pub weight: Uint128,
pub total_weight: Uint128,
}