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

Oracle Adapter #545

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

Kayanski
Copy link
Contributor

@Kayanski Kayanski commented Nov 25, 2024

Adding the Oracle Adapter to abstract supported adapters

Added Pyth implementation and tests

Based on https://www.notion.so/abstract-money/Price-Oracle-24cb3a64c535427d9a38b0312235f889

Checklist

  • CI is green.
  • Changelog updated.

Copy link

cloudflare-workers-and-pages bot commented Nov 25, 2024

Deploying abstract-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7ab80c9
Status: ✅  Deploy successful!
Preview URL: https://f91af29b.abstract-docs.pages.dev
Branch Preview URL: https://nicolas-abs-589-oracle-adapt.abstract-docs.pages.dev

View logs

@Kayanski Kayanski marked this pull request as ready for review November 26, 2024 10:51
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 213 lines in your changes missing coverage. Please review.

Project coverage is 65.2%. Comparing base (bf989a9) to head (7ab80c9).
Report is 73 commits behind head on main.

Files with missing lines Patch % Lines
integrations/oracles/pyth/src/lib.rs 0.0% 54 Missing ⚠️
modules/contracts/adapters/oracle/src/lib.rs 0.0% 48 Missing ⚠️
...les/contracts/adapters/oracle/src/oracle_tester.rs 0.0% 42 Missing ⚠️
modules/contracts/adapters/oracle/src/api.rs 0.0% 26 Missing ⚠️
...es/contracts/adapters/oracle/src/handlers/query.rs 0.0% 16 Missing ⚠️
...tracts/adapters/oracle/src/handlers/instantiate.rs 0.0% 9 Missing ⚠️
.../contracts/adapters/oracle/src/handlers/execute.rs 0.0% 8 Missing ⚠️
...dules/contracts/adapters/oracle/src/oracles/mod.rs 0.0% 6 Missing ⚠️
framework/packages/standards/oracle/src/msg.rs 0.0% 4 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
framework/packages/standards/oracle/src/msg.rs 0.0% <0.0%> (ø)
...dules/contracts/adapters/oracle/src/oracles/mod.rs 0.0% <0.0%> (ø)
.../contracts/adapters/oracle/src/handlers/execute.rs 0.0% <0.0%> (ø)
...tracts/adapters/oracle/src/handlers/instantiate.rs 0.0% <0.0%> (ø)
...es/contracts/adapters/oracle/src/handlers/query.rs 0.0% <0.0%> (ø)
modules/contracts/adapters/oracle/src/api.rs 0.0% <0.0%> (ø)
...les/contracts/adapters/oracle/src/oracle_tester.rs 0.0% <0.0%> (ø)
modules/contracts/adapters/oracle/src/lib.rs 0.0% <0.0%> (ø)
integrations/oracles/pyth/src/lib.rs 0.0% <0.0%> (ø)

... and 169 files with indirect coverage changes

Copy link
Contributor

@adairrr adairrr left a comment

Choose a reason for hiding this comment

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

The PR specifies that the implementation was performed with the API specified in the Oracle adapter design.

However, it seems that asset registration and value queries were not implemented. Are those supposed to be implemented on this adapter or elsewhere?

framework/packages/standards/oracle/README.md Outdated Show resolved Hide resolved
framework/packages/standards/oracle/src/command.rs Outdated Show resolved Hide resolved
framework/packages/standards/oracle/src/error.rs Outdated Show resolved Hide resolved
integrations/oracles/pyth/README.md Outdated Show resolved Hide resolved

let current_price = price_feed
.get_price_no_older_than(env.block.time.seconds() as i64, no_older_than)
.ok_or_else(|| StdError::not_found("Current price is not available"))?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that the price must be available within the current block as of querying?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The price must be not older than no_older_than from the current block time.

modules/contracts/adapters/oracle/STATUS.md Show resolved Hide resolved
modules/contracts/adapters/oracle/tests/osmosis.rs Outdated Show resolved Hide resolved
scripts/wasm-all.sh Outdated Show resolved Hide resolved
@Kayanski
Copy link
Contributor Author

The PR specifies that the implementation was performed with the API specified in the Oracle adapter design.

However, it seems that asset registration and value queries were not implemented. Are those supposed to be implemented on this adapter or elsewhere?

To me, asset registration and value queries should not be placed inside the oracle adapter which is there to query prices from price sources using keys (for the moment).
It belongs in a value computation app for instance, because it contains account specific storage that is best handled within an App

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