Skip to content

Conversation

@mattsse
Copy link
Contributor

@mattsse mattsse commented Apr 15, 2021

Changes

Blocked by #39 because the substate-v3 chainlink feed depends on a newer substrate rococo revision

  • Adds skeleton of price-feed pallet
  • Integrates the chainlink-feed pallet via FeedOracle
  • Adds AssetPricePair type to represent a base/quote price pair
  • Adds PirceFeed trait to fetch asset pairs

The chainlink pallet is abstracted via the FeedOracle trait, the PINT price-feed pallet will be an additional abstraction on top of it. While the design for the price-feed isn't final, I believe we probably will need some storage items, therefor the price-feed will be a pallet instead of an additional trait that is implemented for FeedOracle

The PriceFeed trait is the intended abstraction on top the price feed pallet
New prices are inserting into the designated feeds via the existing chainlink feed pallet; At this point it is assumed that all feeds, including the PINT price feed will use a common base currency (DOT).
The price feed pallet is configured with a Percision which is applied to all price feeds, since feeds can have different decimals, a conversion will be required.

Update:

  • FixedU128 was chosen as type to represent price ratios.
  • The admin needs to create a mapping between assetId and feedId.

Tests

cargo test

Issues

@mattsse mattsse changed the title Matt/add price feed Add price feed pallet Apr 15, 2021
@mattsse mattsse requested a review from willemolding April 16, 2021 13:54
@mattsse mattsse added the needs review PR needs reviewing label Apr 16, 2021
@mattsse mattsse marked this pull request as ready for review April 16, 2021 16:05
Copy link
Contributor

@willemolding willemolding left a comment

Choose a reason for hiding this comment

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

I'm having trouble building this locally and also I think there is a cargo fmt error.

New additions look great. Some more test would be good. The feed_creation_should_work is just a smoke test, we should probably at least test calling the get_price implementation. It would also be great to have test for the AssetPricePair methods.

@dutterbutter dutterbutter added needs changes PR needs changes and removed needs review PR needs reviewing labels Apr 19, 2021
@mattsse mattsse requested a review from willemolding April 19, 2021 18:37
@willemolding willemolding added the approved PR approved to merge label Apr 20, 2021
Copy link
Contributor

@willemolding willemolding left a comment

Choose a reason for hiding this comment

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

Looks great! Happy to merge once you have sorted out the dependency issues

@willemolding willemolding removed the needs changes PR needs changes label Apr 20, 2021
@mattsse mattsse merged commit ea98b51 into main Apr 22, 2021
@mattsse mattsse deleted the matt/add-price-feed branch April 22, 2021 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved PR approved to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate oracle pallet and add price feed

4 participants