feat(asset-index): store initial price pair#106
Conversation
pallets/price-feed/src/lib.rs
Outdated
| /// | ||
| /// * insert: adding a new asset with no price pair been set yet | ||
| /// * remove: an asset has its price pair, remove automatically | ||
| pub type InitialPricePair<T: Config> = |
There was a problem hiding this comment.
Use InitialPricePairs but not submitting new feeds
pallets/price-feed/src/lib.rs
Outdated
| /// This storage stores the initial price pair for quote assets based on `SelfAssetId` | ||
| /// | ||
| /// * insert: adding a new asset with no price pair been set yet | ||
| /// * remove: an asset has its price pair, remove automatically |
There was a problem hiding this comment.
Should we keep this around, since this is only a single entry?
removing it is probably not worth it
There was a problem hiding this comment.
Agree with keeping this without removing
I don't have a certain idea about this actually, this confused me a lot since submitting a new feed automatically while adding a new asset is not suitable
There was a problem hiding this comment.
yeah, chainlink feeds are kept independently from the assets, and the price pair pallet merely keeps a mapping.
you can also have a look at acala's chainlink integration https://github.com/AcalaNetwork/Acala/pull/1073/files
pallets/asset-index/src/lib.rs
Outdated
| let caller = ensure_signed(origin)?; | ||
|
|
||
| // Store intial price pair if not exists | ||
| T::PriceFeed::ensure_price(asset_id, Price::from_inner((value / units).into()))?; |
There was a problem hiding this comment.
would safe math make sense here?
There was a problem hiding this comment.
Had noticed but forgot
Changes
Tests
Issues
Ref #105
Closes #93
Closes #94
Closes #95