From 608063d527a7722e9e0f8daed64ca1b8fdf52619 Mon Sep 17 00:00:00 2001 From: CryptoKage2306 <26vivek06@gmail.com> Date: Thu, 4 Jul 2024 17:40:12 +0530 Subject: [PATCH 1/2] update: leveragelp position resp --- 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 573450ff..e2abcc10 100644 --- a/bindings/src/query_resp.rs +++ b/bindings/src/query_resp.rs @@ -609,7 +609,7 @@ pub struct LeveragelpParamsResponse { } #[cw_serde] -pub struct LeveragelpPosition { +pub struct Position { pub address: String, pub collateral: Coin, pub liabilities: Int128, @@ -621,6 +621,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 { @@ -639,7 +646,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 01dfc8e4..c128a4a1 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::one(), + interest_rate_hour_usd: Decimal::zero(), }; let resp = LeveragelpPositionsResponse { From 8f9ad7f81d9271fa680f75fa268c5c3757fa54cf Mon Sep 17 00:00:00 2001 From: cryptokage <26vivek06@gmail.com> Date: Wed, 17 Jul 2024 17:47:50 +0530 Subject: [PATCH 2/2] update: test Co-authored-by: Amit Yadav --- .../src/tests/claim_rewards_request/claim_rewards_request.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c128a4a1..469b0710 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 @@ -138,7 +138,7 @@ impl Module for ElysModuleWrapper { amm_pool_id: 1, stop_loss_price: Decimal::one(), }, - interest_rate_hour: Decimal::one(), + interest_rate_hour: Decimal::zero(), interest_rate_hour_usd: Decimal::zero(), };