-
Notifications
You must be signed in to change notification settings - Fork 71
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
oracleless repay #64
oracleless repay #64
Conversation
Do we need to add new unit tests for this change? |
yeh was gonna do that today
…On Fri, Jan 28, 2022, 8:25 AM 0xkiplet ***@***.***> wrote:
Do we need to add new unit tests for this change?
—
Reply to this email directly, view it on GitHub
<#64 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT5EXXUATKTWE4SPHZUFTPDUYK7OZANCNFSM5NARPXTA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
return Err(LendingError::InvalidAccountInput.into()); | ||
} | ||
|
||
for (index, liquidity) in obligation.borrows.iter_mut().enumerate() { |
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.
you shouldn't have to refresh all reserves, just the one being touched by the repay
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.
/accumulate interest on all borrows for the obligation
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.
im pretty sure you do because otherwise the other ones wont accumulate properly on an actual refresh
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.
? wdym by that? their last updated slot/accumulated interest hasn't been updated so they would just be updated during the next full refresh
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.
hmm maybe i misread but in Obligation the staleness/last_updated_slot live at the top level so it felt safer to do this. though i do see that the cumulative_borrow_rate_wads lives on the obligationLiquidity so maybe it's ok hmm but would be odd because then different obligationLiquidities would be differently stale which currently never happens
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.
yea, don't really see any issues with having diff staleness on obligation liquidities because the entire obligation will be stale anyways
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.
im gonna read again to make sure lol. partly annoyed if that is true, but just because pr would have been much shorter :/
e913c1c
to
192da2f
Compare
@@ -176,6 +176,21 @@ impl Obligation { | |||
Ok((&self.borrows[liquidity_index], liquidity_index)) | |||
} | |||
|
|||
/// Find liquidity by borrow reserve mut | |||
pub fn find_liquidity_in_borrows_mut( |
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.
so only difference with non-mut version is this returns a mutable ObligationLiquidity so it can be updated with accrue_interest
?
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.
yup
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.
Is there any reason why we don't just make the original one return a mutable variable?
I suppose theres a small risk of us wanting to change logic here and then only fixing it one of the places or something
lgtm |
types wont work without this or similar
…On Tue, Feb 1, 2022, 3:26 PM Da Sichuan ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In token-lending/program/src/state/obligation.rs
<#64 (comment)>
:
> @@ -176,6 +176,21 @@ impl Obligation {
Ok((&self.borrows[liquidity_index], liquidity_index))
}
+ /// Find liquidity by borrow reserve mut
+ pub fn find_liquidity_in_borrows_mut(
Is there any reason why we don't just make the original one return a
mutable variable?
I suppose theres a small risk of us wanting to change logic here and then
only fixing it one of the places or something
—
Reply to this email directly, view it on GitHub
<#64 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT5EXXUFCNIW652IEPBT75TUZBT2ZANCNFSM5NARPXTA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
* fix ci solana version (#67) * Update switchboard-program to v0.2.0 (#66) * oracleless repay (#64) * oracleless repay * lint * the easy way * updated test to make sure interest accumulates before repay * remove unused programs (#60) * remove unused programs * slight consisency changes Co-authored-by: ra <RealAwesomeness@users.noreply.github.com> Co-authored-by: Nope X <nope@solend.fi> * Oracleless ctoken mint and redeem (#69) * no need to refresh on mint/redeem * test fixes * added more robust tests to make sure interest accrues, added oracleless deposit_obligation_collateral, updated instruction.rs for writable account * comment change Co-authored-by: 0xkiplet <98113383+0xkiplet@users.noreply.github.com> Co-authored-by: ra <40503841+RealAwesomeness@users.noreply.github.com> Co-authored-by: ra <RealAwesomeness@users.noreply.github.com>
No description provided.