pryzm_nexus_api/
msg.rs

1use cosmwasm_schema::{cw_serde, QueryResponses};
2use cosmwasm_std::{Uint128, Uint64};
3use pryzm_std::types::cosmos::base::v1beta1::Coin;
4use pryzm_utils::pagination::PageRequest;
5
6#[cw_serde]
7pub struct InstantiateMsg {}
8
9#[cw_serde]
10pub struct MigrateMsg {}
11
12#[cw_serde]
13pub enum StakingMethod {
14    IcStaking {
15        host_chain_id: String,
16        transfer_channel: String,
17    },
18    Contract {},
19}
20
21#[cw_serde]
22pub enum ExecuteMsg {
23    ZeroImpactJoinAssetToNested {
24        staking_method: StakingMethod,
25        pool_id: Uint64,
26        min_lpt_out: Option<Uint128>,
27    },
28    ZeroImpactJoinAssetToYamm {
29        staking_method: StakingMethod,
30        min_lpt_out: Option<Uint128>,
31    },
32    Batch {
33        operations: Vec<Operation>,
34        min_amounts_out: Vec<Coin>,
35    },
36    SetStakeContract {
37        contract: StakeContract,
38    },
39    RemoveStakeContract {
40        denom: String,
41    },
42    BuyAndMatchOrders {
43        order_ids: Vec<u64>,
44        token_in: String,
45        token_out: String,
46        pool_id: u64,
47        min_amounts_out: Vec<Coin>,
48        min_trade_amount: Uint128,
49        max_execution_iterations: usize,
50    },
51    Pause {},
52    Unpause {},
53    UpdateAdmin {
54        address: String,
55    },
56}
57
58#[cw_serde]
59#[derive(QueryResponses)]
60pub enum QueryMsg {
61    #[returns(ZeroImpactJoinAssetToNestedResponse)]
62    SimulateZeroImpactJoinAssetToNested {
63        amount_in: Coin,
64        staking_method: StakingMethod,
65        pool_id: Uint64,
66    },
67    #[returns(ZeroImpactJoinAssetToYammResponse)]
68    SimulateZeroImpactJoinAssetToYamm {
69        amount_in: Coin,
70        staking_method: StakingMethod,
71    },
72    #[returns(BatchResponse)]
73    SimulateBatch {
74        amounts: Vec<Coin>,
75        operations: Vec<Operation>,
76        simulation_type: SimulationType,
77    },
78    #[returns(StakeContractsResponse)]
79    StakeContracts {
80        page_request: Option<PageRequest<String>>,
81    },
82    #[returns(StakeContractResponse)]
83    StakeContract { denom: String },
84    #[returns(FilterApplicableSolverOrdersResponse)]
85    FilterApplicableSolverOrders {
86        order_ids: Vec<u64>,
87        token_in: String,
88        token_out: String,
89        pool_id: u64,
90        min_trade_amount: Uint128,
91        amount_in: Uint128,
92        max_execution_iterations: usize,
93    },
94    #[returns(PausedResponse)]
95    Paused {},
96    #[returns(AdminResponse)]
97    Admin {},
98}
99
100#[cw_serde]
101pub struct PausedResponse {
102    pub paused: bool,
103}
104
105#[cw_serde]
106pub struct AdminResponse {
107    pub admin: String,
108}
109
110#[cw_serde]
111pub struct StakeContractsResponse {
112    pub next_key: Option<String>,
113    pub contracts: Vec<StakeContract>,
114}
115
116#[cw_serde]
117pub struct StakeContractResponse {
118    pub contract: StakeContract,
119}
120
121#[cw_serde]
122pub struct ZeroImpactJoinAssetToNestedResponse {
123    pub base_amount_in: Coin,
124    pub base_amount_to_join: Coin,
125    pub y_amounts_out: Vec<Coin>,
126    pub stake_fee: Coin,
127    pub stake_c_asset: Coin,
128    pub yamm_swap_fee: Vec<Coin>,
129    pub yamm_protocol_fee: Vec<Coin>,
130    pub yamm_lpt: Coin,
131    pub refract_fee: Coin,
132    pub nested_protocol_fee: Vec<Coin>,
133    pub nested_swap_fee: Vec<Coin>,
134    pub nested_lpt: Coin,
135}
136
137#[cw_serde]
138pub struct ZeroImpactJoinAssetToYammResponse {
139    pub base_amount_in: Coin,
140    pub y_amounts_out: Vec<Coin>,
141    pub stake_fee: Coin,
142    pub stake_c_asset: Coin,
143    pub yamm_swap_fee: Vec<Coin>,
144    pub yamm_protocol_fee: Vec<Coin>,
145    pub yamm_lpt: Coin,
146    pub refract_fee: Coin,
147}
148
149#[cw_serde]
150pub struct FilterApplicableSolverOrdersResponse {
151    pub applicable_orders: Vec<u64>,
152}
153
154#[cw_serde]
155pub struct BatchResponse {
156    pub amounts_out: Vec<Coin>,
157    pub amounts_in: Vec<Coin>,
158    pub fees: Vec<Coin>,
159    pub executed_operations: Vec<ExecutedOperation>,
160}
161
162#[cw_serde]
163pub enum StakeContractType {
164    AuuStaking,
165}
166
167#[cw_serde]
168pub struct StakeContract {
169    pub api_type: StakeContractType,
170    pub address: String,
171    pub c_denom: String,
172    pub denom: String,
173}
174
175#[cw_serde]
176pub struct BatchSwapStep {
177    pub pool_id: u64,
178    pub token_in: String,
179    pub token_out: String,
180}
181
182#[cw_serde]
183pub enum SimulationType {
184    GivenIn,
185    GivenOut,
186}
187
188#[cw_serde]
189pub enum Operation {
190    BatchSwap {
191        steps: Vec<BatchSwapStep>,
192    },
193    Refract {
194        token_in: String,
195        maturity_symbol: String,
196    },
197    Redeem {
198        p_asset_denom: String,
199        // this must be provided is maturity level is still active
200        y_asset_denom: Option<String>,
201    },
202    Stake {
203        token_in: String,
204        staking_method: StakingMethod,
205    },
206    InstantUnstake {
207        token_in: String,
208        staking_method: StakingMethod,
209    },
210}
211
212#[cw_serde]
213pub struct ExecutedOperation {
214    pub operation: Operation,
215    pub amounts_out: Vec<Coin>,
216    pub amounts_in: Vec<Coin>,
217    pub fees: Vec<Coin>,
218}