over explaining the code (#168)

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-08-14 20:45:57 +02:00 committed by GitHub
parent 7a343a9a8d
commit 1b6ed725be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -54,6 +54,10 @@ pub fn liq_token_with_token(
let mut liqee_health_cache = new_health_cache(&liqee.borrow(), &account_retriever) let mut liqee_health_cache = new_health_cache(&liqee.borrow(), &account_retriever)
.context("create liqee health cache")?; .context("create liqee health cache")?;
let init_health = liqee_health_cache.health(HealthType::Init); let init_health = liqee_health_cache.health(HealthType::Init);
// Once maint_health falls below 0, we want to start liquidating,
// we want to allow liquidation to continue until init_health is positive,
// to prevent constant oscillation between the two states
if liqee.being_liquidated() { if liqee.being_liquidated() {
if init_health > I80F48::ZERO { if init_health > I80F48::ZERO {
liqee.fixed.set_being_liquidated(false); liqee.fixed.set_being_liquidated(false);