1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use cosmwasm_schema::cw_serde;

#[cw_serde]
pub enum SgWhitelistExecuteMsg {
    /// Update admin of the list
    UpdateAdmin { admin: String },
    /// Add addresses to the list
    AddAddresses { addresses: Vec<String> },
    /// Remove an address from the list
    RemoveAddresses { addresses: Vec<String> },
    /// Called by another contract to process an address
    /// Returns true if the address is whitelisted and processed
    ProcessAddress { address: String },
    /// Update per address limit
    UpdatePerAddressLimit { limit: u32 },
}

#[cw_serde]
pub enum SgWhitelistQueryMsg {
    /// Query the current contract admin
    Admin {},
    /// Query the number of addresses
    AddressCount {},
    /// Query the per address limit
    PerAddressLimit { limit: u64 },
    /// Query if address is included
    IncludesAddress { address: String },
    /// Query if address is included and under per address limit
    IsProcessable { address: String },
}

#[cw_serde]
pub struct CountResponse {
    pub count: u64,
}

#[cw_serde]
pub struct PerAddressLimitResponse {
    pub limit: u64,
}

#[cw_serde]
pub struct IncludesAddressResponse {
    /// Whether the address is included in the whitelist
    pub included: bool,
}

#[cw_serde]
pub struct IsProcessableResponse {
    pub processable: bool,
}