|
1 | 1 | use std::collections::HashMap; |
2 | 2 |
|
3 | 3 | use cosmwasm_schema::cw_serde; |
4 | | -use cosmwasm_std::{DepsMut, StdResult, Storage, Uint128, Addr, Decimal256}; |
| 4 | +use cosmwasm_std::{DepsMut, StdResult, Storage, Uint128, Addr, Decimal256, Decimal}; |
5 | 5 | use cw_storage_plus::{Item, Map}; |
6 | 6 | use dexter::asset::AssetInfo; |
7 | 7 | use dexter::pool::Config; |
@@ -35,7 +35,15 @@ pub struct MathConfig { |
35 | 35 |
|
36 | 36 | #[cw_serde] |
37 | 37 | pub struct StableSwapConfig { |
| 38 | + /// Max allowed spread between the price of the asset and the price of the pool. |
| 39 | + /// If the spread is greater than this value, the swap will fail. |
| 40 | + /// This value is configurable by the Pool Manager. |
| 41 | + /// Max allowed spread is in the range (0, 1) non-inclusive. |
| 42 | + pub max_allowed_spread: Decimal, |
| 43 | + /// If this is true, then the scaling factors can be updated by the scaling_factor_manager. |
38 | 44 | pub supports_scaling_factors_update: bool, |
| 45 | + /// The vector of scaling factors for each asset in the pool. |
| 46 | + /// The scaling factor is used to scale the volume of the asset in the pool for the stableswap invariant calculations. |
39 | 47 | pub scaling_factors: Vec<AssetScalingFactor>, |
40 | 48 | // This address is allowed to update scaling factors. This address is required if support_scaling_factors_update is true. |
41 | 49 | pub scaling_factor_manager: Option<Addr>, |
@@ -78,6 +86,8 @@ pub struct Twap { |
78 | 86 | pub struct StablePoolParams { |
79 | 87 | /// The current stableswap pool amplification |
80 | 88 | pub amp: u64, |
| 89 | + /// Max allowed spread for the trades |
| 90 | + pub max_allowed_spread: Decimal, |
81 | 91 | /// Support scaling factors update |
82 | 92 | pub supports_scaling_factors_update: bool, |
83 | 93 | /// Scaling factors |
@@ -108,6 +118,7 @@ pub enum StablePoolUpdateParams { |
108 | 118 | StopChangingAmp {}, |
109 | 119 | UpdateScalingFactorManager { manager: Addr }, |
110 | 120 | UpdateScalingFactor { asset_info: AssetInfo, scaling_factor: Decimal256 }, |
| 121 | + UpdateMaxAllowedSpread { max_allowed_spread: Decimal }, |
111 | 122 | } |
112 | 123 |
|
113 | 124 | // ----------------x----------------x----------------x---------------- |
|
0 commit comments