-
Notifications
You must be signed in to change notification settings - Fork 74
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 valuation implementation #1311
Conversation
3638731
to
c80e940
Compare
c80e940
to
85dd12a
Compare
a9438fe
to
f80f2fc
Compare
77efafc
to
779893a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical sections commented below:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick overview.
Given we discussed restructuring this with OnChainPricing
and OffChainPriing
this will need to receive changes, right? Especially, the current forwarding of the PriceId
through the valuation logic, right?
Yes, and yes! Next week I'll have this 👍🏻 |
0ce0fc4
to
1acde16
Compare
@lemunozm ping me when ypu need an intermediate review |
ensure!( | ||
quantity.ensure_mul(price)? == amount, | ||
Error::<T>::AmountNotMultipleOfPrice | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@offerijns, finally, I've opted for the deterministic path on this. If we see there is a rounding issue on the UI side, we can go with the solution you've proposed.
7cac50c
to
e4f1eee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least from my point of view it looks sane. I have to admit that I did not cover all code paths, but tried to follow the from my pespective critical once. Mostly repayment and borrow flow for external pricing.
pallets/loans-ref/src/config.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the file is somhow really misleading for me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to express that it was a utility for configuration. In this case, it's used for configuring a pallet-loans
without external pricing support. Maybe util
mod is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to util
.
/// Id of an external price | ||
pub price_id: T::PriceId, | ||
|
||
/// Maximum number of items associated to the price id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't a PriceId
be reused by multiple loans? In that case, wouldn't this rather be "Maximum number of items associated with the loan of the pricing?" or "Initial number of items associated with the loan of the pricing"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't a PriceId be reused by multiple loans?
Yes! I like the first suggestion 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least from my point of view it looks sane. I have to admit that I did not cover all code paths, but tried to follow the from my pespective critical once. Mostly repayment and borrow flow for external pricing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big change set to review in one sitting, but it looks clean. Code paths were relatively easy to follow, and the tests seem like they're validating what needs to be validated.
Needs a rebase or merge-up, but I think we should get this in and get it out the door 👍
Description
Structural changes: diagrams
Epic #1279
Changes and Descriptions
pallet-loans
Write migration=> Can be avoided since there is no loans usage yet.Prerequisites
pallet-collection-data-feed
implementation #1324