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 fields for perpetual asset
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptokage1996 committed Sep 21, 2024
1 parent 75d0df1 commit a224a67
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions bindings/src/trade_shield/types/perpetual_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use crate::ElysQuerier;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{DecCoin, Decimal, Decimal256, SignedDecimal, StdError, StdResult, Uint128};

use super::Fee;

#[cw_serde]
pub struct PerpetualAssets {
pub total_perpetual_asset_balance: DecCoin,
Expand All @@ -24,7 +26,8 @@ pub struct PerpetualAsset {
pub health: SignedDecimal,
pub profit_price: DecCoin,
pub stop_loss: Option<DecCoin>,
pub fees: Decimal,
pub borrow_fee: Fee,
pub funding_fee: Fee,
}

impl PerpetualAsset {
Expand Down Expand Up @@ -91,16 +94,8 @@ impl PerpetualAsset {
}),
None => None,
},
fees: Decimal::from_atomics(
Uint128::new(mtp.mtp.borrow_interest_paid_collateral.i128() as u128),
collateral_info.asset_info.decimal as u32,
)
.map_err(|e| {
StdError::generic_err(format!(
"failed to convert borrow_interest_paid_collateral to Decimal256: {}",
e
))
})?,
borrow_fee: Fee::default(),
funding_fee: Fee::default(),
})
}
}
Expand Down

0 comments on commit a224a67

Please sign in to comment.