-
Notifications
You must be signed in to change notification settings - Fork 69
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
Collateralization Limits Part 2 #172
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## collateralization_limits #172 +/- ##
============================================================
+ Coverage 83.98% 84.42% +0.44%
============================================================
Files 51 52 +1
Lines 19826 20524 +698
============================================================
+ Hits 16650 17327 +677
- Misses 3176 3197 +21 ☔ View full report in Codecov by Sentry. |
@@ -3115,6 +3136,84 @@ pub fn process_resize_reserve(_program_id: &Pubkey, accounts: &[AccountInfo]) -> | |||
Ok(()) | |||
} | |||
|
|||
/// process mark obligation as closable | |||
pub fn process_mark_obligation_as_closeable( |
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.
ig remove expiry time and change this to "set obligation close ability status"
update_borrow_attribution_values(&mut obligation, &accounts[1..], false)?; | ||
|
||
// unmark obligation as closable after it's been liquidated enough times | ||
if obligation.is_closeable(clock.slot) && !any_borrow_attribution_limit_exceeded { |
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.
close vs open attribution limits
return Err(LendingError::ObligationStale.into()); | ||
} | ||
|
||
if &lending_market.risk_authority != risk_authority_info.key { |
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.
or owner
if obligation.borrowed_value < obligation.unhealthy_borrow_value { | ||
if obligation.is_closeable(current_slot) { | ||
return Ok(Decimal::zero()); |
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 think gotta remove the protocol liquidation fee too
actually i don't think we need the init flag. the obligation collateral's borrow attribution value on upgrade will be zero, so the subtraction is useless anyways. |
@@ -3185,13 +3192,14 @@ pub fn process_mark_obligation_as_closeable( | |||
return Err(LendingError::ObligationStale.into()); | |||
} | |||
|
|||
if &lending_market.risk_authority != risk_authority_info.key { | |||
if &lending_market.risk_authority != signer_info.key && &lending_market.owner != signer_info.key | |||
{ | |||
msg!("Lending market risk authority does not match the risk authority provided"); |
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.
update msg
&self, | ||
obligation: &Obligation, | ||
current_slot: Slot, | ||
) -> Result<Decimal, ProgramError> { |
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.
lets just return the protocol liquidation fee here and save self from re-serializing later
* closable instruction * add more tests around signer * liquidate closeable obligations * test fix * pr fixes * adding a close borrow attribution limit * PR fixes
Summary: