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 (deprecated) #557

Closed
wants to merge 28 commits into from

Conversation

apopiak
Copy link
Collaborator

@apopiak apopiak commented Sep 5, 2022

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, TenMinutes, Day and Week.

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

Related Issue

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

How Has This Been Tested?

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.

@github-actions

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Sep 5, 2022

Codecov Report

Base: 43.89% // Head: 43.83% // Decreases project coverage by -0.06% ⚠️

Coverage data is based on head (528e4fb) compared to base (3a7672d).
Patch coverage: 29.16% of modified lines in pull request are covered.

❗ Current head 528e4fb differs from pull request most recent head a22157e. Consider uploading reports for the commit a22157e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #557      +/-   ##
==========================================
- Coverage   43.89%   43.83%   -0.06%     
==========================================
  Files          61       61              
  Lines        4406     4428      +22     
==========================================
+ Hits         1934     1941       +7     
- Misses       2472     2487      +15     
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%) ⬇️
pallets/xyk/src/lib.rs 82.18% <33.33%> (-1.50%) ⬇️
runtime/basilisk/src/lib.rs 21.22% <50.00%> (+0.55%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

@@ -0,0 +1,63 @@
[package]
name = "pallet-exchange"
Copy link
Collaborator Author

@apopiak apopiak Jan 23, 2023

Choose a reason for hiding this comment

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

confused that this is showing up here 🤔
garbled merge (pull)?

Copy link
Contributor

Choose a reason for hiding this comment

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

exchange have been deleted from pallets.

I noticed also some inconsistencies in math.

Perhaps, it would be worth considering to take the latest master, integrate just this and do the same in warehouse and math ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

math and warehouse seem fine, no? would prefer not to lose the history there
I can do this here, yeah

@apopiak apopiak changed the title feat!: [WIP] Integrate EMA Oracle feat!: Integrate EMA Oracle Jan 23, 2023
@apopiak apopiak marked this pull request as ready for review January 24, 2023 13:00
@apopiak
Copy link
Collaborator Author

apopiak commented Jan 24, 2023

[upgrade       ] 2023-01-24 13:43:46        REGISTRY: Unknown signed extensions CurrencyBalanceCheck found, treating them as no-effect
[upgrade       ] 2023-01-24 13:43:46        METADATA: Unknown types found, no types for Lookup74
[upgrade       ] connected to Testing Basilisk Local Testnet 12.0.1-4c240952f runtime 88.0.0 node 8.1.3 x86_64-linux-gnu
[upgrade       ] current runtime version 88
[upgrade       ] Error: createType(Call):: Call: failed decoding sudo.sudoUncheckedWeight:: Struct: failed on args: {"call":"Call","weight":"{\"refTime\":\"u64\"}"}:: Struct: failed on weight: {"refTime":"u64"}:: Struct: Cannot decode value 100 (typeof number), expected an input object, map or array
[upgrade       ]     at createTypeUnsafe (/home/runner/work/Basilisk-node/Basilisk-node/scripts/upgrade-runtime/node_modules/@polkadot/types/create/createType.cjs:75:18)
[upgrade       ]     at TypeRegistry.createTypeUnsafe (/home/runner/work/Basilisk-node/Basilisk-node/scripts/upgrade-runtime/node_modules/@polkadot/types/create/registry.cjs:417:45)
[upgrade       ]     at TypeRegistry.createType (/home/runner/work/Basilisk-node/Basilisk-node/scripts/upgrade-runtime/node_modules/@polkadot/types/create/registry.cjs:409:17)
[upgrade       ]     at extrinsicFn (/home/runner/work/Basilisk-node/Basilisk-node/scripts/upgrade-runtime/node_modules/@polkadot/types/metadata/decorate/extrinsics/createUnchecked.cjs:28:21)
[upgrade       ]     at Object.decorated [as sudoUncheckedWeight] (/home/runner/work/Basilisk-node/Basilisk-node/scripts/upgrade-runtime/node_modules/@polkadot/api/base/Decorate.cjs:462:22)
[upgrade       ]     at main (/home/runner/work/Basilisk-node/Basilisk-node/scripts/upgrade-runtime/index.js:69:28)
[upgrade       ]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[upgrade       ] npm ERR! code ELIFECYCLE
[upgrade       ] npm ERR! errno 1
[upgrade       ] npm ERR! upgrade-runtime@1.0.0 upgrade: `node index.js testing_basilisk_runtime.compact.compressed.wasm`
[upgrade       ] npm ERR! Exit status 1
[upgrade       ] npm ERR! 
[upgrade       ] npm ERR! Failed at the upgrade-runtime@1.0.0 upgrade script.
[upgrade       ] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[upgrade       ] 
[upgrade       ] npm ERR! A complete log of this run can be found in:
[upgrade       ] npm ERR!     /home/runner/.npm/_logs/2023-01-24T13_43_46_752Z-debug.log

The upgrade error doesn't seem related to this PR?

…o apopiak/next-gen-oracle

# Conflicts:
#	Cargo.lock
#	integration-tests/Cargo.toml
#	integration-tests/parachain-runtime-mock/Cargo.toml
#	pallets/duster/Cargo.toml
#	pallets/lbp/Cargo.toml
#	pallets/marketplace/Cargo.toml
#	pallets/xyk-liquidity-mining/Cargo.toml
#	pallets/xyk-liquidity-mining/benchmarking/Cargo.toml
#	pallets/xyk/Cargo.toml
#	primitives/Cargo.toml
#	runtime/basilisk/Cargo.toml
#	runtime/common/Cargo.toml
#	runtime/testing-basilisk/Cargo.toml
@apopiak apopiak requested a review from jak-pan January 30, 2023 10:49

parameter_types! {
pub SupportedPeriods: BoundedVec<OraclePeriod, ConstU32<MAX_PERIODS>> = BoundedVec::truncate_from(
vec![OraclePeriod::LastBlock, OraclePeriod::TenMinutes, OraclePeriod::Day, OraclePeriod::Week]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mrq1911 @jak-pan We will need to decide on what this value should be.

@apopiak
Copy link
Collaborator Author

apopiak commented Feb 7, 2023

no idea why code coverage is failing here, any ideas?

@apopiak apopiak mentioned this pull request Feb 7, 2023
3 tasks
@apopiak
Copy link
Collaborator Author

apopiak commented Feb 7, 2023

superseded by #599

@apopiak apopiak closed this Feb 7, 2023
@apopiak apopiak changed the title feat!: Integrate EMA Oracle feat!: Integrate EMA Oracle (deprecated) Feb 7, 2023
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

2 participants