levana_perpswap_cosmos/contracts/liquidity_token/entry.rs
1//! Entrypoint messages for liquidity token proxy
2use super::LiquidityTokenKind;
3use crate::prelude::*;
4use cosmwasm_schema::QueryResponses;
5use cosmwasm_std::{Binary, Uint128};
6use cw_utils::Expiration;
7
8/// Instantiate message for liquidity token proxy
9#[cw_serde]
10pub struct InstantiateMsg {
11 /// The factory address
12 pub factory: RawAddr,
13 /// Unique market identifier, also used for `symbol` in ContractInfo response
14 pub market_id: MarketId,
15 /// The liquidity token kind
16 pub kind: LiquidityTokenKind,
17}
18
19/// Execute message for liquidity token proxy
20#[cw_serde]
21pub enum ExecuteMsg {
22 /************** Cw20 spec *******************/
23 /// Transfer is a base message to move tokens to another account without triggering actions
24 Transfer {
25 /// Recipient of the funds
26 recipient: RawAddr,
27 /// Amount to transfer
28 amount: Uint128,
29 },
30 /// Send is a base message to transfer tokens to a contract and trigger an action
31 /// on the receiving contract.
32 Send {
33 /// Contract to receive the funds
34 contract: RawAddr,
35 /// Amount to send
36 amount: Uint128,
37 /// Message to execute on the receiving contract
38 msg: Binary,
39 },
40 /// Allows spender to access an additional amount tokens
41 /// from the owner's (env.sender) account. If expires is Some(), overwrites current allowance
42 /// expiration with this one.
43 IncreaseAllowance {
44 /// Who is allowed to spend
45 spender: RawAddr,
46 /// Amount they can spend
47 amount: Uint128,
48 /// When the allowance expires
49 expires: Option<Expiration>,
50 },
51 /// Lowers the spender's access of tokens
52 /// from the owner's (env.sender) account by amount. If expires is Some(), overwrites current
53 /// allowance expiration with this one.
54 DecreaseAllowance {
55 /// Whose spending to reduced
56 spender: RawAddr,
57 /// Amount to reduce by
58 amount: Uint128,
59 /// When the allowance should expire
60 expires: Option<Expiration>,
61 },
62 /// Transfers amount tokens from owner -> recipient
63 /// if `env.sender` has sufficient pre-approval.
64 TransferFrom {
65 /// Owner of the tokens being transferred
66 owner: RawAddr,
67 /// Recipient of the tokens
68 recipient: RawAddr,
69 /// Amount to send
70 amount: Uint128,
71 },
72 /// Sends amount tokens from owner -> contract
73 /// if `env.sender` has sufficient pre-approval.
74 SendFrom {
75 /// Owner of the tokens being transferred
76 owner: RawAddr,
77 /// Contract to receive the funds
78 contract: RawAddr,
79 /// Amount to send
80 amount: Uint128,
81 /// Message to execute on the receiving contract
82 msg: Binary,
83 },
84}
85
86/// Query message for liquidity token proxy
87#[cw_serde]
88#[derive(QueryResponses)]
89pub enum QueryMsg {
90 /************** Cw20 spec *******************/
91 /// * returns [crate::contracts::cw20::entry::BalanceResponse]
92 ///
93 /// The current balance of the given address, 0 if unset.
94 #[returns(crate::contracts::cw20::entry::BalanceResponse)]
95 Balance {
96 /// Address whose balance to check
97 address: RawAddr,
98 },
99
100 /// * returns [crate::contracts::cw20::entry::TokenInfoResponse]
101 ///
102 /// Returns metadata on the contract - name, decimals, supply, etc.
103 #[returns(crate::contracts::cw20::entry::TokenInfoResponse)]
104 TokenInfo {},
105
106 /// * returns [crate::contracts::cw20::entry::AllowanceResponse]
107 ///
108 /// Returns how much spender can use from owner account, 0 if unset.
109 #[returns(crate::contracts::cw20::entry::AllowanceResponse)]
110 Allowance {
111 /// Owner of tokens
112 owner: RawAddr,
113 /// Who is allowed to spend them
114 spender: RawAddr,
115 },
116
117 /// * returns [crate::contracts::cw20::entry::AllAllowancesResponse]
118 ///
119 /// Returns all allowances this owner has approved. Supports pagination.
120 #[returns(crate::contracts::cw20::entry::AllAllowancesResponse)]
121 AllAllowances {
122 /// Owner of tokens
123 owner: RawAddr,
124 /// Last spender we saw
125 start_after: Option<RawAddr>,
126 /// How many spenders to iterate on
127 limit: Option<u32>,
128 },
129
130 /// * returns [crate::contracts::cw20::entry::AllSpenderAllowancesResponse]
131 ///
132 /// Returns all allowances this spender has been granted. Supports pagination.
133 #[returns(crate::contracts::cw20::entry::AllSpenderAllowancesResponse)]
134 AllSpenderAllowances {
135 /// Spender address
136 spender: RawAddr,
137 /// Last owner we saw
138 start_after: Option<RawAddr>,
139 /// How many owners to iterate on
140 limit: Option<u32>,
141 },
142
143 /// * returns [crate::contracts::cw20::entry::AllAccountsResponse]
144 ///
145 /// Returns all accounts that have balances. Supports pagination.
146 #[returns(crate::contracts::cw20::entry::AllAccountsResponse)]
147 AllAccounts {
148 /// Last owner we saw
149 start_after: Option<RawAddr>,
150 /// How many owners to iterate on
151 limit: Option<u32>,
152 },
153
154 /// * returns [crate::contracts::cw20::entry::MarketingInfoResponse]
155 ///
156 /// Returns more metadata on the contract to display in the client:
157 /// - description, logo, project url, etc.
158 #[returns(crate::contracts::cw20::entry::MarketingInfoResponse)]
159 MarketingInfo {},
160
161 /************** Proprietary *******************/
162 /// * returns [cw2::ContractVersion]
163 #[returns(cw2::ContractVersion)]
164 Version {},
165
166 /// * returns [LiquidityTokenKind]
167 #[returns(LiquidityTokenKind)]
168 Kind {},
169}
170
171/// Placeholder migration message
172#[cw_serde]
173pub struct MigrateMsg {}