This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the new margin open estimation as a query (#67)
* feat: add the new margin open estimation as a query * fix: remove raw dicount field and use user address * docs: add comment to why user_address is not used * docs: typo fix * fix: add the user address field to the swap estimation query * docs: typo fix --------- Co-authored-by: Cosmic Vagabond <[email protected]>
- Loading branch information
1 parent
62bcdf3
commit 69595e6
Showing
9 changed files
with
168 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use super::*; | ||
use cosmwasm_std::{Coin, Decimal, StdResult}; | ||
use elys_bindings::query_resp::MarginOpenEstimationResponse; | ||
|
||
pub fn margin_open_estimation( | ||
deps: Deps<ElysQuery>, | ||
position: MarginPosition, | ||
leverage: Decimal, | ||
trading_asset: String, | ||
collateral: Coin, | ||
take_profit_price: Decimal, | ||
_user_address: String, // Parameter unused until account history work | ||
) -> StdResult<MarginOpenEstimationResponse> { | ||
let querier = ElysQuerier::new(&deps.querier); | ||
|
||
querier.margin_open_estimation( | ||
position, | ||
leverage, | ||
trading_asset, | ||
collateral, | ||
take_profit_price, | ||
Decimal::zero(), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.