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

oracleless repay #64

Merged
merged 4 commits into from
Feb 2, 2022
Merged

oracleless repay #64

merged 4 commits into from
Feb 2, 2022

Conversation

nope-finance
Copy link
Member

No description provided.

@0xkiplet
Copy link

Do we need to add new unit tests for this change?

@nope-finance
Copy link
Member Author

nope-finance commented Jan 28, 2022 via email

return Err(LendingError::InvalidAccountInput.into());
}

for (index, liquidity) in obligation.borrows.iter_mut().enumerate() {

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

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

Copy link
Member Author

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

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

Copy link
Member Author

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

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

Copy link
Member Author

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 :/

@@ -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(
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

yup

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

@oxrooter
Copy link
Member

oxrooter commented Feb 1, 2022

lgtm

@nope-finance
Copy link
Member Author

nope-finance commented Feb 1, 2022 via email

@nope-finance nope-finance merged commit 1523011 into upcoming Feb 2, 2022
nope-finance added a commit that referenced this pull request Feb 2, 2022
* 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

Co-authored-by: 0xkiplet <98113383+0xkiplet@users.noreply.github.com>
nope-finance added a commit that referenced this pull request Feb 18, 2022
* 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>
@0xripleys 0xripleys deleted the oracleless_repay branch January 25, 2023 10:06
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.

5 participants