Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: consume dia fair price feed #515

Merged
merged 3 commits into from
Aug 30, 2023

Conversation

gregdhill
Copy link
Member

@gregdhill gregdhill commented Aug 29, 2023

Enables the oracle to be configured to fetch prices from the liquid-staking token feed here: https://www.diadata.org/app/liquid-staking/

There is only one breaking change to existing oracle configs, all DIA price feeds are quoted in USD so it may be required to switch the order e.g. from ["USD", "BTC=xxx"] to ["BTC=xxx", "USD"].

oracle/src/currency.rs Outdated Show resolved Hide resolved
[
{
"symbol": "BTC",
"alias": "KBTC"
Copy link
Member Author

Choose a reason for hiding this comment

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

The current architecture assumes we use the same price feed for all currency pairs, to avoid overhauling the oracle client I'm assuming it is okay to use the KBTC DIA xLSD price feed for BTC.

oracle/src/currency.rs Outdated Show resolved Hide resolved
oracle/src/feeds/dia.rs Show resolved Hide resolved
value
.as_array()?
.into_iter()
.find(|entry| matches!(entry.get("Token").and_then(|value| value.as_str()), Some(token) if token.to_uppercase() == alias))?
Copy link
Member

Choose a reason for hiding this comment

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

should we do alias to uppercase as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

The oracle config already assumes all token symbols are capitalized, if this is not the case then many parts of the code would not work correctly.

@gregdhill gregdhill merged commit 79e1235 into interlay:master Aug 30, 2023
6 checks passed
@gregdhill gregdhill deleted the feat/oracle-xlsd branch August 30, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants