andromeda_std/os/
economics.rs

1use cosmwasm_schema::{cw_serde, QueryResponses};
2use cosmwasm_std::{Addr, Uint128};
3use cw20::Cw20ReceiveMsg;
4
5use crate::{ado_base::ownership::OwnershipMessage, amp::AndrAddr};
6
7#[cw_serde]
8pub struct InstantiateMsg {
9    /// Address of the Kernel contract on chain
10    pub kernel_address: String,
11    pub owner: Option<String>,
12}
13
14#[cw_serde]
15pub enum ExecuteMsg {
16    /// Deposit funds to be used by the Andromeda economics module to pay for ADO fees.
17    ///
18    /// An optional valid VFS path can be provided to deposit funds on behalf of another address.
19    Deposit {
20        address: Option<AndrAddr>,
21    },
22    /// Pay a fee for the given action. The sender must be a valid ADO contract.
23    ///
24    /// Fees are paid in the following fallthrough priority:
25    /// 1. The balance of the ADO contract itself
26    /// 2. The balance of the App contract for the ADO
27    /// 3. The provided payee address
28    PayFee {
29        payee: Addr,
30        action: String,
31    },
32    /// Withdraw native funds from the Andromeda economics module.
33    ///
34    /// If no amount is provided all funds are withdrawn for the given asset.
35    Withdraw {
36        amount: Option<Uint128>,
37        asset: String,
38    },
39    #[serde(rename = "withdraw_cw20")]
40    /// Withdraw CW20 funds from the Andromeda economics module.
41    ///
42    /// If no amount is provided all funds are withdrawn for the given asset.
43    WithdrawCW20 {
44        amount: Option<Uint128>,
45        asset: String,
46    },
47    Receive(Cw20ReceiveMsg),
48    // Base message
49    Ownership(OwnershipMessage),
50}
51
52#[cw_serde]
53pub enum Cw20HookMsg {
54    /// Deposit CW20 tokens for use in paying fees
55    ///
56    /// An optional valid VFS path can be provided in order to deposit on behalf of another address.
57    Deposit { address: Option<AndrAddr> },
58}
59
60#[cw_serde]
61#[derive(QueryResponses)]
62pub enum QueryMsg {
63    /// Queries the current balance for a given AndrAddr and asset tuple
64    ///
65    /// Returns a `Uint128` representing the current balance
66    #[returns(Uint128)]
67    Balance { asset: String, address: AndrAddr },
68    // Base queries
69    #[returns(crate::ado_base::version::VersionResponse)]
70    Version {},
71    #[returns(crate::ado_base::ado_type::TypeResponse)]
72    Type {},
73    #[returns(crate::ado_base::ownership::ContractOwnerResponse)]
74    Owner {},
75    #[returns(crate::ado_base::kernel_address::KernelAddressResponse)]
76    KernelAddress {},
77}
78
79#[cfg(test)]
80mod test {}