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 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add usdc price query * chore: fix endpoint url * chore: define usdc price resp * chore: update query_message return type * chore: update contract version
- Loading branch information
1 parent
db522f2
commit 97bc3a1
Showing
8 changed files
with
49 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use super::*; | ||
use cosmwasm_std::{Decimal, Uint128}; | ||
use crate::bindings::{query::ElysQuery, querier::ElysQuerier}; | ||
use crate::types::ElysDenom; | ||
use crate::msg::query_resp::earn::GetUsdcPriceResp; | ||
|
||
pub fn get_usdc_price(deps: Deps<ElysQuery>) -> Result<GetUsdcPriceResp, ContractError> { | ||
let querier = ElysQuerier::new(&deps.querier); | ||
let usdc_oracle_price = querier.get_oracle_price(ElysDenom::USDC.as_str().to_string(), "".to_string(), 0)?; | ||
let usdc_usd_price = usdc_oracle_price.price.price.checked_div(Decimal::from_atomics(Uint128::new(1000000), 0).unwrap()).unwrap(); | ||
let resp = GetUsdcPriceResp { | ||
price: usdc_usd_price, | ||
}; | ||
Ok(resp) | ||
} |
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,7 @@ | ||
use cosmwasm_schema::cw_serde; | ||
use cosmwasm_std::Decimal; | ||
|
||
#[cw_serde] | ||
pub struct GetUsdcPriceResp { | ||
pub price: Decimal, | ||
} |