From 4db59124bc5a5d241c5f25b49773f0da17d8ba2b Mon Sep 17 00:00:00 2001 From: cryptokage <26vivek06@gmail.com> Date: Fri, 19 Jul 2024 12:11:34 +0530 Subject: [PATCH] feat: Add missing pools (#432) * update: leveragelp position resp * update: test Co-authored-by: Amit Yadav --------- Co-authored-by: Amit Yadav --- bindings/src/query_resp.rs | 11 +++++-- .../claim_rewards_request.rs | 29 +++++++++++-------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/bindings/src/query_resp.rs b/bindings/src/query_resp.rs index 650e24b4..47f76165 100644 --- a/bindings/src/query_resp.rs +++ b/bindings/src/query_resp.rs @@ -608,7 +608,7 @@ pub struct LeveragelpParamsResponse { } #[cw_serde] -pub struct LeveragelpPosition { +pub struct Position { pub address: String, pub collateral: Coin, pub liabilities: Int128, @@ -620,6 +620,13 @@ pub struct LeveragelpPosition { pub amm_pool_id: u64, pub stop_loss_price: Decimal, } +#[cw_serde] +pub struct LeveragelpPosition { + pub position: Position, + pub interest_rate_hour: Decimal, + pub interest_rate_hour_usd: Decimal, +} + #[cw_serde] pub struct LeveragelpPositionResponse { @@ -638,7 +645,7 @@ impl LeveragelpPositionsResponseRaw { .clone() .unwrap_or(vec![]) .iter() - .map(|x| x.id) + .map(|x| x.position.id) .collect() } } diff --git a/contracts/trade-shield-contract/src/tests/claim_rewards_request/claim_rewards_request.rs b/contracts/trade-shield-contract/src/tests/claim_rewards_request/claim_rewards_request.rs index 2006a695..9dbd71d0 100644 --- a/contracts/trade-shield-contract/src/tests/claim_rewards_request/claim_rewards_request.rs +++ b/contracts/trade-shield-contract/src/tests/claim_rewards_request/claim_rewards_request.rs @@ -25,6 +25,7 @@ use elys_bindings::query_resp::LeveragelpPosition; use elys_bindings::query_resp::LeveragelpPositionsResponse; use elys_bindings::query_resp::MasterchefUserPendingRewardData; use elys_bindings::query_resp::MasterchefUserPendingRewardResponse; +use elys_bindings::query_resp::Position; use elys_bindings::query_resp::Validator; use elys_bindings::trade_shield::msg::ExecuteMsg; use elys_bindings::types::PageResponse; @@ -122,19 +123,23 @@ impl Module for ElysModuleWrapper { } ElysQuery::LeveragelpQueryPositionsForAddress { .. } => { let position = LeveragelpPosition { - address: "user".to_string(), - collateral: Coin { - denom: "uelys".to_string(), - amount: Uint128::new(100000000), + position: Position { + address: "user".to_string(), + collateral: Coin { + denom: "uelys".to_string(), + amount: Uint128::new(100000000), + }, + liabilities: Int128::zero(), + interest_paid: Int128::zero(), + leverage: Decimal::new(Uint128::new(10)), + leveraged_lp_amount: Int128::new(10000000), + position_health: Decimal::one(), + id: 1, + amm_pool_id: 1, + stop_loss_price: Decimal::one(), }, - liabilities: Int128::zero(), - interest_paid: Int128::zero(), - leverage: Decimal::new(Uint128::new(10)), - leveraged_lp_amount: Int128::new(10000000), - position_health: Decimal::one(), - id: 1, - amm_pool_id: 1, - stop_loss_price: Decimal::one(), + interest_rate_hour: Decimal::zero(), + interest_rate_hour_usd: Decimal::zero(), }; let resp = LeveragelpPositionsResponse {