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: integrate EMA Oracle #599

Merged
merged 28 commits into from May 31, 2023
Merged

feat: integrate EMA Oracle #599

merged 28 commits into from May 31, 2023

Conversation

apopiak
Copy link
Collaborator

@apopiak apopiak commented Feb 7, 2023

Integrate the EMA oracle from galacticcouncil/warehouse#76 into the Basilisk runtime.

Description

This PR adds the EMA oracle pallet and configures the runtime to ingest xyk trades and liquidity changes into it.
Supported periods are configured to LastBlock, Hour, Day and Week.

The oracle values are not used, yet, to allow for observation.

supersedes #557

Related Issue

https://app.clickup.com/t/2v0w820

How Has This Been Tested?

Includes an integration tests, most of the tests are in the pallet and its corresponding math package.

Checklist:

  • I have updated the documentation if necessary.
  • I have added tests to cover my changes, regression test if fixing an issue.
  • This is a breaking change.

+ add integration test
+ adjust xyk pallet to call pass data to the pallet
runtime/basilisk/src/lib.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Crate versions that have been updated:

  • runtime-integration-tests: v0.9.4 -> v0.9.5
  • basilisk: v9.0.0 -> v9.0.1
  • basilisk-runtime: v96.0.0 -> v97.0.0
  • common-runtime: v2.3.10 -> v2.3.11
  • testing-basilisk-runtime: v96.0.0 -> v97.0.0

Runtime version has been increased.

@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Patch coverage: 46.93% and project coverage change: -0.05 ⚠️

Comparison is base (84850ca) 43.73% compared to head (9dac5e4) 43.68%.

❗ Current head 9dac5e4 differs from pull request most recent head d72a5d2. Consider uploading reports for the commit d72a5d2 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #599      +/-   ##
==========================================
- Coverage   43.73%   43.68%   -0.05%     
==========================================
  Files          61       61              
  Lines        4466     4475       +9     
==========================================
+ Hits         1953     1955       +2     
- Misses       2513     2520       +7     
Impacted Files Coverage Δ
node/src/chain_spec.rs 0.00% <0.00%> (ø)
node/src/testing_chain_spec.rs 0.00% <0.00%> (ø)
runtime/testing-basilisk/src/lib.rs 11.11% <0.00%> (-0.14%) ⬇️
runtime/basilisk/src/lib.rs 21.22% <50.00%> (+0.55%) ⬆️
pallets/xyk/src/lib.rs 81.03% <52.50%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@enthusiastmartin enthusiastmartin left a comment

Choose a reason for hiding this comment

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

lgtm

@apopiak
Copy link
Collaborator Author

apopiak commented Feb 27, 2023

This should only need a rebenchmark based on the new max unique entries (now 30).

@apopiak
Copy link
Collaborator Author

apopiak commented Mar 20, 2023

✅ Note: needs update to galacticcouncil/warehouse#188

@apopiak
Copy link
Collaborator Author

apopiak commented Apr 13, 2023

warehouse PRs included:

@mrq1911 mrq1911 changed the title feat!: Integrate EMA Oracle feat: integrate EMA Oracle Apr 18, 2023
@@ -494,7 +495,7 @@ impl pallet_xyk::Config for Runtime {
type MaxInRatio = MaxInRatio;
type MaxOutRatio = MaxOutRatio;
type CanCreatePool = pallet_lbp::DisallowWhenLBPPoolRunning<Runtime>;
type AMMHandler = ();
type AMMHandler = pallet_ema_oracle::OnActivityHandler<Runtime>;
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't be xyk reweighted now with oracle?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah

# Conflicts:
#	runtime/basilisk/src/lib.rs
#	runtime/testing-basilisk/src/lib.rs
@mrq1911 mrq1911 merged commit 32b4f08 into master May 31, 2023
4 of 5 checks passed
@jak-pan jak-pan deleted the apopiak/oracle-integration branch February 22, 2024 10:59
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.

None yet

3 participants