Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
feat: Add missing pools (#432)
Browse files Browse the repository at this point in the history
* update: leveragelp position resp

* update: test

Co-authored-by: Amit Yadav <[email protected]>

---------

Co-authored-by: Amit Yadav <[email protected]>
  • Loading branch information
cryptokage1996 and amityadav0 authored Jul 19, 2024
1 parent baa74a0 commit 4db5912
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
11 changes: 9 additions & 2 deletions bindings/src/query_resp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ pub struct LeveragelpParamsResponse {
}

#[cw_serde]
pub struct LeveragelpPosition {
pub struct Position {
pub address: String,
pub collateral: Coin,
pub liabilities: Int128,
Expand All @@ -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 {
Expand All @@ -638,7 +645,7 @@ impl LeveragelpPositionsResponseRaw {
.clone()
.unwrap_or(vec![])
.iter()
.map(|x| x.id)
.map(|x| x.position.id)
.collect()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4db5912

Please sign in to comment.