@@ -102,27 +102,27 @@ pub struct AmmSwapEstimationByDenomResponse {
102102}
103103#[ cw_serde]
104104pub struct PerpetualOpenEstimationRawResponse {
105- pub position : i32 ,
106- pub leverage : String ,
107- pub trading_asset : String ,
108- pub collateral : Coin ,
109- pub interest_amount : Int128 ,
110- pub position_size : Coin ,
111- pub swap_fee : String ,
112- pub discount : String ,
113- pub open_price : String ,
114- pub take_profit_price : String ,
115- pub liquidation_price : String ,
116- pub estimated_pnl : Int128 ,
117- pub estimated_pnl_denom : String ,
118- pub available_liquidity : Coin ,
119- pub slippage : String ,
120- pub weight_balance_ratio : String ,
121- pub borrow_interest_rate : String ,
122- pub funding_rate : String ,
123- pub price_impact : String ,
124- pub borrow_fee : Coin ,
125- pub funding_fee : Coin ,
105+ pub position : Option < i32 > ,
106+ pub leverage : Option < String > ,
107+ pub trading_asset : Option < String > ,
108+ pub collateral : Option < Coin > ,
109+ pub interest_amount : Option < Int128 > ,
110+ pub position_size : Option < Coin > ,
111+ pub swap_fee : Option < String > ,
112+ pub discount : Option < String > ,
113+ pub open_price : Option < String > ,
114+ pub take_profit_price : Option < String > ,
115+ pub liquidation_price : Option < String > ,
116+ pub estimated_pnl : Option < Int128 > ,
117+ pub estimated_pnl_denom : Option < String > ,
118+ pub available_liquidity : Option < Coin > ,
119+ pub slippage : Option < String > ,
120+ pub weight_balance_ratio : Option < String > ,
121+ pub borrow_interest_rate : Option < String > ,
122+ pub funding_rate : Option < String > ,
123+ pub price_impact : Option < String > ,
124+ pub borrow_fee : Option < Coin > ,
125+ pub funding_fee : Option < Coin > ,
126126}
127127
128128#[ cw_serde]
@@ -153,44 +153,46 @@ pub struct PerpetualOpenEstimationResponse {
153153impl Into < StdResult < PerpetualOpenEstimationResponse > > for PerpetualOpenEstimationRawResponse {
154154 fn into ( self ) -> StdResult < PerpetualOpenEstimationResponse > {
155155 Ok ( PerpetualOpenEstimationResponse {
156- position : PerpetualPosition :: try_from_i32 ( self . position ) ?,
157- leverage : SignedDecimal :: from_str ( & self . leverage )
158- . map_or ( SignedDecimal :: zero ( ) , |leverage| leverage) ,
159- interest_amount : self . interest_amount ,
160- trading_asset : self . trading_asset ,
161- collateral : self . collateral ,
162- position_size : self . position_size ,
163- swap_fee : Decimal :: from_str ( & self . swap_fee )
164- . map_or ( Decimal :: zero ( ) , |swap_fee| swap_fee) ,
165- discount : Decimal :: from_str ( & self . discount )
166- . map_or ( Decimal :: zero ( ) , |discount| discount) ,
167- open_price : Decimal :: from_str ( & self . open_price )
168- . map_or ( Decimal :: zero ( ) , |open_price| open_price) ,
169- take_profit_price : SignedDecimal256 :: from_str ( & self . take_profit_price )
170- . map_or ( SignedDecimal256 :: zero ( ) , |take_profit_price| {
171- take_profit_price
172- } ) ,
173- liquidation_price : SignedDecimal :: from_str ( & self . liquidation_price )
174- . map_or ( SignedDecimal :: zero ( ) , |liquidation_price| liquidation_price) ,
175- estimated_pnl : self . estimated_pnl ,
176- estimated_pnl_denom : self . estimated_pnl_denom ,
177- available_liquidity : self . available_liquidity ,
178- slippage : Decimal :: from_str ( & self . slippage )
179- . map_or ( Decimal :: zero ( ) , |slippage| slippage) ,
180- weight_balance_ratio : SignedDecimal :: from_str ( & self . weight_balance_ratio )
181- . map_or ( SignedDecimal :: zero ( ) , |weight_balance_ratio| {
182- weight_balance_ratio
183- } ) ,
184- borrow_interest_rate : SignedDecimal :: from_str ( & self . borrow_interest_rate )
185- . map_or ( SignedDecimal :: zero ( ) , |borrow_interest_rate| {
186- borrow_interest_rate
187- } ) ,
188- funding_rate : SignedDecimal :: from_str ( & self . funding_rate )
189- . map_or ( SignedDecimal :: zero ( ) , |funding_rate| funding_rate) ,
190- price_impact : SignedDecimal :: from_str ( & self . price_impact )
191- . map_or ( SignedDecimal :: zero ( ) , |price_impact| price_impact) ,
192- borrow_fee : self . borrow_fee ,
193- funding_fee : self . funding_fee ,
156+ position : PerpetualPosition :: try_from_i32 ( self . position . unwrap_or_default ( ) ) ?,
157+ leverage : SignedDecimal :: from_str ( self . leverage . unwrap_or_default ( ) . as_str ( ) )
158+ . unwrap_or_default ( ) ,
159+ trading_asset : self . trading_asset . unwrap_or_default ( ) ,
160+ collateral : self . collateral . unwrap_or_default ( ) ,
161+ interest_amount : self . interest_amount . unwrap_or_default ( ) ,
162+ position_size : self . position_size . unwrap_or_default ( ) ,
163+ swap_fee : Decimal :: from_str ( self . swap_fee . unwrap_or_default ( ) . as_str ( ) )
164+ . unwrap_or_default ( ) ,
165+ discount : Decimal :: from_str ( self . discount . unwrap_or_default ( ) . as_str ( ) )
166+ . unwrap_or_default ( ) ,
167+ open_price : Decimal :: from_str ( self . open_price . unwrap_or_default ( ) . as_str ( ) )
168+ . unwrap_or_default ( ) ,
169+ take_profit_price : SignedDecimal256 :: from_str (
170+ self . take_profit_price . unwrap_or_default ( ) . as_str ( ) ,
171+ )
172+ . unwrap_or_default ( ) ,
173+ liquidation_price : SignedDecimal :: from_str (
174+ self . liquidation_price . unwrap_or_default ( ) . as_str ( ) ,
175+ )
176+ . unwrap_or_default ( ) ,
177+ estimated_pnl : self . estimated_pnl . unwrap_or_default ( ) ,
178+ estimated_pnl_denom : self . estimated_pnl_denom . unwrap_or_default ( ) ,
179+ available_liquidity : self . available_liquidity . unwrap_or_default ( ) ,
180+ slippage : Decimal :: from_str ( self . slippage . unwrap_or_default ( ) . as_str ( ) )
181+ . unwrap_or_default ( ) ,
182+ weight_balance_ratio : SignedDecimal :: from_str (
183+ self . weight_balance_ratio . unwrap_or_default ( ) . as_str ( ) ,
184+ )
185+ . unwrap_or_default ( ) ,
186+ borrow_interest_rate : SignedDecimal :: from_str (
187+ self . borrow_interest_rate . unwrap_or_default ( ) . as_str ( ) ,
188+ )
189+ . unwrap_or_default ( ) ,
190+ funding_rate : SignedDecimal :: from_str ( self . funding_rate . unwrap_or_default ( ) . as_str ( ) )
191+ . unwrap_or_default ( ) ,
192+ price_impact : SignedDecimal :: from_str ( self . price_impact . unwrap_or_default ( ) . as_str ( ) )
193+ . unwrap_or_default ( ) ,
194+ borrow_fee : self . borrow_fee . unwrap_or_default ( ) ,
195+ funding_fee : self . funding_fee . unwrap_or_default ( ) ,
194196 } )
195197 }
196198}
@@ -646,10 +648,10 @@ pub struct LeveragelpParams {
646648#[ cw_serde]
647649#[ derive( Default ) ]
648650pub struct PerpetualParamsRaw {
649- pub option : Option < bool > ,
650651 pub leverage_max : Option < Decimal > ,
651652 pub borrow_interest_rate_max : Option < Decimal > ,
652653 pub borrow_interest_rate_min : Option < Decimal > ,
654+ pub min_borrow_interest_amount : Option < Uint128 > ,
653655 pub borrow_interest_rate_increase : Option < Decimal > ,
654656 pub borrow_interest_rate_decrease : Option < Decimal > ,
655657 pub health_gain_factor : Option < Decimal > ,
@@ -675,10 +677,10 @@ pub struct PerpetualParamsRaw {
675677
676678#[ cw_serde]
677679pub struct PerpetualParams {
678- pub option : bool ,
679680 pub leverage_max : Decimal ,
680681 pub borrow_interest_rate_max : Decimal ,
681682 pub borrow_interest_rate_min : Decimal ,
683+ pub min_borrow_interest_amount : Uint128 ,
682684 pub borrow_interest_rate_increase : Decimal ,
683685 pub borrow_interest_rate_decrease : Decimal ,
684686 pub health_gain_factor : Decimal ,
@@ -1264,7 +1266,7 @@ pub struct ParameterParamsResponse {
12641266impl Into < PerpetualParams > for PerpetualParamsRaw {
12651267 fn into ( self ) -> PerpetualParams {
12661268 PerpetualParams {
1267- option : self . option . unwrap_or_default ( ) ,
1269+ min_borrow_interest_amount : self . min_borrow_interest_amount . unwrap_or_default ( ) ,
12681270 leverage_max : self . leverage_max . unwrap_or_default ( ) ,
12691271 borrow_interest_rate_max : self . borrow_interest_rate_max . unwrap_or_default ( ) ,
12701272 borrow_interest_rate_min : self . borrow_interest_rate_min . unwrap_or_default ( ) ,
0 commit comments