Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Feat/usdc price #16

Merged
merged 5 commits into from
Dec 11, 2023
Merged

Feat/usdc price #16

merged 5 commits into from
Dec 11, 2023

Conversation

kenta-elys
Copy link
Contributor

@kenta-elys kenta-elys commented Dec 8, 2023

  • Add a special endpoint for querying usdc price on oracle.

@@ -48,4 +50,6 @@ pub enum QueryMsg {
GetCommitments { delegator_addr: String },
#[returns(QueryEarnPoolResponse)]
GetLiquidityPools { pool_ids: Option<Vec<u64>>, filter_type: FilterType, pagination: Option<PageRequest> },
#[returns(Decimal)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to return a Response msg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you forgot to change it here

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();
Ok(usdc_usd_price)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to return a Response msg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

Copy link
Contributor

@politeWall politeWall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should also change the version of the contract

@politeWall politeWall merged commit 97bc3a1 into main Dec 11, 2023
1 check passed
@politeWall politeWall deleted the feat/usdc-price branch December 11, 2023 10:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants